To process the result string from INPUT:

For simple input, use OBJ→ to convert the string into its corresponding objects.

For sensitive input, use the V option for INPUT to check for valid objects, then use OBJ→ to convert the string into those objects.

For special input, process the input as a string object, possibly extracting data as substrings. Example: The program VSPH on page 141 uses an empty commandline string.

The program SSEC on page 144 uses a commandline string whose char acters form a pattern. The program extracts substrings from the result string.

Example: The commandline string "@UPPER LIMIT@" displays @UPPER LIMIT◄ in the command line. If you press 200 `the return string is "@UPPER LIMIT@200". When OBJ→ extracts the text from the string, it strips away the @ characters and the enclosed characters, and it returns the number 200. (See “Creating Programs on a computer” on page 17 for more inform ation about @ comments.)

Example: The following program, TINPUT, executes INPUT to prompt for the inner and outer radii of a torus, then calls TORSA (page 129) to calculate its surfa ce area. TINPUT prompts for a and b in a tworow command line. The level 1 argument for INPUT is a list that contains:

The commandline string, which forms the tags and d elimiters for two tagged objects. An embedded list specifying the initial cursor position.

The V parameter to check for invalid syntax in the result string.

Program:

Comments:

 

 

«

 

"Key in a, b"

The level 2 string, displayed at the top of

 

the stack area.

{ ":a::b:" {1 0} V }

The level 1 list contains a string, a list, and

 

the verify option. (To key in the string,

 

press @ Õ ! Ê a ™ @

 

Ë ! Ê b.

 

After you press `to put the finished

 

program on the stack, the string is shown

 

on one line, with indicating the newline

 

character.) The embedded list puts the

 

insert cursor at the end of row 1.

INPUT

Displays the stack and commandline

 

strings, positions the cursor, sets

 

Programentry mode, and suspends

 

execution for input.

OBJ→

Converts the string into its component

 

objects — two tagged objects.

TORSA

Calls TORSA to calculate the surface area.

»

 

 

 

`O TINPUT

Stores the program in TINPUT.

 

 

RPL Programming 143

Page 67
Image 67
HP 48gII Graphing, 50g Graphing manual To process the result string from Input, Press @ Õ ! Ê a @, `O Tinput ‰