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  
  • long
  • long int
xsd:int  
  • unsigned long
  • unsigned long int
xsd:unsignedInt  
  • long long
  • long long int
xsd:long  
  • unsigned long long
  • unsigned long long int
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

  • long
  • long int
Length = 4 (see note 2)

Length Units = bytes

  • unsigned long
  • unsigned long int
Length = 4 (see note 2)

Length Units = bytes

  • long long
  • long long int
Length = 8

Length Units = bytes

  • unsigned long long
  • unsigned long long int
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)
Notes:
  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.
  2. 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.
  3. Element names that clash with Java™ language keywords are modified by prefixing them with a single underscore character.
  4. The _Packed keyword is not supported. Only ANSI C declarations are supported.
  5. The 128 bit ( 16 byte) long integer is not supported.
  6. C++ object-oriented extensions are not supported. Only ANSI C declarations are supported.
  7. 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.