3 # $Id: getprocaddress.py,v 1.7 2005/06/21 23:42:43 idr Exp $
5 # Helper for the getprocaddress.c test.
8 sys
.path
.append("../../src/mesa/glapi/" )
13 def FindTestFunctions():
14 """Scan getprocaddress.c for lines that start with "test_" to find
15 extension function tests. Return a list of names found."""
17 f
= open("getprocaddress.c")
20 for line
in f
.readlines():
21 v
= re
.search("^test_([a-zA-Z0-9]+)", line
)
24 functions
.append(func
)
29 class PrintExports(gl_XML
.gl_print_base
):
31 gl_XML
.gl_print_base
.__init
__(self
)
33 self
.name
= "getprocaddress.py (from Mesa)"
34 self
.license
= license
.bsd_license_template
% ( \
35 """Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
36 (C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
38 self
.tests
= FindTestFunctions()
39 self
.prevCategory
= ""
43 def printRealHeader(self
):
45 struct name_test_pair {
47 GLboolean (*test)(generic_func);
50 static struct name_test_pair functions[] = {"""
52 def printBody(self
, api
):
56 for f
in api
.functionIterateByOffset():
57 [category
, num
] = api
.get_category_for_name( f
.name
)
58 if category
!= prev_category
:
59 print ' { "-%s", NULL},' % category
60 prev_category
= category
63 for name
in f
.entry_points
:
64 if name
in self
.tests
:
65 test
= "test_%s" % name
68 print ' { "gl%s", %s },' % (f
.name
, test
)
71 print ' { NULL, NULL }'
77 if __name__
== '__main__':
78 file_name
= "../../src/mesa/glapi/gl_API.xml"
81 (args
, trail
) = getopt
.getopt(sys
.argv
[1:], "f:")
85 for (arg
,val
) in args
:
89 printer
= PrintExports()
91 api
= gl_XML
.parse_GL_API( file_name
, gl_XML
.gl_item_factory() )