mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-27 00:51:55 +00:00
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:
parent
7c4df3853a
commit
471af2c0d6
@ -15,8 +15,6 @@ do 'bin/make.pl';
|
|||||||
my @extlist = ();
|
my @extlist = ();
|
||||||
my %extensions = ();
|
my %extensions = ();
|
||||||
|
|
||||||
our $export = shift;
|
|
||||||
|
|
||||||
if (@ARGV)
|
if (@ARGV)
|
||||||
{
|
{
|
||||||
@extlist = @ARGV;
|
@extlist = @ARGV;
|
||||||
@ -35,17 +33,21 @@ if (@ARGV)
|
|||||||
{
|
{
|
||||||
if(length($curexttype) > 0)
|
if(length($curexttype) > 0)
|
||||||
{
|
{
|
||||||
print " }\n";
|
print " }\n";
|
||||||
}
|
}
|
||||||
print " if (_glewStrSame2(&pos, &len, (const GLubyte*)\"$exttype\", " . length($exttype) . "))\n";
|
print " if (_glewStrSame2(&pos, &len, (const GLubyte*)\"$exttype\", " . length($exttype) . "))\n";
|
||||||
print " {\n";
|
print " {\n";
|
||||||
$curexttype = $exttype;
|
$curexttype = $exttype;
|
||||||
}
|
}
|
||||||
print "#ifdef $extname\n";
|
print "#ifdef $extname\n";
|
||||||
print " if (_glewStrSame3(pos, len, (const GLubyte*)\"$extrem\", ". length($extrem) . "))\n";
|
print " if (_glewStrSame3(&pos, &len, (const GLubyte*)\"$extrem\", ". length($extrem) . "))\n";
|
||||||
print " return $extvar;\n";
|
#print " return $extvar;\n";
|
||||||
|
print " {\n";
|
||||||
|
print " ret = $extvar;\n";
|
||||||
|
print " continue;\n";
|
||||||
|
print " }\n";
|
||||||
print "#endif\n";
|
print "#endif\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print " }\n";
|
print " }\n";
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,27 @@ GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
|
|||||||
return i == n ? GL_TRUE : GL_FALSE;
|
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)
|
GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
|
||||||
{
|
{
|
||||||
if(*na >= nb)
|
if(*na >= nb)
|
||||||
@ -137,13 +158,18 @@ GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
|
|||||||
return GL_FALSE;
|
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;
|
GLuint i=0;
|
||||||
while (i < nb && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
|
||||||
return i == nb ? GL_TRUE : GL_FALSE;
|
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;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
}
|
||||||
|
ret = (len == 0);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||||
@ -12,5 +14,8 @@ GLboolean glxewIsSupported (const char* name)
|
|||||||
{
|
{
|
||||||
GLubyte* pos = (GLubyte*)name;
|
GLubyte* pos = (GLubyte*)name;
|
||||||
GLuint len = _glewStrLen(pos);
|
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))
|
||||||
|
{
|
||||||
|
@ -6,5 +6,8 @@ GLboolean glewIsSupported (const char* name)
|
|||||||
{
|
{
|
||||||
GLubyte* pos = (GLubyte*)name;
|
GLubyte* pos = (GLubyte*)name;
|
||||||
GLuint len = _glewStrLen(pos);
|
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))
|
||||||
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
}
|
||||||
|
ret = (len == 0);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
}
|
||||||
|
ret = (len == 0);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -12,5 +14,8 @@ GLboolean wglewIsSupported (const char* name)
|
|||||||
{
|
{
|
||||||
GLubyte* pos = (GLubyte*)name;
|
GLubyte* pos = (GLubyte*)name;
|
||||||
GLuint len = _glewStrLen(pos);
|
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))
|
||||||
|
{
|
||||||
|
@ -108,6 +108,27 @@ GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
|
|||||||
return i == n ? GL_TRUE : GL_FALSE;
|
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)
|
GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
|
||||||
{
|
{
|
||||||
if(*na >= nb)
|
if(*na >= nb)
|
||||||
@ -124,13 +145,18 @@ GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
|
|||||||
return GL_FALSE;
|
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;
|
GLuint i=0;
|
||||||
while (i < nb && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
while (i < nb && *a+i != NULL && b+i != NULL && *a[i] == b[i]) i++;
|
||||||
return i == nb ? GL_TRUE : GL_FALSE;
|
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;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,8 @@
|
|||||||
extern GLuint _glewStrLen (const GLubyte* s);
|
extern GLuint _glewStrLen (const GLubyte* s);
|
||||||
extern GLuint _glewStrCLen (const GLubyte* s, GLubyte c);
|
extern GLuint _glewStrCLen (const GLubyte* s, GLubyte c);
|
||||||
extern GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n);
|
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 _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__ */
|
#endif /* __glew_utils_h__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user