1 | # Copyright (c) 2001, Stanford University
|
---|
2 | # All rights reserved.
|
---|
3 | #
|
---|
4 | # See the file LICENSE.txt for information on redistributing this software.
|
---|
5 |
|
---|
6 | import sys
|
---|
7 |
|
---|
8 | import apiutil
|
---|
9 |
|
---|
10 | apiutil.CopyrightC()
|
---|
11 |
|
---|
12 | print """
|
---|
13 | /* DO NOT EDIT - THIS FILE GENERATED BY THE getprocaddress.py SCRIPT */
|
---|
14 | #include "chromium.h"
|
---|
15 | #include "cr_string.h"
|
---|
16 | #include "cr_version.h"
|
---|
17 | #include "stub.h"
|
---|
18 | #include "icd_drv.h"
|
---|
19 | #include "cr_gl.h"
|
---|
20 | #include "cr_error.h"
|
---|
21 |
|
---|
22 | #ifdef WINDOWS
|
---|
23 | #pragma warning( disable: 4055 )
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | """
|
---|
27 |
|
---|
28 | print """
|
---|
29 | struct name_address {
|
---|
30 | const char *name;
|
---|
31 | CR_PROC address;
|
---|
32 | };
|
---|
33 |
|
---|
34 | PROC WINAPI wglGetProcAddress_prox( LPCSTR name );
|
---|
35 |
|
---|
36 | static struct name_address functions[] = {
|
---|
37 | """
|
---|
38 |
|
---|
39 |
|
---|
40 | keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
41 | for func_name in keys:
|
---|
42 | if "Chromium" == apiutil.Category(func_name):
|
---|
43 | continue
|
---|
44 | if func_name == "BoundsInfoCR":
|
---|
45 | continue
|
---|
46 | if "GL_chromium" == apiutil.Category(func_name):
|
---|
47 | pass #continue
|
---|
48 |
|
---|
49 | wrap = apiutil.GetCategoryWrapper(func_name)
|
---|
50 | name = "gl" + func_name
|
---|
51 | address = "cr_gl" + func_name
|
---|
52 | if wrap:
|
---|
53 | print '#ifdef CR_%s' % wrap
|
---|
54 | print '\t{ "%s", (CR_PROC) %s },' % (name, address)
|
---|
55 | if wrap:
|
---|
56 | print '#endif'
|
---|
57 |
|
---|
58 |
|
---|
59 | print "\t/* Chromium binding/glue functions */"
|
---|
60 |
|
---|
61 | for func_name in keys:
|
---|
62 | if (func_name == "Writeback" or
|
---|
63 | func_name == "BoundsInfoCR"):
|
---|
64 | continue
|
---|
65 | if apiutil.Category(func_name) == "Chromium":
|
---|
66 | print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
|
---|
67 |
|
---|
68 | print "\t/* Windows ICD functions */"
|
---|
69 |
|
---|
70 | for func_name in ( "CopyContext",
|
---|
71 | "CreateContext",
|
---|
72 | "CreateLayerContext",
|
---|
73 | "DeleteContext",
|
---|
74 | "DescribeLayerPlane",
|
---|
75 | "DescribePixelFormat",
|
---|
76 | "GetLayerPaletteEntries",
|
---|
77 | "RealizeLayerPalette",
|
---|
78 | "SetLayerPaletteEntries",
|
---|
79 | "SetPixelFormat",
|
---|
80 | "ShareLists",
|
---|
81 | "SwapBuffers",
|
---|
82 | "SwapLayerBuffers",
|
---|
83 | "ReleaseContext",
|
---|
84 | "SetContext",
|
---|
85 | "ValidateVersion"):
|
---|
86 | print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)
|
---|
87 |
|
---|
88 | print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },'
|
---|
89 |
|
---|
90 | print """
|
---|
91 | { NULL, NULL }
|
---|
92 | };
|
---|
93 |
|
---|
94 | extern const GLubyte * WINAPI wglGetExtensionsStringEXT_prox( HDC hdc );
|
---|
95 |
|
---|
96 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
97 | {
|
---|
98 | int i;
|
---|
99 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = wglGetExtensionsStringEXT_prox;
|
---|
100 |
|
---|
101 | stubInit();
|
---|
102 |
|
---|
103 | for (i = 0; functions[i].name; i++) {
|
---|
104 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
105 | /*crDebug("crGetProcAddress(%s) returns %p", name, functions[i].address);*/
|
---|
106 | return functions[i].address;
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | if (!crStrcmp( name, "wglGetExtensionsStringARB" )) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
111 |
|
---|
112 | crDebug("Returning GetProcAddress:NULL for %s", name);
|
---|
113 | return NULL;
|
---|
114 | }
|
---|
115 |
|
---|
116 | """
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
121 | print_foo = """
|
---|
122 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
123 | #ifdef WINDOWS
|
---|
124 | {
|
---|
125 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
126 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
127 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
128 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
129 | if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
130 | if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
131 | if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
132 | if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
133 | }
|
---|
134 | #endif
|
---|
135 | """
|
---|