-
Notifications
You must be signed in to change notification settings - Fork 60
Variables and Scopes
Jakob Garde edited this page Jan 30, 2020
·
5 revisions
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 |
|---|---|---|---|
| instrument parameter | instr file DEFINE | insrument section of init finally functions |
INSTRUMENT_GETPAR macro, instrument->_parameters.varname
|
| instrument variable | instr file DECLARE | global | symbol may be overridden locally by instr or comp pars, uservars or local variables |
| user variable | instr file USERVARS | EXTEND section of comp trace functions, and cogen'd raytrace functions |
_particle->varname from component trace or cogen'd raytrace functions |
| component parameter | comp file DEFINE | component init, trace, finally, save and display functions (when called with the appropriate comp var) |
MC_GETPAR3 macro, _compname->_parameters.varname
|
| component variable | comp file DECLARE | none |
_comp->_parameters.var or MC_GETPAR(3) macro |
| component OUTPUT par | comp file DEFINE | as comp var | as comp var |
| component share code | comp file SHARE | global | symbols may be overridden locally by instr or comp pars, uservars or local variables |