GET STRING utility RP AUTOMATION INC. DEC 1988
Preliminary Documentation
1.0 Introduction
The programs included in this file allow inputs which are not
just decimal numbers. In the current VAL II system, only
decimal numbers are allowed to be inputs. With this package
of programs, many other types of input are available. The types
of input that are possible are:
Single ASCII character
ASCII character string
ASCII character string converted to UPPERCASE
ASCII character string converted to lowercase
Octal number
Hexadecimal number
2.0 Subroutine Description
Name Description
rp.get.char This program waits until any key is pressed
on the keyboard, and then returns the value
of that key using the variable "inchar".
Sample Call:
CALL get.char ;Get a character
IF inchar==13 THEN ;Do if a <RETURN> key
<code>
END
rp.get.string This program saves all characters that are
input through the keyboard until a <RETURN>
key is typed. The data is saved in the
array "inbuf[]", which is returned to the
calling routine when the string is finished.
Sample Call:
CALL get.string ;Get a filename
tmp=0
DO ;Loop until end of filename
<copy name to different array>
UNTIL inbuf[tmp]==0
Name Description
rp.get.string.upper This program saves all characters that are
input through the keyboard until a <RETURN>
key is typed. The data is saved in the
array "inbuf[]", which is returned to the
calling routine when the string is finished.
Although the characters are all displayed
on the CRT screen in whatever case they are
input, all alpha-characters are converted to
UPPERCASE before the array is returned.
Sample Call:
CALL get.string.upper ;Get a password
tmp=0
WHILE inbuf[tmp]<>0 DO ;Check password as valid
<check password - HALT if error>
END
rp.get.string.lower This program saves all characters that are
input through the keyboard until a <RETURN>
key is typed. The data is saved in the
array "inbuf[]", which is returned to the
calling routine when the string is finished.
Although the characters are all displayed
on the CRT screen in whatever case they are
input, all alpha-characters are converted to
lowercase before the array is returned.
Sample Call:
CALL get.string.lower ;Get a password
tmp=0
WHILE inbuf[tmp]<>0 DO ;Check password as valid
<check password - HALT if error>
END
rp.get.octal.num This program gathers all characters that
are input through the keyboard until a
<RETURN> key is typed. The data is then
converted from ASCII into an octal number.
This number will be returned to the calling
routine in "inbuf[0]". An error message
will be displayed if an illegal octal number
is entered. A "^" key can be entered as the
first character, but it is not necessary.
Sample Call:
CALL get.octal.num ;Get an octal number
address = inbuf[0] ;Set address to value
Name Description
rp.get.hex.num This program gathers all characters that
are input through the keyboard until a
<RETURN> key is typed. The data is then
converted from ASCII to a hexadecimal
number. This number will then be returned
to the calling routine in "inbuf[0]". An
error message will be displayed if an
illegal hexadecimal number is entered.
Sample Call:
CALL get.hex.num ;Get a hexadecimal number
data = inbuf[0] ;Set data to value
rp.demo This program is simply a demonstration of
how the rest of these programs work. It
CALLs each of them, showing how the CALLing
sequence should be used.
3.0 Software Installation
1) Load the RP_GET.STRING file from floppy by typing:
LOAD RP_GET.STRING
2) Make changes to existing programs to CALL the appropriate
subroutines, as per the "sample calls" shown with each
program.
4.0 Notes
1) In all cases except the "get.char" program, <BS> and
<DEL> keypresses work like a BACKSPACE should (I.E. the
last typed character will be deleted from the buffer and
from the CRT screen).
2) All returned strings are terminated with a zero "0" character
in the "inbuf[]" array.
3) A <CONTROL>-C keypress flushes the buffer, as if nothing had
been typed at all.
4) All other <CONTROL>-key data is ignored. This means that
all other characters typed with values less than ^40 (SPACE)
are not put into the buffer.
5.0 Variable names used
The following list of real variable names are used within
this set of programs:
rp.bs.sp.bs[] rp.cr.lf[] rp.get.i
rp.inbuf[] rp.inchar rp.outchr[]
rp.tmp rp.type.i rp.z.factor
rp.z.i rp.z.temp1 rp.z.temp2
rp.z.temp3
RP Automation
Tel (800) 367-7862 (800) FOR PUMA Fax (203) 792-2154
Email info@rpautomation.com
all content copyright RP Automation 1997