From 3b0c0e7b3abd798558b118d38566e74951e90ce0 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Mon, 2 Mar 2026 08:36:44 -0600 Subject: [PATCH 1/2] add codegen support for `static-wstring` required for DF 53.11 support note that at least type identity support for this type also needs to be added to DF (although it could simply be as an opaque type) --- Common.pm | 3 ++- SYNTAX.rst | 1 + StructFields.pm | 7 +++++++ changelog.txt | 1 + data-definition.xsd | 9 +++++++++ lower-1.xslt | 5 +++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Common.pm b/Common.pm index 3e11badbf5..c7fbccec00 100644 --- a/Common.pm +++ b/Common.pm @@ -177,13 +177,14 @@ my @primitive_type_list = size_t ssize_t s-float d-float bool flag-bit - padding static-string); + padding static-string static-wstring); my %primitive_aliases = ( 'ulong' => 'unsigned long', 's-float' => 'float', 'd-float' => 'double', 'static-string' => 'char', + 'static-wstring' => 'wchar_t', 'flag-bit' => 'void', 'padding' => 'void', ); diff --git a/SYNTAX.rst b/SYNTAX.rst index e415dbf1dc..f9b0c676ec 100644 --- a/SYNTAX.rst +++ b/SYNTAX.rst @@ -234,6 +234,7 @@ Primitive fields can be classified as following: 4) String:: + diff --git a/StructFields.pm b/StructFields.pm index 401da82591..e08c96c1a2 100644 --- a/StructFields.pm +++ b/StructFields.pm @@ -294,6 +294,10 @@ sub get_struct_field_type($;%) { my $count = $tag->getAttribute('size') || 0; $prefix = "char"; $suffix = "[$count]"; + } elsif ($subtype eq 'static-wstring') { + my $count = $tag->getAttribute('size') || 0; + $prefix = "wchar_t"; + $suffix = "[$count]"; } elsif ($subtype eq 'padding') { my $count = $tag->getAttribute('size') || 0; my $alignment = $tag->getAttribute('alignment') || 1; @@ -572,6 +576,9 @@ sub render_field_metadata_rec($$) { if ($subtype eq 'static-string') { my $count = $field->getAttribute('size') || 0; push @field_defs, [ "${FLD}(STATIC_STRING, $name)", 'NULL', $count, $extra ]; + } elsif ($subtype eq 'static-wstring') { + my $count = $field->getAttribute('size') || 0; + push @field_defs, [ "${FLD}(STATIC_WSTRING, $name)", 'NULL', $count, $extra ]; } } elsif ($meta eq 'global' || $meta eq 'compound') { if (is_attr_true($field, 'ld:enum-size-forced')) { diff --git a/changelog.txt b/changelog.txt index e3662129e3..5bcc756a5b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -19,6 +19,7 @@ Template for new versions: # Future ## Structures +- added codegen support for ``static-wstring`` (``wchar_t *``), required to support DF 53.11 # 53.10-r2 diff --git a/data-definition.xsd b/data-definition.xsd index a40aaaa8f6..ff3cb4d171 100644 --- a/data-definition.xsd +++ b/data-definition.xsd @@ -239,6 +239,7 @@ + @@ -555,6 +556,14 @@ + + + + + + + + diff --git a/lower-1.xslt b/lower-1.xslt index 101a8b03ad..acec602250 100644 --- a/lower-1.xslt +++ b/lower-1.xslt @@ -207,12 +207,17 @@ Error: field corresponds to an enum value of + + + + + From 94dc5f2c14361583c1bf5c621c8ee3a3418cafc7 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Mon, 2 Mar 2026 18:24:18 -0600 Subject: [PATCH 2/2] change wstring to `PRIMITIVE` for now at least. we probably do not want to have "magic string" handling for wide strings, and will almost certainly initially just treat them as opaque objects --- StructFields.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StructFields.pm b/StructFields.pm index e08c96c1a2..519e77be90 100644 --- a/StructFields.pm +++ b/StructFields.pm @@ -578,7 +578,7 @@ sub render_field_metadata_rec($$) { push @field_defs, [ "${FLD}(STATIC_STRING, $name)", 'NULL', $count, $extra ]; } elsif ($subtype eq 'static-wstring') { my $count = $field->getAttribute('size') || 0; - push @field_defs, [ "${FLD}(STATIC_WSTRING, $name)", 'NULL', $count, $extra ]; + push @field_defs, [ "${FLD}(PRIMITIVE, $name)", 'NULL', $count, $extra ]; } } elsif ($meta eq 'global' || $meta eq 'compound') { if (is_attr_true($field, 'ld:enum-size-forced')) {