Added GLAPIENTRY decorations for all first level OpenGL API function entry
[mesa.git] / src / mesa / glapi / gltable.py
1 #!/usr/bin/env python
2
3 # $Id: gltable.py,v 1.4 2003/10/21 22:22:18 kendallb 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 glapitable.h file.
29 #
30 # Usage:
31 # gloffsets.py >glapitable.h
32 #
33 # Dependencies:
34 # The apispec file must be in the current directory.
35
36
37 import apiparser;
38
39
40 def PrintHead():
41 print '/* DO NOT EDIT - This file generated automatically with gltable.py script */'
42 print '#ifndef _GLAPI_TABLE_H_'
43 print '#define _GLAPI_TABLE_H_'
44 print ''
45 print '#include <GL/gl.h>'
46 print ''
47 print 'struct _glapi_table'
48 print '{'
49 return
50 #endif
51
52
53 def PrintTail():
54 print '};'
55 print ''
56 print '#endif'
57 #endif
58
59
60 records = {}
61
62 def DoRecord(name, returnType, argTypeList, argNameList, alias, offset):
63 argList = apiparser.MakeArgList(argTypeList, argNameList)
64 if offset >= 0 and not records.has_key(offset):
65 records[offset] = (name, returnType, argList)
66 #print '#define _gloffset_%s %d' % (name, offset)
67 #endif
68
69
70 def PrintRecords():
71 keys = records.keys()
72 keys.sort()
73 prevk = -1
74 for k in keys:
75 if k != prevk + 1:
76 #print 'Missing offset %d' % (prevk)
77 pass
78 prevk = int(k)
79 (name, returnType, argList) = records[k]
80 print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (returnType, name, argList, k)
81 #endef
82
83
84 PrintHead()
85 apiparser.ProcessSpecFile("APIspec", DoRecord)
86 PrintRecords()
87 PrintTail()
88