From 73f59b01eacf62c2e0ba720d4fbf250773aeabf2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 18 May 2004 18:33:40 +0000 Subject: New scripts for processing the XML version of APIspec. Mail is being sent to mesa3d-dev with a more detailed description. --- src/mesa/glapi/gl_API.xml | 7119 ++++++++++++++++++++++++++++++++++++++++++ src/mesa/glapi/gl_XML.py | 406 +++ src/mesa/glapi/gl_apitemp.py | 238 ++ src/mesa/glapi/gl_offsets.py | 86 + src/mesa/glapi/gl_procs.py | 90 + src/mesa/glapi/gl_table.py | 98 + src/mesa/glapi/gl_x86_asm.py | 138 + src/mesa/glapi/license.py | 47 + 8 files changed, 8222 insertions(+) create mode 100644 src/mesa/glapi/gl_API.xml create mode 100644 src/mesa/glapi/gl_XML.py create mode 100644 src/mesa/glapi/gl_apitemp.py create mode 100644 src/mesa/glapi/gl_offsets.py create mode 100644 src/mesa/glapi/gl_procs.py create mode 100644 src/mesa/glapi/gl_table.py create mode 100644 src/mesa/glapi/gl_x86_asm.py create mode 100644 src/mesa/glapi/license.py (limited to 'src/mesa/glapi') diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml new file mode 100644 index 0000000000..202bbbe48c --- /dev/null +++ b/src/mesa/glapi/gl_API.xml @@ -0,0 +1,7119 @@ + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py new file mode 100644 index 0000000000..17d45beb49 --- /dev/null +++ b/src/mesa/glapi/gl_XML.py @@ -0,0 +1,406 @@ +#!/usr/bin/python2 + +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +from xml.sax import saxutils +from xml.sax import make_parser +from xml.sax.handler import feature_namespaces + +import sys, re + +class glItem: + """Generic class on which all other API entity types are based.""" + + name = "" + category = "" + context = None + tag_name = "" + + def __init__(self, tag_name, name, context): + self.name = name + self.category = context.get_category_define() + self.context = context + self.tag_name = tag_name + + context.append(tag_name, self) + return + + def startElement(self, name, attrs): + return + + def endElement(self, name): + """Generic endElement handler. + + Generic endElement handler. Returns 1 if the tag containing + the object is complete. Otherwise 0 is returned. All + derived class endElement handlers should call this method. If + the name of the ending tag is the same as the tag that + started this object, the object is assumed to be complete. + + This fails if a tag can contain another tag with the same + name. The XML "" would fail. The + object would end before the bar tag was processed.""" + + if name == self.tag_name: + return 1 + else: + return 0 + return + + +class glEnum( glItem ): + def __init__(self, context, name, attrs): + self.value = int(attrs.get('value', "0x0000"), 0) + self.functions = {} + + enum_name = "GL_" + attrs.get('name', None) + glItem.__init__(self, name, enum_name, context) + + def startElement(self, name, attrs): + if name == "size": + name = attrs.get('name', None) + count = int(attrs.get('count', "0"), 0) + self.functions[name] = count + + return + + +class glType( glItem ): + def __init__(self, context, name, attrs): + self.size = int(attrs.get('size', "0")) + + type_name = "GL" + attrs.get('name', None) + glItem.__init__(self, name, type_name, context) + + +class glParameter: + p_type = None + p_type_string = "" + p_name = None + p_count = 0 + p_count_parameters = None + counter = None + is_output = 0 + is_counter = 0 + is_pointer = 0 + + def __init__(self, t, ts, n, c, p, is_output): + self.counter = None + + try: + self.p_count = int(c) + except Exception,e: + self.p_count = 0 + self.counter = c + + if is_output == "true": + self.is_output = 1 + else: + self.is_output = 0 + + if self.p_count > 0 or self.counter != None or p != None : + has_count = 1 + else: + has_count = 0 + + self.p_type = t + self.p_type_string = ts + self.p_name = n + self.p_count_parameters = p + + # If there is a * anywhere in the parameter's type, then it + # is a pointer. + + if re.compile("[*]").search(ts): + # We could do some other validation here. For + # example, an output parameter should not be const, + # but every non-output parameter should. + + self.is_pointer = 1; + else: + # If a parameter is not a pointer, then there cannot + # be an associated count (either fixed size or + # variable) and the parameter cannot be an output. + + if has_count or self.is_output: + raise RuntimeError("Non-pointer type has count or is output.") + self.is_pointer = 0; + + def is_variable_length_array(self): + return self.p_count_parameters != None + + def is_array(self): + return self.is_pointer + + def count_string(self): + """Return a string representing the number of items + + Returns a string representing the number of items in a + parameter. For scalar types this will always be "1". For + vector types, it will depend on whether or not it is a + fixed length vector (like the parameter of glVertex3fv), + a counted length (like the vector parameter of + glDeleteTextures), or a general variable length vector.""" + + if self.is_array(): + if self.is_variable_length_array(): + return "compsize" + elif self.counter != None: + return self.counter + else: + return str(self.p_count) + else: + return "1" + + def size(self): + if self.is_variable_length_array(): + return 0 + elif self.p_count == 0: + return self.p_type.size + else: + return self.p_type.size * self.p_count + +class glParameterIterator: + def __init__(self, data): + self.data = data + self.index = 0 + + def next(self): + if self.index == len( self.data ): + raise StopIteration + i = self.index + self.index += 1 + return self.data[i] + +class glFunction( glItem ): + real_name = "" + fn_alias = None + fn_offset = -1 + fn_return_type = "void" + fn_parameters = [] + + def __init__(self, context, name, attrs): + self.fn_alias = attrs.get('alias', None) + self.fn_parameters = [] + + temp = attrs.get('offset', None) + if temp == None or temp == "?": + self.fn_offset = -1 + else: + self.fn_offset = int(temp) + + fn_name = attrs.get('name', None) + if self.fn_alias != None: + self.real_name = self.fn_alias + else: + self.real_name = fn_name + + glItem.__init__(self, name, fn_name, context) + return + + + def __iter__(self): + return glParameterIterator(self.fn_parameters) + + + def startElement(self, name, attrs): + if name == "param": + p_name = attrs.get('name', None) + p_type = attrs.get('type', None) + p_count = attrs.get('count', "0") + p_param = attrs.get('variable_param', None) + is_output = attrs.get('output', "false") + is_counter = attrs.get('counter', "false") + + t = self.context.find_type(p_type) + if t == None: + raise RuntimeError("Unknown type '%s' in function '%s'." % (p_type, self.name)) + + try: + p = glParameter(t, p_type, p_name, p_count, p_param, is_output) + except RuntimeError: + print "Error with parameter '%s' in function '%s'." \ + % (p_name, self.name) + raise + + if is_counter == "true": p.is_counter = 1 + + self.add_parameter(p) + elif name == "return": + self.set_return_type(attrs.get('type', None)) + + + def add_parameter(self, p): + self.fn_parameters.append(p) + + def set_return_type(self, t): + self.fn_return_type = t + + def get_parameter_string(self): + arg_string = "" + comma = "" + for p in self: + arg_string = arg_string + comma + p.p_type_string + " " + p.p_name + comma = ", " + + if arg_string == "": + arg_string = "void" + + return arg_string + + +class glItemFactory: + """Factory to create objects derived from glItem.""" + + def create(self, context, name, attrs): + if name == "function": + return glFunction(context, name, attrs) + elif name == "type": + return glType(context, name, attrs) + elif name == "enum": + return glEnum(context, name, attrs) + else: + return None + + +class FilterGLAPISpecBase(saxutils.XMLFilterBase): + name = "a" + license = "The license for this file is unspecified." + functions = {} + next_alias = -2 + types = {} + xref = {} + current_object = None + factory = None + current_category = "" + + def __init__(self): + saxutils.XMLFilterBase.__init__(self) + self.functions = {} + self.types = {} + self.xref = {} + self.factory = glItemFactory() + + def find_type(self,type_name): + for t in self.types: + if re.compile(t).search(type_name): + return self.types[t] + print "Unable to find base type matching \"%s\"." % (type_name) + return None + + def find_function(self,function_name): + index = self.xref[function_name] + return self.functions[index] + + def printFunctions(self): + keys = self.functions.keys() + keys.sort() + prevk = -1 + for k in keys: + if k < 0: continue + + if self.functions[k].fn_alias == None: + if k != prevk + 1: + #print 'Missing offset %d' % (prevk) + pass + prevk = int(k) + self.printFunction(self.functions[k]) + + keys.reverse() + for k in keys: + if self.functions[k].fn_alias != None: + self.printFunction(self.functions[k]) + + return + + def printHeader(self): + print '/* DO NOT EDIT - This file generated automatically by %s script */' \ + % (self.name) + print '' + print '/*' + print ' * ' + self.license.replace('\n', '\n * ') + print ' */' + print '' + self.printRealHeader(); + return + + def printFooter(self): + self.printFunctions() + self.printRealFooter() + + + def get_category_define(self): + if re.compile("[1-9][0-9]*[.][0-9]+").match(self.current_category): + s = self.current_category + return "GL_VERSION_" + s.replace(".", "_") + else: + return self.current_category + + + def append(self, object_type, obj): + if object_type == "function": + # If the function is not an alias and has a negative + # offset, then we do not need to track it. These are + # functions that don't have an assigned offset + + if obj.fn_offset >= 0 or obj.fn_alias != None: + if obj.fn_offset >= 0: + index = obj.fn_offset + else: + index = self.next_alias + self.next_alias -= 1 + + self.functions[index] = obj + self.xref[obj.name] = index + elif object_type == "type": + self.types[obj.name] = obj + + return + + + def startElement(self, name, attrs): + if self.current_object != None: + self.current_object.startElement(name, attrs) + elif name == "category": + self.current_category = attrs.get('name', "") + else: + self.current_object = self.factory.create(self, name, attrs) + return + + def endElement(self, name): + if self.current_object != None: + if self.current_object.endElement(name): + self.current_object = None + return + + def printFunction(self,offset): + return + + def printRealHeader(self): + return + + def printRealFooter(self): + return diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py new file mode 100644 index 0000000000..59655a2179 --- /dev/null +++ b/src/mesa/glapi/gl_apitemp.py @@ -0,0 +1,238 @@ +#!/usr/bin/python2 + +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +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 + +class PrintGlOffsets(gl_XML.FilterGLAPISpecBase): + name = "gl_apitemp.py (from Mesa)" + + def __init__(self): + gl_XML.FilterGLAPISpecBase.__init__(self) + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + + def printFunction(self, f): + p_string = "" + o_string = "" + t_string = "" + comma = "" + + for p in f: + cast = "" + + if p.is_pointer: + t = "%p" + cast = "(const void *) " + elif p.p_type_string == 'GLenum': + t = "0x%x" + elif p.p_type_string in ['GLfloat', 'GLdouble', 'GLclampf', 'GLclampd']: + t = "%f" + else: + t = "%d" + + t_string = t_string + comma + t + p_string = p_string + comma + p.p_name + o_string = o_string + comma + cast + p.p_name + comma = ", " + + + if f.fn_return_type != 'void': + dispatch = "RETURN_DISPATCH" + else: + dispatch = "DISPATCH" + + print 'KEYWORD1 %s KEYWORD2 NAME(%s)(%s)' \ + % (f.fn_return_type, f.name, f.get_parameter_string()) + print '{' + if p_string == "": + print ' %s(%s, (), (F, "gl%s();\\n"));' \ + % (dispatch, f.real_name, f.name) + else: + print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \ + % (dispatch, f.real_name, p_string, f.name, t_string, o_string) + print '}' + print '' + return + + def printRealHeader(self): + print """ +/* + * This file is a template which generates the OpenGL API entry point + * functions. It should be included by a .c file which first defines + * the following macros: + * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32 + * KEYWORD2 - usually nothing, but might be __stdcall on Win32 + * NAME(n) - builds the final function name (usually add "gl" prefix) + * DISPATCH(func, args, msg) - code to do dispatch of named function. + * msg is a printf-style debug message. + * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value + * + * Here is an example which generates the usual OpenGL functions: + * #define KEYWORD1 + * #define KEYWORD2 + * #define NAME(func) gl##func + * #define DISPATCH(func, args, msg) \\ + * struct _glapi_table *dispatch = CurrentDispatch; \\ + * (*dispatch->func) args + * #define RETURN DISPATCH(func, args, msg) \\ + * struct _glapi_table *dispatch = CurrentDispatch; \\ + * return (*dispatch->func) args + * + */ + + +#ifndef KEYWORD1 +#define KEYWORD1 +#endif + +#ifndef KEYWORD2 +#define KEYWORD2 +#endif + +#ifndef NAME +#error NAME must be defined +#endif + +#ifndef DISPATCH +#error DISPATCH must be defined +#endif + +#ifndef RETURN_DISPATCH +#error RETURN_DISPATCH must be defined +#endif + +GLAPI void GLAPIENTRY gl__unused413(void); /* silence warning */ +""" + return + + + + def printInitDispatch(self): + print """ + +/* + * This is how a dispatch table can be initialized with all the functions + * we generated above. + */ +#ifdef DISPATCH_TABLE_NAME + +#ifndef TABLE_ENTRY +#error TABLE_ENTRY must be defined +#endif + +static void * DISPATCH_TABLE_NAME[] = {""" + keys = self.functions.keys() + keys.sort() + for k in keys: + if k < 0: continue + + print ' TABLE_ENTRY(%s),' % (self.functions[k].name) + + print ' /* A whole bunch of no-op functions. These might be called' + print ' * when someone tries to call a dynamically-registered' + print ' * extension function without a current rendering context.' + print ' */' + for i in range(1, 100): + print ' TABLE_ENTRY(Unused),' + + print '};' + print '#endif /* DISPATCH_TABLE_NAME */' + print '' + return + + def printAliasedTable(self): + print """ +/* + * This is just used to silence compiler warnings. + * We list the functions which are not otherwise used. + */ +#ifdef UNUSED_TABLE_NAME +static const void * const UNUSED_TABLE_NAME[] = {""" + + keys = self.functions.keys() + keys.sort() + keys.reverse(); + for k in keys: + f = self.functions[k] + if f.fn_offset < 0: + print ' TABLE_ENTRY(%s),' % (f.name) + + print '};' + print '#endif /*UNUSED_TABLE_NAME*/' + print '' + return + + def printRealFooter(self): + self.printInitDispatch() + self.printAliasedTable() + print""" +#undef KEYWORD1 +#undef KEYWORD2 +#undef NAME +#undef DISPATCH +#undef RETURN_DISPATCH +#undef DISPATCH_TABLE_NAME +#undef UNUSED_TABLE_NAME +#undef TABLE_ENTRY +""" + return + +def show_usage(): + print "Usage: %s [-f input_file_name]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == "-f": + file_name = val + + dh = PrintGlOffsets() + + parser = make_parser() + parser.setFeature(feature_namespaces, 0) + parser.setContentHandler(dh) + + f = open(file_name) + + dh.printHeader() + parser.parse(f) + dh.printFooter() + diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py new file mode 100644 index 0000000000..3ff27e7d2a --- /dev/null +++ b/src/mesa/glapi/gl_offsets.py @@ -0,0 +1,86 @@ +#!/usr/bin/python2 + +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +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 + +class PrintGlOffsets(gl_XML.FilterGLAPISpecBase): + name = "gl_offsets.py (from Mesa)" + + def __init__(self): + gl_XML.FilterGLAPISpecBase.__init__(self) + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + + def printFunction(self, f): + if f.fn_offset < 0: return + print '#define _gloffset_%s %d' % (f.name, f.fn_offset) + + def printRealHeader(self): + print '#ifndef _GLAPI_OFFSETS_H_' + print '#define _GLAPI_OFFSETS_H_' + print '' + return + + def printRealFooter(self): + print '' + print '#endif' + return + +def show_usage(): + print "Usage: %s [-f input_file_name]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == "-f": + file_name = val + + dh = PrintGlOffsets() + + parser = make_parser() + parser.setFeature(feature_namespaces, 0) + parser.setContentHandler(dh) + + f = open(file_name) + + dh.printHeader() + parser.parse(f) + dh.printFooter() diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py new file mode 100644 index 0000000000..6ea53d100b --- /dev/null +++ b/src/mesa/glapi/gl_procs.py @@ -0,0 +1,90 @@ +#!/usr/bin/python2 + +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +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 + +class PrintGlProcs(gl_XML.FilterGLAPISpecBase): + name = "gl_procs.py (from Mesa)" + + def __init__(self): + gl_XML.FilterGLAPISpecBase.__init__(self) + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + + def printRealHeader(self): + print '' + print '/* This file is only included by glapi.c and is used for' + print ' * the GetProcAddress() function' + print ' */' + print '' + print 'static const struct name_address_offset static_functions[] = {' + return + + def printRealFooter(self): + print ' { NULL, NULL, 0 } /* end of list marker */' + print '};' + return + + def printFunction(self, f): + print ' { "gl%s", (GLvoid *) gl%s, _gloffset_%s },' \ + % (f.name, f.name, f.real_name) + + +def show_usage(): + print "Usage: %s [-f input_file_name]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == "-f": + file_name = val + + dh = PrintGlProcs() + + parser = make_parser() + parser.setFeature(feature_namespaces, 0) + parser.setContentHandler(dh) + + f = open(file_name) + + dh.printHeader() + parser.parse(f) + dh.printFooter() diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py new file mode 100644 index 0000000000..d59d3de42a --- /dev/null +++ b/src/mesa/glapi/gl_table.py @@ -0,0 +1,98 @@ +#!/usr/bin/python2 + +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +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 + +class PrintGlTable(gl_XML.FilterGLAPISpecBase): + file_name = "gl_gen_table.xml (from Mesa)" + + def __init__(self): + gl_XML.FilterGLAPISpecBase.__init__(self) + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + + + def printFunction(self, f): + if f.fn_offset < 0: return + + arg_string = f.get_parameter_string() + print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % \ + (f.fn_return_type, f.name, arg_string, f.fn_offset) + + def printRealHeader(self): + print '#ifndef _GLAPI_TABLE_H_' + print '#define _GLAPI_TABLE_H_' + print '' + print '#ifndef GLAPIENTRYP' + print '#define GLAPIENTRYP' + print '#endif' + print '' + print 'struct _glapi_table' + print '{' + return + + def printRealFooter(self): + print '};' + print '' + print '#endif' + return + + +def show_usage(): + print "Usage: %s [-f input_file_name]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == "-f": + file_name = val + + dh = PrintGlTable() + + parser = make_parser() + parser.setFeature(feature_namespaces, 0) + parser.setContentHandler(dh) + + f = open(file_name) + + dh.printHeader() + parser.parse(f) + dh.printFooter() diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py new file mode 100644 index 0000000000..a0147b22b9 --- /dev/null +++ b/src/mesa/glapi/gl_x86_asm.py @@ -0,0 +1,138 @@ +#!/usr/bin/python2 + +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +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 + +class PrintGenericStubs(gl_XML.FilterGLAPISpecBase): + name = "gl_x86_asm.py (from Mesa)" + + def __init__(self): + gl_XML.FilterGLAPISpecBase.__init__(self) + self.license = license.bsd_license_template % ( \ +"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. +(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + + + def get_stack_size(self, f): + size = 0 + for p in f: + t = p.p_type + + if p.is_array() or t.size != 8: + size += 4 + else: + size += 8 + + return size + + def printRealHeader(self): + print '#include "assyntax.h"' + print '#include "glapioffsets.h"' + print '' + print '#ifndef __WIN32__' + print '' + print '#if defined(STDCALL_API)' + print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))' + print '#elif defined(USE_MGL_NAMESPACE)' + print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))' + print '#else' + print '#define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))' + print '#endif' + print '' + print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))' + print '' + print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)' + print '#define GLOBL_FN(x) GLOBL x ; .type x,@function' + print '#else' + print '#define GLOBL_FN(x) GLOBL x' + print '#endif' + print '' + print '#define GL_STUB(fn,off,stack)\t\t\t\t\\' + print 'ALIGNTEXT16;\t\t\t\t\t\t\\' + print 'GLOBL_FN(GL_PREFIX(fn, fn ## @ ## stack));\t\t\\' + print 'GL_PREFIX(fn, fn ## @ ## stack):\t\t\t\\' + print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\' + print '\tJMP(GL_OFFSET(off))' + print '' + print 'SEG_TEXT' + print 'EXTERN GLNAME(_glapi_Dispatch)' + print '' + return + + def printRealFooter(self): + print '' + print '#endif /* __WIN32__ */' + return + + def printFunction(self, f): + if f.fn_offset == -1: return + + stack = self.get_stack_size(f) + + print '\tGL_STUB(%s, _gloffset_%s, %u)' % (f.name, f.real_name, stack) + return + +def show_usage(): + print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + mode = "generic" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "m:f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == '-m': + mode = val + elif arg == "-f": + file_name = val + + if mode == "generic": + dh = PrintGenericStubs() + else: + print "ERROR: Invalid mode \"%s\" specified." % mode + show_usage() + + parser = make_parser() + parser.setFeature(feature_namespaces, 0) + parser.setContentHandler(dh) + + f = open(file_name) + + dh.printHeader() + parser.parse(f) + dh.printFooter() diff --git a/src/mesa/glapi/license.py b/src/mesa/glapi/license.py new file mode 100644 index 0000000000..02181648e4 --- /dev/null +++ b/src/mesa/glapi/license.py @@ -0,0 +1,47 @@ +# (C) Copyright IBM Corporation 2004 +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# Authors: +# Ian Romanick + +bsd_license_template = """%s +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sub license, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +%s, +AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.""" -- cgit v1.2.3