OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # (C) Copyright IBM Corporation 2004, 2005 | 3 # (C) Copyright IBM Corporation 2004, 2005 |
4 # All Rights Reserved. | 4 # All Rights Reserved. |
5 # | 5 # |
6 # Permission is hereby granted, free of charge, to any person obtaining a | 6 # Permission is hereby granted, free of charge, to any person obtaining a |
7 # copy of this software and associated documentation files (the "Software"), | 7 # copy of this software and associated documentation files (the "Software"), |
8 # to deal in the Software without restriction, including without limitation | 8 # to deal in the Software without restriction, including without limitation |
9 # on the rights to use, copy, modify, merge, publish, distribute, sub | 9 # on the rights to use, copy, modify, merge, publish, distribute, sub |
10 # license, and/or sell copies of the Software, and to permit persons to whom | 10 # license, and/or sell copies of the Software, and to permit persons to whom |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 cast = "(const void *) " | 72 cast = "(const void *) " |
73 else: | 73 else: |
74 cast = "" | 74 cast = "" |
75 | 75 |
76 t_string = t_string + comma + p.format_string() | 76 t_string = t_string + comma + p.format_string() |
77 p_string = p_string + comma + p.name | 77 p_string = p_string + comma + p.name |
78 o_string = o_string + comma + cast + p.name | 78 o_string = o_string + comma + cast + p.name |
79 comma = ", " | 79 comma = ", " |
80 | 80 |
81 | 81 |
82 if f.return_type != 'void': | |
83 dispatch = "RETURN_DISPATCH" | |
84 else: | |
85 dispatch = "DISPATCH" | |
86 | |
87 need_proto = False | 82 need_proto = False |
88 if not f.is_static_entry_point(name): | 83 if not f.is_static_entry_point(name): |
89 need_proto = True | 84 need_proto = True |
90 elif self.es: | 85 elif self.es: |
91 cat, num = api.get_category_for_name(name) | 86 cat, num = api.get_category_for_name(name) |
92 if (cat.startswith("es") or cat.startswith("GL_OES")): | 87 if (cat.startswith("es") or cat.startswith("GL_OES")): |
93 need_proto = True | 88 need_proto = True |
94 if need_proto: | 89 if need_proto: |
95 print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.retur
n_type, n, f.get_parameter_string(name)) | 90 print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.retur
n_type, n, f.get_parameter_string(name)) |
96 print '' | 91 print '' |
97 | 92 |
98 print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n
, f.get_parameter_string(name)) | 93 print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n
, f.get_parameter_string(name)) |
99 print '{' | 94 print '{' |
100 » » if p_string == "": | 95 » » if f.return_type != 'void': |
101 » » » print ' %s(%s, (), (F, "gl%s();\\n"));' \ | 96 » » » dispatch = "RETURN_DISPATCH" |
102 » » » » % (dispatch, f.name, name) | 97 » » » if p_string == "": |
| 98 » » » » print ' %s(%s, %s, (), (F, "gl%s();\\n"));' \ |
| 99 » » » » » % (dispatch, f.return_type, f.name, name
) |
| 100 » » » else: |
| 101 » » » » print ' %s(%s, %s, (%s), (F, "gl%s(%s);\\n", %
s));' \ |
| 102 » » » » » % (dispatch, f.return_type, f.name, p_st
ring, name, t_string, o_string) |
103 else: | 103 else: |
104 » » » print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \ | 104 » » » dispatch = "DISPATCH" |
105 » » » » % (dispatch, f.name, p_string, name, t_string, o
_string) | 105 » » » if p_string == "": |
| 106 » » » » print ' %s(%s, (), (F, "gl%s();\\n"));' \ |
| 107 » » » » » % (dispatch, f.name, name) |
| 108 » » » else: |
| 109 » » » » print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));
' \ |
| 110 » » » » » % (dispatch, f.name, p_string, name, t_s
tring, o_string) |
106 print '}' | 111 print '}' |
107 print '' | 112 print '' |
108 return | 113 return |
109 | 114 |
110 def printRealHeader(self): | 115 def printRealHeader(self): |
111 print '' | 116 print '' |
112 self.printVisibility( "HIDDEN", "hidden" ) | 117 self.printVisibility( "HIDDEN", "hidden" ) |
113 print """ | 118 print """ |
114 /* | 119 /* |
115 * This file is a template which generates the OpenGL API entry point | 120 * This file is a template which generates the OpenGL API entry point |
116 * functions. It should be included by a .c file which first defines | 121 * functions. It should be included by a .c file which first defines |
117 * the following macros: | 122 * the following macros: |
118 * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32 | 123 * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32 |
119 * KEYWORD2 - usually nothing, but might be __stdcall on Win32 | 124 * KEYWORD2 - usually nothing, but might be __stdcall on Win32 |
120 * NAME(n) - builds the final function name (usually add "gl" prefix) | 125 * NAME(n) - builds the final function name (usually add "gl" prefix) |
121 * DISPATCH(func, args, msg) - code to do dispatch of named function. | 126 * DISPATCH(func, args, msg) - code to do dispatch of named function. |
122 * msg is a printf-style debug message. | 127 * msg is a printf-style debug message. |
123 * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value | 128 * RETURN_DISPATCH(type, func, args, msg) - code to do dispatch with a |
| 129 * return value of type. |
124 * | 130 * |
125 * Here is an example which generates the usual OpenGL functions: | 131 * Here is an example which generates the usual OpenGL functions: |
126 * #define KEYWORD1 | 132 * #define KEYWORD1 |
127 * #define KEYWORD2 | 133 * #define KEYWORD2 |
128 * #define NAME(func) gl##func | 134 * #define NAME(func) gl##func |
129 * #define DISPATCH(func, args, msg) \\ | 135 * #define DISPATCH(func, args, msg) \\ |
130 * struct _glapi_table *dispatch = CurrentDispatch; \\ | 136 * struct _glapi_table *dispatch = CurrentDispatch; \\ |
131 * (*dispatch->func) args | 137 * (*dispatch->func) args |
132 * #define RETURN DISPATCH(func, args, msg) \\ | 138 * #define RETURN DISPATCH(func, args, msg) \\ |
133 * struct _glapi_table *dispatch = CurrentDispatch; \\ | 139 * struct _glapi_table *dispatch = CurrentDispatch; \\ |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 for (arg,val) in args: | 317 for (arg,val) in args: |
312 if arg == "-f": | 318 if arg == "-f": |
313 file_name = val | 319 file_name = val |
314 elif arg == "-c": | 320 elif arg == "-c": |
315 es = True | 321 es = True |
316 | 322 |
317 api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) | 323 api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) |
318 | 324 |
319 printer = PrintGlOffsets(es) | 325 printer = PrintGlOffsets(es) |
320 printer.Print(api) | 326 printer.Print(api) |
OLD | NEW |