4 # Helper for the getprocaddress.c test.
7 sys
.path
.append("../../src/mesa/glapi/gen" )
12 def FindTestFunctions():
13 """Scan getprocaddress.c for lines that start with "test_" to find
14 extension function tests. Return a list of names found."""
16 f
= open("getprocaddress.c")
19 for line
in f
.readlines():
20 v
= re
.search("^test_([a-zA-Z0-9]+)", line
)
23 functions
.append(func
)
28 class PrintExports(gl_XML
.gl_print_base
):
30 gl_XML
.gl_print_base
.__init
__(self
)
32 self
.name
= "getprocaddress.py (from Mesa)"
33 self
.license
= license
.bsd_license_template
% ( \
34 """Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
35 (C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
37 self
.tests
= FindTestFunctions()
38 self
.prevCategory
= ""
42 def printRealHeader(self
):
44 struct name_test_pair {
46 GLboolean (*test)(generic_func);
49 static struct name_test_pair functions[] = {"""
51 def printBody(self
, api
):
55 for f
in api
.functionIterateByCategory():
56 [category
, num
] = api
.get_category_for_name( f
.name
)
57 if category
!= prev_category
:
58 print ' { "-%s", NULL},' % category
59 prev_category
= category
62 for name
in f
.entry_points
:
63 if name
in self
.tests
:
64 test
= "test_%s" % name
67 print ' { "gl%s", %s },' % (f
.name
, test
)
70 print ' { NULL, NULL }'
76 if __name__
== '__main__':
77 file_name
= "../../src/mesa/glapi/gen/gl_API.xml"
80 (args
, trail
) = getopt
.getopt(sys
.argv
[1:], "f:")
84 for (arg
,val
) in args
:
88 printer
= PrintExports()
90 api
= gl_XML
.parse_GL_API( file_name
, gl_XML
.gl_item_factory() )