mesa: make mm.c use unsigned ints for offsets.
[mesa.git] / src / mesa / glapi / mesadef.py
1 #!/usr/bin/env python
2
3 # $Id: mesadef.py,v 1.4 2006/01/25 15:05:36 brianp Exp $
4
5 # Mesa 3-D graphics library
6 # Version: 4.1
7 #
8 # Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 #
10 # Permission is hereby granted, free of charge, to any person obtaining a
11 # copy of this software and associated documentation files (the "Software"),
12 # to deal in the Software without restriction, including without limitation
13 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 # and/or sell copies of the Software, and to permit persons to whom the
15 # Software is furnished to do so, subject to the following conditions:
16 #
17 # The above copyright notice and this permission notice shall be included
18 # in all copies or substantial portions of the Software.
19 #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
24 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27
28 # Generate the mesa.def file for Windows.
29 #
30 # Usage:
31 # mesadef.py >mesa.def
32 # Then copy to src/mesa/drivers/windows/gdi
33 #
34 # Dependencies:
35 # The apispec file must be in the current directory.
36
37
38
39 import apiparser
40 import string
41
42
43 def PrintHead():
44 print '; DO NOT EDIT - This file generated automatically by mesadef.py script'
45 print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\''
46 print 'VERSION 6.0'
47 print ';'
48 print '; Module definition file for Mesa (OPENGL32.DLL)'
49 print ';'
50 print '; Note: The OpenGL functions use the STDCALL'
51 print '; function calling convention. Microsoft\'s'
52 print '; OPENGL32 uses this convention and so must the'
53 print '; Mesa OPENGL32 so that the Mesa DLL can be used'
54 print '; as a drop-in replacement.'
55 print ';'
56 print '; The linker exports STDCALL entry points with'
57 print '; \'decorated\' names; e.g., _glBegin@0, where the'
58 print '; trailing number is the number of bytes of '
59 print '; parameter data pushed onto the stack. The'
60 print '; callee is responsible for popping this data'
61 print '; off the stack, usually via a RETF n instruction.'
62 print ';'
63 print '; However, the Microsoft OPENGL32.DLL does not export'
64 print '; the decorated names, even though the calling convention'
65 print '; is STDCALL. So, this module definition file is'
66 print '; needed to force the Mesa OPENGL32.DLL to export the'
67 print '; symbols in the same manner as the Microsoft DLL.'
68 print '; Were it not for this problem, this file would not'
69 print '; be needed (for the gl* functions) since the entry'
70 print '; points are compiled with dllexport declspec.'
71 print ';'
72 print '; However, this file is still needed to export "internal"'
73 print '; Mesa symbols for the benefit of the OSMESA32.DLL.'
74 print ';'
75 print 'EXPORTS'
76 return
77 #enddef
78
79
80 def PrintTail():
81 print ';'
82 print '; WGL API'
83 print '\twglChoosePixelFormat'
84 print '\twglCopyContext'
85 print '\twglCreateContext'
86 print '\twglCreateLayerContext'
87 print '\twglDeleteContext'
88 print '\twglDescribeLayerPlane'
89 print '\twglDescribePixelFormat'
90 print '\twglGetCurrentContext'
91 print '\twglGetCurrentDC'
92 print '\twglGetExtensionsStringARB'
93 print '\twglGetLayerPaletteEntries'
94 print '\twglGetPixelFormat'
95 print '\twglGetProcAddress'
96 print '\twglMakeCurrent'
97 print '\twglRealizeLayerPalette'
98 print '\twglSetLayerPaletteEntries'
99 print '\twglSetPixelFormat'
100 print '\twglShareLists'
101 print '\twglSwapBuffers'
102 print '\twglSwapLayerBuffers'
103 print '\twglUseFontBitmapsA'
104 print '\twglUseFontBitmapsW'
105 print '\twglUseFontOutlinesA'
106 print '\twglUseFontOutlinesW'
107 print ';'
108 print '; Mesa internals - mostly for OSMESA'
109 print '\t_ac_CreateContext'
110 print '\t_ac_DestroyContext'
111 print '\t_ac_InvalidateState'
112 print '\t_glapi_get_context'
113 print '\t_glapi_get_proc_address'
114 print '\t_mesa_buffer_data'
115 print '\t_mesa_buffer_map'
116 print '\t_mesa_buffer_subdata'
117 print '\t_mesa_bzero'
118 print '\t_mesa_calloc'
119 print '\t_mesa_choose_tex_format'
120 print '\t_mesa_compressed_texture_size'
121 print '\t_mesa_create_framebuffer'
122 print '\t_mesa_create_visual'
123 print '\t_mesa_delete_buffer_object'
124 print '\t_mesa_delete_texture_object'
125 print '\t_mesa_destroy_framebuffer'
126 print '\t_mesa_destroy_visual'
127 print '\t_mesa_enable_1_3_extensions'
128 print '\t_mesa_enable_1_4_extensions'
129 print '\t_mesa_enable_1_5_extensions'
130 print '\t_mesa_enable_sw_extensions'
131 print '\t_mesa_error'
132 print '\t_mesa_free'
133 print '\t_mesa_free_context_data'
134 print '\t_mesa_get_current_context'
135 print '\t_mesa_init_default_imports'
136 print '\t_mesa_initialize_context'
137 print '\t_mesa_make_current'
138 print '\t_mesa_memcpy'
139 print '\t_mesa_memset'
140 print '\t_mesa_new_buffer_object'
141 print '\t_mesa_new_texture_object'
142 print '\t_mesa_problem'
143 print '\t_mesa_ResizeBuffersMESA'
144 print '\t_mesa_store_compressed_teximage1d'
145 print '\t_mesa_store_compressed_teximage2d'
146 print '\t_mesa_store_compressed_teximage3d'
147 print '\t_mesa_store_compressed_texsubimage1d'
148 print '\t_mesa_store_compressed_texsubimage2d'
149 print '\t_mesa_store_compressed_texsubimage3d'
150 print '\t_mesa_store_teximage1d'
151 print '\t_mesa_store_teximage2d'
152 print '\t_mesa_store_teximage3d'
153 print '\t_mesa_store_texsubimage1d'
154 print '\t_mesa_store_texsubimage2d'
155 print '\t_mesa_store_texsubimage3d'
156 print '\t_mesa_strcmp'
157 print '\t_mesa_test_proxy_teximage'
158 print '\t_mesa_Viewport'
159 print '\t_swrast_Accum'
160 print '\t_swrast_alloc_buffers'
161 print '\t_swrast_Bitmap'
162 print '\t_swrast_CopyPixels'
163 print '\t_swrast_DrawPixels'
164 print '\t_swrast_GetDeviceDriverReference'
165 print '\t_swrast_Clear'
166 print '\t_swrast_choose_line'
167 print '\t_swrast_choose_triangle'
168 print '\t_swrast_CopyColorSubTable'
169 print '\t_swrast_CopyColorTable'
170 print '\t_swrast_CopyConvolutionFilter1D'
171 print '\t_swrast_CopyConvolutionFilter2D'
172 print '\t_swrast_copy_teximage1d'
173 print '\t_swrast_copy_teximage2d'
174 print '\t_swrast_copy_texsubimage1d'
175 print '\t_swrast_copy_texsubimage2d'
176 print '\t_swrast_copy_texsubimage3d'
177 print '\t_swrast_CreateContext'
178 print '\t_swrast_DestroyContext'
179 print '\t_swrast_InvalidateState'
180 print '\t_swrast_ReadPixels'
181 print '\t_swrast_zbuffer_address'
182 print '\t_swsetup_Wakeup'
183 print '\t_swsetup_CreateContext'
184 print '\t_swsetup_DestroyContext'
185 print '\t_swsetup_InvalidateState'
186 print '\t_tnl_CreateContext'
187 print '\t_tnl_DestroyContext'
188 print '\t_tnl_InvalidateState'
189 print '\t_tnl_MakeCurrent'
190 print '\t_tnl_run_pipeline'
191 #enddef
192
193
194 records = []
195
196 def FindOffset(funcName):
197 for (name, alias, offset) in records:
198 if name == funcName:
199 return offset
200 #endif
201 #endfor
202 return -1
203 #enddef
204
205
206 def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
207 if alias == '':
208 dispatchName = name
209 else:
210 dispatchName = alias
211 if offset < 0:
212 offset = FindOffset(dispatchName)
213 if offset >= 0 and string.find(name, "unused") == -1:
214 print '\tgl%s' % (name)
215 # save this info in case we need to look up an alias later
216 records.append((name, dispatchName, offset))
217
218 #enddef
219
220
221 PrintHead()
222 apiparser.ProcessSpecFile("APIspec", EmitEntry)
223 PrintTail()