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_string.h"
|
---|
17 | #include "cr_version.h"
|
---|
18 | #include "stub.h"
|
---|
19 |
|
---|
20 |
|
---|
21 | struct name_address {
|
---|
22 | const char *name;
|
---|
23 | CR_PROC address;
|
---|
24 | };
|
---|
25 |
|
---|
26 | static struct name_address functions[] = {
|
---|
27 | """
|
---|
28 |
|
---|
29 |
|
---|
30 | keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
31 | for 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 |
|
---|
49 | print "\t/* Chromium binding/glue functions */"
|
---|
50 |
|
---|
51 | for 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 |
|
---|
59 | print """
|
---|
60 | { NULL, NULL }
|
---|
61 | };
|
---|
62 |
|
---|
63 | CR_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 |
|
---|
83 | print_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 | """
|
---|