Make the merged unhooking code work again.
[screen-lua.git] / src / script.h
blob6870d318b79290a15e935f98eafc3bcd46a150f9
1 /* Copyright (c) 2008 Sadrul Habib Chowdhury (sadrul@users.sf.net)
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 3, or (at your option)
6 * any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program (see the file COPYING); if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
18 ****************************************************************
19 * $Id$ FAU
21 #ifndef SCRIPT_H
22 #define SCRIPT_H
23 struct win;
25 /*Obsolete*/
26 struct ScriptFuncs
28 int (*sf_ForeWindowChanged) __P((void));
29 int (*sf_ProcessCaption) __P((const char *, struct win *, int len));
32 /***Language binding***/
33 struct binding
35 char * name;
36 int inited;
37 int registered;
38 int (*bd_Init) __P((void));
39 int (*bd_Finit) __P((void));
40 int (*bd_call) __P((const char *func, const char **argv));
41 /*Returns zero on failure, non zero on success*/
42 int (*bd_Source) __P((const char *, int));
43 /* The return value is significant:
44 * a non-zero value will stop further
45 * notification to the rest of the chain.*/
46 int (*bd_dispatch) __P((void *handler, const char *params, va_list va));
47 int (*bd_hdlrcmp) __P((void * h1, void *h2));
49 struct binding *b_next;
50 struct ScriptFuncs *fns;
53 void LoadBindings(void);
54 void FinializeBindings(void);
55 void ScriptCmd __P((int argc, const char **argv));
57 /***Script events***/
59 struct script_event;
60 /* Script event listener */
61 struct listener
63 /*Binding dependent event handler data*/
64 void *handler;
65 struct binding *bd;
67 /* smaller means higher privilege.*/
68 unsigned int priv;
69 struct listener *chain;
70 struct listener *prev;
73 /* the script_event structure needs to be zeroed before using.
74 * embeding this structure directly into screen objects will do the job, as
75 * long as the objects are created from calloc() call.*/
76 struct script_event
78 /* expected parameter description of this event. */
79 char *params;
80 struct listener listeners;
82 struct script_event* object_get_event __P((char *obj, const char *name));
83 int trigger_sevent(struct script_event *ev, VA_DOTS);
84 int register_listener(struct script_event *ev, struct listener *l);
85 void unregister_listener(struct listener *l);
87 struct gevents {
88 struct script_event cmdexecuted;
89 struct script_event detached;
91 extern struct gevents globalevents;
92 #endif