mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 05:45:07 +00:00
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.
This commit is contained in:
parent
17dd9d8fa5
commit
6acc3d0e85
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ sub make_define($$)
|
||||
# type declaration
|
||||
sub make_type($$)
|
||||
{
|
||||
return "typedef $_[1] $_[0];"
|
||||
return "@_;"
|
||||
}
|
||||
|
||||
# function pointer type declaration
|
||||
|
@ -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 <<EOT
|
||||
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam)
|
||||
EOT
|
||||
|
||||
# add typedef to GL_ARB_debug_output
|
||||
# parse_spec.pl can't parse typedefs from New Types section, but ought to
|
||||
cat >> $1/GL_ARB_debug_output <<EOT
|
||||
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam)
|
||||
EOT
|
||||
|
||||
# add typedefs to GL_ARB_cl_event
|
||||
# parse_spec.pl can't parse typedefs from New Types section, but ought to
|
||||
cat >> $1/GL_ARB_cl_event <<EOT
|
||||
typedef struct _cl_context *cl_context
|
||||
typedef struct _cl_event *cl_event
|
||||
EOT
|
||||
|
||||
# clean up
|
||||
rm -f $1/*.bak
|
||||
|
||||
|
@ -185,27 +185,6 @@ typedef GLuint64EXT GLuint64;
|
||||
typedef struct __GLsync *GLsync;
|
||||
|
||||
typedef char GLchar;
|
||||
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,
|
||||
GLenum category,
|
||||
GLenum severity,
|
||||
GLsizei length,
|
||||
const GLchar* message,
|
||||
GLvoid* userParam);
|
||||
|
||||
/* For ARB_debug_output */
|
||||
|
||||
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,
|
||||
GLenum type,
|
||||
GLuint id,
|
||||
GLenum severity,
|
||||
GLsizei length,
|
||||
const GLchar* message,
|
||||
GLvoid* userParam);
|
||||
|
||||
/* For GL_ARB_cl_event */
|
||||
|
||||
typedef struct _cl_context *cl_context;
|
||||
typedef struct _cl_event *cl_event;
|
||||
|
||||
#define GL_ACCUM 0x0100
|
||||
#define GL_LOAD 0x0101
|
||||
|
Loading…
Reference in New Issue
Block a user