Importing from C (DFDL): supported features
The C importer uses default values when mapping C data types to message model elements.
The following table shows how the C definitions influence the XML schema settings in the message model. Some xsd types are enclosed in angle brackets (< >). The brackets indicate an anonymous simple type based on this type. For strings, the purpose of the anonymous type is to add a maximum length restriction. For numeric types, the purpose of the anonymous type is to add either a minimum or a maximum value restriction.
C data type | XML Schema type | Notes |
---|---|---|
char | <xsd:string> | maxlength=1 |
char[10] | <xsd:string> | maxlength=10 |
char[10][3] | <xsd:string> | maxlength=3
maxOccurs=10 |
char[10][3][6] | <xsd:string> | maxlength=6
maxOccurs=30 |
unsigned char | xsd:unsignedByte | |
unsigned char[2] | xsd:unsignedByte | maxOccurs=2 |
signed char | xsd:byte | |
signed char[2] | xsd:byte | maxOccurs=2 |
int | xsd:int | |
int[2] | xsd:int | maxOccurs=2 |
int[2][3] | xsd:int | maxOccurs=6 |
unsigned int | xsd:unsignedInt | |
short | xsd:short | |
unsigned short | xsd:unsignedShort | |
|
xsd:int | |
|
xsd:unsignedInt | |
|
xsd:long | |
|
xsd:unsignedLong | |
float | xsd:float | |
double | xsd:double | |
long double | xsd:double | |
<any pointer type> | xsd:hexBinary | |
<any enum> | (see note 1) |
The following table shows how C definitions influence the DFDL properties of the elements that are generated in the message model.
C data type | DFDL properties |
---|---|
char | Length = 1 Length Units = bytes |
char[10] | Length = 10 Length Units = bytes String Justification = left |
char[10][3] | Length = 3 (and Max Occurs = 10) Length Units = bytes String Justification = left |
char[10][3][6] | Length =6 (and Max Occurs = 30) Length Units = bytes String Justification = left |
unsigned char | Length = 1 Length Units = bytes |
unsigned char[2] | Length = 1 (and Max Occurs = 2) Length Units = bytes |
signed char | Length = 1 Length Units = bytes |
signed char[2] | Length = 1 (and Max Occurs = 2) Length Units = bytes |
int | Length = 4 Length Units = bytes |
int[2] | Length = 4 (and Max Occurs = 2) Length Units = bytes |
int[2][3] | Length = 4 (and Max Occurs = 6) Length Units = bytes |
unsigned int | Length = 4 Length Units = bytes |
short | Length = 2 Length Units = bytes |
unsigned short | Length = 2 Length Units = bytes |
|
Length = 4 (see note 2) Length Units = bytes |
|
Length = 4 (see note 2) Length Units = bytes |
|
Length = 8 Length Units = bytes |
|
Length=8 Length Units = bytes |
float | Length = 4 Length Units = bytes |
double | Length = 8 Length Units = bytes |
long double | Length = 8 Length Units = bytes |
<any pointer type> | Length = 4 Length Units = bytes |
<any enum> | (see note 1) |
- The type and length of an enum is affected by the Size of enum C
importer option:
- For 1: Logical type = xsd:byte, dfdl:length = 1 byte.
- For 2: Logical type = xsd:short, dfdl:length = 2 bytes.
- For 4: Logical type = xsd:int, dfdl:length = 4 bytes.
- For Compact: The smallest representation is chosen that the enumeration fits into.
- The length of pointer is affected by the Address Size C options:
- For 32 bit: dfdl:length = 4 bytes.
- For 64 bit: dfdl:length = 8 bytes.
- Element names that clash with Java™ language keywords are modified by prefixing them with a single underscore character.
- The _Packed keyword is not supported. Only ANSI C declarations are supported.
- The 128 bit ( 16 byte) long integer is not supported.
- C++ object-oriented extensions are not supported. Only ANSI C declarations are supported.
- Recursive C structures are not supported. If a nested structure contains a structure with the same name as the parent structure, the import succeeds, but the logical definitions are not correct. To avoid this problem, ensure that the nested structure and the outer or parent structure have different names.