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 |
|
---|
15 | #include "chromium.h"
|
---|
16 | #include "cr_error.h"
|
---|
17 | #include "cr_string.h"
|
---|
18 | #include "cr_version.h"
|
---|
19 | #include "stub.h"
|
---|
20 | #include "dri_glx.h"
|
---|
21 | #if defined(VBOXOGL_DRI) || defined(VBOXOGL_FAKEDRI)
|
---|
22 | #include "cr_gl.h"
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | struct name_address {
|
---|
26 | const char *name;
|
---|
27 | CR_PROC address;
|
---|
28 | };
|
---|
29 |
|
---|
30 | static struct name_address functions[] = {
|
---|
31 | """
|
---|
32 |
|
---|
33 |
|
---|
34 | keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
35 | for func_name in keys:
|
---|
36 | if "Chromium" == apiutil.Category(func_name):
|
---|
37 | continue
|
---|
38 | if func_name == "BoundsInfoCR":
|
---|
39 | continue
|
---|
40 | if "GL_chromium" == apiutil.Category(func_name):
|
---|
41 | pass #continue
|
---|
42 |
|
---|
43 | wrap = apiutil.GetCategoryWrapper(func_name)
|
---|
44 | name = "gl" + func_name
|
---|
45 | address = "VBOXGLTAG(gl" + func_name + ")"
|
---|
46 | if wrap:
|
---|
47 | print '#ifdef CR_%s' % wrap
|
---|
48 | print '\t{ "%s", (CR_PROC) %s },' % (name, address)
|
---|
49 | if wrap:
|
---|
50 | print '#endif'
|
---|
51 |
|
---|
52 |
|
---|
53 | print "\t/* Chromium binding/glue functions */"
|
---|
54 |
|
---|
55 | for func_name in keys:
|
---|
56 | if (func_name == "Writeback" or
|
---|
57 | func_name == "BoundsInfoCR"):
|
---|
58 | continue
|
---|
59 | if apiutil.Category(func_name) == "Chromium":
|
---|
60 | print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
|
---|
61 |
|
---|
62 |
|
---|
63 | print """
|
---|
64 | { NULL, NULL }
|
---|
65 | };
|
---|
66 |
|
---|
67 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
68 | {
|
---|
69 | int i;
|
---|
70 | stubInit();
|
---|
71 |
|
---|
72 | for (i = 0; functions[i].name; i++) {
|
---|
73 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
74 | return functions[i].address;
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | /*@todo, reuse fakedri_glxfuncsList.h and dri_glx.h here*/
|
---|
79 | /*also, in case of fake dri, those should point to vbox_glX* not to vbox_stub* ones, VBOXGLXENTRYTAG */
|
---|
80 | if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXBindTexImageEXT);
|
---|
81 | if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXReleaseTexImageEXT);
|
---|
82 | if (!crStrcmp( name, "glXQueryDrawable" )) return (CR_PROC) VBOXGLXTAG(glXQueryDrawable);
|
---|
83 | if (!crStrcmp( name, "glXGetFBConfigs" )) return (CR_PROC) VBOXGLXTAG(glXGetFBConfigs);
|
---|
84 | if (!crStrcmp( name, "glXGetFBConfigAttrib" )) return (CR_PROC) VBOXGLXTAG(glXGetFBConfigAttrib);
|
---|
85 | if (!crStrcmp( name, "glXCreatePixmap" )) return (CR_PROC) VBOXGLXTAG(glXCreatePixmap);
|
---|
86 | if (!crStrcmp( name, "glXCreateWindow" )) return (CR_PROC) VBOXGLXTAG(glXCreateWindow);
|
---|
87 | if (!crStrcmp( name, "glXGetVisualFromFBConfig" )) return (CR_PROC) VBOXGLXTAG(glXGetVisualFromFBConfig);
|
---|
88 | if (!crStrcmp( name, "glXDestroyWindow" )) return (CR_PROC) VBOXGLXTAG(glXDestroyWindow);
|
---|
89 | if (!crStrcmp( name, "glXDestroyPixmap" )) return (CR_PROC) VBOXGLXTAG(glXDestroyPixmap);
|
---|
90 |
|
---|
91 | if (name) crDebug("Returning NULL for %s", name);
|
---|
92 | return NULL;
|
---|
93 | }
|
---|
94 |
|
---|
95 | """
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
100 |
|
---|
101 | print_foo = """
|
---|
102 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
103 | #ifdef WINDOWS
|
---|
104 | {
|
---|
105 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
106 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
107 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
108 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
109 | if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
110 | if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
111 | if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
112 | if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
113 | }
|
---|
114 | #endif
|
---|
115 | """
|
---|