home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xco212p.zip / ISODEF / longstr.def < prev    next >
Text File  |  1994-12-22  |  2KB  |  49 lines

  1. DEFINITION MODULE LongStr;
  2.  
  3. IMPORT ConvTypes;
  4.  
  5. TYPE
  6.   float = LONGREAL;
  7.   ConvResults = ConvTypes.ConvResults;
  8.   (* strAllRight, strOutOfRange, strWrongFormat, strEmpty *)
  9.  
  10. (* the string form of a signed fixed-point real number is
  11.    ["+"|"-"]. decimal digit, {decimal digit}, [".", {decimal digit}]
  12. *)
  13.  
  14. (* the string form of a signed flating-point real number is
  15.    signed fixed-point real number, "E", ["+"|"-"], decimal digit, {decimal digit}
  16. *)
  17.  
  18. PROCEDURE StrToReal (str: ARRAY OF CHAR; VAR real: float; VAR res: ConvResults);
  19. (* Ignores any leading spaces in str. If the subsequent characters in str are in the
  20.    format of a signed real number, assigns a corresponding value to real.
  21.    Assigns a value indicating the format of str to res.
  22. *)
  23.  
  24. PROCEDURE RealToFloat (real: float; sigFigs: CARDINAL; VAR str: ARRAY OF CHAR);
  25. (* Converts the value of real to floating-point string form, with sigFigs significant
  26.    figures, and copies the possibly truncated result to str.
  27. *)
  28.  
  29. PROCEDURE RealToEng (real: float; sigFigs: CARDINAL; VAR str: ARRAY OF CHAR);
  30. (* Converts the value of real to floating-point string form, with sigFigs significant
  31.    digits, and copies the possibly truncated result to str. The number is scaled
  32.    with one to three digits in the whole number part and with an exponent that is
  33.    multiple of three.
  34. *)
  35.  
  36. PROCEDURE RealToFixed (real: float; place: INTEGER; VAR str: ARRAY OF CHAR);
  37. (* Converts the value of real to fixed-point string form, rounded to the given place
  38.    relative to the decimal poin, and copies the possibly truncated result to str.
  39. *)
  40.  
  41. PROCEDURE RealToStr (real: float; VAR str: ARRAY OF CHAR);
  42. (* Convers the value of real as RealToFixed if the sign and magnitute can be shown
  43.    within the capacity of str, or otherwise as RealToFloat, and copies the possibly
  44.    truncated result to str. The number of places or significant digits are
  45.    implementation-defined.
  46. *)
  47.  
  48. END LongStr.
  49.