Skip to content

Implicit array definition doesn't work right #104

@cf-ispace

Description

@cf-ispace

Describe the bug
The SOIS spec allows for an Entry in an EntryList to have an arbitrary number of ArrayDimension components for inline array definitions. When adding an ArrayDimension component to an Entry, the structure generated by sedstool does not appear as I would expect. The structure created is a typedef of the Entry's type, instead of an array of the type

A similar problem is observed when trying to use a ListEntry field instead of an ArrayDimension component.

Using this Container as a basic example

      <ContainerDataType name="thing" baseType="CFE_HDR/TelemetryHeader">
        <EntryList>
          <Entry type="BASE_TYPES/uint8" name="nested_array">
            <ArrayDimensions>
              <Dimension size="100" indexTypeRef="BASE_TYPES/uint16"/>
            </ArrayDimensions>
          </Entry>
          <Entry type="BASE_TYPES/uint16" name="i1"></Entry>
          <Entry type="BASE_TYPES/uint16" name="i2"></Entry>
        </EntryList>
      </ContainerDataType>

yields the below set of structures (note the first typedef):

/**
 * @brief Implicitly created type based on INTEGER_DATATYPE name=uint8
 */
typedef EdsDataType_BASE_TYPES_uint8_t                     EdsImplicit_ARRAY_MyEDS_thing_nested_array_t;

/**
 * @brief Structure definition for CONTAINER_DATATYPE 'MyEDS/thing'
 *
 * Data definition signature 9127b9d403aec1d8
 */
struct EdsContainer_MyEDS_thing /* checksum=9127b9d403aec1d8 */
{
   EdsDataType_CFE_HDR_TelemetryHeader_t              TelemetryHeader;               /* 96  bits/20  bytes */
   EdsImplicit_ARRAY_MyEDS_thing_nested_array_t         nested_array;                  /* 800 bits/100 bytes */
   EdsDataType_BASE_TYPES_uint16_t                    i1;                            /* 16  bits/2   bytes */
   EdsDataType_BASE_TYPES_uint16_t                    i2;                            /* 16  bits/2   bytes */
};

/**
 *
 */
typedef struct EdsContainer_MyEDS_thing                      EdsDataType_MyEDS_thing_t;
  /* bits= 928  bytes= 124/124   align=0x3  checksum=9127b9d403aec1d8 */

typedef uint8_t                                            EdsPackedBuffer_MyEDS_thing_t[116];

To Reproduce
Steps to reproduce the behavior:

  1. Add the previous ContainerDataType to any EDS XML
  2. Run sedstool to generate the structures

Expected behavior
Generated implicit array structures should appear as follows

/**
 * @brief Implicitly created type based on INTEGER_DATATYPE name=uint8
 */
typedef EdsDataType_BASE_TYPES_uint8_t                     EdsImplicit_ARRAY_MyEDS_thing_nested_array_t[100];

System observed on:

  • OS: Ubuntu 22.04
  • Versions v7.0.0

Additional context
The obvious workaround to this problem is to define an ArrayDataType and use that newly defined object inside the container. However, the SOIS spec specifically makes mention of allowing anonymous subdeclarations here:

3.11 Fields
...

2. The concept of ‘field’ permits the definition of parameter, arguments, or container entries that are a subrange, encoding, or array of the referenced type; this definition of an anonymous type avoids the need to define artificial explicit named types.

Reporter Info
Chris Fallon | ispace-US

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions