Target Language Compiler    

Counting Blocks and Subsystems

The Target Language Compiler is a program that transforms model.rtw record files and S-functions into C source code. In this exercise you will modify a program that reports the blocks contained in a model.rtw file. You can use the TLC utility scripts from this exercise to list the contents of any such .rtw file, not just the one used in the example.

  1. Open listrtw1.tlc in your text editor. As provided, it contains

Note that the following TLC directives are used (refer to Directives and Built-in Functions, for detailed descriptions):

%addincludepath
Enables TLC to find included files. You must edit this string to describe the MATLAB root directory. Notice that the `/' character has to be escaped (doubled).
%assign
Creates or modifies a variable
%include
Inserts one file in another, as in C
%selectfile
Directs output to a stream or file
%with...%endwith
Adds a scope to simplify referencing blocks
%foreach...%endforeach
Iterates loop variable from 0 to upper limit

  1. Find the line %addincludepath "<matlabroot>//rtw//c//tlc" and change <matlabroot> to specify the MATLAB root directory on your system. The double slashes are required to parse the string properly.
  2. Run listrtw1.tlc on the f14a.rtw file. Do this by typing the tlc command in MATLAB (type help tlc for command syntax information). In the MATLAB command window (having made sure you are currently in your own /listrtw directory) type

The model file is read and analyzed by listrtw1.tlc, which prints the following summary of it in the MATLAB command window:


  Getting Started Listing Block Names