diff options
author | Michael Mann <mmann78@netscape.net> | 2017-04-18 10:42:35 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-04-18 21:31:07 +0000 |
commit | c9088466253f53bb29602810b7f4ad5fca627f92 (patch) | |
tree | c7f6bccbaf169a58ab1aaaefabeb6cd0644e370b /tools | |
parent | 73e2354e4c4dfcffe413562e0f9f0169c8f6b50e (diff) |
X11: Sort mesa_enum to allow for value_string_ext
Adjust the dissector generator to put mesa_enum values in
numerical order. Remove comments about where the specific
values came from as sorting them means the comments aren't
always going to be in the right place.
Change-Id: I3c6b8252017c8a3ec379be49b3df069ec488cd1c
Reviewed-on: https://code.wireshark.org/review/21198
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/process-x11-xcb.pl | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/tools/process-x11-xcb.pl b/tools/process-x11-xcb.pl index c7134d1f81..80342fb4a8 100755 --- a/tools/process-x11-xcb.pl +++ b/tools/process-x11-xcb.pl @@ -177,26 +177,12 @@ my @mesas = ($srcdir . '/mesa/src/mapi/glapi/gen', # 2010-04-26 $srcdir . '/mesa/src/mesa/glapi'); # 2004-05-18 my $mesadir = (grep { -d } @mesas)[0]; -sub mesa_category_start { - my ($t, $elt) = @_; - my $name = $elt->att('name'); - my $comment; - if ($name =~ /^\d\.\d$/) { - $comment = "version $name"; - } else { - $comment = "extension $name"; - } - - print $enum "/* OpenGL $comment */\n"; - print(" - $comment\n"); -} - sub mesa_category { my ($t, $elt) = @_; $t->purge; } -#used to prevent value_string duplication +#used to prevent duplication and sort enumerated values my %mesa_enum_hash = (); sub mesa_enum { @@ -208,7 +194,6 @@ sub mesa_enum { #make sure value isn't already in the hash, to prevent duplication in value_string if (!exists($mesa_enum_hash{$hex_value})) { $mesa_enum_hash{$hex_value} = $name; - print $enum " { $value, \"$name\" },\n" if (length($value) > 3 && length($value) < 10); } $t->purge; } @@ -226,9 +211,9 @@ sub mesa_type { if($name eq 'enum') { # enum does not have a direct X equivalent - $gltype{'GLenum'} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX', + $gltype{'GLenum'} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX|BASE_EXT_STRING', get => 'VALUE32', list => 'listOfCard32', - val => 'VALS(mesa_enum)', }; + val => '&mesa_enum_ext', }; return; } @@ -1823,7 +1808,6 @@ if (-e "$mesadir/gl_API.xml") { my $xml = XML::Twig->new( start_tag_handlers => { - 'category' => \&mesa_category_start, }, twig_roots => { 'category' => \&mesa_category, @@ -1833,6 +1817,9 @@ if (-e "$mesadir/gl_API.xml") { }); $xml->parsefile("$mesadir/gl_API.xml") or die ("Cannot open gl_API\n"); + for my $enum_key ( sort {$a<=>$b} keys %mesa_enum_hash) { + say $enum sprintf(" { 0x%04x, \"%s\" },", $enum_key, $mesa_enum_hash{$enum_key}); + } print $enum " { 0, NULL }\n"; print $enum "};\n"; $enum->close(); @@ -1845,6 +1832,7 @@ if (-e "$mesadir/gl_API.xml") { } print $impl " { 0, NULL }\n"; print $impl "};\n"; + print $impl "static value_string_ext mesa_enum_ext = VALUE_STRING_EXT_INIT(mesa_enum);\n"; print $reg "{ &hf_x11_glx_render_op_name, { \"render op\", \"x11.glx.render.op\", FT_UINT16, BASE_DEC, VALS(glx_render_op_name), 0, NULL, HFILL }},\n\n"; |