glapi: move reusable glapi printing code to apiexec.py
This will be used by all new scripts. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>
This commit is contained in:
parent
ac622b8536
commit
d7c5161242
|
@ -206,23 +206,5 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
print(' }')
|
||||
|
||||
|
||||
def _parser():
|
||||
"""Parse arguments and return namespace."""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-f',
|
||||
dest='filename',
|
||||
default='gl_and_es_API.xml',
|
||||
help='an xml file describing an API')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
"""Main function."""
|
||||
args = _parser()
|
||||
printer = PrintCode()
|
||||
api = gl_XML.parse_GL_API(args.filename)
|
||||
printer.Print(api)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
apiexec.print_glapi_file(PrintCode())
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
import argparse
|
||||
import gl_XML
|
||||
|
||||
class exec_info():
|
||||
"""Information relating GL APIs to a function.
|
||||
|
||||
|
@ -345,3 +348,13 @@ def get_api_condition(f):
|
|||
# This function does not exist in any API.
|
||||
return None
|
||||
return ' || '.join(condition_parts)
|
||||
|
||||
def print_glapi_file(printer):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-f',
|
||||
dest='filename',
|
||||
default='gl_and_es_API.xml',
|
||||
help='an xml file describing an API')
|
||||
args = parser.parse_args()
|
||||
api = gl_XML.parse_GL_API(args.filename)
|
||||
printer.Print(api)
|
||||
|
|
Loading…
Reference in New Issue