Add header schema

This commit is contained in:
Thomas Krijnen
2025-02-25 21:30:20 +01:00
parent a420c4b707
commit 1d9dcb3ab7
2 changed files with 30 additions and 3 deletions
@@ -0,0 +1,28 @@
SCHEMA header_section_schema;
TYPE time_stamp_text = STRING(256);
END_TYPE;
TYPE schema_name = STRING(1024);
END_TYPE;
ENTITY file_name;
name : STRING (256);
time_stamp : time_stamp_text;
author : LIST [1:?] OF STRING (256);
organization : LIST [1:?] OF STRING (256);
preprocessor_version : STRING (256);
originating_system : STRING (256);
authorisation : STRING (256);
END_ENTITY;
ENTITY file_description;
description : LIST [1:?] OF STRING (256);
implementation_level : STRING (256);
END_ENTITY;
ENTITY file_schema;
schema_identifiers : LIST [1:?] OF UNIQUE schema_name;
END_ENTITY;
END_SCHEMA;
@@ -384,9 +384,8 @@ class SchemaClass(codegen.Base):
else:
match = re.search(r'\((\w+?_[\w+]+?_\w+?)\)', declared_type)
if match:
old_decl = match.group(1)
tn = old_decl.rsplit('_', 2)[1]
idx = x.names.index(tn)
old_decl = match.group(1).lower().replace(schema_name.lower() + '_', '').replace('_type', '')
idx = [n.lower() for n in x.names].index(old_decl)
snu = schema_name.upper()
declared_type = declared_type.replace(old_decl, '%(snu)s_types[%(idx)d]' % locals())
return declared_type