equal
deleted
inserted
replaced
19 |
19 |
20 UnboundedExternalStream comment:' |
20 UnboundedExternalStream comment:' |
21 COPYRIGHT (c) 1994 by Claus Gittinger |
21 COPYRIGHT (c) 1994 by Claus Gittinger |
22 All Rights Reserved |
22 All Rights Reserved |
23 |
23 |
24 $Header: /cvs/stx/stx/libbasic/UnboundedExternalStream.st,v 1.2 1995-02-02 12:22:54 claus Exp $ |
24 $Header: /cvs/stx/stx/libbasic/UnboundedExternalStream.st,v 1.3 1995-03-18 05:06:41 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !UnboundedExternalStream class methodsFor:'documentation'! |
27 !UnboundedExternalStream class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libbasic/UnboundedExternalStream.st,v 1.2 1995-02-02 12:22:54 claus Exp $ |
45 $Header: /cvs/stx/stx/libbasic/UnboundedExternalStream.st,v 1.3 1995-03-18 05:06:41 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
51 This class provides common protocol for all external streams which are |
51 This class provides common protocol for all external streams which are |
52 unbound in size (i.e. have no end). Examples of these are PipeStream, |
52 unbound in size (i.e. have no end). Examples of these are PipeStream, |
53 Sockets, TTYStreams etc. |
53 Sockets, TTYStreams etc. |
54 " |
54 " |
55 ! ! |
|
56 |
|
57 !UnboundedExternalStream primitiveDefinitions! |
|
58 |
|
59 %{ |
|
60 #include <stdio.h> |
|
61 %} |
|
62 |
|
63 ! ! |
|
64 |
|
65 !UnboundedExternalStream methodsFor:'testing'! |
|
66 |
|
67 atEnd |
|
68 "return true, if position is at end" |
|
69 |
|
70 %{ /* NOCONTEXT */ |
|
71 FILE *f; |
|
72 OBJ t; |
|
73 OBJ _true = true; |
|
74 int c; |
|
75 |
|
76 if (_INST(hitEOF) == _true) { |
|
77 RETURN (_true); |
|
78 } |
|
79 /* |
|
80 * has to be redefined, since EOF is never really |
|
81 * reached (although stdio library thinks so ...) |
|
82 */ |
|
83 if ((t = _INST(filePointer)) != nil) { |
|
84 f = MKFD(t); |
|
85 if (feof(f)) { |
|
86 if (ferror(f)) { |
|
87 _INST(hitEOF) = true; |
|
88 RETURN (true); |
|
89 } |
|
90 } |
|
91 RETURN ( false ); |
|
92 } |
|
93 %}. |
|
94 ^ self errorNotOpen |
|
95 ! ! |
55 ! ! |
96 |
56 |
97 !UnboundedExternalStream methodsFor:'redefind basic'! |
57 !UnboundedExternalStream methodsFor:'redefind basic'! |
98 |
58 |
99 size |
59 size |