ekg2  GIT master
Struktury danych | Definicje | Definicje typów | Wyliczenia | Funkcje | Zmienne
Dokumentacja pliku scripts.h
#include <sys/types.h>
#include "commands.h"
#include "plugins.h"
#include "protocol.h"
#include "stuff.h"
#include "vars.h"
#include "queries.h"
Wykres zależności załączania dla scripts.h:
Ten wykres pokazuje, które pliki bezpośrednio lub pośrednio załączają ten plik:

Idź do kodu źródłowego tego pliku.

Struktury danych

struct  script
 
struct  script_timer_t
 
struct  script_plugin_t
 
struct  script_var_t
 
struct  script_query_t
 
struct  script_command_t
 
struct  script_watch_t
 
struct  scriptlang
 

Definicje

#define SCRIPT_HANDLE_UNBIND   -666
 
#define MAX_ARGS   QUERY_ARGS_MAX+1
 
#define SCRIPT_FINDER(bool)
 
#define BUILD_BUG_ON(condition)   ((void)sizeof(char[1 - 2*!!(condition)]))
 
#define SCRIPT_DEFINE(x, y)
 
#define script_private_get(s)   (s->priv_data)
 
#define script_private_set(s, p)   (s->priv_data = p)
 
#define SCRIPT_UNBIND_HANDLER(type, args...)
 
#define SCRIPT_BIND_HEADER(x)
 
#define SCRIPT_BIND_FOOTER(y)
 
#define SCRIPT_HANDLER_HEADER(x)
 
#define SCRIPT_HANDLER_FOOTER(y, _args...)
 
#define SCRIPT_HANDLER_MULTI_FOOTER(y, _args...)
 

Definicje typów

typedef struct script script_t
 
typedef int() scriptlang_initialize_t()
 
typedef int() scriptlang_finalize_t()
 
typedef int() script_load_t(script_t *)
 
typedef int() script_unload_t(script_t *)
 
typedef int() script_handler_command_t(script_t *, script_command_t *, char **)
 
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_query_t(script_t *, script_query_t *, void **)
 
typedef int() script_handler_watch_t(script_t *, script_watch_t *, int, int, int)
 
typedef int() script_free_bind_t(script_t *, void *, int, void *,...)
 
typedef struct scriptlang scriptlang_t
 

Wyliczenia

enum  script_type_t {
  SCRIPT_UNKNOWNTYPE, SCRIPT_VARTYPE, SCRIPT_COMMANDTYPE, SCRIPT_QUERYTYPE,
  SCRIPT_TIMERTYPE, SCRIPT_WATCHTYPE, SCRIPT_PLUGINTYPE
}
 

Funkcje

int script_unload_lang (scriptlang_t *s)
 
int script_list (scriptlang_t *s)
 
int script_unload_name (scriptlang_t *s, char *name)
 
int script_load (scriptlang_t *s, char *name)
 
int scriptlang_register (scriptlang_t *s)
 
int scriptlang_unregister (scriptlang_t *s)
 
int scripts_init ()
 
script_tscript_find (scriptlang_t *s, char *name)
 
int script_query_unbind (script_query_t *squery, int from)
 
int script_command_unbind (script_command_t *scr_comm, int free)
 
int script_timer_unbind (script_timer_t *stimer, int free)
 
int script_var_unbind (script_var_t *data, int free)
 
int script_watch_unbind (script_watch_t *temp, int free)
 
script_command_tscript_command_bind (scriptlang_t *s, script_t *scr, char *command, char *params, char *possibilities, void *handler)
 
script_timer_tscript_timer_bind (scriptlang_t *s, script_t *scr, int freq, void *handler)
 
script_query_tscript_query_bind (scriptlang_t *s, script_t *scr, char *qname, void *handler)
 
script_var_tscript_var_add_full (scriptlang_t *s, script_t *scr, char *name, int type, char *value, void *handler)
 
script_var_tscript_var_add (scriptlang_t *s, script_t *scr, char *name, char *value, void *handler)
 
script_watch_tscript_watch_add (scriptlang_t *s, script_t *scr, int fd, int type, void *handler, void *data)
 
