~ubuntu-branches/ubuntu/lucid/glew/lucid-201002122355

« back to all changes in this revision

Viewing changes to auto/src/glew_utils.h

  • Committer: Bazaar Package Importer
  • Author(s): Muharem Hrnjadovic
  • Date: 2009-06-04 12:12:40 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090604121240-e0rh5kfvft8wh2b0
Tags: 1.5.1-4ubuntu1
* Merge from debian unstable, remaining changes:
  - Build shared libraries with CC, not LD.
  - The debian Makefile had trailing '^M' characters; once sanitized
    the diff between the debian/ubuntu Makefile looks as follows:
    http://pastebin.ca/1447378

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
** The OpenGL Extension Wrangler Library
3
 
** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
4
 
** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
5
 
** Copyright (C) 2002, Lev Povalahev
6
 
** All rights reserved.
7
 
** 
8
 
** Redistribution and use in source and binary forms, with or without 
9
 
** modification, are permitted provided that the following conditions are met:
10
 
** 
11
 
** * Redistributions of source code must retain the above copyright notice, 
12
 
**   this list of conditions and the following disclaimer.
13
 
** * Redistributions in binary form must reproduce the above copyright notice, 
14
 
**   this list of conditions and the following disclaimer in the documentation 
15
 
**   and/or other materials provided with the distribution.
16
 
** * The name of the author may be used to endorse or promote products 
17
 
**   derived from this software without specific prior written permission.
18
 
**
19
 
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
20
 
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
21
 
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
 
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
23
 
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
24
 
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
25
 
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
 
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
 
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
 
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29
 
** THE POSSIBILITY OF SUCH DAMAGE.
30
 
*/
31
 
 
32
 
#ifndef __glew_utils_h__
33
 
#define __glew_utils_h__
34
 
 
35
 
#include <GL/glew.h>
36
 
#if defined(_WIN32)
37
 
#  include <GL/wglew.h>
38
 
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
39
 
#  include <GL/glxew.h>
40
 
#endif
41
 
 
42
 
/*
43
 
 * Define glewGetContext and related helper macros.
44
 
 */
45
 
#ifdef GLEW_MX
46
 
#  define glewGetContext() ctx
47
 
#  ifdef _WIN32
48
 
#    define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx
49
 
#    define GLEW_CONTEXT_ARG_VAR_INIT ctx
50
 
#    define wglewGetContext() ctx
51
 
#    define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx
52
 
#    define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx
53
 
#  else /* _WIN32 */
54
 
#    define GLEW_CONTEXT_ARG_DEF_INIT void
55
 
#    define GLEW_CONTEXT_ARG_VAR_INIT
56
 
#    define glxewGetContext() ctx
57
 
#    define GLXEW_CONTEXT_ARG_DEF_INIT void
58
 
#    define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx
59
 
#  endif /* _WIN32 */
60
 
#  define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx
61
 
#else /* GLEW_MX */
62
 
#  define GLEW_CONTEXT_ARG_DEF_INIT void
63
 
#  define GLEW_CONTEXT_ARG_VAR_INIT
64
 
#  define GLEW_CONTEXT_ARG_DEF_LIST void
65
 
#  define WGLEW_CONTEXT_ARG_DEF_INIT void
66
 
#  define WGLEW_CONTEXT_ARG_DEF_LIST void
67
 
#  define GLXEW_CONTEXT_ARG_DEF_INIT void
68
 
#  define GLXEW_CONTEXT_ARG_DEF_LIST void
69
 
#endif /* GLEW_MX */
70
 
 
71
 
/*
72
 
 * Define glewGetProcAddress.
73
 
 */
74
 
#if defined(_WIN32)
75
 
#  define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
76
 
#else
77
 
#  if defined(__APPLE__)
78
 
     extern void* NSGLGetProcAddress (const GLubyte* name);
79
 
#    define glewGetProcAddress(name) NSGLGetProcAddress(name)
80
 
#  else
81
 
#    if defined(__sgi) || defined(__sun)
82
 
       extern void* dlGetProcAddress (const GLubyte* name);
83
 
#      define glewGetProcAddress(name) dlGetProcAddress(name)
84
 
#    else /* __linux */
85
 
#      define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
86
 
#    endif
87
 
#  endif
88
 
#endif
89
 
 
90
 
/*
91
 
 * GLEW, just like OpenGL or GLU, does not rely on the standard C library.
92
 
 * These functions implement the string processing functionality required in the library.
93
 
 */
