mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 16:30:10 +01:00
pan/genxml: Include pan_pack_helpers.h instead of copying it
The generic bits in autogen pack helpers files were extracted in a common header, so let's include it from the autogenerated file rather than copying its content there. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32962>
This commit is contained in:
parent
39461e5818
commit
ab1cd917ad
2 changed files with 16 additions and 10 deletions
|
|
@ -511,8 +511,20 @@ class Value(object):
|
|||
self.name = attrs["name"]
|
||||
self.value = int(attrs["value"], 0)
|
||||
|
||||
pack_header = """/* Autogenerated file, do not edit */
|
||||
/*
|
||||
* Copyright 2024 Collabora Ltd.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef PAN_PACK_H
|
||||
#define PAN_PACK_H
|
||||
|
||||
#include "genxml/pan_pack_helpers.h"
|
||||
"""
|
||||
|
||||
class Parser(object):
|
||||
def __init__(self, pack_header):
|
||||
def __init__(self):
|
||||
self.parser = xml.parsers.expat.ParserCreate()
|
||||
self.parser.StartElementHandler = self.start_element
|
||||
self.parser.EndElementHandler = self.end_element
|
||||
|
|
@ -523,17 +535,13 @@ class Parser(object):
|
|||
self.enums = set()
|
||||
self.aggregate = None
|
||||
self.aggregates = {}
|
||||
self.pack_header = pack_header
|
||||
|
||||
def gen_prefix(self, name):
|
||||
return '{}_{}'.format(global_prefix.upper(), name)
|
||||
|
||||
def start_element(self, name, attrs):
|
||||
if name == "panxml":
|
||||
print('/* Autogenerated file, do not edit */')
|
||||
print(self.pack_header)
|
||||
print('#ifndef PAN_PACK_H')
|
||||
print('#define PAN_PACK_H')
|
||||
print(pack_header)
|
||||
if "arch" in attrs:
|
||||
arch = int(attrs["arch"])
|
||||
if arch <= 6:
|
||||
|
|
@ -704,9 +712,7 @@ class Parser(object):
|
|||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('input_file')
|
||||
parser.add_argument('pack_header')
|
||||
args = parser.parse_args()
|
||||
|
||||
pack_header = open(args.pack_header).read()
|
||||
p = Parser(pack_header)
|
||||
p = Parser()
|
||||
p.parse(args.input_file)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pan_packers = []
|
|||
foreach packer : ['common', 'v4', 'v5', 'v6', 'v7', 'v9', 'v10']
|
||||
pan_packers += custom_target(
|
||||
packer + '_pack.h',
|
||||
input : ['gen_pack.py', packer + '.xml', 'pan_pack_helpers.h'],
|
||||
input : ['gen_pack.py', packer + '.xml'],
|
||||
output : packer + '_pack.h',
|
||||
command : [prog_python, '@INPUT@'],
|
||||
capture : true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue