STRUCT
Added in version 2.24
Instantiate a struct. The struct being instantiated must currently be included within a STRUCT_BEGIN / STRUCT_END block.
[STRUCT,name]
As of ginmake 2.24, simple struct typedefs are parsed.
As of ginmake 2.41, if the name ends with a ‘#’ character, it shall synthesize names in the format ’name #NNn member’, instead of using array syntax ’name[N].member’. If the name ends with ‘#.’, then the format will be dotted, e.g. ’name_#NNn.member’.
As of ginmake 2.45, struct identifier numbering syntax was extended to allow starting at indices other than 0 by specifying a number before the #.
e.g.
[STRUCT,MyStruct1#] will start numbering at 1
[STRUCT,MyStruct2#] will start numbering at 2.
Currently, it is necessary to use the typedef name of the struct as the data type in other structures – the ginmake C parser is currently quite limited.
Structs that you intend to instantiate through the STRUCT directive should not have their definition within a SEGMENT_BEGIN / SEGMENT_END section.
Structs can contain members that do not have ginmake comments. These are not accessible via the GIN file but their size and alignment will be taken into account when computing the structure size and alignment. Alignment can be controlled with PACK_PUSH / PACK_POP.
The ’name’ field is used as a prefix for the names within the struct. The struct member names are appended to the prefix and separated by a dot character.
Arrays are also supported. The array will be un-rolled and the names will include the array index, starting at zero.
typedef struct CAL_track_struct
{
1int32_t lon; // [Longitude,(GPS Coord Units),,,o,-,f,,]
2int32_t lat; // [Latitude,(GPS Coord Units),,,o,-,f,,]
3uint16_t course; // [Course,(GPS Course Units),,,o,,f,,]
4uint16_t width; // [Width,(Track Width Units),,,o,,f,,][DESCRIPTION,If this value is zero then the track entry is disabled.]
5} CAL_track;
6typedef struct CAL_data_nvm_struct{
1// [SEGMENT_BEGIN,CAL_SEG_NVM]
2CAL_track tracks[CAL_TRACK_COUNT]; // [STRUCT,Track][ATTRIBUTES,gps_start_line]
3// crcloc must be at the end!
4uint16_t crcloc; // specially handled by ginmake - region checksum
5// [SEGMENT_END,CAL_SEG_NVM]
6} CAL_data_nvm;This would produce items in the calibration along the following lines:
Track[0].Longitude Track[0].Latitude Track[0].Course Track[0].Width
Track[1].Longitude Track[1].Latitude Track[1].Course Track[1].Width
Track[2].Longitude Track[2].Latitude Track[2].Course Track[2].Width …