mesa: add KHR_no_error support to glDrawBuffer()
[mesa.git] / src / mapi / glapi / gen / gl_marshal_h.py
1 #!/usr/bin/env python
2
3 # Copyright (C) 2012 Intel Corporation
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
14 # Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 # IN THE SOFTWARE.
23
24 import getopt
25 import gl_XML
26 import license
27 import marshal_XML
28 import sys
29
30
31 header = """
32 #ifndef MARSHAL_GENERATABLE_H
33 #define MARSHAL_GENERATABLE_H
34 """
35
36 footer = """
37 #endif /* MARSHAL_GENERATABLE_H */
38 """
39
40
41 class PrintCode(gl_XML.gl_print_base):
42 def __init__(self):
43 super(PrintCode, self).__init__()
44
45 self.name = 'gl_marshal_h.py'
46 self.license = license.bsd_license_template % (
47 'Copyright (C) 2012 Intel Corporation', 'INTEL CORPORATION')
48
49 def printRealHeader(self):
50 print header
51
52 def printRealFooter(self):
53 print footer
54
55 def printBody(self, api):
56 print 'enum marshal_dispatch_cmd_id'
57 print '{'
58 for func in api.functionIterateAll():
59 flavor = func.marshal_flavor()
60 if flavor in ('skip', 'sync'):
61 continue
62 print ' DISPATCH_CMD_{0},'.format(func.name)
63 print '};'
64
65
66 def show_usage():
67 print 'Usage: %s [-f input_file_name]' % sys.argv[0]
68 sys.exit(1)
69
70
71 if __name__ == '__main__':
72 file_name = 'gl_API.xml'
73
74 try:
75 (args, trail) = getopt.getopt(sys.argv[1:], 'm:f:')
76 except Exception,e:
77 show_usage()
78
79 for (arg,val) in args:
80 if arg == '-f':
81 file_name = val
82
83 printer = PrintCode()
84
85 api = gl_XML.parse_GL_API(file_name, marshal_XML.marshal_item_factory())
86 printer.Print(api)