Some improvements to the Lua plugin:

- Makefile.am fix: elua_register.h generation + checking serialized
- ProtoField.new(..) parameter parsing fix and changes
- enabling gui_enabled() function in Lua (typo fix, thanks to Tamas Regos)


svn path=/trunk/; revision=18611
This commit is contained in:
Luis Ontanon 2006-06-29 13:49:56 +00:00
parent 20b7999d60
commit 8c8a4ce877
4 changed files with 13 additions and 15 deletions

View File

@ -2491,7 +2491,9 @@ Authesserre Samuel <sauthess [AT] gmail.com> {
DTLS
}
And assorted fixes and enhancements by the people listed above
Balint Reczey <balint.reczey [AT] ericsson.com> {
Lua fixes
}
and by:
Pavel Roskin <proski [AT] gnu.org>

View File

@ -78,7 +78,7 @@ elua.h: elua_register.h
# do not do not unnecessarilly modify the old file in order avoid recompiling every module every time
elua_register.h: elua_makereg.pl $(lua_modules)
$(PERL) elua_makereg.pl $(lua_modules) > elua_register.h.new
$(PERL) elua_makereg.pl $(lua_modules) > elua_register.h.new ;\
if diff elua_register.h.new elua_register.h >/dev/null; then rm elua_register.h.new; else mv elua_register.h.new elua_register.h; fi
doc: $(lua_modules)

View File

@ -40,7 +40,7 @@ static int menu_cb_error_handler(lua_State* L) {
return 0;
}
ELUA_FUNCTION lua_gui_enabled(lua_State* L) { /* Checks whether the GUI facility is enabled. */
ELUA_FUNCTION elua_gui_enabled(lua_State* L) { /* Checks whether the GUI facility is enabled. */
lua_pushboolean(L,GPOINTER_TO_INT(ops));
ELUA_RETURN(1); /* A boolean: true if it is enabled, false if it isn't. */
}

View File

@ -287,7 +287,6 @@ static const eth_ft_types_t ftenums[] = {
{NULL,FT_NONE}
};
#if 0
static enum ftenum get_ftenum(const gchar* type) {
const eth_ft_types_t* ts;
for (ts = ftenums; ts->str; ts++) {
@ -298,7 +297,6 @@ static enum ftenum get_ftenum(const gchar* type) {
return FT_NONE;
}
#endif
static const gchar* ftenum_to_string(enum ftenum ft) {
const eth_ft_types_t* ts;
@ -335,7 +333,6 @@ static const gchar* base_to_string(base_display_e base) {
return NULL;
}
#if 0
static base_display_e string_to_base(const gchar* str) {
const struct base_display_string_t* b;
for (b=base_displays;b->str;b++) {
@ -344,7 +341,6 @@ static base_display_e string_to_base(const gchar* str) {
}
return BASE_NONE;
}
#endif
static value_string* value_string_from_table(lua_State* L, int idx) {
GArray* vs = g_array_new(TRUE,TRUE,sizeof(value_string));
@ -397,10 +393,10 @@ ELUA_CONSTRUCTOR ProtoField_new(lua_State* L) { /* Creates a new field to be use
#define ELUA_ARG_ProtoField_new_NAME 1 /* Actual name of the field (the string that appears in the tree). */
#define ELUA_ARG_ProtoField_new_ABBR 2 /* Filter name of the field (the string that is used in filters). */
#define ELUA_ARG_ProtoField_new_TYPE 3 /* Field Type (FT_*). */
#define ELUA_OPTARG_ProtoField_new_VALUESTRING 3 /* a ValueString object. */
#define ELUA_OPTARG_ProtoField_new_BASE 4 /* The representation BASE_*. */
#define ELUA_OPTARG_ProtoField_new_MASK 5 /* the bitmask to be used. */
#define ELUA_OPTARG_ProtoField_new_DESCR 6 /* The description of the field. */
#define ELUA_OPTARG_ProtoField_new_VALUESTRING 4 /* a ValueString object. */
#define ELUA_OPTARG_ProtoField_new_BASE 5 /* The representation BASE_*. */
#define ELUA_OPTARG_ProtoField_new_MASK 6 /* the bitmask to be used. */
#define ELUA_OPTARG_ProtoField_new_DESCR 7 /* The description of the field. */
ProtoField f = g_malloc(sizeof(eth_field_t));
value_string* vs;
@ -410,7 +406,7 @@ ELUA_CONSTRUCTOR ProtoField_new(lua_State* L) { /* Creates a new field to be use
f->ett = -1;
f->name = g_strdup(luaL_checkstring(L,ELUA_ARG_ProtoField_new_NAME));
f->abbr = g_strdup(luaL_checkstring(L,ELUA_ARG_ProtoField_new_ABBR));
f->type = luaL_checkint(L,ELUA_ARG_ProtoField_new_TYPE);
f->type = get_ftenum(luaL_checkstring(L,ELUA_ARG_ProtoField_new_TYPE));
/*XXX do it better*/
if (f->type == FT_NONE) {
@ -418,8 +414,8 @@ ELUA_CONSTRUCTOR ProtoField_new(lua_State* L) { /* Creates a new field to be use
return 0;
}
if (! lua_isnil(L,4) ) {
vs = value_string_from_table(L,4);
if (! lua_isnil(L,ELUA_OPTARG_ProtoField_new_VALUESTRING) ) {
vs = value_string_from_table(L,ELUA_OPTARG_ProtoField_new_VALUESTRING);
if (vs) {
f->vs = vs;
@ -434,7 +430,7 @@ ELUA_CONSTRUCTOR ProtoField_new(lua_State* L) { /* Creates a new field to be use
}
/* XXX: need BASE_ERROR */
f->base = luaL_optint(L, ELUA_OPTARG_ProtoField_new_BASE, BASE_NONE);
f->base = string_to_base(luaL_optstring(L, ELUA_OPTARG_ProtoField_new_BASE, "BASE_NONE"));
f->mask = luaL_optint(L, ELUA_OPTARG_ProtoField_new_MASK, 0x0);
f->blob = g_strdup(luaL_optstring(L,ELUA_OPTARG_ProtoField_new_DESCR,""));