REM---------------------------------------------------------------------------
DEF	getnum(prompt,low,high) PUBLIC

REM THIS FUNCTION RETURNS AN INTEGER WITHIN A GIVEN RANGE
	INTEGER	getnum,low,high,number
	STRING	prompt
10	print prompt;:input "";number
	if number<low or number>high then print "Out of Range - reenter": \
		goto 10
	getnum=number
	FEND


REM---------------------------------------------------------------------------
DEF	getstr(prompt,min,max) PUBLIC

REM THIS FUNCTION RETURNS A STRING AS PROMPTED.
REM IT PROMPTS THE OPERATOR TO INPUT A STRING VALUE AND PROVIDES
REM DASHES TO INDICATE THE MAXIMUM LENGTH OF STRING PERMITTED
	INTEGER	min,max,i
	STRING	prompt,getstr,t
10	t="":for i=1 to max:t=t+"-":next i:print prompt+t
	t="":for i=1 to len(prompt)-1:t=t+" ":next i:print t;
	input "";line t
	if len(t)>max then print "Too long - reenter":goto 10
	if len(t)<min then print "Too short - reenter":goto 10
	getstr=t
	FEND


REM---------------------------------------------------------------------------
DEF	yesno(prompt) PUBLIC

REM THIS FUNCTION RETURNS A STRING AS "Y" OR "N"
	STRING	prompt,yesno,t
10	print prompt;:input "?(Y/N)";t:t=ucase$(left$(t,1))
		if t<>"Y" and t<>"N" then print "Use only Y or N":goto 10
	yesno=t
	FEND


REM---------------------------------------------------------------------------
DEF	pause PUBLIC

REM THIS FUNCTION CAUSES THE PROGRAM TO PAUSE UNTIL THE OPERATOR PRESSES A KEY
	STRING	t
	input "Press CR when ready -";line t
	FEND


REM---------------------------------------------------------------------------
DEF	panic PUBLIC

REM THIS FUNCTION INTERRUPTS THE OPERATION IN PROGRESS UNTIL OPERATOR ENTERS
REM EITHER A CR OR "STOP"
REM NOTE!!! IF OUTPUT IS DIRECTED TO THE PRINTER, IT IS NECESSARY TO DIRECT
REM OUTPUT BACK TO THE CONSOLE MOMENTARILY FOR THE CONSTAT% TO WORK PROPERLY.
REM BE SURE TO RESET OUTPUT TO LPRINTER AFTER CALLING PANIC!
	STRING t
10	print bel;"Enter STOP to abort program, or"
	input "Press CR to continue -";line t
	if ucase$(t)="STOP" then stop
	if t="" then return ELSE goto 10
	FEND
