Variables and Scopes - mccode-dev/McCode GitHub Wiki
Jan. 22nd, 2020.
The table below describes the variables and parameters that can be defined inthe McCode meta language, and the role they play in the generated code. This is not exhaustive, but describes the most important cases - and conditions for possible name clashes in cogen3.
what | where | symbol C scope | alternative access |
---|---|---|---|
instr par | instr file DEFINE | insrument section of init finally functions |
INSTRUMENT_GETPAR macro, instrument->_parameters.varname
|
instr var | instr file DECLARE | global | symbol may be overridden locally by instr or comp pars, uservars or local variables |
user var | instr file USERVARS | EXTEND section of comp trace functions, and cogen'd raytrace functions |
_particle->varname from component trace or cogen'd raytrace functions |
comp par | comp file DEFINE | component init , trace , finally , save and display functions (when called with the appropriate comp var) |
MC_GETPAR3 macro, _compname ->_parameters.varname
|
comp var | comp file DECLARE | none |
_comp->_parameters.var or MC_GETPAR(3) macro |
comp OUTPUT par | comp file DEFINE | as comp var | as comp par |
comp share | comp file SHARE | global | symbols may be overridden locally by instr or comp pars, user vars or local variables |