home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
TURBOPAS
/
BULLETTP.LBR
/
READINT.PZC
/
READINT.PRC
Wrap
Text File
|
2000-06-30
|
2KB
|
53 lines
{READINT.PRC}
{
Description: Accepts entry of integer at specified locations on the
screen. Returns flag if entry is within range.
Author: Don Taylor
Date: 8/06/86
Last revised: 8/07/86
Application: All Systems
Published in: TUG Lines - Turbo User Group, PO Group Box 1510, Poulsbo, WA 98370
Notes: Requires READSTUF.INC
}
PROCEDURE ReadInt ( x: BYTE; { Horizontal location of field }
y: BYTE; { Vertical local of field }
len: BYTE; { Absolute length of field }
VAR value: INTEGER; { Real value returned }
VAR OK: BOOLEAN); { Valid entry flag }
VAR
r : REAL;
ECode : INTEGER;
c : CharSet;
s : Str255;
DStr : Str255;
BEGIN
c := ['0'..'9','-']; { Valid charactes for integer input }
OK := TRUE;
STR(value:len, s);
DStr := s;
ReadFld(x,y,len,c,DStr,s);
IF LENGTH(S) > 0 { A new entry was made }
THEN BEGIN
VAL(s,r,ECode);
OK := (ECode = 0);
IF OK
THEN IF (r <=MaxInt) AND (r >= -32768.0)
THEN BEGIN
IF r > -32767.5
THEN value := ROUND(r)
ELSE value := -MaxInt - 1
END
ELSE OK := FALSE;
END;
STR(value:len, s); { Re-display entry }
GOTOXY(x,y); LowVideo;
WRITE(s); NormVideo
END; {ReadInt}