VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/windows_getprocaddress.py@ 15844

Last change on this file since 15844 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: 3.0 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#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
21#ifdef WINDOWS
22#pragma warning( disable: 4055 )
23#endif
24
25"""
26
27print """
28struct name_address {
29 const char *name;
30 CR_PROC address;
31};
32
33PROC WINAPI wglGetProcAddress_prox( LPCSTR name );
34
35static struct name_address functions[] = {
36"""
37
38
39keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
40for func_name in keys:
41 if "Chromium" == apiutil.Category(func_name):
42 continue
43 if func_name == "BoundsInfoCR":
44 continue
45 if "GL_chromium" == apiutil.Category(func_name):
46 pass #continue
47
48 wrap = apiutil.GetCategoryWrapper(func_name)
49 name = "gl" + func_name
50 address = "cr_gl" + func_name
51 if wrap:
52 print '#ifdef CR_%s' % wrap
53 print '\t{ "%s", (CR_PROC) %s },' % (name, address)
54 if wrap:
55 print '#endif'
56
57
58print "\t/* Chromium binding/glue functions */"
59
60for func_name in keys:
61 if (func_name == "Writeback" or
62 func_name == "BoundsInfoCR"):
63 continue
64 if apiutil.Category(func_name) == "Chromium":
65 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
66
67print "\t/* Windows ICD functions */"
68
69for func_name in ( "CopyContext",
70 "CreateContext",
71 "CreateLayerContext",
72 "DeleteContext",
73 "DescribeLayerPlane",
74 "DescribePixelFormat",
75 "GetLayerPaletteEntries",
76 "RealizeLayerPalette",
77 "SetLayerPaletteEntries",
78 "SetPixelFormat",
79 "ShareLists",
80 "SwapBuffers",
81 "SwapLayerBuffers",
82 "ReleaseContext",
83 "SetContext",
84 "ValidateVersion"):
85 print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)
86
87print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },'
88
89print """
90 { NULL, NULL }
91};
92
93CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
94{
95 int i;
96 stubInit();
97
98 for (i = 0; functions[i].name; i++) {
99 if (crStrcmp(name, functions[i].name) == 0) {
100 return functions[i].address;
101 }
102 }
103
104 return NULL;
105}
106
107"""
108
109
110
111# XXX should crGetProcAddress really handle WGL/GLX functions???
112
113print_foo = """
114/* As these are Windows specific (i.e. wgl), define these now.... */
115#ifdef WINDOWS
116 {
117 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
118 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
119 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
120 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
121 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
122 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
123 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
124 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
125 }
126#endif
127"""
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