Model Templates : Template for nroff : Segment 2: Activity-Chart Plot and Property Report (nroff)

Segment 2: Activity-Chart Plot and Property Report (nroff)

In the second segment of the template, seg2, the template produces the activity’s plot and generates a property report of all of its subactivities using plot and report functions. Formatting commands are introduced where appropriate. One variable (ac_list) is declared, which represents the list of subactivities from which the property report is constructed.

The segment’s body begins with the DGL verbatim symbol, /@. This command indicates that everything between it and the following @/ symbol is to be included verbatim in the output document segment. The comments do not actually appear in the generated output, but explain the purpose of each command when interpreted by nroff. The generated output is as follows:

.PAGE -- starts a new page.
.HL 1 SYSTEM ACTIVITIES -- produces a header.
.SKIP -- skips a line.
.HL 2 Activity-chart -- produces a subheading.
.SKIP -- skips a line.
This is the chart that describes the activities
of the system:
.BREAK -- causes hard return (new line).

Note: nroff commands written in a verbatim environment must start at the extreme left of the line (otherwise, the formatter does not correctly interpret them). Do not be misled into indenting these commands in the desire to produce a more readable template.

The next WRITE statement passes a nroff formatting command to the output segment. This command formats the page so as to provide a place for the plot that follows. A place for the plot must be made because nroff has no inherent graphics capability. The statement passes a SKIP command that causes the document to skip 40 lines to leave room for the activity chart plot.

Next, the template uses an Include Plot statement to generate a plot of the activity for which you are producing the document. Note that the second argument is the name of the file in which the output plot is contained. The file belongs to the file system outside of Statemate. If you do not give the full path name (as in the example), the file will appear in your workarea.

The ninth argument represents the plotter type. This determines the graphical language in which the plot is generated. Because this is a template parameter, you can change its initial value in a form before executing the template.

The example template produces the plot for a pen plotter, and places it in a file called act_plot. Following the execution of the template you must explicitly output the plot on the particular plotting device and thereafter manually merge the plot into the blank space set aside for this. For an explanation of the other parameters of the plot, see INCLUDE.

Now you can give instructions for the inclusion of the property report for the subactivities. First, you include another section of formatting commands to be passed verbatim to the output segments. These include instructions for a subheading, a blank line, and a sentence introducing the property report. Next you assign a value to the variable ac_list, which represents the subactivities of the subject activity. This is followed by an Include Property Report statement, which causes the property report to appear in the output segment before formatting with its nroff commands embedded in the text. The Documentor embeds nroff commands because you attached the template to the nroff formatter at the Create Template stage. Upon formatting, these commands are interpreted along with the rest of the formatting commands.