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