Added register action for loading Lua plugins.

Removed an unused argument to wslua_init().

svn path=/trunk/; revision=39214
This commit is contained in:
Stig Bjørlykke 2011-10-02 13:39:35 +00:00
parent 18ed55e1e6
commit 3e75b436a0
5 changed files with 20 additions and 8 deletions

View File

@ -111,7 +111,7 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
host_name_lookup_init();
expert_init();
#ifdef HAVE_LUA_5_1
wslua_init(NULL);
wslua_init(cb, client_data);
#endif
#ifdef HAVE_GEOIP
geoip_db_init();

View File

@ -317,11 +317,18 @@ static void lua_load_plugins (const char *dirname)
}
}
int wslua_init(lua_State* LS) {
int wslua_init(register_cb cb, gpointer client_data) {
gchar* filename;
const funnel_ops_t* ops = funnel_get_funnel_ops();
gboolean run_anyway = FALSE;
/*
** TBD: count the number of lua scripts to load in splash_update()
** and call cb for each file instead of once for all files.
*/
if(cb)
(*cb)(RA_LUA_PLUGINS, NULL, client_data);
/* set up the logger */
g_log_set_handler(LOG_DOMAIN_LUA, G_LOG_LEVEL_CRITICAL|
G_LOG_LEVEL_WARNING|
@ -331,10 +338,7 @@ int wslua_init(lua_State* LS) {
ops ? ops->logger : basic_logger, NULL);
if (!L) {
if (LS)
L = LS;
else
L = luaL_newstate();
L = luaL_newstate();
}
WSLUA_INIT(L);

View File

@ -403,7 +403,7 @@ extern void clear_outstanding_TreeItem(void);
extern void wslua_print_stack(char* s, lua_State* L);
extern int wslua_init(lua_State* L);
extern int wslua_init(register_cb cb, gpointer client_data);
extern tap_extractor_t wslua_get_tap_extractor(const gchar* name);
extern int wslua_set_tap_enums(lua_State* L);

View File

@ -216,6 +216,9 @@ splash_update(register_action_e action, const char *message, gpointer client_dat
case RA_PLUGIN_HANDOFF:
action_msg = "Handing off plugins ...";
break;
case RA_LUA_PLUGINS:
action_msg = "Loading Lua plugins ...";
break;
case RA_PREFERENCES:
action_msg = "Loading module preferences ...";
break;
@ -230,11 +233,15 @@ splash_update(register_action_e action, const char *message, gpointer client_dat
last_action = action;
}
if(ul_count == 0) /* get the count of dissectors */
if(ul_count == 0) { /* get the count of dissectors */
ul_count = register_count() + 6; /* additional 6 for:
dissectors, listeners,
registering plugins, handingoff plugins,
preferences and configuration */
#ifdef HAVE_LUA_5_1
ul_count++; /* additional one for lua plugins */
#endif
}
main_lb = g_object_get_data(G_OBJECT(win), "protocol_label");
/* make_dissector_reg.py changed -

View File

@ -35,6 +35,7 @@ typedef enum {
RA_PLUGIN_REGISTER, /* plugin register */
RA_HANDOFF, /* handoff */
RA_PLUGIN_HANDOFF, /* plugin handoff */
RA_LUA_PLUGINS, /* lua plugin register */
RA_PREFERENCES, /* module preferences */
RA_CONFIGURATION /* configuration files */
} register_action_e;