API Expand.VarName: Difference between revisions
Appearance
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable"" |
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
||
| Line 1: | Line 1: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''VarName''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''VarName''' | ||
|- | |- | ||
Revision as of 14:08, 13 July 2026
Detailed description
This expands a global variable to the name it would be given in the generated code. The size define (the size of the final dimension of the array) may be returned instead if required.
Note this does not return the full expression unless FullLine is true. In this case, Source must be a valid variable name for the Owner component, as the system needs this in order to expand the variable type, array sizes and initialisers.
This is an example of what may be shown with differing SizeName and FullLine values. The sample variable is TestVar, a byte array of 16 elements.
| SizeName | FullLine | Result |
|---|---|---|
| false | false | FCV_TESTVAR |
| true | false | FCVsz_TESTVAR |
| false | true | MX_UINT8 FCV_TESTVAR[FCVsz_TESTVAR] |
| true | true | #define FCVsz_TESTVAR 16 |
Examples
Calling in a calculation
- Declare a variable 'result' of type STRING
- Add to a calculation icon:
result = ::Expand.VarName("source", owner, false, true)