mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 13:55:07 +00:00
[CoreSupport] Add code generation for sorted array of extension strings, which can index into array of pointers of extension enable flags.
This commit is contained in:
parent
ea763af989
commit
1da7dd6e0a
@ -198,7 +198,14 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
|
||||
$(BIN)/make_def_var.pl GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_var.pl GL $(GL_EXT_SPEC) >> $@
|
||||
echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
|
||||
echo -e "" >> $@;
|
||||
echo -e "\nstatic const char * _glewExtensionLookup[] = {" >> $@;
|
||||
$(BIN)/make_index.pl $(GL_EXT_SPEC) >> $@
|
||||
echo -e " NULL\n};\n" >> $@;
|
||||
echo -e "\n#if !defined(GLEW_MX)" >> $@;
|
||||
echo -e "\nstatic GLboolean* _glewEnabled[] = {" >> $@;
|
||||
$(BIN)/make_enable_index.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
|
||||
echo -e " NULL\n};\n" >> $@;
|
||||
echo -e "\n#endif /* !GLEW_MX */\n" >> $@;
|
||||
$(BIN)/make_initd.pl GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_initd.pl GL $(GL_EXT_SPEC) >> $@
|
||||
echo -e "" >> $@;
|
||||
|
37
auto/bin/make_enable_index.pl
Executable file
37
auto/bin/make_enable_index.pl
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/perl
|
||||
##
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
do 'bin/make.pl';
|
||||
|
||||
##
|
||||
## Make Extension-enabled Index
|
||||
##
|
||||
|
||||
my @extlist = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " &__$extvar,\n";
|
||||
print "#endif\n";
|
||||
}
|
||||
}
|
38
auto/bin/make_index.pl
Executable file
38
auto/bin/make_index.pl
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/perl
|
||||
##
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
do 'bin/make.pl';
|
||||
|
||||
##
|
||||
## Make Index
|
||||
##
|
||||
## Output sorted array of extension strings for indexing into extension
|
||||
## enable/disable flags. This provides a way to convert an extension string
|
||||
## into an integer index.
|
||||
##
|
||||
|
||||
my @extlist = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " \"$extstring\",\n";
|
||||
print "#endif\n";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user