Test calling glTexSubImage2D mid-way through a frame.
[mesa.git] / progs / tests / getprocaddress.py
1 #!/usr/bin/env python
2
3 # $Id: getprocaddress.py,v 1.7 2005/06/21 23:42:43 idr Exp $
4
5 # Helper for the getprocaddress.c test.
6
7 import sys, getopt, re
8 sys.path.append("../../src/mesa/glapi/" )
9 import gl_XML
10 import license
11
12
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."""
16 functions = []
17 f = open("getprocaddress.c")
18 if not f:
19 return functions
20 for line in f.readlines():
21 v = re.search("^test_([a-zA-Z0-9]+)", line)
22 if v:
23 func = v.group(1)
24 functions.append(func)
25 f.close
26 return functions
27
28
29 class PrintExports(gl_XML.gl_print_base):
30 def __init__(self):
31 gl_XML.gl_print_base.__init__(self)
32
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")
37
38 self.tests = FindTestFunctions()
39 self.prevCategory = ""
40 return
41
42
43 def printRealHeader(self):
44 print """
45 struct name_test_pair {
46 const char *name;
47 GLboolean (*test)(generic_func);
48 };
49
50 static struct name_test_pair functions[] = {"""
51
52 def printBody(self, api):
53 prev_category = None
54
55
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
61
62 test = "NULL"
63 for name in f.entry_points:
64 if name in self.tests:
65 test = "test_%s" % name
66 break
67
68 print ' { "gl%s", %s },' % (f.name, test)
69
70 print ''
71 print ' { NULL, NULL }'
72 print '};'
73 print ''
74 return
75
76
77 if __name__ == '__main__':
78 file_name = "../../src/mesa/glapi/gl_API.xml"
79
80 try:
81 (args, trail) = getopt.getopt(sys.argv[1:], "f:")
82 except Exception,e:
83 show_usage()
84
85 for (arg,val) in args:
86 if arg == "-f":
87 file_name = val
88
89 printer = PrintExports()
90
91 api = gl_XML.parse_GL_API( file_name, gl_XML.gl_item_factory() )
92
93 printer.Print( api )