diff --git a/auto/Makefile b/auto/Makefile index a1a42a7..0825d74 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -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 "" >> $@; diff --git a/auto/bin/make_enable_index.pl b/auto/bin/make_enable_index.pl new file mode 100755 index 0000000..53cdf75 --- /dev/null +++ b/auto/bin/make_enable_index.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl +## +## Copyright (C) 2002-2008, Marcelo E. Magallon +## Copyright (C) 2002-2008, Milan Ikits +## +## 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"; + } +} diff --git a/auto/bin/make_index.pl b/auto/bin/make_index.pl new file mode 100755 index 0000000..2d06979 --- /dev/null +++ b/auto/bin/make_index.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl +## +## Copyright (C) 2002-2008, Marcelo E. Magallon +## Copyright (C) 2002-2008, Milan Ikits +## +## 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"; + } +}