home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xco212p.zip / ODEF / IN.ODF < prev    next >
Text File  |  1996-03-05  |  2KB  |  88 lines

  1. (** Oakwood Oberon-2 library *)
  2. (** Copyright (c) xTech 1994,95. All Rights Reserved. *)
  3. DEFINITION In;
  4.  
  5. (** Formatted input of characters, numbers and strings.
  6.  
  7.   All operations except Open require Done = TRUE and guarantee
  8.   (Done = TRUE and the result is valid) or (Done = FALSE).
  9.  
  10.   All operations except Char skip leanding blanks, tabs or
  11.   end-of-line characters.
  12.  
  13. *)
  14.  
  15. (** Example:
  16.  
  17.   VAR i: INTEGER; ch: CHAR; r: REAL; s,n: ARRAY 32 OF CHAR;
  18.   ...
  19.   In.Open;
  20.   In.Int(i); In.Char(ch); In.Real(r); In.String(s); In.Name(n);
  21.  
  22. Input stream:
  23.  
  24.   123*1.5       "abc"   Mod.Proc
  25.  
  26. Results:
  27.  
  28.   i = 123
  29.   ch = "*"
  30.   r = 1.5E0
  31.   s = "abc"
  32.   n = "Mod.Proc"
  33. *)
  34.  
  35. VAR
  36.   Done*: BOOLEAN;
  37.  
  38. PROCEDURE Open*;
  39. (** Sets the standard input stream as input source.
  40.   Sets Done to TRUE.
  41. *)
  42.  
  43. PROCEDURE Char*(VAR ch: CHAR);
  44. (** Returns the character ch at the current position
  45.   (LF for the end-of-line character).
  46. *)
  47.  
  48. PROCEDURE String*(VAR str: ARRAY OF CHAR);
  49. (** Returns the string at the current position:
  50.         string = '"' char {char} '"'.
  51.   The string must not contain characters less than blank,
  52.   such as EOL or TAB.
  53. *)
  54.  
  55. PROCEDURE Name*(VAR name: ARRAY OF CHAR);
  56. (** Returns the name at the current position according to the
  57.   file name format of the underlying operating system (e.g.
  58.   "lib/MyMod" under Unix).
  59.  
  60.   In the current implementation the procedure copies 
  61.   to "name" characters before next blank, tab or
  62.   end-of-line character.
  63. *)
  64.  
  65. PROCEDURE Int*(VAR n: INTEGER);
  66. (** Returns the integer constant at the current position:
  67.         IntConst = digit {digit} | digit {hexDigit} "H".
  68. *)
  69.  
  70. PROCEDURE LongInt*(VAR n: LONGINT);
  71. (** Returns the long integer constant n at the current position:
  72.         IntConst = digit {digit} | digit {hexDigit} "H".
  73. *)
  74.  
  75. PROCEDURE Real*(VAR x: REAL);
  76. (** Returns the real constant at the current position:
  77.         RealConst = digit {digit}
  78.             [ "." {digit} [ "E" ["+"|"-"] digit {digit} ]]
  79. *)
  80.  
  81. PROCEDURE LongReal*(VAR x: LONGREAL);
  82. (** Returns the long real constant at the current position:
  83.         LongRealConst = digit {digit}
  84.             [ "." {digit} [ ("D"|"E") ["+"|"-"] digit {digit} ]]
  85. *)
  86.  
  87. END In.
  88.