94
 
extern GLuint _glewStrLen (const GLubyte* s);
95
 
extern GLuint _glewStrCLen (const GLubyte* s, GLubyte c);
96
 
extern GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n);
97
 
extern GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
98
 
extern GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
99
 
extern GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
100
 
 
101
 
#endif /* __glew_utils_h__ */
 
1
/*
 
2
** The OpenGL Extension Wrangler Library
 
3
** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
 
4
** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
 
5
** Copyright (C) 2002, Lev Povalahev
 
6
** All rights reserved.
 
7
** 
 
8
** Redistribution and use in source and binary forms, with or without 
 
9
** modification, are permitted provided that the following conditions are met:
 
10
** 
 
11
** * Redistributions of source code must retain the above copyright notice, 
 
12
**   this list of conditions and the following disclaimer.
 
13
** * Redistributions in binary form must reproduce the above copyright notice, 
 
14
**   this list of conditions and the following disclaimer in the documentation 
 
15
**   and/or other materials provided with the distribution.
 
16
** * The name of the author may be used to endorse or promote products 
 
17
**   derived from this software without specific prior written permission.
 
18
**
 
19
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 
20
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 
21
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
22
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 
23
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 
24
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 
25
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
26
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
27
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
28
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 
29
** THE POSSIBILITY OF SUCH DAMAGE.
 
30
*/
 
31
 
 
32
#ifndef __glew_utils_h__
 
33
#define __glew_utils_h__
 
34
 
 
35
#include <GL/glew.h>
 
36
#if defined(_WIN32)
 
37
#  include <GL/wglew.h>
 
38
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
 
39
#  include <GL/glxew.h>
 
40
#endif
 
41
 
 
42
/*
 
43
 * Define glewGetContext and related helper macros.
 
44
 */
 
45
#ifdef GLEW_MX
 
46
#  define glewGetContext() ctx
 
47
#  ifdef _WIN32
 
48
#    define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx
 
49
#    define GLEW_CONTEXT_ARG_VAR_INIT ctx
 
50
#    define wglewGetContext() ctx
 
51
#    define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx
 
52
#    define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx
 
53
#  else /* _WIN32 */
 
54
#    define GLEW_CONTEXT_ARG_DEF_INIT void
 
55
#    define GLEW_CONTEXT_ARG_VAR_INIT
 
56
#    define glxewGetContext() ctx
 
57
#    define GLXEW_CONTEXT_ARG_DEF_INIT void
 
58
#    define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx
 
59
#  endif /* _WIN32 */
 
60
#  define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx
 
61
#else /* GLEW_MX */
 
62
#  define GLEW_CONTEXT_ARG_DEF_INIT void
 
63
#  define GLEW_CONTEXT_ARG_VAR_INIT
 
64
#  define GLEW_CONTEXT_ARG_DEF_LIST void
 
65
#  define WGLEW_CONTEXT_ARG_DEF_INIT void
 
66
#  define WGLEW_CONTEXT_ARG_DEF_LIST void
 
67
#  define GLXEW_CONTEXT_ARG_DEF_INIT void
 
68
#  define GLXEW_CONTEXT_ARG_DEF_LIST void
 
69
#endif /* GLEW_MX */
 
70
 
 
71
/*
 
72
 * Define glewGetProcAddress.
 
73
 */
 
74
#if defined(_WIN32)
 
75
#  define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
 
76
#else
 
77
#  if defined(__APPLE__)
 
78
     extern void* NSGLGetProcAddress (const GLubyte* name);
 
79
#    define glewGetProcAddress(name) NSGLGetProcAddress(name)
 
80
#  else
 
81
#    if defined(__sgi) || defined(__sun)
 
82
       extern void* dlGetProcAddress (const GLubyte* name);
 
83
#      define glewGetProcAddress(name) dlGetProcAddress(name)
 
84
#    else /* __linux */
 
85
#      define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
 
86
#    endif
 
87
#  endif
 
88
#endif
 
89
 
 
90
/*
 
91
 * GLEW, just like OpenGL or GLU, does not rely on the standard C library.
 
92
 * These functions implement the string processing functionality required in the library.
 
93
 */
 
94
extern GLuint _glewStrLen (const GLubyte* s);
 
95
extern GLuint _glewStrCLen (const GLubyte* s, GLubyte c);
 
96
extern GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n);
 
97
extern GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
 
98
extern GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb);
 
99
extern GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb)
 
100
 
 
101
#endif /* __glew_utils_h__ */