# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
-#
+#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
touch taps
taps_wslua.c: make-taps.pl taps
- $(PERL) $(srcdir)/make-taps.pl $(srcdir)/taps taps_wslua.c taps.txt $(srcdir)
+ $(PERL) $(srcdir)/make-taps.pl taps taps_wslua.c taps.txt
taps.txt: taps_wslua.c
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);";
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";
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 */
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;
{"$tname", $functs{$tname} },
TBLELEM
}
-
+
print CFILE <<"TBLFTR";
{"frame",NULL},
{NULL,NULL}
for(t = tappables; t->name; t++ ) {
if (g_str_equal(t->name,name)) return t->extractor;
}
-
+
return NULL;
}