GET.STRING V01 RP AUTOMATION INC 11JAN89

 

 

DESCRIPTION

The programs included in this file allow inputs which are not

just decimal numbers. In the current VAL-II software system,

only 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

 

 

PREPARATION

Load the GET.STRING file into memory. If some of the programs

are not necessary for the specific application that is being

done, then those programs can be deleted.

DO NOT DELETE THE "type.string" OR "get.string" PROGRAMS AS

THEY ARE USED BY MOST OF THE OTHER ROUTINES. THE "get.char"

PROGRAM IS THE ONLY ONE WHICH USES NEITHER.

 

PROGRAM USAGE

To use these programs, simply make the subroutine CALL to the

feature that is desired. The names of these subroutines and

their outputs are:

 

get.char

This routine waits until any key is pressed on the keyboard,

and then returns the value of that key to the calling routine

in the variable "inchar".

Sample call: CALL get.char ;Get a character

IF inchar==13 THEN ;Do if a <RETURN> key

<code>

END

 

 

PROGRAM USAGE (continued)

 

get.string

This routine 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

 

 

get.string.upper

This routine 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 whichever 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

 

 

get.string.lower

This routine 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 whichever 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

 

 

PROGRAM USAGE (continued)

 

get.octal.num

This routine gathers all characters that are input through

the keyboard until a <RETURN> key is typed. The data is then

converted from an octal number to LSI-11 number format. This

number will be returned to the calling routine in "inbuf[0]".

An error message will be displayed if an illegal number is

entered. Another number must then be 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

 

 

get.hex.num

This routine gathers all characters that are input through

the keyboard until a <RETURN> key is typed. The data is then

converted from a hexadecimal number to LSI-11 number format.

This number will then be returned to the calling routine in

"inbuf[0]". An error message will be displayed if an illegal

number is entered. Another number must then be entered.

Sample call: CALL get.hex.num ;Get a hexadecimal number

data = inbuf[0] ;Set data to value

 

 

NOTES

In all cases (except "get.char"), <BS> and <DEL> keypresses

will work like a BACKSPACE should: the last typed character

will be deleted from the buffer and from the CRT screen.

All returned strings are terminated with a zero "0" character

in the "inbuf[]" array.

A <CONTROL>-C keypress flushes the buffer, as if nothing had

been typed at all.

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.

There are 2 real-valued arrays which also cannot be deleted.

They are "cr.lf[]" and "bs.sp.sp[]". These are used to type

out the input data.

 

 

MESSAGES

 

*** Illegal 16-bit OCTAL number ***

This message gets displayed when the "get.octal.num" routine

is called, and the characters entered through the keyboard do

not constitute a legal octal number.

 

*** Illegal 16-bit HEXADECIMAL number ***

This message gets displayed when the "get.hex.num" routine is

called, and the characters entered through the keyboard do

not constitute a legal hexidecimal number.

 

RP Automation
Tel  (800) 367-7862  (800) FOR PUMA  Fax  (203) 792-2154
Email  info@rpautomation.com

all content copyright RP Automation 1997