#include <sys/types.h>#include "commands.h"#include "plugins.h"#include "protocol.h"#include "stuff.h"#include "vars.h"#include "queries.h"Go to the source code of this file.
| #define MAX_ARGS QUERY_ARGS_MAX+1 |
| #define SCRIPT_BIND_FOOTER | ( | y | ) |
| #define SCRIPT_BIND_HEADER | ( | x | ) |
Value:
x *temp; \
if (scr && scr->inited != 1) {\
debug_error("[script_bind_error] script not inited!\n"); \
return NULL; \
} \
temp = xmalloc(sizeof(x)); \
temp->scr = scr;\
temp->private = handler;
| #define SCRIPT_DEFINE | ( | x, | |||
| y | ) |
Value:
extern int x##_load(script_t *);\ extern int x##_unload(script_t *);\ \ extern int x##_commands(script_t *, script_command_t *, char **);\ extern int x##_timers(script_t *, script_timer_t *, int );\ extern int x##_variable_changed(script_t *, script_var_t *, char *);\ extern int x##_query(script_t *, script_query_t *, void **);\ extern int x##_watches(script_t *, script_watch_t *, int, int, long int);\ \ extern int x##_bind_free(script_t *, void *, int type, void *, ...);\ \ scriptlang_t x##_lang = { \ name: #x, \ plugin: &x##_plugin, \ ext: y, \ \ init: x##_initialize,\ deinit: x##_finalize, \ \ script_load: x##_load, \ script_unload: x##_unload, \ script_free_bind: x##_bind_free,\ \ script_handler_query : x##_query,\ script_handler_command: x##_commands,\ script_handler_timer : x##_timers,\ script_handler_var : x##_variable_changed,\ script_handler_watch : x##_watches,\ }
| #define SCRIPT_FINDER | ( | bool | ) |
| #define SCRIPT_HANDLE_UNBIND -666 |
| #define SCRIPT_HANDLER_FOOTER | ( | y, | |||
| _args... | ) |
Value:
if ((_scr = temp->scr) && ((_slang = _scr->lang))) _handler = _slang->y;\ else _handler = temp->private;\ if (_handler)\ ret = _handler(_scr, temp, _args); \ else {\ debug("[%s] (_handler == NULL)\n", #y);\ ret = SCRIPT_HANDLE_UNBIND;\ }\ \ if (ret == SCRIPT_HANDLE_UNBIND) { debug("[%s] script or scriptlang want to delete this handler\n", #y); }\ if (ret == SCRIPT_HANDLE_UNBIND)
| #define SCRIPT_HANDLER_HEADER | ( | x | ) |
Value:
script_t *_scr;\ scriptlang_t *_slang;\ x *_handler;\ int ret = SCRIPT_HANDLE_UNBIND;
| #define SCRIPT_HANDLER_MULTI_FOOTER | ( | y, | |||
| _args... | ) |
Value:
/* foreach y->list->next do SCRIPT_HANDLER_FOOTER(y->list->data, _args); */\ SCRIPT_HANDLER_FOOTER(y, _args)
| #define script_private_get | ( | s | ) | (s->private) |
| #define script_private_set | ( | s, | |||
| p | ) | (s->private = p) |
| #define SCRIPT_UNBIND_HANDLER | ( | type, | |||
| args... | ) |
Value:
{\
SCRIPT_HANDLER_HEADER(script_free_bind_t);\
SCRIPT_HANDLER_FOOTER(script_free_bind, type, temp->private, args);\
}
| typedef int( script_free_bind_t)(script_t *, void *, int, void *,...) |
| typedef int( script_handler_command_t)(script_t *, script_command_t *, char **) |
| typedef int( script_handler_query_t)(script_t *, script_query_t *, void **) |
| typedef int( script_handler_timer_t)(script_t *, script_timer_t *, int) |
| typedef int( script_handler_var_t)(script_t *, script_var_t *, char *) |
| typedef int( script_handler_watch_t)(script_t *, script_watch_t *, int, int, int) |
| typedef int( script_load_t)(script_t *) |
| typedef int( script_unload_t)(script_t *) |
| typedef int( scriptlang_finalize_t)() |
| typedef int( scriptlang_initialize_t)() |
| typedef struct scriptlang scriptlang_t |
| enum script_type_t |
| script_command_t* script_command_bind | ( | scriptlang_t * | s, | |
| script_t * | scr, | |||
| char * | command, | |||
| void * | handler | |||
| ) |
| int script_command_unbind | ( | script_command_t * | scr_comm, | |
| int | free | |||
| ) |
| script_t* script_find | ( | scriptlang_t * | s, | |
| char * | name | |||
| ) |
| int script_list | ( | scriptlang_t * | s | ) |
| int script_load | ( | scriptlang_t * | s, | |
| char * | name | |||
| ) |
| script_plugin_t* script_plugin_init | ( | scriptlang_t * | s, | |
| script_t * | scr, | |||
| char * | name, | |||
| plugin_class_t | pclass, | |||
| void * | handler | |||
| ) |
| script_query_t* script_query_bind | ( | scriptlang_t * | s, | |
| script_t * | scr, | |||
| char * | qname, | |||
| void * | handler | |||
| ) |
| int script_query_unbind | ( | script_query_t * | squery, | |
| int | from | |||
| ) |
| script_timer_t* script_timer_bind | ( | scriptlang_t * | s, | |
| script_t * | scr, | |||
| int | freq, | |||
| void * | handler | |||
| ) |
| int script_timer_unbind | ( | script_timer_t * | stimer, | |
| int | free | |||
| ) |
| int script_unload_lang | ( | scriptlang_t * | s | ) |
| int script_unload_name | ( | scriptlang_t * | s, | |
| char * | name | |||
| ) |
| script_var_t* script_var_add | ( | scriptlang_t * | s, | |
| script_t * | scr, | |||
| char * | name, | |||
| char * | value, | |||
| void * | handler | |||
| ) |
| int script_var_unbind | ( | script_var_t * | data, | |
| int | free | |||
| ) |
| int script_variables_free | ( | int | free | ) |
| int script_variables_write | ( | ) |
| script_watch_t* script_watch_add | ( | scriptlang_t * | s, | |
| script_t * | scr, | |||
| int | fd, | |||
| int | type, | |||
| void * | handler, | |||
| void * | data | |||
| ) |
| int script_watch_unbind | ( | script_watch_t * | temp, | |
| int | free | |||
| ) |
| int scriptlang_register | ( | scriptlang_t * | s | ) |
| int scriptlang_unregister | ( | scriptlang_t * | s | ) |
| int scripts_init | ( | ) |
1.5.1