doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
process.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # process stdin into an M4 macro definition file
3 # recognize three keyword qgl qwgl qglX
4 #
5 # output
6 # global macros keep track of the three intervals for function types:
7 # gl_start gl_end wgl_start wgl_end glX_start glX_end
8 # NOTE: will we need similar thing for extensions?
9 #
10 # each function:
11 # f<id>_ret: return type
12 # f<id>_name: function name
13 # f<id>_params: complete params
14 #
15 # ex:
16 # define(`f1_ret', `void')
17 # define(`f1_name', `Accum')
18 # define(`f1_params', ``GLenum op, GLfloat value'')
19 #
20 
21 import sys, string
22 from read import read_gl
23 
24 (gl, wgl, glX) = read_gl(sys.stdin)
25 
26 sys.stdout.write('define(`gl_start\', `0\')\n')
27 sys.stdout.write('define(`gl_end\', `%d\')\n' % int(len(gl)-1))
28 sys.stdout.write('define(`wgl_start\', `%d\')\n' % int(len(gl)))
29 sys.stdout.write('define(`wgl_end\', `%d\')\n' % int(len(gl)+len(wgl)-1))
30 sys.stdout.write('define(`glX_start\', `%d\')\n' % int(len(gl)+len(wgl)))
31 sys.stdout.write('define(`glX_end\', `%d\')\n' % int(len(gl)+len(wgl)+len(glX)-1))
32 
33 i = 0
34 for l in (gl, wgl, glX):
35  for t in l:
36  # process ret type to strip trailing spaces
37  t[0] = string.strip(t[0])
38  sys.stdout.write('define(`f%d_ret\', `%s\')\n' % (i, t[0]))
39  sys.stdout.write('define(`f%d_name\', `%s\')\n' % (i, t[2]))
40  sys.stdout.write('define(`f%d_params\', ``%s\'\')\n' % (i, t[3]))
41  i += 1
case const int
Definition: Callbacks.cpp:52
def read_gl
Definition: read.py:5