Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down
1 change: 1 addition & 0 deletions SYNTAX.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Primitive fields can be classified as following:
4) String::

<static-string name='id' size='bytes'.../>
<static-wstring name='id' size='words'.../>
<ptr-string name='id'.../>
<stl-string name='id'.../>

Expand Down
7 changes: 7 additions & 0 deletions StructFields.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}(PRIMITIVE, $name)", 'NULL', $count, $extra ];
}
} elsif ($meta eq 'global' || $meta eq 'compound') {
if (is_attr_true($field, 'ld:enum-size-forced')) {
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions data-definition.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
<xs:element name="pointer" type="PointerField" />
<xs:element name="ptr-string" type="PtrStringField" />
<xs:element name="static-string" type="StaticStringField" />
<xs:element name="static-wstring" type="StaticWStringField" />
<xs:element name="padding" type="PaddingField" />
</xs:choice>
</xs:group>
Expand Down Expand Up @@ -555,6 +556,14 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StaticWStringField">
<xs:complexContent>
<xs:extension base="SimpleFieldType">
<xs:attribute name="size" type="xs:positiveInteger" use="required">
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PaddingField">
<xs:complexContent>
<xs:extension base="SimpleFieldType">
Expand Down
5 changes: 5 additions & 0 deletions lower-1.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ Error: field <xsl:value-of select='$enum-key'/> corresponds to an enum value of

<prim-type ld:meta='bytes' ld:subtype='padding'/>
<prim-type ld:meta='bytes' ld:subtype='static-string'/>
<prim-type ld:meta='bytes' ld:subtype='static-wstring'/>

<prim-type ld:meta='pointer' ld:subtype='pointer'/>
<prim-type ld:meta='pointer' ld:subtype='ptr-string' ld:is-container='true'>
<static-string/>
</prim-type>

<prim-type ld:meta='pointer' ld:subtype='ptr-wstring' ld:is-container='true'>
<static-wstring/>
</prim-type>

<prim-type ld:meta='primitive' ld:subtype='stl-string'/>
<prim-type ld:meta='primitive' ld:subtype='stl-fstream'/>
<prim-type ld:meta='primitive' ld:subtype='stl-mutex'/>
Expand Down