From 6acc3d0e8509facba13c07718ba99f94e79a0303 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 1 Jan 2011 09:30:11 -0600 Subject: [PATCH] Support function pointer typedefs in the extension files, rather than hard-coding those directly into the header. Enables support for AMD_debug_output, ARB_debug_output and ARB_cl_event in SCI GLEW branch. --- auto/bin/make.pl | 13 ++++++------- auto/bin/make_header.pl | 2 +- auto/bin/update_ext.sh | 19 +++++++++++++++++++ auto/src/glew_head.h | 21 --------------------- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/auto/bin/make.pl b/auto/bin/make.pl index c3e72c3..80843bd 100755 --- a/auto/bin/make.pl +++ b/auto/bin/make.pl @@ -11,7 +11,7 @@ my %regex = ( exturl => qr/^http.+$/, function => qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)$/i, token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+|[A-Z][A-Z0-9_]*)$/, - type => qr/^typedef\s+(.+)\s+([\*A-Za-z0-9_]+)$/, + type => qr/^typedef\s+(.+)$/, exact => qr/.*;$/, ); @@ -69,7 +69,7 @@ sub parse_ext($) my $filename = shift; my %functions = (); my %tokens = (); - my %types = (); + my @types = (); my @exacts = (); my $extname = ""; # Full extension name GL_FOO_extension my $exturl = ""; # Info URL @@ -110,8 +110,7 @@ sub parse_ext($) } elsif (/$regex{type}/) { - my ($value, $name) = ($1, $2); - $types{$name} = $value; + push @types, $_; } elsif (/$regex{token}/) { @@ -133,7 +132,7 @@ sub parse_ext($) close EXT; - return ($extname, $exturl, $extstring, \%types, \%tokens, \%functions, \@exacts); + return ($extname, $exturl, $extstring, \@types, \%tokens, \%functions, \@exacts); } sub output_tokens($$) @@ -153,11 +152,11 @@ sub output_tokens($$) sub output_types($$) { my ($tbl, $fnc) = @_; - if (keys %{$tbl}) + if (scalar @{$tbl}) { local $, = "\n"; print "\n"; - print map { &{$fnc}($_, $tbl->{$_}) } sort { ${$tbl}{$a} cmp ${$tbl}{$b} } keys %{$tbl}; + print map { &{$fnc}($_) } sort @{$tbl}; print "\n"; } } diff --git a/auto/bin/make_header.pl b/auto/bin/make_header.pl index e58b46f..934ef77 100755 --- a/auto/bin/make_header.pl +++ b/auto/bin/make_header.pl @@ -21,7 +21,7 @@ sub make_define($$) # type declaration sub make_type($$) { - return "typedef $_[1] $_[0];" + return "@_;" } # function pointer type declaration diff --git a/auto/bin/update_ext.sh b/auto/bin/update_ext.sh index bbb6c5e..8123bf8 100755 --- a/auto/bin/update_ext.sh +++ b/auto/bin/update_ext.sh @@ -299,6 +299,25 @@ EOT grep -v "glGetPointerv" $1/GL_EXT_vertex_array > tmp mv tmp $1/GL_EXT_vertex_array +# add typedef to GL_AMD_debug_output +# parse_spec.pl can't parse typedefs from New Types section, but ought to + cat >> $1/GL_AMD_debug_output <> $1/GL_ARB_debug_output <> $1/GL_ARB_cl_event <