Syntax
Ginmake parses input source code files and extracts information from comments that are associated with objects in the source code. The syntax of these comments is described in this section.
Ginmake parses input source code files and extracts information from comments that are associated with objects in the source code. The syntax of these comments is described in this section.
Definitions can occur in any kind of source code comment, depending upon the source type.
Note that comments are ignored in sections that have been excluded by conditional compilation (see “The Pre-processor” section).
For ASM, comments extend from the first ; character seen on a line to the end of the line.
If the source being compiled is ‘C’ source, then comments can either be traditional multi-line/in-line C style comments /* .. */.
C++ style comments are also supported, which behave in the same way as ASM comments except that the comment begins with the sequence //.
Multiple definitions may be provided for the same address in the ECU. This allows both aliasing of names and it also means that different GIN objects can be set up to control individual bits of an ECU object.
Comments are scanned for definitions that are flanked by square brackets and may contain a comma separated list:
For some definitions, the comma count dictates the information type:
| Type | Number of Commas |
|---|---|
| Options | 8 |
| Channels | 9 |
| Tables | 13 |
| Maps | 18 |
All other definitions have a tag for their first field and can have an arbitrary number of commas:
1// [USERSCALAR,Load Units,kPa,y,,,]
Expressions can be used in data definitions and in source code (e.g. as an array index). Expressions can be contained within pre-processor symbols. e.g.
Within source code, all expressions are considered to be integer expressions. In numerical fields of data definitions, expressions are either integer or floating-point, depending upon the type of the field. For example, the Scalar field of a parameter is integer unless a ‘*’ character is used to indicate that it is floating-point.
Integer expressions can contain the following operators:
In both C and ASM code, ordered by precedence:
| Operator | Description | Associativity |
|---|---|---|
| () | Parentheses (grouping) | left-to-right |
| + - ! ~ | Unary plus/minus Unary logical negation/bitwise complement | right-to-left |
| * / % | Multiplication/division/modulus | left-to-right |
| + - | Addition/subtraction | left-to-right |
| « » | Bitwise shift left, Bitwise shift right | left-to-right |
| < <= > >= | Relational less than/less than or equal to Relational greater than/greater than or equal to | left-to-right |
| == != | Relational is equal to/is not equal to | left-to-right |
| & | Bitwise AND | left-to-right |
| ^ | Bitwise exclusive OR | left-to-right |
| | | Bitwise inclusive OR | left-to-right |
| && | Logical AND | left-to-right |
| || | Logical OR | left-to-right |
In ASM code, the following symbols are predefined by default:
div \
sdiv \
mult *
and &
or |
xor ^
shr >>
shl <<
lt <
gt >
slt <
sgt >
le <=
ge >=
sle <=
sge >=
eq ==
ne !=Floating-point expressions may only contain arithmetic operators – they cannot contain bitwise operators or conditional operators.
Variables in the source code can be followed by data definitions comments. Ginmake can be run against C and ASM code.
Data types recognised by ginmake for C code:
1uint8
2uint8_t
3int8
4int8_t
5uint16
6uint16_t
7int16
8int16_t
9int24
10int24_t
11int32
12int32_t
13int64
14int64_t
15float
16doubleIf the underlying type is float or double then GWv4 will treat the raw value as floating-point.
Data types recognised by ginmake for ASM code:
As of ginmake 1.33, it is possible to use entity references in strings for names etc.
These are very similar to HTML entity references, but they have a different syntax - the ‘&’ and ‘;’ characters are replaced with the $ symbol.
e.g.
< codes for <
This becomes:
$lt$ in ginmake syntax.
Entity references enable us to circumvent the issuse of the DOS and ANSI code pages not entirely overlapping one another and also allows other special characters that may not be present in these codepages.
For example, the capital ‘omega’ symbol is in the DOS codepage, but not in the ANSI codepage. The symbol can now be represented with $Omega$.
If you find that an entity is not supported, you can enter the value of the code-point directly.
e.g. These each code for Capital Letter Omega:
$Omega$
$#x03A9$
$#937$
Be aware that entities are case sensitive. $Omega$ and $omega$ are not the same!
Some values may have their type specified.
This is intended to be used when specifying raw values where there would otherwise be ambiguity over the type that could lead to incorrect values ending up in the output GIN. Additionally for floating-point raw values it is easier to specify them using floating-point values in many cases.
Format:
@Nt:VALUE
Where ‘N’ is the number of bytes in the value (1,2,3,4 or 8).
If ‘N’ is zero, the value is undefined.
Where ’t’ is the type:
i = signed integer
u = unsigned integer
f = floating-point
e.g.
@4i:1234567
@2u:65535
@0u:undefined
Value specifiers can be used in a number of places: