aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2008-04-14 21:16:32 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2008-04-14 21:16:32 +0000
commit4eb08aad661e31c46e5ee94409b367d43dc3d06a (patch)
treeb67380e52acc39d355fcbc4f04a294d00bc00ef2 /epan/wslua
parent16717f3be20d6fefb16d6eb2f866496a82fd05aa (diff)
From Marton Nemeth:
Addenda and fixes to WSLUA_CLASS_DEFINE documentation Mine: fix init.lua generation svn path=/trunk/; revision=25025
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/Makefile.am2
-rw-r--r--epan/wslua/Makefile.nmake2
-rwxr-xr-xepan/wslua/make-init-lua.pl11
-rw-r--r--epan/wslua/wslua.h8
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