66 ! ! |
66 ! ! |
67 |
67 |
68 !NonPositionableExternalStream class methodsFor:'instance creation'! |
68 !NonPositionableExternalStream class methodsFor:'instance creation'! |
69 |
69 |
70 forStderr |
70 forStderr |
|
71 "{ Pragma: +optSpace }" |
|
72 |
71 "return a NonPositionableExternalStream object for writing to |
73 "return a NonPositionableExternalStream object for writing to |
72 Unixes standard error output file descriptor" |
74 Unixes standard error output file descriptor" |
73 |
75 |
74 StdErrorStream isNil ifTrue:[ |
76 StdErrorStream isNil ifTrue:[ |
75 StdErrorStream := self basicNew initializeForStderr |
77 StdErrorStream := self basicNew initializeForStderr |
76 ]. |
78 ]. |
77 ^ StdErrorStream |
79 ^ StdErrorStream |
78 ! |
80 ! |
79 |
81 |
80 forStdin |
82 forStdin |
|
83 "{ Pragma: +optSpace }" |
|
84 |
81 "return a NonPositionableExternalStream object for reading from |
85 "return a NonPositionableExternalStream object for reading from |
82 Unixes standard input file descriptor" |
86 Unixes standard input file descriptor" |
83 |
87 |
84 StdInStream isNil ifTrue:[ |
88 StdInStream isNil ifTrue:[ |
85 StdInStream := self basicNew initializeForStdin |
89 StdInStream := self basicNew initializeForStdin |
86 ]. |
90 ]. |
87 ^ StdInStream |
91 ^ StdInStream |
88 ! |
92 ! |
89 |
93 |
90 forStdout |
94 forStdout |
|
95 "{ Pragma: +optSpace }" |
|
96 |
91 "return a NonPositionableExternalStream object for writing to |
97 "return a NonPositionableExternalStream object for writing to |
92 Unixes standard output file descriptor" |
98 Unixes standard output file descriptor" |
93 |
99 |
94 StdOutStream isNil ifTrue:[ |
100 StdOutStream isNil ifTrue:[ |
95 StdOutStream := self basicNew initializeForStdout |
101 StdOutStream := self basicNew initializeForStdout |
98 ! ! |
104 ! ! |
99 |
105 |
100 !NonPositionableExternalStream methodsFor:'error handling'! |
106 !NonPositionableExternalStream methodsFor:'error handling'! |
101 |
107 |
102 positionError |
108 positionError |
|
109 "{ Pragma: +optSpace }" |
|
110 |
103 "notify that this stream has no concept of a position" |
111 "notify that this stream has no concept of a position" |
104 |
112 |
105 ^ PositionErrorSignal raiseRequestWith:self in:thisContext sender |
113 ^ PositionErrorSignal raiseRequestWith:self in:thisContext sender |
106 ! ! |
114 ! ! |
107 |
115 |
108 !NonPositionableExternalStream methodsFor:'positioning'! |
116 !NonPositionableExternalStream methodsFor:'positioning'! |
109 |
117 |
110 position |
118 position |
|
119 "{ Pragma: +optSpace }" |
|
120 |
111 "catch position - there is none here" |
121 "catch position - there is none here" |
112 |
122 |
113 ^ self positionError |
123 ^ self positionError |
114 ! |
124 ! |
115 |
125 |
116 position:aPosition |
126 position:aPosition |
|
127 "{ Pragma: +optSpace }" |
|
128 |
117 "catch position - there is none here" |
129 "catch position - there is none here" |
118 |
130 |
119 ^ self positionError |
131 ^ self positionError |
120 ! |
132 ! |
121 |
133 |
130 ! ! |
142 ! ! |
131 |
143 |
132 !NonPositionableExternalStream methodsFor:'printing & storing'! |
144 !NonPositionableExternalStream methodsFor:'printing & storing'! |
133 |
145 |
134 printOn:aStream |
146 printOn:aStream |
|
147 "{ Pragma: +optSpace }" |
|
148 |
135 "append a printed representation of the receiver on aStream" |
149 "append a printed representation of the receiver on aStream" |
136 |
150 |
|
151 |myName| |
|
152 |
137 self == Stdin ifTrue:[ |
153 self == Stdin ifTrue:[ |
138 aStream nextPutAll:'Stdin'. |
154 myName := 'Stdin'. |
|
155 ] ifFalse:[ |
|
156 self == Stdout ifTrue:[ |
|
157 myName := 'Stdout'. |
|
158 ] ifFalse:[ |
|
159 self == Stderr ifTrue:[ |
|
160 myName := 'Stderr'. |
|
161 ] |
|
162 ] |
|
163 ]. |
|
164 |
|
165 myName notNil ifTrue:[ |
|
166 aStream nextPutAll:myName. |
139 ^ self |
167 ^ self |
140 ]. |
168 ]. |
141 self == Stdout ifTrue:[ |
|
142 aStream nextPutAll:'Stdout'. |
|
143 ^ self |
|
144 ]. |
|
145 self == Stderr ifTrue:[ |
|
146 aStream nextPutAll:'Stderr'. |
|
147 ^ self |
|
148 ]. |
|
149 super printOn:aStream |
169 super printOn:aStream |
150 ! |
170 ! |
151 |
171 |
152 storeOn:aStream |
172 storeOn:aStream |
|
173 "{ Pragma: +optSpace }" |
|
174 |
153 "append a printed representation of the receiver on aStream, from |
175 "append a printed representation of the receiver on aStream, from |
154 which the receiver can be reconstructed." |
176 which the receiver can be reconstructed." |
155 |
177 |
156 ((self == Stdin) |
178 ((self == Stdin) |
157 or:[self == Stdout |
179 or:[self == Stdout |
198 __INST(filePointer) = fp = __MKOBJ(stdout); __STORE(self, fp); |
226 __INST(filePointer) = fp = __MKOBJ(stdout); __STORE(self, fp); |
199 %} |
227 %} |
200 ! |
228 ! |
201 |
229 |
202 reOpen |
230 reOpen |
|
231 "{ Pragma: +optSpace }" |
|
232 |
203 "reopen the stream after an image restart. |
233 "reopen the stream after an image restart. |
204 If I am one of the standard streams, reopen is easy" |
234 If I am one of the standard streams, reopen is easy" |
205 |
235 |
206 (self == StdInStream) ifTrue:[ |
236 (self == StdInStream) ifTrue:[ |
207 ^ self initializeForStdin |
237 ^ self initializeForStdin |