Generate Sources of origin/master updated at Fri Feb 19 17:44:34 GMT 2016

This commit is contained in:
omniavinco 2016-02-20 02:44:34 +09:00
parent ae08241886
commit 868558e265

View File

@ -44,8 +44,6 @@
#endif
#include <stddef.h> /* For size_t */
#include <stdlib.h> /* For bsearch */
#include <string.h> /* For memset */
#if defined(GLEW_EGL)
#elif defined(GLEW_REGAL)
@ -16697,11 +16695,9 @@ static GLboolean _glewInit_GL_WIN_swap_hint ()
/* ------------------------------------------------------------------------- */
static int _glewExtensionCompare(const void *a, const void *b)
static int _glewExtensionCompare(const char *s1, const char *s2)
{
/* http://www.chanduthedev.com/2012/07/strcmp-implementation-in-c.html */
const char *s1 = (const char *) a;
const char *s2 = *(const char * const *) b;
while (*s1 || *s2)
{
if (*s1 > *s2)
@ -16714,31 +16710,32 @@ static int _glewExtensionCompare(const void *a, const void *b)
return 0;
}
static GLboolean *_glewGetExtensionString(const char *name)
static ptrdiff_t _glewBsearchExtension(const char* name)
{
const char **n = (const char **) bsearch(name, _glewExtensionLookup, sizeof(_glewExtensionLookup)/sizeof(char *)-1, sizeof(char *), _glewExtensionCompare);
ptrdiff_t i;
ptrdiff_t lo = 0, hi = sizeof(_glewExtensionLookup) / sizeof(char*) - 2;
if (n)
while (lo <= hi)
{
i = n-_glewExtensionLookup;
return _glewExtensionString+i;
ptrdiff_t mid = (lo + hi) / 2;
const int cmp = _glewExtensionCompare(name, _glewExtensionLookup[mid]);
if (cmp < 0) hi = mid - 1;
else if (cmp > 0) lo = mid + 1;
else return mid;
}
return -1;
}
static GLboolean *_glewGetExtensionString(const char *name)
{
ptrdiff_t n = _glewBsearchExtension(name);
if (n >= 0) return &_glewExtensionString[n];
return NULL;
}
static GLboolean *_glewGetExtensionEnable(const char *name)
{
const char **n = (const char **) bsearch(name, _glewExtensionLookup, sizeof(_glewExtensionLookup)/sizeof(char *)-1, sizeof(char *), _glewExtensionCompare);
ptrdiff_t i;
if (n)
{
i = n-_glewExtensionLookup;
return _glewExtensionEnabled[i];
}
ptrdiff_t n = _glewBsearchExtension(name);
if (n >= 0) return _glewExtensionEnabled[n];
return NULL;
}
@ -16777,6 +16774,7 @@ static GLenum GLEWAPIENTRY glewContextInit ()
const GLubyte* s;
GLuint dot;
GLint major, minor;
size_t n;
/* query opengl version */
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString");
@ -16822,7 +16820,8 @@ static GLenum GLEWAPIENTRY glewContextInit ()
GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
}
memset(_glewExtensionString,0,sizeof(_glewExtensionString));
for (n = 0; n < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++n)
_glewExtensionString[n] = GL_FALSE;
if (GLEW_VERSION_3_0)
{
@ -20778,6 +20777,18 @@ GLenum GLEWAPIENTRY glewInit (void)
return r;
#endif /* _WIN32 */
}
#if defined(_WIN32) && defined(GLEW_BUILD) && defined(__GNUC__)
/* GCC requires a DLL entry point even without any standard library included. */
/* Types extracted from windows.h to avoid polluting the rest of the file. */
int __stdcall DllMainCRTStartup(void* instance, unsigned reason, void* reserved)
{
(void) instance;
(void) reason;
(void) reserved;
return 1;
}
#endif
GLboolean GLEWAPIENTRY glewIsSupported (const char* name)
{
const GLubyte* pos = (const GLubyte*)name;