summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/glapi/glX_XML.py4
-rw-r--r--src/mesa/glapi/glX_doc.py15
-rw-r--r--src/mesa/glapi/glX_proto_send.py13
-rw-r--r--src/mesa/glapi/glX_proto_size.py14
-rw-r--r--src/mesa/glapi/gl_SPARC_asm.py14
-rw-r--r--src/mesa/glapi/gl_XML.py18
-rw-r--r--src/mesa/glapi/gl_apitemp.py16
-rw-r--r--src/mesa/glapi/gl_enums.py15
-rw-r--r--src/mesa/glapi/gl_offsets.py15
-rw-r--r--src/mesa/glapi/gl_procs.py17
-rw-r--r--src/mesa/glapi/gl_table.py15
-rw-r--r--src/mesa/glapi/gl_x86_asm.py14
12 files changed, 29 insertions, 141 deletions
diff --git a/src/mesa/glapi/glX_XML.py b/src/mesa/glapi/glX_XML.py
index 81c94a52230..53f89b31bd5 100644
--- a/src/mesa/glapi/glX_XML.py
+++ b/src/mesa/glapi/glX_XML.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import license
import sys, getopt, string
diff --git a/src/mesa/glapi/glX_doc.py b/src/mesa/glapi/glX_doc.py
index ea90d53f714..fa2d812974c 100644
--- a/src/mesa/glapi/glX_doc.py
+++ b/src/mesa/glapi/glX_doc.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import glX_XML
import license
@@ -266,13 +262,4 @@ if __name__ == '__main__':
file_name = val
dh = PrintGlxProtoText()
-
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py
index d78e07ee5e9..1ac46c3b4cd 100644
--- a/src/mesa/glapi/glX_proto_send.py
+++ b/src/mesa/glapi/glX_proto_send.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import glX_XML
import license
@@ -889,13 +885,6 @@ if __name__ == '__main__':
else:
show_usage()
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
dh.debug = debug
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/glX_proto_size.py b/src/mesa/glapi/glX_proto_size.py
index 50495452223..a1c0497ae74 100644
--- a/src/mesa/glapi/glX_proto_size.py
+++ b/src/mesa/glapi/glX_proto_size.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import glX_XML
import license
@@ -533,12 +529,4 @@ if __name__ == '__main__':
else:
show_usage()
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_SPARC_asm.py b/src/mesa/glapi/gl_SPARC_asm.py
index 2623e1beea7..76a545d90c9 100644
--- a/src/mesa/glapi/gl_SPARC_asm.py
+++ b/src/mesa/glapi/gl_SPARC_asm.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import license
import sys, getopt
@@ -123,12 +119,4 @@ if __name__ == '__main__':
print "ERROR: Invalid mode \"%s\" specified." % mode
show_usage()
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py
index 38ccc53465f..64422be913d 100644
--- a/src/mesa/glapi/gl_XML.py
+++ b/src/mesa/glapi/gl_XML.py
@@ -48,6 +48,24 @@ def is_attr_true( attrs, name ):
raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name))
+def parse_GL_API( handler, file_name ):
+ """Boiler-plate code to create an XML parser and use it.
+
+ Creates an XML parser and uses that parser with the application
+ supplied SAX callback, which should be derived from
+ FilterGLAPISpecBase.
+ """
+ parser = make_parser()
+ parser.setFeature(feature_namespaces, 1)
+ parser.setContentHandler( handler )
+
+ handler.printHeader()
+ parser.parse( file_name )
+
+ handler.printFooter()
+ return
+
+
class glItem:
"""Generic class on which all other API entity types are based."""
diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py
index 4c4bcd40ff3..6f30a16d994 100644
--- a/src/mesa/glapi/gl_apitemp.py
+++ b/src/mesa/glapi/gl_apitemp.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import license
import sys, getopt
@@ -216,14 +212,4 @@ if __name__ == '__main__':
file_name = val
dh = PrintGlOffsets()
-
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
-
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py
index 177c95f6edd..615f79729cf 100644
--- a/src/mesa/glapi/gl_enums.py
+++ b/src/mesa/glapi/gl_enums.py
@@ -26,10 +26,6 @@
# Authors:
# Zack Rusin <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import license
import gl_XML
import sys, getopt
@@ -235,13 +231,4 @@ if __name__ == '__main__':
file_name = val
dh = PrintGlEnums()
-
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py
index 95657b80e02..f47eaa26b30 100644
--- a/src/mesa/glapi/gl_offsets.py
+++ b/src/mesa/glapi/gl_offsets.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import license
import sys, getopt
@@ -65,13 +61,4 @@ if __name__ == '__main__':
file_name = val
dh = PrintGlOffsets()
-
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py
index b5d51b0b404..75bb844a335 100644
--- a/src/mesa/glapi/gl_procs.py
+++ b/src/mesa/glapi/gl_procs.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import license
import gl_XML
import sys, getopt
@@ -128,7 +124,7 @@ def show_usage():
if __name__ == '__main__':
file_name = "gl_API.xml"
-
+
try:
(args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
except Exception,e:
@@ -147,13 +143,4 @@ if __name__ == '__main__':
show_usage()
dh = PrintGlProcs( long_string )
-
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py
index 30dcd4149fb..3b8f1ca411a 100644
--- a/src/mesa/glapi/gl_table.py
+++ b/src/mesa/glapi/gl_table.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import license
import sys, getopt
@@ -82,13 +78,4 @@ if __name__ == '__main__':
file_name = val
dh = PrintGlTable()
-
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )
diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py
index 02dafa5c629..85a5c2be050 100644
--- a/src/mesa/glapi/gl_x86_asm.py
+++ b/src/mesa/glapi/gl_x86_asm.py
@@ -25,10 +25,6 @@
# Authors:
# Ian Romanick <[email protected]>
-from xml.sax import saxutils
-from xml.sax import make_parser
-from xml.sax.handler import feature_namespaces
-
import gl_XML
import license
import sys, getopt
@@ -247,12 +243,4 @@ if __name__ == '__main__':
print "ERROR: Invalid mode \"%s\" specified." % mode
show_usage()
- parser = make_parser()
- parser.setFeature(feature_namespaces, 1)
- parser.setContentHandler(dh)
-
- f = open(file_name)
-
- dh.printHeader()
- parser.parse(f)
- dh.printFooter()
+ gl_XML.parse_GL_API( dh, file_name )