• Aucun résultat trouvé

The 'tLC Special Symbol

Dans le document Program Product (Page 159-162)

The &$LC special symbol contains the number of lines left in the column at the time of symbol substitution. This value does not include running ti tIes, headings, or footings which have been placed on the page, nor does it include keeps, widows, or partial-ly filled output lines which have not been placed in the column at the time of symbol substitution.

The value of &$LC at the time of symbol substi tution may not accu-rately reflect the final position of surrounding text on the page if that text is in a keep, float, or widow, if there is a partial-ly filled output line, or if column balancing is in effect. The value of &$LC at the time of symbol substitution will accurately reflect the final position on the page of text only at the begin-ning of a new page, section, or column.

PASSING PARAMETERS TO INPUT FILES

SCRIPT/VS has three sets of symbols that are set automatically by parameters passed to a file or macro. These are:

• SCRIPT/VS system symbols, which can be set when the SCRIPT command is issued

• Parameters passed to imbedded files with the .IM [Imbed] and .AP [Append] control words

• Pa rameters passed to a macro Setting Symbols with the SCRIPT Command

Use the SYSVAR option of the SCRIPT command when you want to pass values to the input file from the SCRIPT command line.

The symbols that you can set with the SYSVAR option have names starting with "&SYSVAR" appended to one alphameric character: 0 through 9, uppercase A through Z, and

a,

I, and $. For example,

script outline ( sysvar ( a atype 2 nogo

This command line sets the symbols &SYSVARA to ATYPE and &SYSVAR2 to NOGO. Lowercase letters assigned to an &SYSVAR symbol are translated to uppercase letters. Consequently, when you include the symbols in an input line, always use the uppercase symbol name and character-string values.

For example, &SYSVARA may be used to bypass parts of the document and &SYSVAR2 may be used to terminate processing before com-pletion:

.if &SYSVARA eq ATYPE .go aproc .if &SYSVAR2 eq NOGO .qu

... aproc

When you use &SYSVAR symbols, it is good practice to put comments at the beginning of your input file so that other users who proc-ess the file are aware of each &SYSVAR symbol and the meanings of its values.

For details about the SYSVAR option of the SCRIPT command, see

"Chapter 2. Using the SCRIPT Command" on page 13.

Symbols Set When a File Is Imbedded or Appended

You can pass parameters to an imbedded or appended file with the .IM [Imbed] and .AP [Append] control words. The symbols &0 through

&14 are set to the parameters following the name of the imbedded file. For example,

.im finance George 125 $21.50 '18-7'

When the file named FINANCE is imbedded, the symbols &0 through &4 are automatically set by SCRIPT/VS:

Symbol Name

&0

&1

&2

&3

&4

Value Set by SCRIPT/VS 4

George 125 $21.50 18-7

Symbol &0 contains the number of parameters passed. Up to 14 parameters can be passed when a file is imbedded or appended.

These parameters are called "tokens." Each token can be up to ei ght cha racters long, del imi ted wi th blanks. The rul es that apply to setting the value of a symbol also apply to specifying a

Chapter 12. Symbols in Your Document 141

token. See "Chapter 11. Combining SCRIPT/VS Files" on page 119 for details about imbedding and appending files.

Symbols Set When a Macro Is Processed

You can pass parameters to a macro when your input file calls the macro. The parameters become macro-local symbols (that is, sym-bols that are set for the called macro only; not for other macro calls that occur within the called macro). The format of the macro call might be:

.burger fries+shake nosauce 'on a great big poppy-seed bun' When the macro BURGER is processed, local symbols within i t are automatically set by SCRIPT/VS:

Symbol Name

&*

&*0

&*1

&*2

&*3

&*4

&*5

Value set by SCRIPT/VS

fries+shake nosauce 'on a great big poppy-seed bun' 5

fries + shake nosauce

on a great big poppy-seed bun

Symbol &* contains the entire untokenized input line. It contains all leading blanks after the blank that delimits the macro name.

Symbol &*0 contains the number of symbol values passed. The sym-bols &*1 through &*n contain the individual tokens passed to the macro. Notice that blanks, arithmetic operators, and parentheses normally delimit tokens, but that a single token can contain these and other special characters if i t is enclosed in single quotation marks. Also, macro tokens are not subject to the 8-character limit applied to .IM [Imbed] and .AP [Append] tokens. See "Chapter 13.

Writing SCRIPT/VS Macro Instructions" on page 147 for details about specifying symbols within macro instructions.

Note: Symbols whose names begin with an asterisk (*) are treated differently from other symbols. Other symbols are globally avail-able to all files and macros, but symbols whose names begin with an asterisk (*) are local to a particular macro at a particular level of nesting. The symbols ~&*~ ~nd "&*0" through "&*n" that are used to pass tokens to a maCro are "macro-local symbols." Each time a macro is called, a new set of macro-local symbols is estab-lished for it. The set lasts until th~ macro completes.

Unlike other symbols, macro-Ioc~l symbols, when undefined, are replaced during symbol substitution w~th the null string.

SETTING THE CURRENT PAGE NUMBER

You can set a symbol to be equal to the value of the current page number when the .SE [Set Symbol] control word is encountered. For example,

.se pagenum

=

&

A single ampersand on the right-hand side of the equal sign of a .SE control word is replaced with the character string of the cur-rent page number, including its prefix, if any. Elsewhere in your document, you can refer to the page number with its symbol name.

To continue the example,

For details, see page &pagenum ..

Whenever the &pagenum symbol occurs in your document, SCRIPT/VS replaces i t with whatever the page number was when the .SE [Set Symbol] control word was processed. If the symbol is set before the page is started, the page number will be the same as that of

the previous page and not that of the next page. At the start of the document, the page number is O.

SYMBOLS FOR ARRAYS OF VALUES

An array symbol is a special type of symbol that allows you to assign many values to the same symbol name. Each individual ele-ment of the array has, in addition to the name, an eleele-ment number in parentheses. The element number is also called the index or subscript of the element. When you format your document for output, the entire array of values can be referred to by a single symbol name. An array symbol is defined with the .SE [Set Symbol]

control word. For example, .se name()

=

value

The parentheses indicate that this is an element of an array and

"value" is an~ expression that can legally appear on a .SE [Set Symbol] control word line. The notation () is a shorthand way to specify the "next" element of the array.

When SCRIPT/VS encounters the array symbol value in the forml

&nameOO

it replaces "&nameOO" with the values of all the currently defined array elements, in the order in which they are indexed. A comma and a blank separate the individual elements. You can speci-fy di fferent array separator characters using the . DC [Define Character] ASEP control word (for details, see ".DC [Define Char-acter]" on page 241).

When the output line is too long because of the expansion of an array symbol, the line's first part is used as one output line and the remainder is printed on the next output line.

You can also cancel an array symbol by using the OFF parameter of the .SE [Set Symbol] control word. If the symbol is an array sym-bol and no subscript is provided, the entire array is cancelled.

Dans le document Program Product (Page 159-162)