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 / READREAL.PZC / READREAL.PRC
Text File  |  2000-06-30  |  1KB  |  46 lines

  1. {READREAL.PRC}
  2. {
  3. Description:  Accepts entry of real at specified locations on the
  4.               screen.  Returns flag if entry is within range.
  5.  
  6. Author:       Don Taylor
  7. Date:         8/06/86
  8. Last revised: 8/07/86
  9. Application:  All Systems
  10. Published in: TUG Lines - Turbo User Group, PO Group Box 1510, Poulsbo, WA 98370
  11.  
  12. Notes:        Requires READSTUF.INC
  13. }
  14.  
  15. PROCEDURE ReadReal(        x: BYTE;     { Horizontal location of field  }
  16.                            y: BYTE;     { Vertical local of field       }
  17.                          len: BYTE;     { Absolute length of field      }
  18.                          dec: BYTE;     { Number of decimal places      }
  19.                    VAR value: REAL;     { Real value returned           }
  20.                    VAR    OK: BOOLEAN); { Valid entry flag              }
  21.  
  22. VAR
  23.  r       : REAL;
  24.  ECode   : INTEGER;
  25.  c       : CharSet;
  26.  DStr    : Str255;
  27.  
  28. BEGIN
  29.  c := ['0'..'9','-','.'];     { Valid charactes for real input }
  30.  OK := TRUE;
  31.  STR(value:len:dec, s);
  32.  DStr := s;
  33.  ReadFld(x,y,len,c,DStr,s);
  34.  IF LENGTH(S) > 0             { A new entry was made           }
  35.   THEN BEGIN
  36.         VAL(s,r,ECode);
  37.         OK := (ECode = 0);
  38.         IF OK THEN value := r
  39.        END;
  40.   STR(value:len:dec, s);       { Re-display entry              }
  41.   GOTOXY(x,y); LowVideo;
  42.   WRITE(s); NormVideo
  43. END;   {ReadReal}
  44.  
  45.  
  46.