File: In.Mod

package info (click to toggle)
oo2c32 1.5.0-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 8,748 kB
  • ctags: 5,415
  • sloc: ansic: 95,007; sh: 473; makefile: 344; perl: 57; lisp: 21
file content (120 lines) | stat: -rw-r--r-- 2,795 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
(*	$Id: In.Mod,v 1.5 1999/10/31 13:53:27 ooc-devel Exp $	*)
MODULE In;

(*
    In -  Simple terminal input of Oberon variables.       
    Copyright (C) 1997 Michael Griebling
 
    This module is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as 
    published by the Free Software Foundation; either version 2 of the
    License, or (at your option) any later version.
 
    This module is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
    License along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*)

IMPORT
  StdChannels, TextRider;
    
VAR
  reader-: TextRider.Reader;
  (* This is the rider used by the input procedures.  Initialized to hold a
     text reader on the `StdChannels.stdin' channel.  Can be changed by 
     calling SetReader.  *)

PROCEDURE Done* () : BOOLEAN;
(* Returns TRUE if the last operation was successful.  *)
  BEGIN
    RETURN (reader. res = TextRider.done)
  END Done;

PROCEDURE ClearError*;
  BEGIN
    reader. ClearError
  END ClearError;


PROCEDURE SetReader* (r: TextRider.Reader);
(* Changes the rider `reader'.  All following calls to input procedures will 
   write to `r'.  *)
  BEGIN
    IF r=NIL THEN reader:=TextRider.ConnectReader(StdChannels.stdin)
    ELSE reader := r
    END
  END SetReader;

PROCEDURE Char* (VAR ch: CHAR);
  BEGIN
    reader. ReadChar (ch);
  END Char;

PROCEDURE Line* (VAR s: ARRAY OF CHAR);
  BEGIN
    reader. ReadLine (s)   
  END Line;

PROCEDURE String* (VAR s: ARRAY OF CHAR);
  BEGIN
    reader. ReadString (s)   
  END String;  
  
PROCEDURE Identifier* (VAR s: ARRAY OF CHAR);
  BEGIN
    reader. ReadIdentifier (s) 
  END Identifier;
  
PROCEDURE Bool* (VAR bool: BOOLEAN);
  BEGIN
    reader. ReadBool (bool)   
  END Bool;
  
PROCEDURE ShortInt* (VAR int: SHORTINT);
  BEGIN
    reader. ReadSInt (int)   
  END ShortInt;
  
PROCEDURE Int* (VAR int: INTEGER);
  BEGIN
    reader. ReadInt (int)  
  END Int;

PROCEDURE LongInt* (VAR lint: LONGINT);
  BEGIN
    reader. ReadLInt (lint)  
  END LongInt;

PROCEDURE Hex* (VAR lint: LONGINT);
  BEGIN
    reader. ReadHex (lint) 
  END Hex;
  
PROCEDURE LongReal* (VAR lreal: LONGREAL);
  BEGIN
    reader. ReadLReal (lreal)    
  END LongReal;

PROCEDURE Real* (VAR real: REAL);
  BEGIN
    reader. ReadReal (real)   
  END Real;
  
PROCEDURE Set* (VAR s: SET);
  BEGIN
    reader. ReadSet (s)    
  END Set;

BEGIN
  SetReader(NIL)
END In.