From 1d6263e2659e582e6c99ce1789143fcfc8392a2f Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 20 Apr 2001 06:01:10 +0000 Subject: 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 --- process-x11-fields.pl | 61 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 18 deletions(-) (limited to 'process-x11-fields.pl') 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 <