3 # $Id: getprocaddress.py,v 1.3 2003/06/10 14:54:37 brianp Exp $
5 # Helper for the getprocaddress.c test.
13 struct name_test_pair {
15 GLboolean (*test)(void *);
18 static struct name_test_pair functions[] = {"""
28 def HaveTest(function
):
33 if function
in testFuncs
:
39 def FindTestFunctions():
40 """Scan getprocaddress.c for lines that start with "test_" to find
41 extension function tests. Return a list of names found."""
43 f
= open("getprocaddress.c")
46 for line
in f
.readlines():
47 v
= re
.search("^test_([a-zA-Z0-9]+)", line
)
50 functions
.append(func
)
55 def PrintFunctions(specFile
, tests
):
62 for line
in f
.readlines():
64 # split line into tokens
65 tokens
= string
.split(line
)
67 if len(tokens
) > 0 and line
[0] != '#':
69 if tokens
[0] == 'name':
71 if category
!= prevCategory
:
72 print ' { "-%s", NULL},' % category
73 prevCategory
= category
76 test
= "test_%s" % funcName
79 print ' { "gl%s", %s },' % (funcName
, test
)
82 elif tokens
[0] == 'category':
91 tests
= FindTestFunctions()
93 PrintFunctions("../../src/mesa/glapi/APIspec", tests
)