1
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
202
|
3 |
All Rights Reserved
|
1
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
PositionableStream subclass:#ReadStream
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Streams'
|
|
18 |
!
|
|
19 |
|
|
20 |
ReadStream comment:'
|
88
|
21 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
202
|
22 |
All Rights Reserved
|
93
|
23 |
|
384
|
24 |
$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.16 1995-08-11 03:03:15 claus Exp $
|
88
|
25 |
'!
|
1
|
26 |
|
88
|
27 |
!ReadStream class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
202
|
32 |
All Rights Reserved
|
1
|
33 |
|
88
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
1
|
42 |
|
88
|
43 |
version
|
|
44 |
"
|
384
|
45 |
$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.16 1995-08-11 03:03:15 claus Exp $
|
88
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
ReadStream defines protocol for reading streamwise over collections.
|
|
52 |
"
|
|
53 |
! !
|
1
|
54 |
|
202
|
55 |
!ReadStream methodsFor:'converting'!
|
|
56 |
|
|
57 |
readStream
|
|
58 |
"return a readStream from the receiver. Since this is already
|
|
59 |
a readStream, return self."
|
|
60 |
|
|
61 |
^ self
|
|
62 |
! !
|
|
63 |
|
345
|
64 |
!ReadStream methodsFor:'queries'!
|
|
65 |
|
|
66 |
isReadable
|
|
67 |
^ true
|
|
68 |
! !
|
|
69 |
|
59
|
70 |
!ReadStream methodsFor:'reading'!
|
1
|
71 |
|
|
72 |
peek
|
|
73 |
"return the next element; do NOT advance read pointer.
|
2
|
74 |
return nil, if there is no next element.
|
345
|
75 |
- tuned for a bit more speed on String/ByteArray/Array-Streams"
|
1
|
76 |
|
|
77 |
%{ /* NOCONTEXT */
|
|
78 |
|
|
79 |
REGISTER int pos;
|
|
80 |
unsigned ch;
|
2
|
81 |
OBJ coll;
|
252
|
82 |
OBJ cls, p, l;
|
2
|
83 |
extern OBJ ByteArray;
|
1
|
84 |
|
2
|
85 |
coll = _INST(collection);
|
252
|
86 |
p = _INST(position);
|
|
87 |
l = _INST(readLimit);
|
1
|
88 |
|
252
|
89 |
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) {
|
|
90 |
|
|
91 |
pos = _intVal(p);
|
|
92 |
if (pos > _intVal(l)) {
|
202
|
93 |
RETURN ( nil );
|
|
94 |
}
|
59
|
95 |
|
202
|
96 |
if (pos > 0) {
|
329
|
97 |
cls = __qClass(coll);
|
202
|
98 |
if (cls == String) {
|
|
99 |
if (pos <= _stringSize(coll)) {
|
|
100 |
ch = _stringVal(coll)[pos-1];
|
|
101 |
RETURN ( _MKCHARACTER(ch) );
|
|
102 |
}
|
|
103 |
} else if (cls == ByteArray) {
|
|
104 |
if (pos <= _byteArraySize(coll)) {
|
|
105 |
ch = _ByteArrayInstPtr(coll)->ba_element[pos-1];
|
|
106 |
RETURN ( _MKSMALLINT(ch) );
|
|
107 |
}
|
|
108 |
} else if (cls == Array) {
|
|
109 |
if (pos <= _arraySize(coll)) {
|
|
110 |
RETURN ( _ArrayInstPtr(coll)->a_element[pos-1]);
|
|
111 |
}
|
|
112 |
}
|
|
113 |
}
|
1
|
114 |
}
|
|
115 |
%}
|
|
116 |
.
|
|
117 |
(position > readLimit) ifTrue:[^ nil].
|
|
118 |
^ collection at:position
|
|
119 |
!
|
|
120 |
|
|
121 |
next
|
|
122 |
"return the next element; advance read pointer.
|
2
|
123 |
return nil, if there is no next element.
|
345
|
124 |
- tuned for a bit more speed on String/ByteArray/Array-Streams"
|
1
|
125 |
|
|
126 |
|ret|
|
|
127 |
|
|
128 |
%{ /* NOCONTEXT */
|
|
129 |
|
|
130 |
REGISTER int pos;
|
|
131 |
unsigned ch;
|
252
|
132 |
OBJ coll, p, l;
|
1
|
133 |
|
2
|
134 |
coll = _INST(collection);
|
252
|
135 |
p = _INST(position);
|
|
136 |
l = _INST(readLimit);
|
1
|
137 |
|
252
|
138 |
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) {
|
|
139 |
|
|
140 |
pos = _intVal(p);
|
|
141 |
if (pos > _intVal(l)) {
|
202
|
142 |
RETURN ( nil );
|
|
143 |
}
|
|
144 |
if (pos > 0) {
|
|
145 |
OBJ cls;
|
59
|
146 |
|
329
|
147 |
cls = __qClass(coll);
|
202
|
148 |
if (cls == String) {
|
|
149 |
if (pos <= _stringSize(coll)) {
|
|
150 |
_INST(position) = _MKSMALLINT(pos + 1);
|
|
151 |
ch = _stringVal(coll)[pos-1];
|
|
152 |
RETURN ( _MKCHARACTER(ch) );
|
|
153 |
}
|
|
154 |
} else if (cls == ByteArray) {
|
|
155 |
if (pos <= _byteArraySize(coll)) {
|
|
156 |
_INST(position) = _MKSMALLINT(pos + 1);
|
|
157 |
ch = _ByteArrayInstPtr(coll)->ba_element[pos-1];
|
|
158 |
RETURN ( _MKSMALLINT(ch) );
|
|
159 |
}
|
|
160 |
} else if (cls == Array) {
|
|
161 |
if (pos <= _arraySize(coll)) {
|
|
162 |
_INST(position) = _MKSMALLINT(pos + 1);
|
|
163 |
RETURN ( _ArrayInstPtr(coll)->a_element[pos-1]);
|
|
164 |
}
|
|
165 |
}
|
|
166 |
}
|
1
|
167 |
}
|
|
168 |
%}
|
|
169 |
.
|
|
170 |
(position > readLimit) ifTrue:[^ nil].
|
|
171 |
ret := collection at:position.
|
|
172 |
position := position + 1.
|
|
173 |
^ ret
|
|
174 |
!
|
|
175 |
|
|
176 |
nextPeek
|
|
177 |
"advance read pointer return the peek element.
|
|
178 |
this is equivalent to (self next; peek).
|
59
|
179 |
- tuned for speed on String-Streams for faster scanning"
|
1
|
180 |
|
|
181 |
%{ /* NOCONTEXT */
|
252
|
182 |
OBJ coll, l, p;
|
1
|
183 |
|
59
|
184 |
coll = _INST(collection);
|
252
|
185 |
p = _INST(position);
|
|
186 |
l = _INST(readLimit);
|
|
187 |
|
|
188 |
if (__isString(coll) && __bothSmallInteger(p, l)) {
|
202
|
189 |
REGISTER int pos;
|
|
190 |
unsigned ch;
|
1
|
191 |
|
252
|
192 |
pos = _intVal(p);
|
|
193 |
if (pos > _intVal(l)) {
|
202
|
194 |
RETURN ( nil );
|
|
195 |
}
|
|
196 |
if ((pos > 0) && (pos <= _stringSize(coll))) {
|
|
197 |
_INST(position) = _MKSMALLINT(pos + 1);
|
|
198 |
pos = pos + 1;
|
|
199 |
if (pos <= _stringSize(coll)) {
|
|
200 |
ch = _stringVal(coll)[pos-1];
|
|
201 |
RETURN ( _MKCHARACTER(ch) );
|
|
202 |
}
|
|
203 |
RETURN ( nil );
|
|
204 |
}
|
1
|
205 |
}
|
|
206 |
%}
|
|
207 |
.
|
|
208 |
(position > readLimit) ifTrue:[^ nil].
|
|
209 |
position := position + 1.
|
|
210 |
(position > readLimit) ifTrue:[^ nil].
|
|
211 |
^ collection at:position
|
|
212 |
!
|
|
213 |
|
|
214 |
nextDecimalInteger
|
|
215 |
"read the next integer in radix 10. dont skip whitespace.
|
59
|
216 |
- tuned for speed on String-Streams for faster scanning"
|
1
|
217 |
|
59
|
218 |
|value nextOne|
|
1
|
219 |
%{
|
|
220 |
int pos, limit, sz;
|
13
|
221 |
REGISTER unsigned char *cp;
|
|
222 |
REGISTER unsigned ch;
|
1
|
223 |
int val = 0;
|
252
|
224 |
OBJ coll, p, l;
|
1
|
225 |
|
252
|
226 |
coll = _INST(collection);
|
|
227 |
p = _INST(position);
|
|
228 |
l = _INST(readLimit);
|
|
229 |
|
|
230 |
if (__isString(coll) && __bothSmallInteger(p, l)) {
|
|
231 |
|
|
232 |
pos = _intVal(p);
|
|
233 |
limit = _intVal(l);
|
329
|
234 |
sz = __qSize(coll) - OHDR_SIZE;
|
202
|
235 |
if (sz < limit)
|
|
236 |
limit = sz;
|
252
|
237 |
cp = _stringVal(coll) + pos - 1;
|
1
|
238 |
|
202
|
239 |
for (;;) {
|
|
240 |
if (pos > limit) break;
|
|
241 |
ch = *cp;
|
1
|
242 |
|
202
|
243 |
if ((ch < '0') || (ch > '9')) break;
|
|
244 |
val = val * 10 + (ch - '0');
|
|
245 |
pos++;
|
|
246 |
if (val > (_MAX_INT / 10)) goto oops;
|
|
247 |
cp++;
|
|
248 |
}
|
|
249 |
_INST(position) = _MKSMALLINT(pos);
|
|
250 |
return _MKSMALLINT(val);
|
1
|
251 |
}
|
|
252 |
oops:
|
|
253 |
value = _MKSMALLINT(val);
|
|
254 |
%}
|
|
255 |
.
|
59
|
256 |
"fall-back for non-string streams - we have to continue where
|
|
257 |
above primitive left off, in case of a large integer ...
|
|
258 |
(instead of doing a super nextDecimalInteger)"
|
13
|
259 |
|
59
|
260 |
nextOne := self peek.
|
|
261 |
[nextOne notNil and:[nextOne isDigitRadix:10]] whileTrue:[
|
202
|
262 |
value = (value * 10) + nextOne digitValue.
|
|
263 |
nextOne := self nextPeek
|
1
|
264 |
].
|
|
265 |
^ value
|
|
266 |
!
|
|
267 |
|
252
|
268 |
nextAlphaNumericWord
|
1
|
269 |
"read the next word (i.e. up to non letter-or-digit).
|
|
270 |
return a string containing those characters.
|
59
|
271 |
- tuned for speed on String-Streams for faster scanning"
|
1
|
272 |
%{
|
|
273 |
/* speedup, if collection is a string */
|
|
274 |
|
|
275 |
int pos, limit, sz;
|
|
276 |
int len;
|
13
|
277 |
char buffer[256];
|
|
278 |
REGISTER unsigned char *cp;
|
|
279 |
REGISTER unsigned ch;
|
252
|
280 |
OBJ coll, p, l;
|
1
|
281 |
|
252
|
282 |
coll = _INST(collection);
|
|
283 |
p = _INST(position);
|
|
284 |
l = _INST(readLimit);
|
|
285 |
|
|
286 |
if (__isString(coll) && __bothSmallInteger(p, l)) {
|
|
287 |
|
|
288 |
pos = _intVal(p);
|
|
289 |
limit = _intVal(l);
|
329
|
290 |
sz = __qSize(coll) - OHDR_SIZE;
|
202
|
291 |
if (sz < limit)
|
|
292 |
limit = sz;
|
252
|
293 |
cp = _stringVal(coll) + pos - 1;
|
1
|
294 |
|
202
|
295 |
for (;;) {
|
|
296 |
if (pos > limit) break;
|
|
297 |
ch = *cp;
|
1
|
298 |
|
202
|
299 |
if (ch > ' ') break;
|
|
300 |
if ((ch != ' ') && (ch != '\t') && (ch != '\r')
|
|
301 |
&& (ch != '\n') && (ch != 0x0b)) break;
|
|
302 |
cp++;
|
|
303 |
pos++;
|
|
304 |
}
|
1
|
305 |
|
202
|
306 |
len = 0;
|
|
307 |
for (;;) {
|
|
308 |
if (pos > limit) break;
|
|
309 |
ch = *cp & 0xFF;
|
1
|
310 |
|
202
|
311 |
if (! (((ch >= 'a') && (ch <= 'z')) ||
|
|
312 |
((ch >= 'A') && (ch <= 'Z')) ||
|
|
313 |
((ch >= '0') && (ch <= '9'))))
|
|
314 |
break;
|
|
315 |
buffer[len++] = ch;
|
|
316 |
if (len >= (sizeof(buffer)-1)) {
|
|
317 |
/* emergency */
|
|
318 |
break;
|
|
319 |
}
|
|
320 |
pos++;
|
|
321 |
cp++;
|
|
322 |
}
|
1
|
323 |
|
202
|
324 |
_INST(position) = _MKSMALLINT(pos);
|
|
325 |
buffer[len] = '\0';
|
|
326 |
RETURN ( (len != 0) ? _MKSTRING(buffer COMMA_CON) : nil );
|
1
|
327 |
}
|
|
328 |
%}
|
|
329 |
.
|
252
|
330 |
^ super nextAlphaNumericWord
|
1
|
331 |
!
|
|
332 |
|
|
333 |
nextSymbol
|
|
334 |
"read the next selector-symbol (i.e. up to non letter-or-digit).
|
|
335 |
return a string containing those characters.
|
59
|
336 |
- tuned for speed on String-Streams for faster scanning"
|
1
|
337 |
%{
|
|
338 |
int pos, limit, sz;
|
|
339 |
int len;
|
13
|
340 |
char buffer[256];
|
|
341 |
REGISTER unsigned char *cp;
|
|
342 |
REGISTER unsigned ch;
|
252
|
343 |
OBJ coll, p, l;
|
1
|
344 |
|
252
|
345 |
coll = _INST(collection);
|
|
346 |
p = _INST(position);
|
|
347 |
l = _INST(readLimit);
|
|
348 |
|
|
349 |
if (__isString(coll) && __bothSmallInteger(p, l)) {
|
|
350 |
|
|
351 |
pos = _intVal(p);
|
|
352 |
limit = _intVal(l);
|
329
|
353 |
sz = __qSize(coll) - OHDR_SIZE;
|
202
|
354 |
if (sz < limit)
|
|
355 |
limit = sz;
|
252
|
356 |
cp = _stringVal(coll) + pos - 1;
|
1
|
357 |
|
202
|
358 |
len = 0;
|
|
359 |
for (;;) {
|
|
360 |
if (pos > limit) break;
|
|
361 |
ch = *cp;
|
1
|
362 |
|
202
|
363 |
if (! (((ch >= 'a') && (ch <= 'z')) ||
|
|
364 |
((ch >= 'A') && (ch <= 'Z')) ||
|
|
365 |
((ch >= '0') && (ch <= '9')) ||
|
|
366 |
(ch == ':')))
|
|
367 |
break;
|
|
368 |
buffer[len++] = ch;
|
|
369 |
if (len >= (sizeof(buffer)-1)) {
|
|
370 |
/* emergency */
|
|
371 |
break;
|
|
372 |
}
|
|
373 |
pos++;
|
|
374 |
cp++;
|
|
375 |
}
|
1
|
376 |
|
202
|
377 |
_INST(position) = _MKSMALLINT(pos);
|
|
378 |
buffer[len] = '\0';
|
|
379 |
RETURN ( (len != 0) ? _MKSTRING(buffer COMMA_CON) : nil );
|
1
|
380 |
}
|
|
381 |
%}
|
|
382 |
.
|
|
383 |
^ super nextSymbol
|
|
384 |
!
|
|
385 |
|
59
|
386 |
skipThrough:anObject
|
2
|
387 |
"skip all objects up-to and including anObject, return anObject on success,
|
59
|
388 |
nil if end-of-stream is reached before.
|
|
389 |
On success, the next read operation will return the element after anObject.
|
2
|
390 |
- reimplemented for speed on String-Streams for faster scanning"
|
1
|
391 |
|
|
392 |
%{ /* NOCONTEXT */
|
252
|
393 |
OBJ coll, p, l;
|
1
|
394 |
|
59
|
395 |
coll = _INST(collection);
|
252
|
396 |
p = _INST(position);
|
|
397 |
l = _INST(readLimit);
|
|
398 |
|
59
|
399 |
if (__isString(coll)
|
|
400 |
&& __isCharacter(anObject)
|
252
|
401 |
&& __bothSmallInteger(p, l)) {
|
202
|
402 |
REGISTER unsigned char *chars;
|
|
403 |
REGISTER int pos, limit;
|
|
404 |
unsigned ch;
|
|
405 |
int sz;
|
1
|
406 |
|
252
|
407 |
pos = _intVal(p);
|
202
|
408 |
if (pos <= 0) {
|
|
409 |
RETURN ( nil );
|
|
410 |
}
|
1
|
411 |
|
252
|
412 |
limit = _intVal(l);
|
202
|
413 |
sz = _stringSize(coll);
|
|
414 |
if (limit > sz) limit = sz;
|
1
|
415 |
|
202
|
416 |
chars = (unsigned char *)(_stringVal(coll) + pos - 1);
|
|
417 |
ch = _intVal(_characterVal(anObject)) & 0xFF;
|
|
418 |
while (pos < limit) {
|
|
419 |
if (*chars == ch) {
|
|
420 |
ch = *++chars;
|
|
421 |
pos++;
|
|
422 |
_INST(position) = _MKSMALLINT(pos);
|
|
423 |
RETURN ( anObject );
|
|
424 |
}
|
|
425 |
chars++;
|
|
426 |
pos++;
|
|
427 |
}
|
|
428 |
RETURN ( nil );
|
1
|
429 |
}
|
|
430 |
%}
|
|
431 |
.
|
59
|
432 |
^ super skipThrough:anObject
|
1
|
433 |
!
|
|
434 |
|
|
435 |
skipSeparators
|
|
436 |
"skip all whitespace; next will return next non-white-space element.
|
59
|
437 |
Return the peeked character or nil, if the end-of-stream was reached.
|
2
|
438 |
- reimplemented for speed on String-Streams for faster scanning"
|
1
|
439 |
|
|
440 |
%{ /* NOCONTEXT */
|
252
|
441 |
OBJ coll, p, l;
|
1
|
442 |
|
252
|
443 |
coll = _INST(collection);
|
|
444 |
p = _INST(position);
|
|
445 |
l = _INST(readLimit);
|
|
446 |
|
|
447 |
if (__isString(coll) && __bothSmallInteger(p, l)) {
|
202
|
448 |
REGISTER unsigned char *chars;
|
|
449 |
REGISTER unsigned ch;
|
|
450 |
REGISTER int pos;
|
|
451 |
int limit;
|
1
|
452 |
|
252
|
453 |
pos = _intVal(p);
|
202
|
454 |
if (pos <= 0) {
|
|
455 |
RETURN ( nil );
|
|
456 |
}
|
1
|
457 |
|
252
|
458 |
limit = _intVal(l);
|
329
|
459 |
if (limit > (__qSize(coll) - OHDR_SIZE))
|
|
460 |
limit = __qSize(coll) - OHDR_SIZE;
|
1
|
461 |
|
252
|
462 |
chars = (unsigned char *)(_stringVal(coll) + pos - 1);
|
202
|
463 |
while (pos <= limit) {
|
|
464 |
ch = *chars++;
|
|
465 |
if ((ch != ' ') && (ch != '\t') && (ch != '\r')
|
|
466 |
&& (ch != '\n') && (ch != 0x0B)) {
|
|
467 |
_INST(position) = _MKSMALLINT(pos);
|
|
468 |
RETURN ( _MKCHARACTER(ch) );
|
|
469 |
}
|
|
470 |
pos++;
|
|
471 |
}
|
|
472 |
_INST(position) = _MKSMALLINT(pos);
|
|
473 |
RETURN ( nil );
|
1
|
474 |
}
|
|
475 |
%}
|
|
476 |
.
|
|
477 |
^ super skipSeparators
|
|
478 |
!
|
|
479 |
|
13
|
480 |
skipSeparatorsExceptCR
|
|
481 |
"skip all whitespace except newlines;
|
202
|
482 |
next will return next non-white-space element.
|
|
483 |
- reimplemented for speed on String-Streams for faster scanning"
|
|
484 |
|
13
|
485 |
%{ /* NOCONTEXT */
|
|
486 |
|
252
|
487 |
OBJ coll, p, l;
|
|
488 |
|
|
489 |
coll = _INST(collection);
|
|
490 |
p = _INST(position);
|
|
491 |
l = _INST(readLimit);
|
|
492 |
|
|
493 |
if (__isString(coll) && __bothSmallInteger(p, l)) {
|
202
|
494 |
REGISTER unsigned char *chars;
|
|
495 |
REGISTER unsigned ch;
|
|
496 |
REGISTER int pos;
|
|
497 |
int limit;
|
13
|
498 |
|
252
|
499 |
pos = _intVal(p);
|
202
|
500 |
if (pos <= 0) {
|
|
501 |
RETURN ( nil );
|
|
502 |
}
|
13
|
503 |
|
252
|
504 |
limit = _intVal(l);
|
329
|
505 |
if (limit > (__qSize(coll) - OHDR_SIZE))
|
|
506 |
limit = __qSize(coll) - OHDR_SIZE;
|
13
|
507 |
|
252
|
508 |
chars = (unsigned char *)(_stringVal(coll) + pos - 1);
|
202
|
509 |
while (pos <= limit) {
|
|
510 |
ch = *chars++;
|
|
511 |
if ((ch != ' ') && (ch != '\t') && (ch != '\r') && (ch != 0x0B)) {
|
|
512 |
_INST(position) = _MKSMALLINT(pos);
|
|
513 |
RETURN ( _MKCHARACTER(ch) );
|
|
514 |
}
|
|
515 |
pos++;
|
|
516 |
}
|
|
517 |
_INST(position) = _MKSMALLINT(pos);
|
|
518 |
RETURN ( nil );
|
13
|
519 |
}
|
|
520 |
%}
|
|
521 |
.
|
|
522 |
^ super skipSeparatorsExceptCR
|
|
523 |
!
|
|
524 |
|
1
|
525 |
skipToAll:aCollection
|
|
526 |
"skip for the sequence given by the argument, aCollection;
|
|
527 |
return nil if not found, self otherwise. On a successful match, next read
|
|
528 |
will return elements of aCollection."
|
|
529 |
|
|
530 |
|oldPos buffer l first idx|
|
|
531 |
|
|
532 |
oldPos := self position.
|
|
533 |
l := aCollection size.
|
|
534 |
first := aCollection at:1.
|
|
535 |
[self atEnd] whileFalse:[
|
202
|
536 |
buffer := self next:l.
|
|
537 |
buffer = aCollection ifTrue:[
|
|
538 |
self position:(self position - l).
|
|
539 |
^ self
|
|
540 |
].
|
|
541 |
idx := buffer indexOf:first startingAt:2.
|
|
542 |
idx == 0 ifFalse:[
|
|
543 |
self position:(self position - l + idx - 1)
|
|
544 |
]
|
1
|
545 |
].
|
|
546 |
self position:oldPos.
|
|
547 |
^ nil
|
|
548 |
|
59
|
549 |
"
|
|
550 |
|s|
|
1
|
551 |
s := ReadStream on:'12345678901234567890'.
|
|
552 |
s skipToAll:'901'.
|
59
|
553 |
s next:4
|
|
554 |
"
|
1
|
555 |
! !
|
|
556 |
|
59
|
557 |
!ReadStream methodsFor:'writing'!
|
1
|
558 |
|
|
559 |
nextPut:anElement
|
10
|
560 |
"catch write access to readstreams - report an error"
|
|
561 |
|
|
562 |
self shouldNotImplement
|
1
|
563 |
! !
|