Implicit array definition doesn't work right
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 43
- Forks
- 19
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 2
Description
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:
- Add the previous
ContainerDataTypeto any EDS XML - 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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by creating the ContainerDataType example from the issue in an EDS XML file and run sedstool on Ubuntu 22.04 or the relevant project setup. Inspect the generated implicit typedef and compare it with the expected array declaration, including the similar ListEntry case. Done means anonymous array entries generate a typedef with the declared array dimensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100