From Marton Nemeth <nm127@freemail.hu>
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 10 Apr 2008 20:07:58 +0000 (20:07 +0000)
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 10 Apr 2008 20:07:58 +0000 (20:07 +0000)
   correct example and documentation about register_menu()

my own: do not fail to make init.lua when building in a different dir

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24879 f5534014-38df-0310-8fa8-9805f1628bb7

docbook/wsluarm.xml
epan/wslua/Makefile.am
epan/wslua/make-init-lua.pl
epan/wslua/wslua_gui.c

index 018c4b9c32e99a797b8aad5e00c521c09fa24f15..7290c077af51bf7f89e0b8955ab677b317b513fa 100644 (file)
@@ -154,7 +154,7 @@ do
 
        -- using this function we register our fuction
        -- to be called when the user selects the Tools->Test->Packets menu
-       register_menu("Test/Packets",menuable_tap)
+       register_menu("Test/Packets", menuable_tap, MENU_TOOLS)
 end
        </programlisting>
   </section>
index 8784ffa09cec37612617f0faa133ed1f03244d82..808b42c9e32fc994146cd47aaed61514f93ee06c 100644 (file)
@@ -108,4 +108,4 @@ dummy:
        touch dummy
 
 init.lua: template-init.lua make-init-lua.pl ../ftypes/ftypes.h ../../wiretap/wtap.h  ../proto.h ../../stat_menu.h
-       $(PERL) $(srcdir)/make-init-lua.pl template-init.lua > init.lua
+       $(PERL) $(srcdir) $(srcdir)/make-init-lua.pl template-init.lua > init.lua
index 06dd7d41909ffe42913886a76261a19b951e4cfb..1ec24393d148090197b624345c72cc59713360c9 100755 (executable)
@@ -28,7 +28,8 @@
 
 use strict;
 
-my $WSROOT = "../..";
+my $root = shift;
+my $WSROOT = $root  . "/../..";
 
 my $wtap_encaps_table = '';
 my $ft_types_table = '';
index 6626d1f9662790768a6401fe527abf346602b792..065d6dfa0c6e68f2ad90f7de7053dd378d90a240 100644 (file)
@@ -71,18 +71,18 @@ void lua_menu_callback(gpointer data) {
     return;
 }
 
-WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /*  Register a menu item in the Statistics menu. */
-#define WSLUA_ARG_register_menu_NAME 1 /* The name of the menu item. */
-#define WSLUA_ARG_register_menu_ACTION 2 /* The function to be called when the menu item is invoked. */
-#define WSLUA_ARG_register_menu_GROUP 3 /* The menu group into which the menu item is to be inserted. */
+WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /*  Register a menu item in one of the main menus. */
+#define WSLUA_ARG_register_menu_NAME 1 /* The name of the menu item. The submenus are to be separated by '/'s. (string) */
+#define WSLUA_ARG_register_menu_ACTION 2 /* The function to be called when the menu item is invoked. (function taking no arguments and returning nothing)  */
+#define WSLUA_OPTARG_register_menu_GROUP 3 /* The menu group into which the menu item is to be inserted. One of MENU_STAT (Statistics), MENU_STAT_GENERIC (Statistics, first section), MENU_STAT_CONVERSATION (Statistics/Conversation List), MENU_STAT_ENDPOINT (Statistics/Endpoint List), MENU_STAT_RESPONSE (Statistics/Service Response Time), MENU_STAT_TELEPHONY (Statistics, third section), MENU_ANALYZE (Analyze), MENU_ANALYZE_CONVERSATION (Analyze/Conversation Filter), MENU_TOOLS (Tools). (number) */
 
     const gchar* name = luaL_checkstring(L,WSLUA_ARG_register_menu_NAME);
     struct _lua_menu_data* md;
     gboolean retap = FALSE;
-       register_stat_group_t group = (int)luaL_optnumber(L,WSLUA_ARG_register_menu_GROUP,REGISTER_STAT_GROUP_GENERIC);
+       register_stat_group_t group = (int)luaL_optnumber(L,WSLUA_OPTARG_register_menu_GROUP,REGISTER_STAT_GROUP_GENERIC);
 
        if ( group > REGISTER_TOOLS_GROUP_NONE)
-               WSLUA_ARG_ERROR(register_menu,GROUP,"must be a defined MENU_* (see init.lua)");
+               WSLUA_OPTARG_ERROR(register_menu,GROUP,"must be a defined MENU_* (see init.lua)");
 
        if(!name)
                WSLUA_ARG_ERROR(register_menu,NAME,"must be a string");