extended glewIsSupported

git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@343 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
ikits 2005-01-04 05:31:44 +00:00
parent 7c4df3853a
commit 471af2c0d6
8 changed files with 93 additions and 23 deletions

View File

@ -15,8 +15,6 @@ do 'bin/make.pl';
my @extlist = ();
my %extensions = ();
our $export = shift;
if (@ARGV)
{
@extlist = @ARGV;
@ -35,17 +33,21 @@ if (@ARGV)
{
if(length($curexttype) > 0)
{
print " }\n";
print " }\n";
}
print " if (_glewStrSame2(&pos, &len, (const GLubyte*)\"$exttype\", " . length($exttype) . "))\n";
print " {\n";
print " if (_glewStrSame2(&pos, &len, (const GLubyte*)\"$exttype\", " . length($exttype) . "))\n";
print " {\n";
$curexttype = $exttype;
}
print "#ifdef $extname\n";
print " if (_glewStrSame3(pos, len, (const GLubyte*)\"$extrem\", ". length($extrem) . "))\n";
print " return $extvar;\n";
print " if (_glewStrSame3(&pos, &len, (const GLubyte*)\"$extrem\", ". length($extrem) . "))\n";
#print " return $extvar;\n";
print " {\n";
print " ret = $extvar;\n";
print " continue;\n";
print " }\n";
print "#endif\n";
}
print " }\n";
print " }\n";
}

View File

@ -121,6 +121,27 @@ GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
return i == n ? GL_TRUE : GL_FALSE;
}
GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t'))
{
*a++;
*na--;
}
if(*na >= nb)
{
GLuint i=0;
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
if(i == nb)
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}
GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
if(*na >= nb)
@ -137,13 +158,18 @@ GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
return GL_FALSE;
}
GLboolean _glewStrSame3 (const GLubyte* a, GLuint na, const GLubyte* b, GLuint nb)
GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
if(na == nb)
if(*na >= nb)
{
GLuint i=0;
while (i < nb && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
return i == nb ? GL_TRUE : GL_FALSE;
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
if (i == nb && (*na == nb || *a[i] == ' ' || *a[i] == '\n' || *a[i] == '\r' || *a[i] == '\t'))
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}

View File

@ -1,5 +1,7 @@
}
ret = (len == 0);
}
return GL_FALSE;
return ret;
}
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
@ -12,5 +14,8 @@ GLboolean glxewIsSupported (const char* name)
{
GLubyte* pos = (GLubyte*)name;
GLuint len = _glewStrLen(pos);
if(_glewStrSame2(&pos, &len, (const GLubyte*)"GLX_", 4))
GLboolean ret = GL_TRUE;
while (ret && len > 0)
{
if(_glewStrSame1(&pos, &len, (const GLubyte*)"GLX_", 4))
{

View File

@ -6,5 +6,8 @@ GLboolean glewIsSupported (const char* name)
{
GLubyte* pos = (GLubyte*)name;
GLuint len = _glewStrLen(pos);
if(_glewStrSame2(&pos, &len, (const GLubyte*)"GL_", 3))
GLboolean ret = GL_TRUE;
while (ret && len > 0)
{
if (_glewStrSame1(&pos, &len, (const GLubyte*)"GL_", 3))
{

View File

@ -1,5 +1,7 @@
}
ret = (len == 0);
}
return GL_FALSE;
return ret;
}
#endif /* _WIN32 */

View File

@ -1,5 +1,7 @@
}
ret = (len == 0);
}
return GL_FALSE;
return ret;
}
#if defined(_WIN32)
@ -12,5 +14,8 @@ GLboolean wglewIsSupported (const char* name)
{
GLubyte* pos = (GLubyte*)name;
GLuint len = _glewStrLen(pos);
if(_glewStrSame2(&pos, &len, (const GLubyte*)"WGL_", 4))
GLboolean ret = GL_TRUE;
while (ret && len > 0)
{
if (_glewStrSame1(&pos, &len, (const GLubyte*)"WGL_", 4))
{

View File

@ -108,6 +108,27 @@ GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
return i == n ? GL_TRUE : GL_FALSE;
}
GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t'))
{
*a++;
*na--;
}
if(*na >= nb)
{
GLuint i=0;
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
if(i == nb)
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}
GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
if(*na >= nb)
@ -124,13 +145,18 @@ GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
return GL_FALSE;
}
GLboolean _glewStrSame3 (const GLubyte* a, GLuint na, const GLubyte* b, GLuint nb)
GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
{
if(na == nb)
if(*na >= nb)
{
GLuint i=0;
while (i < nb && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
return i == nb ? GL_TRUE : GL_FALSE;
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
if (i == nb && (*na == nb || *a[i] == ' ' || *a[i] == '\n' || *a[i] == '\r' || *a[i] == '\t'))
{
*a = *a + nb;
*na = *na - nb;
return GL_TRUE;
}
}
return GL_FALSE;
}

View File

@ -94,7 +94,8 @@
extern GLuint _glewStrLen (const GLubyte* s);
extern GLuint _glewStrCLen (const GLubyte* s, GLubyte c);
extern GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n);
extern GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
extern GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
extern GLboolean _glewStrSame3 (const GLubyte* a, GLuint na, const GLubyte* b, GLuint nb);
extern GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
#endif /* __glew_utils_h__ */