script_plugin_tscript_plugin_init (scriptlang_t *s, script_t *scr, char *name, plugin_class_t pclass, void *handler)
 
void script_variables_free ()
 
void script_variables_write ()
 

Zmienne

script_tscripts
 
scriptlang_tscriptlang
 

Dokumentacja definicji

◆ BUILD_BUG_ON

#define BUILD_BUG_ON (   condition)    ((void)sizeof(char[1 - 2*!!(condition)]))

◆ MAX_ARGS

#define MAX_ARGS   QUERY_ARGS_MAX+1

◆ SCRIPT_BIND_FOOTER

#define SCRIPT_BIND_FOOTER (   y)
Wartość:
if (!temp->self) {\
debug("[script_bind_error] (before adding to %s) ERROR! retcode = 0x%x\n", #y, temp->self);\
xfree(temp);\
return NULL;\
}\
list_add(&y, temp);\
return temp;
#define NULL
Definition: oralog.c:49

◆ SCRIPT_BIND_HEADER

#define SCRIPT_BIND_HEADER (   x)
Wartość:
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->priv_data = handler;
#define NULL
Definition: oralog.c:49
void * xmalloc(size_t size)
Definition: ekg_hash_benchmark.c:25
abort_handler handler
Definition: abort.c:24

◆ SCRIPT_DEFINE

#define SCRIPT_DEFINE (   x,
 
)
Wartość:
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);\
void x##_dummy_sanity_check() { BUILD_BUG_ON(sizeof(void *) > sizeof(long)); };\
\
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,\
}
Definition: scripts.h:79
Definition: scripts.h:29
#define BUILD_BUG_ON(condition)
Definition: scripts.h:144
Definition: scripts.h:53
Definition: scripts.h:73
Definition: scripts.h:40
Definition: scripts.h:62

◆ SCRIPT_FINDER

#define SCRIPT_FINDER (   bool)
Wartość:
script_t *scr = NULL;\
scriptlang_t *slang = NULL;\
\
for (scr = scripts; scr; scr = scr->next) {\
slang = scr->lang;\
if (bool)\
return scr;\
}\
return NULL;
Definition: scripts.h:29
#define NULL
Definition: oralog.c:49
script_t * scripts
Definition: scripts.c:21
struct script * next
Definition: scripts.h:30

◆ SCRIPT_HANDLE_UNBIND

#define SCRIPT_HANDLE_UNBIND   -666

◆ SCRIPT_HANDLER_FOOTER

#define SCRIPT_HANDLER_FOOTER (   y,
  _args... 
)
Wartość:
if ((_scr = temp->scr) && ((_slang = _scr->lang))) _handler = _slang->y;\
else _handler = temp->priv_data;\
if (_handler)\
ret = _handler(_scr, temp, _args); \
else {\
debug("[%s] (_handler == NULL)\n", #y);\
}\
\
if (ret == SCRIPT_HANDLE_UNBIND) { debug("[%s] script or scriptlang want to delete this handler\n", #y); }\
void debug(const char *format,...)
Definition: stuff.c:1961
#define SCRIPT_HANDLE_UNBIND
Definition: scripts.h:16

◆ SCRIPT_HANDLER_HEADER

#define SCRIPT_HANDLER_HEADER (   x)
Wartość:
script_t *_scr;\
scriptlang_t *_slang;\
x *_handler;\
Definition: scripts.h:29
#define SCRIPT_HANDLE_UNBIND
Definition: scripts.h:16

◆ SCRIPT_HANDLER_MULTI_FOOTER

#define SCRIPT_HANDLER_MULTI_FOOTER (   y,
  _args... 
)
Wartość:
/* foreach y->list->next do SCRIPT_HANDLER_FOOTER(y->list->data, _args); */\
SCRIPT_HANDLER_FOOTER(y, _args)

◆ script_private_get

#define script_private_get (   s)    (s->priv_data)

◆ script_private_set

#define script_private_set (   s,
  p 
)    (s->priv_data = p)

◆ SCRIPT_UNBIND_HANDLER

#define SCRIPT_UNBIND_HANDLER (   type,
  args... 
)
Wartość:
{\
SCRIPT_HANDLER_HEADER(script_free_bind_t);\
SCRIPT_HANDLER_FOOTER(script_free_bind, type, temp->priv_data, args);\
}
int() script_free_bind_t(script_t *, void *, int, void *,...)
Definition: scripts.h:97

