home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
turbopas
/
bullettp.lbr
/
READREAL.PZC
/
READREAL.PRC
Wrap
Text File
|
1987-02-16
|
1KB
|
46 lines
{READREAL.PRC}
{
Description: Accepts entry of real 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 ReadReal( x: BYTE; { Horizontal location of field }
y: BYTE; { Vertical local of field }
len: BYTE; { Absolute length of field }
dec: BYTE; { Number of decimal places }
VAR value: REAL; { Real value returned }
VAR OK: BOOLEAN); { Valid entry flag }
VAR
r : REAL;
ECode : INTEGER;
c : CharSet;
DStr : Str255;
BEGIN
c := ['0'..'9','-','.']; { Valid charactes for real input }
OK := TRUE;
STR(value:len:dec, 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 value := r
END;
STR(value:len:dec, s); { Re-display entry }
GOTOXY(x,y); LowVideo;
WRITE(s); NormVideo
END; {ReadReal}