Program:

Comments:

 

 

 

 

 

 

UNTIL 'm' EVAL 0 ==

Repeat the DO...UNTIL loop until m =

 

 

 

0 (i.e. all decimal value have been

 

 

 

accounted for).

 

 

END

Is flag 1 set? Clear the flag after the test.

 

 

IF 1 FS?C

 

 

 

THEN "0" +

Then add a placeholding zero to the

 

 

 

result string.

 

 

WHILE i 'k' EVAL

Begin WHILE...REPEAT loop to

 

 

- 0 ‹

determine if additional placeholding

 

 

 

zeros are needed.

 

 

 

Loop repeats as long as ik.

 

 

REPEAT "0" +

Add an additional placeholding zero and

 

 

1 'k' STO+

increment k before repeating the test-

 

 

 

clause.

 

 

END

End the WHILE...REPEAT...END

 

 

END

loop, the IF...THEN...END structure,

 

 

»

and the inner local variable structure.

 

 

" base" b +

End the outermost

 

 

n SWAP + →TAG

IF...THEN...ELSE...END structure and

 

 

 

create the label string and tag the result

 

 

 

string using the original arguments.

 

 

f STOF

Restore original flag settings.

 

 

»

 

 

 

»

 

 

 

 

 

 

 

`OnBASE K

Stores the program in nBASE.

 

 

 

 

 

 

Checksum: # 54850d

 

Bytes:

433

 

Example: Convert 100010 to base 23.

1000 `23 J%NBASE%

Verifying Program Arguments

The two utility programs in this section verify that the argument to a program is the correct object type.

NAMES verifies that a list argument contains exactly two names.

VFY verifies that the argument is either a name or a list containing exactly two names. It calls NAMES if the argument is a list.

You can modify these utilities to verify other object types and object content.

2-24 RPL Programming Examples