diff options
author | Ian Romanick <idr@us.ibm.com> | 2005-04-18 21:30:20 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2005-04-18 21:30:20 +0000 |
commit | d03ab104db0b9ebacb4265787d4c924fc721fcda (patch) | |
tree | bdd98f2f58e089909116579dd2ee164058311984 | |
parent | 93d2d54e7a11cf1a01c976ede37db2320ccc2dff (diff) |
If the file name passed to parse_GL_API is None or "-", read from standard
input. This allows use of GL API scripts in pipelines.
-rw-r--r-- | src/mesa/glapi/gl_XML.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index 64422be913..ac936d1565 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -30,6 +30,7 @@ from xml.sax import make_parser from xml.sax.handler import feature_namespaces import re +import sys def is_attr_true( attrs, name ): """Read a name value from an element's attributes. @@ -55,12 +56,17 @@ def parse_GL_API( handler, file_name ): 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 ) + + if not file_name or file_name == "-": + parser.parse( sys.stdin ) + else: + parser.parse( file_name ) handler.printFooter() return |