From b56f8e70e86d663fa7cd95ba0f17166d4722f931 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 20 Jul 2013 22:06:29 -0500 Subject: [PATCH] Revert "Use git instead of clone to download OpenGL registry." This reverts commit 974679c6d884fda238cdceb5c8211fc269cde1a3. --- auto/Makefile | 6 ++-- auto/bin/make_list_gl.pl | 66 ------------------------------------- auto/bin/update_registry.sh | 33 +++++++++++++++++++ auto/src/glew_head.c | 15 --------- auto/src/glew_init_gl.c | 47 ++++++++------------------ auto/src/glew_init_gl_2.c | 44 ------------------------- 6 files changed, 48 insertions(+), 163 deletions(-) delete mode 100755 auto/bin/make_list_gl.pl create mode 100755 auto/bin/update_registry.sh delete mode 100644 auto/src/glew_init_gl_2.c diff --git a/auto/Makefile b/auto/Makefile index 64f59c4..113313f 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -197,9 +197,8 @@ $(S.DEST)/glew.c: $(EXT)/.dummy $(BIN)/make_init.pl GL $(GL_CORE_SPEC) >> $@ $(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@ cat $(SRC)/glew_init_gl.c >> $@ - $(BIN)/make_list_gl.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@ - cat $(SRC)/glew_init_gl_2.c >> $@ - $(BIN)/make_list_gl.pl $(GL_EXT_SPEC) >> $@ + $(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@ + $(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@ echo -e "\n return GLEW_OK;\n}\n" >> $@ echo -e "\n#if defined(_WIN32)" >> $@ echo -e "\n#if !defined(GLEW_MX)" >> $@ @@ -275,7 +274,6 @@ $(S.DEST)/glew_init.c: $(EXT)/.dummy $(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@ cat $(SRC)/glew_init_gl.c >> $@ $(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@ - cat $(SRC)/glew_init_gl_2.c >> $@ $(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@ echo -e "\n return GLEW_OK;\n}\n\n#if defined(_WIN32)\n" >> $@; $(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@ diff --git a/auto/bin/make_list_gl.pl b/auto/bin/make_list_gl.pl deleted file mode 100755 index 0ac08f5..0000000 --- a/auto/bin/make_list_gl.pl +++ /dev/null @@ -1,66 +0,0 @@ -#!/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'; - -#--------------------------------------------------------------------------------------- - -# function pointer definition -sub make_init_call($%) -{ - my $name = prefixname($_[0]); - return " r = r || (" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $name . "\")) == NULL;"; -} - -#--------------------------------------------------------------------------------------- - -my @extlist = (); -my %extensions = (); - -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_/; - - my $extpre = $extname; - $extpre =~ s/^(W?)GL(X?).*$/\l$1gl\l$2ew/; - - #my $pextvar = prefix_varname($extvar); - - print "#ifdef $extname\n"; - - if (length($extstring)) - { - print " CONST_CAST(" . $extvar . ") = _glewSearchExtensionArray(\"$extstring\", extArrayStart, extArrayEnd);\n"; - } - - if (keys %$functions) - { - if ($extname =~ /WGL_.*/) - { - print " if (glewExperimental || " . $extvar . "|| crippled) CONST_CAST(" . $extvar . ")= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n"; - } - else - { - print " if (glewExperimental || " . $extvar . ") CONST_CAST(" . $extvar . ") = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n"; - } - } - print "#endif /* $extname */\n"; - } - -} diff --git a/auto/bin/update_registry.sh b/auto/bin/update_registry.sh new file mode 100755 index 0000000..54b0fd2 --- /dev/null +++ b/auto/bin/update_registry.sh @@ -0,0 +1,33 @@ +#!/bin/sh +## +## 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. + +set -e + +if [ ! -d $1 ] ; then + mkdir -p $1 +fi +cd $1 + +# wget used to return 0 (success), but more recent versions +# don't so we don't want to bail out in failure mode +# eventhough everything is fine. + +set +e + +wget \ + --mirror \ + --no-parent \ + --no-host-directories \ + --cut-dirs=2 \ + --accept=txt,html \ + $2 + +echo 'wget exit code: ' $? + +exit 0 diff --git a/auto/src/glew_head.c b/auto/src/glew_head.c index 3bfd4d7..252d55a 100644 --- a/auto/src/glew_head.c +++ b/auto/src/glew_head.c @@ -247,18 +247,3 @@ static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, c } return GL_FALSE; } - -static GLboolean _glewSearchExtensionArray (const char* name, const GLubyte** start, const GLubyte** end) -{ - const GLubyte** p; - GLuint len = _glewStrLen((const GLubyte*)name); - p = start; - while (p < end) - { - GLuint n = _glewStrCLen(*p, ' '); - if (len == n && _glewStrSame((const GLubyte*)name, *p, n)) return GL_TRUE; - p += 1; - } - return GL_FALSE; -} - diff --git a/auto/src/glew_init_gl.c b/auto/src/glew_init_gl.c index 8f7ad33..5f9bf65 100644 --- a/auto/src/glew_init_gl.c +++ b/auto/src/glew_init_gl.c @@ -1,38 +1,14 @@ /* ------------------------------------------------------------------------- */ GLboolean GLEWAPIENTRY glewGetExtension (const char* name) -{ +{ const GLubyte* start; const GLubyte* end; - GLuint dot; - GLint numExt, i, major; - /* query opengl version to decide how to enumerate extensions */ - start = glGetString(GL_VERSION); - dot = _glewStrCLen(start, '.'); - if (dot == 0) - return GL_FALSE; - major = start[dot-1]-'0'; - - if (major >= 3) - { - glGetIntegerv(GL_NUM_EXTENSIONS, &numExt); - for(i = 0; i < numExt; ++i) - { - start = glGetStringi(GL_EXTENSIONS, i); - end = start + _glewStrLen(start); - if(_glewSearchExtension(name, start, end) == GL_TRUE) - return GL_TRUE; - } - } - else - { - start = (const GLubyte*)glGetString(GL_EXTENSIONS); - if (start == 0) - return GL_FALSE; - end = start + _glewStrLen(start); - return _glewSearchExtension(name, start, end); - } - return GL_FALSE; + start = (const GLubyte*)glGetString(GL_EXTENSIONS); + if (start == 0) + return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); } /* ------------------------------------------------------------------------- */ @@ -45,9 +21,6 @@ GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) const GLubyte* s; GLuint dot; GLint major, minor; - const GLubyte* extArray[1000]; - const GLubyte** extArrayStart; - const GLubyte** extArrayEnd; const GLubyte* extStart; const GLubyte* extEnd; /* query opengl version */ @@ -89,4 +62,10 @@ GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) CONST_CAST(GLEW_VERSION_1_1) = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; } - /* initialize core */ + /* query opengl extensions string */ + extStart = glGetString(GL_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte*)""; + extEnd = extStart + _glewStrLen(extStart); + + /* initialize extensions */ diff --git a/auto/src/glew_init_gl_2.c b/auto/src/glew_init_gl_2.c deleted file mode 100644 index fe6f540..0000000 --- a/auto/src/glew_init_gl_2.c +++ /dev/null @@ -1,44 +0,0 @@ - - /* get extensions */ - if (GLEW_VERSION_3_0 == GL_TRUE) - { - GLint numExt; - GLint i; - glGetIntegerv(GL_NUM_EXTENSIONS, &numExt); - - for(i = 0; i < numExt; ++i) - { - extArray[i] = glGetStringi(GL_EXTENSIONS, i); - } - - extArrayStart = &extArray[0]; - extArrayEnd = &extArray[i]; - } - else - { - int i; - - extStart = glGetString(GL_EXTENSIONS); - if (extStart == 0) - extStart = (const GLubyte*)""; - extEnd = extStart + _glewStrLen(extStart); - i = 0; - - while (extStart < extEnd) - { - int len = _glewStrCLen(extStart, ' '); - - if (len > 0) - { - extArray[i] = extStart; - i += 1; - } - - extStart += len + 1; - } - - extArrayStart = &extArray[0]; - extArrayEnd = &extArray[i]; - } - - /* initialize extensions */