Dokumentacja definicji typów

◆ script_free_bind_t

typedef int() script_free_bind_t(script_t *, void *, int, void *,...)

◆ script_handler_command_t

typedef int() script_handler_command_t(script_t *, script_command_t *, char **)

◆ script_handler_query_t

typedef int() script_handler_query_t(script_t *, script_query_t *, void **)

◆ script_handler_timer_t

typedef int() script_handler_timer_t(script_t *, script_timer_t *, int)

◆ script_handler_var_t

typedef int() script_handler_var_t(script_t *, script_var_t *, char *)

◆ script_handler_watch_t

typedef int() script_handler_watch_t(script_t *, script_watch_t *, int, int, int)

◆ script_load_t

typedef int() script_load_t(script_t *)

◆ script_t

typedef struct script script_t

◆ script_unload_t

typedef int() script_unload_t(script_t *)

◆ scriptlang_finalize_t

typedef int() scriptlang_finalize_t()

◆ scriptlang_initialize_t

typedef int() scriptlang_initialize_t()

◆ scriptlang_t

typedef struct scriptlang scriptlang_t

Dokumentacja typów wyliczanych

◆ script_type_t

Wartości wyliczeń
SCRIPT_UNKNOWNTYPE 
SCRIPT_VARTYPE 
SCRIPT_COMMANDTYPE 
SCRIPT_QUERYTYPE 
SCRIPT_TIMERTYPE 
SCRIPT_WATCHTYPE 
SCRIPT_PLUGINTYPE 

Dokumentacja funkcji

◆ script_command_bind()

script_command_t* script_command_bind ( scriptlang_t s,
script_t scr,
char *  command,
char *  params,
char *  possibilities,
void *  handler 
)

◆ script_command_unbind()

int script_command_unbind ( script_command_t scr_comm,
int  free 
)

◆ script_find()

script_t* script_find ( scriptlang_t s,
char *  name 
)

◆ script_list()

int script_list ( scriptlang_t s)

◆ script_load()

int script_load ( scriptlang_t s,
char *  name 
)

◆ script_plugin_init()

script_plugin_t* script_plugin_init ( scriptlang_t s,
script_t scr,
char *  name,
plugin_class_t  pclass,
void *  handler 
)

◆ script_query_bind()

script_query_t* script_query_bind ( scriptlang_t s,
script_t scr,
char *  qname,
void *  handler 
)

◆ script_query_unbind()

int script_query_unbind ( script_query_t squery,
int  from 
)

◆ script_timer_bind()

script_timer_t* script_timer_bind ( scriptlang_t s,
script_t scr,
int  freq,
void *  handler 
)

◆ script_timer_unbind()

int script_timer_unbind ( script_timer_t stimer,
int  free 
)

◆ script_unload_lang()

int script_unload_lang ( scriptlang_t s)

◆ script_unload_name()

int script_unload_name ( scriptlang_t s,
char *  name 
)

◆ script_var_add()

script_var_t* script_var_add ( scriptlang_t s,
script_t scr,
char *  name,
char *  value,
void *  handler 
)

◆ script_var_add_full()

script_var_t* script_var_add_full ( scriptlang_t s,
script_t scr,
char *  name,
int  type,
char *  value,
void *  handler 
)

◆ script_var_unbind()

int script_var_unbind ( script_var_t data,
int  free 
)

◆ script_variables_free()

void script_variables_free ( )

◆ script_variables_write()

void script_variables_write ( )

◆ script_watch_add()

script_watch_t* script_watch_add ( scriptlang_t s,
script_t scr,
int  fd,
int  type,
void *  handler,
void *  data 
)

◆ script_watch_unbind()

int script_watch_unbind ( script_watch_t temp,
int  free 
)

◆ scriptlang_register()

int scriptlang_register ( scriptlang_t s)

◆ scriptlang_unregister()

int scriptlang_unregister ( scriptlang_t s)

◆ scripts_init()

int scripts_init ( )

Dokumentacja zmiennych

◆ scriptlang

◆ scripts

script_t* scripts