diff options
-rw-r--r-- | epan/wslua/Makefile.am | 2 | ||||
-rw-r--r-- | epan/wslua/Makefile.nmake | 2 | ||||
-rwxr-xr-x | epan/wslua/make-init-lua.pl | 11 | ||||
-rw-r--r-- | epan/wslua/wslua.h | 8 |
4 files changed, 15 insertions, 8 deletions
diff --git a/epan/wslua/Makefile.am b/epan/wslua/Makefile.am index 808b42c9e3..f476d20f2e 100644 --- a/epan/wslua/Makefile.am +++ b/epan/wslua/Makefile.am @@ -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) $(srcdir)/make-init-lua.pl template-init.lua > init.lua + $(PERL) $(srcdir)/make-init-lua.pl $(srcdir) $(srcdir)/template-init.lua > init.lua diff --git a/epan/wslua/Makefile.nmake b/epan/wslua/Makefile.nmake index fbbd6d11b0..78a221b03f 100644 --- a/epan/wslua/Makefile.nmake +++ b/epan/wslua/Makefile.nmake @@ -79,5 +79,5 @@ dummy: touch dummy init.lua: template-init.lua make-init-lua.pl ../ftypes/ftypes.h ../../wiretap/wtap.h ../proto.h - $(PERL) make-init-lua.pl template-init.lua > init.lua + $(PERL) make-init-lua.pl "../" template-init.lua > init.lua diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl index 1ec24393d1..5ef7f9b06c 100755 --- a/epan/wslua/make-init-lua.pl +++ b/epan/wslua/make-init-lua.pl @@ -28,8 +28,10 @@ use strict; -my $root = shift; -my $WSROOT = $root . "/../.."; +my $cd = shift; +my $WSROOT = $cd . "/../.."; + +die "'$cd' is not a directory" unless -d $cd; my $wtap_encaps_table = ''; my $ft_types_table = ''; @@ -50,8 +52,11 @@ my %replacements = %{{ # load template # my $template = ''; -$template .= $_ while(<>); +my $template_filename = shift; +open TEMPLATE, "< $template_filename" or die "could not open '$template_filename'"; +$template .= $_ while(<TEMPLATE>); +close TEMPLATE; # # make wiretap encapusulation table diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h index a036b30b2c..537a5fb626 100644 --- a/epan/wslua/wslua.h +++ b/epan/wslua/wslua.h @@ -203,13 +203,15 @@ typedef tvbparse_action_t* Shortcut; typedef struct _wslua_main* WireShark; typedef struct _wslua_dir* Dir; + /* * toXxx(L,idx) gets a Xxx from an index (Lua Error if fails) * checkXxx(L,idx) gets a Xxx from an index after calling check_code (No Lua Error if it fails) * pushXxx(L,xxx) pushes an Xxx into the stack * isXxx(L,idx) tests whether we have an Xxx at idx - * - * LUA_CLASS_DEFINE must be used without trailing ';' + * shiftXxx(L,idx) removes and returns an Xxx from idx only if it has a type of Xxx, returns NULL otherwise + * WSLUA_CLASS_DEFINE must be used with a trailing ';' + * (a dummy typedef is used to be syntactically correct) */ #define WSLUA_CLASS_DEFINE(C,check_code,push_code) \ C to##C(lua_State* L, int index) { \ @@ -249,7 +251,7 @@ C shift##C(lua_State* L,int i) { \ if (p) { lua_remove(L,i); return *p; }\ else return NULL;\ } \ -int dummy##C +typedef int dummy##C #ifdef HAVE_LUA_5_1 |