00e09f8bde020b960c1205addc0a8adb809a4847
[screen-lua.git] / src / script.h
blob00e09f8bde020b960c1205addc0a8adb809a4847
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));
30 int (*sf_CommandExecuted) __P((const char *, const char **, int));
33 /***Language binding***/
34 struct binding
36 char * name;
37 int inited;
38 int registered;
39 int (*bd_Init) __P((void));
40 int (*bd_Finit) __P((void));
41 /*Returns zero on failure, non zero on success*/
42 int (*bd_Source) __P((const char *, int));
43 struct binding *b_next;
44 struct ScriptFuncs *fns;
47 void LoadBindings(void);
48 void FinializeBindings(void);
49 void ScriptCmd __P((int argc, const char **argv));
51 /***Script events***/
53 // Script event listener
54 struct listener
56 /*Binding dependent event handler data*/
57 void *handler;
59 /* dispatcher provided by the binding.
60 * The return value is significant:
61 * a non-zero value will stop further
62 * notification to the rest of the chain.*/
63 int (*dispatcher) __P((void *handler, char *params, VA_DOTS));
65 /* smaller means higher privilege.*/
66 int priv;
67 struct listener *chain;
70 /* the script_event structure needs to be zeroed before using.
71 * embeding this structure directly into screen objects will do the job, as
72 * long as the objects are created from calloc() call.*/
73 struct script_event
75 /* expected parameter description of this event. */
76 char *params;
77 struct listener *listeners;
80 #endif