summaryrefslogtreecommitdiff
path: root/process-x11-fields.pl
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-04-20 06:01:10 +0000
committerGuy Harris <guy@alum.mit.edu>2001-04-20 06:01:10 +0000
commit1d6263e2659e582e6c99ce1789143fcfc8392a2f (patch)
tree91c701c78b1fd0e412ae73913940fe07212d3391 /process-x11-fields.pl
parent986bd7f26198ca2a5973e5b11c4477c2717cc64f (diff)
downloadwireshark-1d6263e2659e582e6c99ce1789143fcfc8392a2f.tar.gz
Fix up "process-x11-fields" to allow both a base *and* VALS to be
specified - with or without a name for the list of values - and to roll up *all* the tokens at the end into the blurb for the field. Supply a base in "x11-fields" for all numeric fields, and supply a base of NONE rather than a parent-field width for Boolean fields that aren't bitfields. svn path=/trunk/; revision=3342
Diffstat (limited to 'process-x11-fields.pl')
-rw-r--r--process-x11-fields.pl61
1 files changed, 43 insertions, 18 deletions
diff --git a/process-x11-fields.pl b/process-x11-fields.pl
index 219ca5ee7e..816b539b38 100644
--- a/process-x11-fields.pl
+++ b/process-x11-fields.pl
@@ -23,35 +23,60 @@ while(<>) {
$subfieldStringLength = length $subfield;
}
- ($abbrev, $type, $presentation, $field4) = split /\s+/o;
+ @fields = split /\s+/o ;
+ $abbrev = shift @fields;
+ $type = shift @fields;
$lastAbbrev = $abbrev;
$field = $prefix.$abbrev;
- if ($presentation =~ /^VALS/) {
- $fieldBase = 'BASE_NONE';
- } elsif ($presentation =~ /^\d+$/o) {
- $fieldBase = $presentation;
+ if ($fields[0] =~ /^\d+$/o) {
+ #
+ # This is presumably a Boolean bitfield, and this is the number
+ # of bits in the parent field.
+ #
+ $fieldDisplay = shift @fields;
} else {
- $fieldBase = "BASE_$presentation";
+ #
+ # The next token is the base for the field.
+ #
+ $fieldDisplay = "BASE_".shift @fields;
}
- if ($presentation eq 'VALS') {
- $fieldConvert = "VALS(${abbrev}_vals)";
- $fieldConvert =~ s/-/_/go;
- } elsif ($presentation =~ /^VALS\(/o) {
- $fieldConvert = $presentation;
- $fieldConvert =~ s/\)/_vals\)/o;
+ if ($fields[0] eq 'VALS') {
+ #
+ # It's an enumerated field, with the value_string table having a
+ # name based on the field's name.
+ #
+ shift @fields;
+ $fieldStrings = "VALS(${abbrev}_vals)";
+ $fieldStrings =~ s/-/_/go;
+ } elsif ($fields[0] =~ /^VALS\(/o) {
+ #
+ # It's an enumerated field, with a specified name for the
+ # value_string table.
+ #
+ $fieldStrings = shift @fields;
+ $fieldStrings =~ s/\)/_vals\)/o;
} else {
- $fieldConvert = 'NULL';
+ #
+ # It's not an enumerated field.
+ #
+ $fieldStrings = 'NULL';
}
- $mask = 0;
- $mask = $field4 if $subfield;
- $mask = 0 unless $mask =~ /\d+/o;
+ if ($fields[0] =~ /^0x/) {
+ #
+ # The next token looks like a bitmask for a bitfield.
+ #
+ $mask = shift @fields;
+ } else {
+ $mask = 0;
+ }
+ $rest = join(' ', @fields);
$longName = uc $name;
- $longName = $field4 if ($field4 && !$subfield);
+ $longName = $rest if ($rest);
$variable = $field;
$variable =~ s/-/_/go;
@@ -60,6 +85,6 @@ while(<>) {
print DECL "static int hf_x11_$variable = -1;\n";
print REG <<END;
-{ &hf_x11_$variable, { "$abbrev", "x11.$field", FT_$type, $fieldBase, $fieldConvert, $mask, "$longName" } },
+{ &hf_x11_$variable, { "$abbrev", "x11.$field", FT_$type, $fieldDisplay, $fieldStrings, $mask, "$longName" } },
END
}