home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / modu1096.zip / ISOsym / realio.def < prev    next >
Text File  |  1996-08-29  |  2KB  |  55 lines

  1. DEFINITION MODULE RealIO;
  2.  
  3. (* Input and output of real numbers in decimal text form over specified channels.
  4.    The read result is of type IOConsts.ReadResults.
  5. *)
  6.  
  7. FROM IOChan IMPORT ChanId;
  8.  
  9. (* The text form of a signed fixed-point real number is
  10.      ["+"|"-"], decimal digit, {decimal digit}, [".", {decimal digit}] *)
  11.  
  12. (* The text form of a signed floating-point real number is
  13.      signed fixed-point real number,
  14.      "E", ["+"|"-"], decimal digit, {decimal digit} *)
  15.  
  16. PROCEDURE ReadReal (    cid  : ChanId;
  17.                     VAR real : REAL);
  18. (* Skips leading spaces and removes any remaining characters
  19.    that form part of a signed fixed or floating point number.
  20.    A corresponding value is assigned to the parameter real.
  21.    The real result is set to the value allRight, outOfRange, wrongFormat,
  22.    endOfLine, or endOfInput. *)
  23.  
  24. PROCEDURE WriteFloat (cid     : ChanId;
  25.                       real    : REAL;
  26.                       sigFigs : CARDINAL;
  27.                       width   : CARDINAL);
  28. (* Writes the value of the parameter real in floating-point text form
  29.    with sigFigs significant figures in a field of the given minimum width. *)
  30.  
  31. PROCEDURE WriteEng (cid     : ChanId;
  32.                     real    : REAL;
  33.                     sigFigs : CARDINAL;
  34.                     width   : CARDINAL);
  35. (* As for WriteFloat except that the number is scaled with one to
  36.    three digits in the whole number part and with an exponent that is
  37.    a multiple of three. *)
  38.  
  39. PROCEDURE WriteFixed (cid   : ChanId;
  40.                       real  : REAL;
  41.                       place : INTEGER;
  42.                       width : CARDINAL);
  43. (* Writes the value of the parameter real in fixed-point text form,
  44.    rounded to the given place relative to the decimal point,
  45.    in a field of the given minimum width. *)
  46.  
  47. PROCEDURE WriteReal (cid   : ChanId;
  48.                      real  : REAL;
  49.                      width : CARDINAL);
  50. (* Writes the value of real as WriteFixed if the sign and magnitude
  51.    can be shown in the given width, otherwise as WriteFloat.
  52.    The number of places or significant digits depend on the given width. *)
  53.  
  54. END RealIO.
  55.