parse_GL_API, in gl_XML.py.
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
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."""
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
# Authors:
# Zack Rusin <zack@kde.org>
-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
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
if __name__ == '__main__':
file_name = "gl_API.xml"
-
+
try:
(args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
except Exception,e:
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )
# Authors:
# Ian Romanick <idr@us.ibm.com>
-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
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 )