API Expand.VarName

From Flowcode Help
Jump to navigationJump to search
Fc9-comp-macro.png VarName
Expands a string to the name of a global variable used in the generated code 
Fc9-string-icon.png - STRING Source
The variable name to expand 
Fc9-h32-icon.png - HANDLE Owner
A component that owns the variable 
Fc9-bool-icon.png - BOOL SizeName
Set true to return the expanded size define 
Fc9-bool-icon.png - BOOL FullLine
Set true to expand to a full declaration, else just the name 
Fc9-string-icon.png - STRING Return


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)