29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.13 USING @PARAM<br />

<strong>The</strong> @PARAM SuperVisor Call is used in practically all DOS library commands and utilities<br />

as well as filters, drivers, and languages. Since you are already familiar with the DOS<br />

commands, you should recognize the wide range of input syntax parsed and interpreted by<br />

@PARAM. <strong>The</strong> SVC is used <strong>to</strong> decode TRUE/FALSE parameters (by either entering or not<br />

entering a parameter word), YES/NO parameters (by using PARM=Y or PARM=N), ON/OFF<br />

parameters (by using PARM=ON or PARM=OFF), decimal values (by entering PARM=ddddd),<br />

hexadecimal values (by entering PARM=X'xxxx'), and character string values (by entering<br />

PARM="characterstring"). Parameter entries can be made in either upper case or lower case<br />

- even with hexadecimal digits (A-F equally acceptable as a-f).<br />

<strong>The</strong> system parses a complex parameter string that may be composed of many parameters -<br />

each separated from the other by a comma. <strong>The</strong> interpreted entries are passed back <strong>to</strong><br />

@PARAM caller according <strong>to</strong> the parameter table designed by the programmer. <strong>Version</strong> 6<br />

supports two types of parameter tables. <strong>The</strong> first type is the fixed width table which was<br />

supported under <strong>Version</strong> 5.<br />

<strong>The</strong> second type is a variable width table that supports additional information. In the<br />

following discussions, we will first illustrate the former table. You should have already<br />

read the information in chapter 7 covering the @PARAM SuperVisor Call.<br />

Let's assume we have an application that offers the user varying options <strong>to</strong> set up the<br />

function of the application. In BASIC, this may be the number of files or protected<br />

memory size. In BACKUP, this may be the diskette master password or date range of files<br />

<strong>to</strong> select. In SETCOM, this may be whether CTS is <strong>to</strong> be honored. How do we get this<br />

information <strong>to</strong> the program? We could prompt the user by a prompt message for each and<br />

every parameter that needs <strong>to</strong> be determined. Experienced users soon get tired of prompts.<br />

Inexperienced users get extremely frustrated when the system requires an inflexible<br />

syntax for the entry of options. How can everyone be satisfied - from novice <strong>to</strong> expert?<br />

Why, by using @PARAM.<br />

We will propose a hypothetical application requiring the determination of five options:<br />

1. A length field used in ascertaining the number of print columns of output. This<br />

should default <strong>to</strong> 80 <strong>to</strong> denote an 80 column printer if no entry is made. <strong>The</strong><br />

range should be limited <strong>to</strong> 32-255.<br />

2. A module specification field <strong>to</strong> indicate whether line feeds are <strong>to</strong> be added<br />

after carriage return, removed after carriage return, or no checking is <strong>to</strong> be<br />

performed.<br />

3. A title field <strong>to</strong> be placed on each page of output. In addition, paging is <strong>to</strong> be<br />

suppressed if no titling is desired. Furthermore, the default is <strong>to</strong> incorporate<br />

paging unless otherwise specified by the user.<br />

4. A prompting specification <strong>to</strong> note whether prompts for changing paper are <strong>to</strong> be<br />

made at the appropriate time if sheet paper is used or omitted if trac<strong>to</strong>r feed<br />

paper is used. <strong>The</strong> default should be no prompting.<br />

5. A translation option for converting a character on output. This should default<br />

<strong>to</strong> no translation.<br />

<strong>The</strong> first thing required by the system designer is <strong>to</strong> designate "words" for the command<br />

line parameters. <strong>The</strong>y should be chosen <strong>to</strong> be as easily remembered as possible. <strong>The</strong>y<br />

should be greatly correlated in definition <strong>to</strong> the function they are specifying.<br />

Additionally, abbreviations should be considered in addition <strong>to</strong> the full "word". Thought<br />

should be given <strong>to</strong> using words whose first character is different for each parameter so<br />

as <strong>to</strong> provide single character abbreviations. However, if any parameter is omnipotent,<br />

care should be exercised in designating an abbreviation.<br />

8-30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!