VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/getprocaddress.py@ 17719

Last change on this file since 17719 was 17719, checked in by vboxsync, 16 years ago

warning

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6import sys
7
8import apiutil
9
10apiutil.CopyrightC()
11
12print """
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
21
22struct name_address {
23 const char *name;
24 CR_PROC address;
25};
26
27static struct name_address functions[] = {
28"""
29
30
31keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
32for func_name in keys:
33 if "Chromium" == apiutil.Category(func_name):
34 continue
35 if func_name == "BoundsInfoCR":
36 continue
37 if "GL_chromium" == apiutil.Category(func_name):
38 pass #continue
39
40 wrap = apiutil.GetCategoryWrapper(func_name)
41 name = "gl" + func_name
42 address = "gl" + func_name
43 if wrap:
44 print '#ifdef CR_%s' % wrap
45 print '\t{ "%s", (CR_PROC) %s },' % (name, address)
46 if wrap:
47 print '#endif'
48
49
50print "\t/* Chromium binding/glue functions */"
51
52for func_name in keys:
53 if (func_name == "Writeback" or
54 func_name == "BoundsInfoCR"):
55 continue
56 if apiutil.Category(func_name) == "Chromium":
57 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
58
59
60print """
61 { NULL, NULL }
62};
63
64DECLEXPORT(void) glXBindTexImageEXT(Display *dpy, GLXDrawable draw, int buffer, const int *attrib_list);
65DECLEXPORT(void) glXReleaseTexImageEXT(Display *dpy, GLXDrawable draw, int buffer);
66DECLEXPORT(void) glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
67DECLEXPORT(GLXFBConfig *) glXGetFBConfigs(Display *dpy, int screen, int *nelements);
68DECLEXPORT(int) glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value);
69DECLEXPORT(GLXPixmap) glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
70
71
72CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
73{
74 int i;
75 stubInit();
76
77 for (i = 0; functions[i].name; i++) {
78 if (crStrcmp(name, functions[i].name) == 0) {
79 return functions[i].address;
80 }
81 }
82
83 if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) glXBindTexImageEXT;
84 if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) glXReleaseTexImageEXT;
85 if (!crStrcmp( name, "glXQueryDrawable" )) return (CR_PROC) glXQueryDrawable;
86 if (!crStrcmp( name, "glXGetFBConfigs" )) return (CR_PROC) glXGetFBConfigs;
87 if (!crStrcmp( name, "glXGetFBConfigAttrib" )) return (CR_PROC) glXGetFBConfigAttrib;
88 if (!crStrcmp( name, "glXCreatePixmap" )) return (CR_PROC) glXCreatePixmap;
89
90 if (name) crDebug("Returning NULL for %s", name);
91 return NULL;
92}
93
94"""
95
96
97
98# XXX should crGetProcAddress really handle WGL/GLX functions???
99
100print_foo = """
101/* As these are Windows specific (i.e. wgl), define these now.... */
102#ifdef WINDOWS
103 {
104 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
105 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
106 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
107 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
108 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
109 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
110 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
111 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
112 }
113#endif
114"""
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette