aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/make-init-lua.pl
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-05-14 00:49:05 +0000
committerGuy Harris <guy@alum.mit.edu>2012-05-14 00:49:05 +0000
commit14b616c35d40cce1ee05592f15e548183f1fb235 (patch)
tree917e02f5b08e86246f2b18c717a6818ab430d77d /epan/wslua/make-init-lua.pl
parent723b213c8909521bba4d0492b2110545898a9378 (diff)
Get rid of remaining Booleans-as-encoding-arguments in
proto_tree_add_item() calls. Add new "add_packet_field" method to the TreeItem class, taking a protocol field (*not* a protocol), TvbRange, and encoding value as arguments. Add the ENC_ values to init.lua. Make them all hex #defines so make-init-lua.pl can easily extract them. Export tvb_unicode_strsize() for use by Lua (and elsewhere as desired). Note that it handles UTF-16 and UTF-8, and fix the comment to note that its count of hexadectets *does* include the null terminator (that's what the code does). svn path=/trunk/; revision=42621
Diffstat (limited to 'epan/wslua/make-init-lua.pl')
-rwxr-xr-xepan/wslua/make-init-lua.pl31
1 files changed, 24 insertions, 7 deletions
diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl
index 73c2bdabfb..d22e503445 100755
--- a/epan/wslua/make-init-lua.pl
+++ b/epan/wslua/make-init-lua.pl
@@ -35,6 +35,7 @@ die "'$WSROOT' is not a directory" unless -d $WSROOT;
my $wtap_encaps_table = '';
my $ft_types_table = '';
my $bases_table = '';
+my $encodings = '';
my $expert_pi = '';
my $menu_groups = '';
@@ -42,6 +43,7 @@ my %replacements = %{{
WTAP_ENCAPS => \$wtap_encaps_table,
FT_TYPES => \$ft_types_table,
BASES => \$bases_table,
+ ENCODINGS => \$encodings,
EXPERT => \$expert_pi,
MENU_GROUPS => \$menu_groups,
}};
@@ -58,7 +60,9 @@ $template .= $_ while(<TEMPLATE>);
close TEMPLATE;
#
-# make wiretap encapusulation table
+# Extract values from wiretap/wtap.h:
+#
+# WTAP_ENCAP_ values
#
$wtap_encaps_table = "-- Wiretap encapsulations\nwtap = {\n";
@@ -74,7 +78,9 @@ while(<WTAP_H>) {
$wtap_encaps_table =~ s/,\n$/\n}\n/msi;
#
-# enum fttype
+# Extract values from epan/ftypes/ftypes.h:
+#
+# values from enum fttype
#
$ft_types_table = " -- Field Types\nftypes = {\n";
@@ -92,13 +98,15 @@ close FTYPES_H;
$ft_types_table =~ s/,\n$/\n}\n/msi;
-
-
#
-# enum base
+# Extract values from epan/proto.h:
+#
+# values from enum base
+# #defines for encodings and expert group and severity levels
#
$bases_table = "-- Display Bases\n base = {\n";
+$encodings = "-- Encodings\n";
$expert_pi = "-- Expert flags and facilities\n";
my $base_num = 0;
@@ -114,11 +122,19 @@ while(<PROTO_H>) {
my ($name, $value) = ($1, hex($2));
$expert_pi .= "$name = $value\n";
}
+
+ if ( /^.define\s+(ENC_[A-Z0-9_]+)\s+((0x)?[0-9A-Fa-f]+)/ ) {
+ my ($name, $value) = ($1, hex($2));
+ $encodings .= "$name = $value\n";
+ }
}
close PROTO_H;
-# register_stat_group_t
-
+#
+# Extract values from stat_menu.h:
+#
+# MENU_X_X values for register_stat_group_t
+#
$menu_groups .= "-- menu groups for register_menu\n";
my $menu_i = 0;
@@ -135,6 +151,7 @@ close STAT_MENU;
$bases_table .= "}\n\n";
+$encodings .= "\n\n";
$expert_pi .= "\n\n";
for my $key (keys %replacements) {