aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/make-taps.pl
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2014-08-01 16:14:23 -0400
committerEvan Huus <eapache@gmail.com>2014-08-02 01:00:05 +0000
commit6b11cd97f2153bb015ade6efd05929999de85457 (patch)
tree361e91fabf668189dba6ecb8b8653e4b9313d76f /epan/wslua/make-taps.pl
parent69d0788875b81b2cdd0c751f00eb5b20944ffe15 (diff)
Make Lua taps work in out-of-source-tree builds.
make-taps.pl needs to know where to find the source files otherwise none of the tap data gets built correctly. This makes the wslua test suite run in out-of-source-tree builds too. Change-Id: I059474d90d59e87bd57dba18530a66a927a014cf Reviewed-on: https://code.wireshark.org/review/3337 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/wslua/make-taps.pl')
-rwxr-xr-xepan/wslua/make-taps.pl16
1 files changed, 9 insertions, 7 deletions
diff --git a/epan/wslua/make-taps.pl b/epan/wslua/make-taps.pl
index 0c7327fdcb..bd709aa006 100755
--- a/epan/wslua/make-taps.pl
+++ b/epan/wslua/make-taps.pl
@@ -73,19 +73,19 @@ my %enums = ();
sub dotap {
my ($tname,$fname,$sname,@enums) = @_;
my $buf = '';
-
+
open FILE, "< $fname";
while(<FILE>) {
$buf .= $_;
}
close FILE;
-
+
$buf =~ s@/\*.*?\*/@@;
for my $ename (@enums) {
$enums{$ename} = [];
my $a = $enums{$ename};
-
+
my $enumre = "typedef\\s+enum[^{]*{([^}]*)}[\\s\\n]*" . ${ename} . "[\\s\\n]*;";
if ($buf =~ s/$enumre//ms ) {
$types{$ename} = "/*$ename*/ lua_pushnumber(L,(lua_Number)v->%s);";
@@ -127,13 +127,13 @@ sub dotap {
for my $n (sort keys %elems) {
my $fmt = $types{$elems{$n}};
-
+
if ($fmt) {
$code .= "\tlua_pushstring(L,\"$n\"); ";
$code .= sprintf($fmt,$n,$n) . " lua_settable(L,-3);\n";
$doc .= "\t$n: $comments{$elems{$n}}\n";
}
-
+
}
$code .= "}\n\n";
@@ -148,6 +148,7 @@ sub dotap {
open TAPSFILE, "< $ARGV[0]";
open CFILE, "> $ARGV[1]";
open DOCFILE, "> $ARGV[2]";
+my $srcdir=$ARGV[3] . "/";
print CFILE <<"HEADER";
/* This file is autogenerated from ./taps by ./make-taps.pl */
@@ -165,6 +166,7 @@ while (<TAPSFILE>) {
s@#.*@@;
next if /^\s*$/;
my ($tname,$fname,$sname,@enums) = split /\s+/;
+ $fname=$srcdir . "/" . $fname;
my ($c,$doc) = dotap($tname,$fname,$sname,@enums);
print CFILE "#include \"$fname\"\n";
print CFILE $c;
@@ -180,7 +182,7 @@ TBLHDR
{"$tname", $functs{$tname} },
TBLELEM
}
-
+
print CFILE <<"TBLFTR";
{"frame",NULL},
{NULL,NULL}
@@ -211,7 +213,7 @@ tap_extractor_t wslua_get_tap_extractor(const gchar* name) {
for(t = tappables; t->name; t++ ) {
if (g_str_equal(t->name,name)) return t->extractor;
}
-
+
return NULL;
}