Technical data

Coding Conventions
3-9
of the Name identifier into the parent block scope is currently done for the
Parameter, RWorkDefine, IWorkDefine, and PWorkDefine block records.
The TLC assignment directive (
%assign) generates a warning if you assign
a value to an “unqualified” RTW identifier. For example,
%assign TID = 1
will produce an error because TID identifier is not qualified by Block.
However, a “qualified” assignment will not generate a warning.
%assign Block.TID = 1
does not generate a warning because the Target Language Compiler
assumes the programmer is intentionally modifying an identifier since the
assignment contains a qualifier.
2 Global TLC variable assignments should start with uppercase letters. A
global variable is any variable declared in a system target file (
grt.tlc,
mdlwide.tlc, mdlhdr.tlc, mdlbody.tlc, mdlreg.tlc, or mdlparam.tlc), or
within a function that uses the
:: operator. In some sense, global
assignments have the same scope as RTW variables. An example of a global
TLC variable defined in
mdlwide.tlc is
%assign InlineParameters = 1
An example of a global reference in a function is
%function foo() void
%assign ::GlobalIdx = ::GlobalIdx + 1
%endfunction
3 Local TLC variable assignments should start with lowercase letters. A local
TLC variable is a variable assigned inside a function. For example,
%assign numBlockStates = ContStates[0]
4 Library functions (functions in funclib.tlc) start with Lib when the
function is to be used outside the library file. If the function is only used