From 0c1a32c5e4e5fc22f6403718e2d14b08a7202a2c Mon Sep 17 00:00:00 2001 From: Matthias Bentrup Date: Sat, 7 Feb 2015 10:01:01 +0100 Subject: [PATCH] Add deleters to functions that exist both in core and extensions. Parts of later GL versions are often published as extension too, so these functions may be queried twice. --- auto/Makefile | 5 ++--- auto/bin/parse_spec.pl | 28 +++++++++++++++++++++++++++- auto/bin/update_ext.sh | 2 +- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/auto/Makefile b/auto/Makefile index f6d9e4a..4a1544c 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -113,7 +113,7 @@ $(EXT)/.dummy: $(REGISTRY)/.dummy @echo "Creating descriptors" @echo "--------------------------------------------------------------------" rm -rf $(EXT) - $(BIN)/update_ext.sh $(EXT) $(REGISTRY) $(BLACKLIST) + $(BIN)/update_ext.sh $(EXT) $(REGISTRY) $(BLACKLIST) $(CORE) $(BIN)/$(FILTER) $(EXT) ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin) find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \ @@ -199,8 +199,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy $(SRC)/glew_init_hash.c cp -f $(SRC)/glew_license.h $@ cat $(SRC)/glew_head.c >> $@ echo -e "\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@ - $(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@ - $(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@ + $(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@ echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@ echo -e "\n#if !defined(GLEW_MX)" >> $@; echo -e "\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@ diff --git a/auto/bin/parse_spec.pl b/auto/bin/parse_spec.pl index efbf1bf..9476e7e 100755 --- a/auto/bin/parse_spec.pl +++ b/auto/bin/parse_spec.pl @@ -307,8 +307,10 @@ sub parse_spec($) my @speclist = (); my %extensions = (); +my %fcn_in_core = (); my $ext_dir = shift; +my $core_dir = shift; my $reg_http = "http://www.opengl.org/registry/specs/"; # Take command line arguments or read list from file @@ -320,6 +322,24 @@ if (@ARGV) @speclist = split "\n", (<>); } +# Get functions moved to the GL core +my %core_fnc = (); +foreach my $spec (<$core_dir/GL_VERSION_*>) +{ + my $vsn = $spec; + $vsn =~ s/.*\/GL_VERSION_(\d+)_(\d+)/$1.$2/; + + open SPEC, "<$spec"; + while () + { + if ($_ =~ qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)\s*(~.*)?$/i ) + { + $core_fnc{$2} = $vsn; + } + } + close SPEC; +} + foreach my $spec (sort @speclist) { my ($extname, $extnames, $tokens, $functions) = parse_spec($spec); @@ -371,7 +391,13 @@ foreach my $spec (sort @speclist) { if ($function =~ /^$prefix.*/i) { - print EXT "\t" . ${$functions}{$function}{rtype} . " " . $function . " (" . ${$functions}{$function}{parms} . ")" . "\n"; + my $deleter = ""; + + if ($core_fnc{$function}) + { + $deleter = " ~ " . $core_fnc{$function}; + } + print EXT "\t" . ${$functions}{$function}{rtype} . " " . $function . " (" . ${$functions}{$function}{parms} . ")" . $deleter . "\n"; } } close EXT; diff --git a/auto/bin/update_ext.sh b/auto/bin/update_ext.sh index e990a21..f350cbc 100755 --- a/auto/bin/update_ext.sh +++ b/auto/bin/update_ext.sh @@ -20,6 +20,6 @@ if [ ! -d $1 ] ; then # Parse each of the extensions in the registry find $2 -name doc -type d -prune -o -name "*.txt" -print | \ - grep -v -f $3 | sort | bin/parse_spec.pl $1 + grep -v -f $3 | sort | bin/parse_spec.pl $1 $4 fi