VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/getprocaddress.py@ 16241

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

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.3 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_string.h"
17#include "cr_version.h"
18#include "stub.h"
19
20
21struct name_address {
22 const char *name;
23 CR_PROC address;
24};
25
26static struct name_address functions[] = {
27"""
28
29
30keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
31for func_name in keys:
32 if "Chromium" == apiutil.Category(func_name):
33 continue
34 if func_name == "BoundsInfoCR":
35 continue
36 if "GL_chromium" == apiutil.Category(func_name):
37 pass #continue
38
39 wrap = apiutil.GetCategoryWrapper(func_name)
40 name = "gl" + func_name
41 address = "gl" + func_name
42 if wrap:
43 print '#ifdef CR_%s' % wrap
44 print '\t{ "%s", (CR_PROC) %s },' % (name, address)
45 if wrap:
46 print '#endif'
47
48
49print "\t/* Chromium binding/glue functions */"
50
51for func_name in keys:
52 if (func_name == "Writeback" or
53 func_name == "BoundsInfoCR"):
54 continue
55 if apiutil.Category(func_name) == "Chromium":
56 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
57
58
59print """
60 { NULL, NULL }
61};
62
63CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
64{
65 int i;
66 stubInit();
67
68 for (i = 0; functions[i].name; i++) {
69 if (crStrcmp(name, functions[i].name) == 0) {
70 return functions[i].address;
71 }
72 }
73
74 return NULL;
75}
76
77"""
78
79
80
81# XXX should crGetProcAddress really handle WGL/GLX functions???
82
83print_foo = """
84/* As these are Windows specific (i.e. wgl), define these now.... */
85#ifdef WINDOWS
86 {
87 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
88 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
89 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
90 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
91 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
92 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
93 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
94 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
95 }
96#endif
97"""
Note: See TracBrowser for help on using the repository browser.

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