Technical data
3 
Writing Target Language Files
3-22
buffer. The prototypes are placed inside model.h among other generated 
function prototypes.
LibCacheDefine(buffer)
LibCacheDefine should be called from inside BlockTypeSetup to cache a 
#define statement. Each call to this function appends your buffer to the 
existing cache buffer. The 
#define statements are placed inside model.h 
among other generated 
#define statements.
LibIsDiscrete(tid)
Based on the block’s TID, this function returns 1 if the block is discrete, 
otherwise, it returns 0. For an example of this function, see 
sin_wave.tlc.
LibDataOutputPortWidth(portIdx)
Based on the output port index, this function returns the width of the data port. 
For an example of this function, see 
css.tlc.
LibDataInputPortWidth(portIdx) 
Based on the input port index, this function returns the width of the data port. 
For an example of this function, see 
css.tlc.
LibBlockOutputSignal(portIdx, ucv, lcv, sigIdx)
Based on the output port index (portIdx), the user control variable (ucv), the 
loop control variable (
lcv), and the signal index (sigIdx), this function returns 
a reference to the block I/O data structure. For example,
Given the same set of arguments, this function returns the appropriate 
reference to the block’s output signal depending on the state of RTW code 
generation. For example, case 1 is generated since the user control variable is 
specified. Cases 1 and 2 receive the same arguments, 
lcv and sigIdx, however, 
Case Function May Produce
1 LibBlockOutputSignal(0, "i", "", sigIdx) rtB.blockname[i]
2 LibBlockOutputSignal(0, "", lcv, sigIdx) y0[i1]
3 LibBlockOutputSignal(0, "", lcv, sigIdx) rtB.blockname[0]










