author | Claus Gittinger <cg@exept.de> |
Fri, 08 Jul 2005 19:15:03 +0200 | |
changeset 8913 | b9498d27a554 |
parent 8614 | 88421fbd4ab6 |
child 8914 | acac69ff65b0 |
permissions | -rw-r--r-- |
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 |
||
5810 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
1 | 15 |
PositionableStream subclass:#ReadStream |
970
3b59c9b38dbb
ST80 compatibility: generate signal at end of stream when instance variable
Stefan Vogel <sv@exept.de>
parents:
829
diff
changeset
|
16 |
instanceVariableNames:'' |
3b59c9b38dbb
ST80 compatibility: generate signal at end of stream when instance variable
Stefan Vogel <sv@exept.de>
parents:
829
diff
changeset
|
17 |
classVariableNames:'' |
3b59c9b38dbb
ST80 compatibility: generate signal at end of stream when instance variable
Stefan Vogel <sv@exept.de>
parents:
829
diff
changeset
|
18 |
poolDictionaries:'' |
3b59c9b38dbb
ST80 compatibility: generate signal at end of stream when instance variable
Stefan Vogel <sv@exept.de>
parents:
829
diff
changeset
|
19 |
category:'Streams' |
1 | 20 |
! |
21 |
||
2162
7e1601f633b6
ff is a separator too (in #skipSeparators*)
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
22 |
!ReadStream class methodsFor:'documentation'! |
88 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
202 | 27 |
All Rights Reserved |
1 | 28 |
|
88 | 29 |
This software is furnished under a license and may be used |
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
1 | 37 |
|
88 | 38 |
documentation |
39 |
" |
|
40 |
ReadStream defines protocol for reading streamwise over collections. |
|
1295 | 41 |
|
42 |
[author:] |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
43 |
Claus Gittinger |
1295 | 44 |
|
88 | 45 |
" |
46 |
! ! |
|
1 | 47 |
|
202 | 48 |
!ReadStream methodsFor:'converting'! |
49 |
||
50 |
readStream |
|
51 |
"return a readStream from the receiver. Since this is already |
|
52 |
a readStream, return self." |
|
53 |
||
54 |
^ self |
|
8140
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
55 |
! |
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
56 |
|
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
57 |
readStreamOrNil |
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
58 |
"return a readStream from the receiver. Since this is already |
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
59 |
a readStream, return self. |
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
60 |
|
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
61 |
This method has been defined for protocol copmatibility with Filename" |
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
62 |
|
7cc7ac5f29ca
Define #xxxStreamOrNil methods.
Stefan Vogel <sv@exept.de>
parents:
8098
diff
changeset
|
63 |
^ self |
202 | 64 |
! ! |
65 |
||
1400 | 66 |
!ReadStream methodsFor:'emphasis'! |
67 |
||
68 |
emphasis |
|
69 |
"return the emphasis of the current (i.e. next returned by #next) |
|
70 |
element. Streams on a string will return nil for all elements. |
|
71 |
Streams on collections which nothing at all about emphasises, |
|
72 |
will report an error." |
|
73 |
||
7114 | 74 |
^ collection emphasisAt:(position - ZeroPosition + 1). |
1400 | 75 |
|
76 |
" |
|
77 |
|t s| |
|
78 |
||
79 |
t := 'hello world' asText |
|
7114 | 80 |
emphasizeFrom:1 to:5 with:#bold; |
81 |
emphasizeFrom:7 to:11 with:#italic. |
|
1400 | 82 |
|
83 |
s := t readStream. |
|
84 |
[s atEnd] whileFalse:[ |
|
7114 | 85 |
Transcript show:(s emphasis); show:' '. |
86 |
Transcript show:''''; show:(s next); showCR:''''. |
|
1400 | 87 |
]. |
88 |
" |
|
89 |
||
90 |
"Modified: 15.5.1996 / 17:30:33 / cg" |
|
91 |
! ! |
|
92 |
||
345 | 93 |
!ReadStream methodsFor:'queries'! |
94 |
||
5310 | 95 |
copyFrom:beginning to:end |
96 |
^ collection copyFrom:beginning to:end |
|
97 |
! |
|
98 |
||
345 | 99 |
isReadable |
2997 | 100 |
"return true, if reading is supported by the recevier. |
101 |
Here, true is always returned." |
|
102 |
||
345 | 103 |
^ true |
2997 | 104 |
|
105 |
"Modified: 4.10.1997 / 17:59:21 / cg" |
|
1665
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
106 |
! |
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
107 |
|
6315 | 108 |
isWritable |
109 |
"return true, if writing is supported by the recevier. |
|
110 |
This has to be redefined in concrete subclasses." |
|
111 |
||
112 |
^ false |
|
113 |
! |
|
114 |
||
1665
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
115 |
size |
2997 | 116 |
"return the number of elements in the streamed collection." |
117 |
||
1665
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
118 |
^ collection size |
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
119 |
|
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
120 |
"Created: 13.9.1996 / 18:14:35 / cg" |
2997 | 121 |
"Modified: 4.10.1997 / 17:59:45 / cg" |
345 | 122 |
! ! |
123 |
||
59 | 124 |
!ReadStream methodsFor:'reading'! |
1 | 125 |
|
126 |
next |
|
127 |
"return the next element; advance read pointer. |
|
2 | 128 |
return nil, if there is no next element. |
345 | 129 |
- tuned for a bit more speed on String/ByteArray/Array-Streams" |
1 | 130 |
|
131 |
|ret| |
|
132 |
||
133 |
%{ /* NOCONTEXT */ |
|
134 |
||
135 |
REGISTER int pos; |
|
136 |
unsigned ch; |
|
252 | 137 |
OBJ coll, p, l; |
1 | 138 |
|
1133 | 139 |
coll = __INST(collection); |
140 |
p = __INST(position); |
|
141 |
l = __INST(readLimit); |
|
1 | 142 |
|
252 | 143 |
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) { |
144 |
||
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
145 |
pos = __intVal(p); |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
146 |
/* make 1-based */ |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
147 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
148 |
if (pos > 0 && pos <= __intVal(l)) { |
8614 | 149 |
OBJ cls, ret; |
59 | 150 |
|
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
151 |
cls = __qClass(coll); |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
152 |
if (cls == @global(String)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
153 |
if (pos <= __stringSize(coll)) { |
8614 | 154 |
ch = __stringVal(coll)[pos-1]; |
155 |
ret = __MKCHARACTER(ch); |
|
8913 | 156 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
8614 | 157 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
158 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
159 |
} else if (cls == @global(ByteArray)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
160 |
if (pos <= __byteArraySize(coll)) { |
8614 | 161 |
ch = __ByteArrayInstPtr(coll)->ba_element[pos-1]; |
8913 | 162 |
ret = __mkSmallInteger(ch); |
163 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
|
8614 | 164 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
165 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
166 |
} else if (cls == @global(Unicode16String)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
167 |
if (pos <= __unicode16StringSize(coll)) { |
8614 | 168 |
ch = __Unicode16StringInstPtr(coll)->s_element[pos-1]; |
169 |
ret = __MKUCHARACTER(ch); |
|
8913 | 170 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
8614 | 171 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
172 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
173 |
} else if (cls == @global(Array)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
174 |
if (pos <= __arraySize(coll)) { |
8614 | 175 |
ret = __ArrayInstPtr(coll)->a_element[pos-1]; |
8913 | 176 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
8614 | 177 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
178 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
179 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
180 |
} |
1 | 181 |
} |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
182 |
%}. |
8614 | 183 |
((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
184 |
ret := collection at:(position + 1 - ZeroPosition). |
1 | 185 |
position := position + 1. |
186 |
^ ret |
|
187 |
! |
|
188 |
||
252 | 189 |
nextAlphaNumericWord |
1 | 190 |
"read the next word (i.e. up to non letter-or-digit). |
191 |
return a string containing those characters. |
|
3112
ccf7121ddae8
nextAlphaNumericWord changed
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
192 |
Skips any non-alphanumeric chars first. |
59 | 193 |
- tuned for speed on String-Streams for faster scanning" |
1 | 194 |
%{ |
195 |
/* speedup, if collection is a string */ |
|
196 |
||
197 |
int pos, limit, sz; |
|
198 |
int len; |
|
13 | 199 |
char buffer[256]; |
200 |
REGISTER unsigned char *cp; |
|
201 |
REGISTER unsigned ch; |
|
252 | 202 |
OBJ coll, p, l; |
1 | 203 |
|
1133 | 204 |
coll = __INST(collection); |
205 |
p = __INST(position); |
|
206 |
l = __INST(readLimit); |
|
252 | 207 |
|
208 |
if (__isString(coll) && __bothSmallInteger(p, l)) { |
|
209 |
||
1133 | 210 |
pos = __intVal(p); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
211 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
212 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
213 |
|
1133 | 214 |
limit = __intVal(l); |
329 | 215 |
sz = __qSize(coll) - OHDR_SIZE; |
202 | 216 |
if (sz < limit) |
217 |
limit = sz; |
|
1133 | 218 |
cp = __stringVal(coll) + pos - 1; |
1 | 219 |
|
202 | 220 |
for (;;) { |
221 |
if (pos > limit) break; |
|
222 |
ch = *cp; |
|
1 | 223 |
|
3112
ccf7121ddae8
nextAlphaNumericWord changed
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
224 |
if (((ch >= 'a') && (ch <= 'z')) || |
ccf7121ddae8
nextAlphaNumericWord changed
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
225 |
((ch >= 'A') && (ch <= 'Z')) || |
ccf7121ddae8
nextAlphaNumericWord changed
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
226 |
((ch >= '0') && (ch <= '9'))) |
ccf7121ddae8
nextAlphaNumericWord changed
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
227 |
break; |
202 | 228 |
cp++; |
229 |
pos++; |
|
230 |
} |
|
1 | 231 |
|
202 | 232 |
len = 0; |
233 |
for (;;) { |
|
234 |
if (pos > limit) break; |
|
235 |
ch = *cp & 0xFF; |
|
1 | 236 |
|
202 | 237 |
if (! (((ch >= 'a') && (ch <= 'z')) || |
238 |
((ch >= 'A') && (ch <= 'Z')) || |
|
239 |
((ch >= '0') && (ch <= '9')))) |
|
240 |
break; |
|
241 |
buffer[len++] = ch; |
|
242 |
if (len >= (sizeof(buffer)-1)) { |
|
243 |
/* emergency */ |
|
244 |
break; |
|
245 |
} |
|
246 |
pos++; |
|
247 |
cp++; |
|
248 |
} |
|
1 | 249 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
250 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
251 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 252 |
__INST(position) = __mkSmallInteger(pos); |
202 | 253 |
buffer[len] = '\0'; |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1665
diff
changeset
|
254 |
RETURN ( (len != 0) ? __MKSTRING_L(buffer, len) : nil ); |
1 | 255 |
} |
256 |
%} |
|
257 |
. |
|
252 | 258 |
^ super nextAlphaNumericWord |
1 | 259 |
! |
260 |
||
1665
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
261 |
nextByte |
4826
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
262 |
"return the next element; advance read pointer. |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
263 |
return nil, if there is no next element. |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
264 |
- tuned for a bit more speed on String/ByteArray/Array-Streams" |
1665
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
265 |
|
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
266 |
|ret| |
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
267 |
|
4826
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
268 |
%{ /* NOCONTEXT */ |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
269 |
|
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
270 |
REGISTER int pos; |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
271 |
unsigned ch; |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
272 |
OBJ coll, p, l; |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
273 |
|
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
274 |
coll = __INST(collection); |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
275 |
p = __INST(position); |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
276 |
l = __INST(readLimit); |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
277 |
|
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
278 |
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) { |
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
279 |
|
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
280 |
pos = __intVal(p); |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
281 |
/* make 1-based */ |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
282 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
283 |
if (pos > 0 && pos <= __intVal(l)) { |
8614 | 284 |
OBJ cls, ret; |
4826
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
285 |
|
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
286 |
cls = __qClass(coll); |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
287 |
if (cls == @global(String)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
288 |
if (pos <= __stringSize(coll)) { |
8614 | 289 |
ch = __stringVal(coll)[pos-1]; |
8913 | 290 |
ret = __mkSmallInteger(ch); |
291 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
|
8614 | 292 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
293 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
294 |
} else if (cls == @global(ByteArray)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
295 |
if (pos <= __byteArraySize(coll)) { |
8614 | 296 |
ch = __ByteArrayInstPtr(coll)->ba_element[pos-1]; |
8913 | 297 |
ret = __mkSmallInteger(ch); |
298 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
|
8614 | 299 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
300 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
301 |
} else if (cls == @global(Array)) { |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
302 |
if (pos <= __arraySize(coll)) { |
8614 | 303 |
ret = __ArrayInstPtr(coll)->a_element[pos-1]; |
8913 | 304 |
__INST(position) = __mkSmallInteger(__intVal(__INST(position)) + 1); |
8614 | 305 |
RETURN ( ret ); |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
306 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
307 |
} |
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
308 |
} |
4826
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
309 |
} |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
310 |
%}. |
8614 | 311 |
((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
312 |
ret := collection at:(position + 1 -ZeroPosition). |
4826
ff30434f0feb
#nextByte does return an integer, even when operating on a
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
313 |
position := position + 1. |
8098
8d1d5cd8529b
nextByte should (at least) return integer when reading from a string-stream
Claus Gittinger <cg@exept.de>
parents:
7483
diff
changeset
|
314 |
^ ret asInteger |
1665
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
315 |
! |
928e9a308cea
added ExternalStream compatibility protocol
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
316 |
|
8530
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
317 |
nextBytes:numBytes into:aCollection startingAt:initialIndex |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
318 |
"return the next numBytes from the stream. If the end is |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
319 |
reached before, only that many bytes are copyied into the |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
320 |
collection. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
321 |
Returns the number of bytes that have been actually read. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
322 |
The receiver must support reading of binary bytes. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
323 |
|
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
324 |
Notice: this method is provided here for protocol completeness |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
325 |
with externalStreams - it is normally not used with other |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
326 |
streams." |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
327 |
|
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
328 |
(initialIndex + numBytes - 1) <= aCollection size ifTrue:[ |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
329 |
(position + numBytes - 1) <= readLimit ifTrue:[ |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
330 |
collection class isBytes ifTrue:[ |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
331 |
aCollection class isBytes ifTrue:[ |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
332 |
aCollection |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
333 |
replaceBytesFrom:initialIndex to:(initialIndex + numBytes - 1) |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
334 |
with:collection startingAt:position+1. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
335 |
position := position + numBytes. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
336 |
^ numBytes |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
337 |
]. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
338 |
]. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
339 |
]. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
340 |
]. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
341 |
^ super nextBytes:numBytes into:aCollection startingAt:initialIndex |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
342 |
|
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
343 |
" |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
344 |
|s n buffer| |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
345 |
|
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
346 |
buffer := ByteArray new:10. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
347 |
|
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
348 |
s := ReadStream on:#[1 2 3 4 5 6 7 8 9]. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
349 |
s next:3. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
350 |
n := s nextBytes:9 into:buffer startingAt:1. |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
351 |
Transcript showCR:('n = %1; buffer = <%2>' bindWith:n with:buffer) |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
352 |
" |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
353 |
! |
edcadeea17a1
tuned reading long strings & byteArrays from byteArray streams.
Claus Gittinger <cg@exept.de>
parents:
8140
diff
changeset
|
354 |
|
611 | 355 |
nextDecimalInteger |
356 |
"read the next integer in radix 10. dont skip whitespace. |
|
357 |
- tuned for speed on String-Streams for faster scanning" |
|
358 |
||
359 |
|value nextOne| |
|
360 |
%{ |
|
361 |
int pos, limit, sz; |
|
362 |
REGISTER unsigned char *cp; |
|
363 |
REGISTER unsigned ch; |
|
364 |
int val = 0; |
|
365 |
OBJ coll, p, l; |
|
366 |
||
1133 | 367 |
coll = __INST(collection); |
368 |
p = __INST(position); |
|
369 |
l = __INST(readLimit); |
|
611 | 370 |
|
371 |
if (__isString(coll) && __bothSmallInteger(p, l)) { |
|
372 |
||
1133 | 373 |
pos = __intVal(p); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
374 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
375 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
1133 | 376 |
limit = __intVal(l); |
611 | 377 |
sz = __qSize(coll) - OHDR_SIZE; |
378 |
if (sz < limit) |
|
379 |
limit = sz; |
|
1133 | 380 |
cp = __stringVal(coll) + pos - 1; |
611 | 381 |
|
382 |
for (;;) { |
|
383 |
if (pos > limit) break; |
|
384 |
ch = *cp; |
|
385 |
||
386 |
if ((ch < '0') || (ch > '9')) break; |
|
387 |
val = val * 10 + (ch - '0'); |
|
388 |
pos++; |
|
389 |
if (val > (_MAX_INT / 10)) goto oops; |
|
390 |
cp++; |
|
391 |
} |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
392 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
393 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 394 |
__INST(position) = __mkSmallInteger(pos); |
395 |
RETURN (__mkSmallInteger(val)); |
|
611 | 396 |
} |
397 |
oops: |
|
8913 | 398 |
value = __mkSmallInteger(val); |
611 | 399 |
%} |
400 |
. |
|
401 |
"fall-back for non-string streams - we have to continue where |
|
402 |
above primitive left off, in case of a large integer ... |
|
403 |
(instead of doing a super nextDecimalInteger)" |
|
404 |
||
405 |
nextOne := self peek. |
|
406 |
[nextOne notNil and:[nextOne isDigitRadix:10]] whileTrue:[ |
|
407 |
value = (value * 10) + nextOne digitValue. |
|
408 |
nextOne := self nextPeek |
|
409 |
]. |
|
410 |
^ value |
|
411 |
! |
|
412 |
||
413 |
nextPeek |
|
414 |
"advance read pointer return the peek element. |
|
415 |
this is equivalent to (self next; peek). |
|
416 |
- tuned for speed on String-Streams for faster scanning" |
|
417 |
||
418 |
%{ /* NOCONTEXT */ |
|
419 |
OBJ coll, l, p; |
|
420 |
||
1133 | 421 |
coll = __INST(collection); |
422 |
p = __INST(position); |
|
423 |
l = __INST(readLimit); |
|
611 | 424 |
|
425 |
if (__isString(coll) && __bothSmallInteger(p, l)) { |
|
8614 | 426 |
REGISTER int pos; |
427 |
unsigned ch; |
|
611 | 428 |
|
8614 | 429 |
pos = __intVal(p); |
430 |
/* make 1-based */ |
|
431 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
|
432 |
if ((pos > 0) && (pos < __intVal(l)) && (pos < __stringSize(coll))) { |
|
433 |
pos = pos + 1; |
|
434 |
ch = __stringVal(coll)[pos-1]; |
|
435 |
/* make ZeroPosition-based */ |
|
436 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
|
8913 | 437 |
__INST(position) = __mkSmallInteger(pos); |
8614 | 438 |
RETURN ( __MKCHARACTER(ch) ); |
439 |
} |
|
611 | 440 |
} |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
441 |
%}. |
8614 | 442 |
((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
611 | 443 |
position := position + 1. |
8614 | 444 |
((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
445 |
^ collection at:(position + 1 - ZeroPosition) |
611 | 446 |
! |
447 |
||
1 | 448 |
nextSymbol |
449 |
"read the next selector-symbol (i.e. up to non letter-or-digit). |
|
450 |
return a string containing those characters. |
|
59 | 451 |
- tuned for speed on String-Streams for faster scanning" |
1 | 452 |
%{ |
453 |
int pos, limit, sz; |
|
454 |
int len; |
|
13 | 455 |
char buffer[256]; |
456 |
REGISTER unsigned char *cp; |
|
457 |
REGISTER unsigned ch; |
|
252 | 458 |
OBJ coll, p, l; |
1 | 459 |
|
1133 | 460 |
coll = __INST(collection); |
461 |
p = __INST(position); |
|
462 |
l = __INST(readLimit); |
|
252 | 463 |
|
464 |
if (__isString(coll) && __bothSmallInteger(p, l)) { |
|
465 |
||
1133 | 466 |
pos = __intVal(p); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
467 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
468 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
1133 | 469 |
limit = __intVal(l); |
329 | 470 |
sz = __qSize(coll) - OHDR_SIZE; |
202 | 471 |
if (sz < limit) |
472 |
limit = sz; |
|
1133 | 473 |
cp = __stringVal(coll) + pos - 1; |
1 | 474 |
|
202 | 475 |
len = 0; |
476 |
for (;;) { |
|
477 |
if (pos > limit) break; |
|
478 |
ch = *cp; |
|
1 | 479 |
|
202 | 480 |
if (! (((ch >= 'a') && (ch <= 'z')) || |
481 |
((ch >= 'A') && (ch <= 'Z')) || |
|
482 |
((ch >= '0') && (ch <= '9')) || |
|
483 |
(ch == ':'))) |
|
484 |
break; |
|
485 |
buffer[len++] = ch; |
|
486 |
if (len >= (sizeof(buffer)-1)) { |
|
487 |
/* emergency */ |
|
488 |
break; |
|
489 |
} |
|
490 |
pos++; |
|
491 |
cp++; |
|
492 |
} |
|
1 | 493 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
494 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
495 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 496 |
__INST(position) = __mkSmallInteger(pos); |
202 | 497 |
buffer[len] = '\0'; |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1665
diff
changeset
|
498 |
RETURN ( (len != 0) ? __MKSTRING_L(buffer, len) : nil ); |
1 | 499 |
} |
500 |
%} |
|
501 |
. |
|
502 |
^ super nextSymbol |
|
503 |
! |
|
504 |
||
611 | 505 |
peek |
506 |
"return the next element; do NOT advance read pointer. |
|
507 |
return nil, if there is no next element. |
|
508 |
- tuned for a bit more speed on String/ByteArray/Array-Streams" |
|
1 | 509 |
|
510 |
%{ /* NOCONTEXT */ |
|
611 | 511 |
|
512 |
REGISTER int pos; |
|
513 |
unsigned ch; |
|
514 |
OBJ coll; |
|
515 |
OBJ cls, p, l; |
|
1 | 516 |
|
1133 | 517 |
coll = __INST(collection); |
518 |
p = __INST(position); |
|
519 |
l = __INST(readLimit); |
|
252 | 520 |
|
611 | 521 |
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) { |
1 | 522 |
|
8614 | 523 |
pos = __intVal(p); |
524 |
/* make 1-based */ |
|
525 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
|
526 |
if (pos <= __intVal(l) && pos > 0) { |
|
527 |
cls = __qClass(coll); |
|
528 |
if (cls == @global(String)) { |
|
529 |
if (pos <= __stringSize(coll)) { |
|
530 |
ch = __stringVal(coll)[pos-1]; |
|
531 |
RETURN ( __MKCHARACTER(ch) ); |
|
532 |
} |
|
533 |
} else if (cls == @global(ByteArray)) { |
|
534 |
if (pos <= __byteArraySize(coll)) { |
|
535 |
ch = __ByteArrayInstPtr(coll)->ba_element[pos-1]; |
|
8913 | 536 |
RETURN ( __mkSmallInteger(ch) ); |
8614 | 537 |
} |
538 |
} else if (cls == @global(Array)) { |
|
539 |
if (pos <= __arraySize(coll)) { |
|
540 |
RETURN ( __ArrayInstPtr(coll)->a_element[pos-1]); |
|
541 |
} |
|
542 |
} |
|
543 |
} |
|
1 | 544 |
} |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
545 |
%}. |
8614 | 546 |
((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
547 |
^ collection at:(position + 1 - ZeroPosition) |
1 | 548 |
! |
549 |
||
3316 | 550 |
peekOrNil |
551 |
"return the next element; do NOT advance read pointer. |
|
552 |
return nil, if there is no next element. |
|
553 |
This is much like #peek - |
|
554 |
However, unlike #peek, this does not raise an atEnd-query signal - even |
|
555 |
if handled. Instead, nil is returned immediately." |
|
556 |
||
557 |
%{ /* NOCONTEXT */ |
|
558 |
||
559 |
REGISTER int pos; |
|
560 |
unsigned ch; |
|
561 |
OBJ coll; |
|
562 |
OBJ cls, p, l; |
|
563 |
||
564 |
coll = __INST(collection); |
|
565 |
p = __INST(position); |
|
566 |
l = __INST(readLimit); |
|
567 |
||
568 |
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) { |
|
569 |
||
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
570 |
pos = __intVal(p); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
571 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
572 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
573 |
if (pos <= __intVal(l) && pos > 0) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
574 |
cls = __qClass(coll); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
575 |
if (cls == @global(String)) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
576 |
if (pos <= __stringSize(coll)) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
577 |
ch = __stringVal(coll)[pos-1]; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
578 |
RETURN ( __MKCHARACTER(ch) ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
579 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
580 |
RETURN ( nil ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
581 |
} else if (cls == @global(ByteArray)) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
582 |
if (pos <= __byteArraySize(coll)) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
583 |
ch = __ByteArrayInstPtr(coll)->ba_element[pos-1]; |
8913 | 584 |
RETURN ( __mkSmallInteger(ch) ); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
585 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
586 |
RETURN ( nil ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
587 |
} else if (cls == @global(Array)) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
588 |
if (pos <= __arraySize(coll)) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
589 |
RETURN ( __ArrayInstPtr(coll)->a_element[pos-1]); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
590 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
591 |
RETURN ( nil ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
592 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
593 |
} |
3316 | 594 |
} |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
595 |
%}. |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
596 |
((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ nil]. |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
597 |
^ collection at:(position + 1 - ZeroPosition) |
3316 | 598 |
! |
599 |
||
1 | 600 |
skipSeparators |
601 |
"skip all whitespace; next will return next non-white-space element. |
|
59 | 602 |
Return the peeked character or nil, if the end-of-stream was reached. |
2 | 603 |
- reimplemented for speed on String-Streams for faster scanning" |
1 | 604 |
|
605 |
%{ /* NOCONTEXT */ |
|
252 | 606 |
OBJ coll, p, l; |
1 | 607 |
|
1133 | 608 |
coll = __INST(collection); |
609 |
p = __INST(position); |
|
610 |
l = __INST(readLimit); |
|
252 | 611 |
|
612 |
if (__isString(coll) && __bothSmallInteger(p, l)) { |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
613 |
REGISTER unsigned char *chars; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
614 |
REGISTER unsigned ch; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
615 |
REGISTER int pos; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
616 |
int limit; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
617 |
int sz; |
1 | 618 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
619 |
pos = __intVal(p); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
620 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
621 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
622 |
if (pos <= 0) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
623 |
RETURN ( nil ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
624 |
} |
1 | 625 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
626 |
limit = __intVal(l); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
627 |
sz = __qSize(coll) - OHDR_SIZE; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
628 |
if (limit > sz) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
629 |
limit = sz; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
630 |
} |
1 | 631 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
632 |
chars = (unsigned char *)(__stringVal(coll) + pos - 1); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
633 |
while (pos <= limit) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
634 |
pos++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
635 |
ch = *chars++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
636 |
if ((ch > 0x20) |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
637 |
|| ((ch != ' ') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
638 |
&& (ch != '\t') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
639 |
&& (ch != '\r') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
640 |
&& (ch != '\n') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
641 |
&& (ch != '\f') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
642 |
&& (ch != 0x0B))) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
643 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
644 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 645 |
__INST(position) = __mkSmallInteger(pos-1); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
646 |
RETURN ( __MKCHARACTER(ch) ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
647 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
648 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
649 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
650 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 651 |
__INST(position) = __mkSmallInteger(pos); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
652 |
RETURN ( nil ); |
1 | 653 |
} |
1406 | 654 |
%}. |
1 | 655 |
^ super skipSeparators |
1406 | 656 |
|
657 |
" |
|
658 |
|s| |
|
659 |
||
660 |
s := ' hello world ' readStream. |
|
661 |
s skipSeparators. |
|
662 |
s next. |
|
663 |
" |
|
1 | 664 |
! |
665 |
||
13 | 666 |
skipSeparatorsExceptCR |
667 |
"skip all whitespace except newlines; |
|
202 | 668 |
next will return next non-white-space element. |
669 |
- reimplemented for speed on String-Streams for faster scanning" |
|
670 |
||
13 | 671 |
%{ /* NOCONTEXT */ |
672 |
||
252 | 673 |
OBJ coll, p, l; |
674 |
||
1133 | 675 |
coll = __INST(collection); |
676 |
p = __INST(position); |
|
677 |
l = __INST(readLimit); |
|
252 | 678 |
|
679 |
if (__isString(coll) && __bothSmallInteger(p, l)) { |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
680 |
REGISTER unsigned char *chars; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
681 |
REGISTER unsigned ch; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
682 |
REGISTER int pos; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
683 |
int limit; |
13 | 684 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
685 |
pos = __intVal(p); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
686 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
687 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
688 |
if (pos <= 0) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
689 |
RETURN ( nil ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
690 |
} |
2162
7e1601f633b6
ff is a separator too (in #skipSeparators*)
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
691 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
692 |
limit = __intVal(l); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
693 |
if (limit > (__qSize(coll) - OHDR_SIZE)) |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
694 |
limit = __qSize(coll) - OHDR_SIZE; |
13 | 695 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
696 |
chars = (unsigned char *)(__stringVal(coll) + pos - 1); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
697 |
while (pos <= limit) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
698 |
ch = *chars++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
699 |
if (((int)ch > 0x20) |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
700 |
|| ( |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
701 |
(ch != ' ') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
702 |
&& (ch != '\t') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
703 |
&& (ch != '\f') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
704 |
&& (ch != '\b') |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
705 |
&& (ch != 0x0B))) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
706 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
707 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 708 |
__INST(position) = __mkSmallInteger(pos); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
709 |
RETURN ( __MKCHARACTER(ch) ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
710 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
711 |
pos++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
712 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
713 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
714 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 715 |
__INST(position) = __mkSmallInteger(pos); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
716 |
RETURN ( nil ); |
13 | 717 |
} |
718 |
%} |
|
719 |
. |
|
720 |
^ super skipSeparatorsExceptCR |
|
721 |
! |
|
722 |
||
611 | 723 |
skipThrough:anObject |
6011
3b91d7834ca5
fixed: skipThrough dod not position atEnd if the element was not found.
Claus Gittinger <cg@exept.de>
parents:
5810
diff
changeset
|
724 |
"skip all objects up-to and including anObject. |
3b91d7834ca5
fixed: skipThrough dod not position atEnd if the element was not found.
Claus Gittinger <cg@exept.de>
parents:
5810
diff
changeset
|
725 |
Return the receiver if skip was successful, |
3b91d7834ca5
fixed: skipThrough dod not position atEnd if the element was not found.
Claus Gittinger <cg@exept.de>
parents:
5810
diff
changeset
|
726 |
otherwise (i.e. if not found) return nil and leave the stream positioned at the end. |
611 | 727 |
On success, the next read operation will return the element after anObject. |
728 |
- reimplemented for speed on String-Streams for faster scanning" |
|
729 |
||
730 |
%{ /* NOCONTEXT */ |
|
731 |
OBJ coll, p, l; |
|
732 |
||
1133 | 733 |
coll = __INST(collection); |
734 |
p = __INST(position); |
|
735 |
l = __INST(readLimit); |
|
611 | 736 |
|
737 |
if (__isString(coll) |
|
738 |
&& __isCharacter(anObject) |
|
739 |
&& __bothSmallInteger(p, l)) { |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
740 |
REGISTER unsigned char *chars; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
741 |
REGISTER int pos, limit; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
742 |
unsigned ch; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
743 |
int sz; |
611 | 744 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
745 |
pos = __intVal(p); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
746 |
/* make 1-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
747 |
pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition)); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
748 |
if (pos <= 0) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
749 |
RETURN ( nil ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
750 |
} |
611 | 751 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
752 |
limit = __intVal(l); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
753 |
sz = __stringSize(coll); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
754 |
if (limit > sz) limit = sz; |
611 | 755 |
|
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
756 |
chars = (unsigned char *)(__stringVal(coll) + pos - 1); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
757 |
ch = __intVal(_characterVal(anObject)) & 0xFF; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
758 |
while (pos < limit) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
759 |
if (*chars == ch) { |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
760 |
ch = *++chars; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
761 |
pos++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
762 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
763 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 764 |
__INST(position) = __mkSmallInteger(pos); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
765 |
RETURN ( self ); |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
766 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
767 |
chars++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
768 |
pos++; |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
769 |
} |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
770 |
/* make ZeroPosition-based */ |
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
771 |
pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition)); |
8913 | 772 |
__INST(position) = __mkSmallInteger(pos+1); |
7051
984d8271d06b
preps for 0-based stream positions
Claus Gittinger <cg@exept.de>
parents:
6814
diff
changeset
|
773 |
RETURN ( nil ); |
611 | 774 |
} |
6011
3b91d7834ca5
fixed: skipThrough dod not position atEnd if the element was not found.
Claus Gittinger <cg@exept.de>
parents:
5810
diff
changeset
|
775 |
%}. |
611 | 776 |
^ super skipThrough:anObject |
1 | 777 |
! ! |
778 |
||
59 | 779 |
!ReadStream methodsFor:'writing'! |
1 | 780 |
|
781 |
nextPut:anElement |
|
10 | 782 |
"catch write access to readstreams - report an error" |
783 |
||
784 |
self shouldNotImplement |
|
1 | 785 |
! ! |
611 | 786 |
|
2162
7e1601f633b6
ff is a separator too (in #skipSeparators*)
Claus Gittinger <cg@exept.de>
parents:
1688
diff
changeset
|
787 |
!ReadStream class methodsFor:'documentation'! |
701 | 788 |
|
789 |
version |
|
8913 | 790 |
^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.53 2005-07-08 17:15:02 cg Exp $' |
701 | 791 |
! ! |