--- a/ReadStream.st Thu Nov 05 17:25:22 2009 +0100
+++ b/ReadStream.st Thu Nov 05 17:25:23 2009 +0100
@@ -238,53 +238,53 @@
p = __INST(position);
l = __INST(readLimit);
- if (__isString(coll) && __bothSmallInteger(p, l)) {
+ if (__isStringLike(coll) && __bothSmallInteger(p, l)) {
- pos = __intVal(p);
- /* make 1-based */
- pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
+ pos = __intVal(p);
+ /* make 1-based */
+ pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
- limit = __intVal(l);
- sz = __qSize(coll) - OHDR_SIZE;
- if (sz < limit)
- limit = sz;
- cp = __stringVal(coll) + pos - 1;
+ limit = __intVal(l);
+ sz = __qSize(coll) - OHDR_SIZE;
+ if (sz < limit)
+ limit = sz;
+ cp = __stringVal(coll) + pos - 1;
- for (;;) {
- if (pos > limit) break;
- ch = *cp;
+ for (;;) {
+ if (pos > limit) break;
+ ch = *cp;
- if (((ch >= 'a') && (ch <= 'z')) ||
- ((ch >= 'A') && (ch <= 'Z')) ||
- ((ch >= '0') && (ch <= '9')))
- break;
- cp++;
- pos++;
- }
+ if (((ch >= 'a') && (ch <= 'z')) ||
+ ((ch >= 'A') && (ch <= 'Z')) ||
+ ((ch >= '0') && (ch <= '9')))
+ break;
+ cp++;
+ pos++;
+ }
- len = 0;
- for (;;) {
- if (pos > limit) break;
- ch = *cp & 0xFF;
+ len = 0;
+ for (;;) {
+ if (pos > limit) break;
+ ch = *cp & 0xFF;
- if (! (((ch >= 'a') && (ch <= 'z')) ||
- ((ch >= 'A') && (ch <= 'Z')) ||
- ((ch >= '0') && (ch <= '9'))))
- break;
- buffer[len++] = ch;
- if (len >= (sizeof(buffer)-1)) {
- /* emergency */
- break;
- }
- pos++;
- cp++;
- }
+ if (! (((ch >= 'a') && (ch <= 'z')) ||
+ ((ch >= 'A') && (ch <= 'Z')) ||
+ ((ch >= '0') && (ch <= '9'))))
+ break;
+ buffer[len++] = ch;
+ if (len >= (sizeof(buffer)-1)) {
+ /* emergency */
+ break;
+ }
+ pos++;
+ cp++;
+ }
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos);
- buffer[len] = '\0';
- RETURN ( (len != 0) ? __MKSTRING_L(buffer, len) : nil );
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos);
+ buffer[len] = '\0';
+ RETURN ( (len != 0) ? __MKSTRING_L(buffer, len) : nil );
}
%}
.
@@ -401,31 +401,31 @@
p = __INST(position);
l = __INST(readLimit);
- if (__isString(coll) && __bothSmallInteger(p, l)) {
+ if (__isStringLike(coll) && __bothSmallInteger(p, l)) {
- pos = __intVal(p);
- /* make 1-based */
- pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
- limit = __intVal(l);
- sz = __qSize(coll) - OHDR_SIZE;
- if (sz < limit)
- limit = sz;
- cp = __stringVal(coll) + pos - 1;
+ pos = __intVal(p);
+ /* make 1-based */
+ pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
+ limit = __intVal(l);
+ sz = __qSize(coll) - OHDR_SIZE;
+ if (sz < limit)
+ limit = sz;
+ cp = __stringVal(coll) + pos - 1;
- for (;;) {
- if (pos > limit) break;
- ch = *cp;
+ for (;;) {
+ if (pos > limit) break;
+ ch = *cp;
- if ((ch < '0') || (ch > '9')) break;
- val = val * 10 + (ch - '0');
- pos++;
- if (val > (_MAX_INT / 10)) goto oops;
- cp++;
- }
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos);
- RETURN (__mkSmallInteger(val));
+ if ((ch < '0') || (ch > '9')) break;
+ val = val * 10 + (ch - '0');
+ pos++;
+ if (val > (_MAX_INT / 10)) goto oops;
+ cp++;
+ }
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos);
+ RETURN (__mkSmallInteger(val));
}
oops:
value = __mkSmallInteger(val);
@@ -437,8 +437,8 @@
nextOne := self peek.
[nextOne notNil and:[nextOne isDigitRadix:10]] whileTrue:[
- value = (value * 10) + nextOne digitValue.
- nextOne := self nextPeek
+ value := (value * 10) + nextOne digitValue.
+ nextOne := self nextPeek
].
^ value
!
@@ -520,7 +520,7 @@
p = __INST(position);
l = __INST(readLimit);
- if (__isString(coll) && __bothSmallInteger(p, l)) {
+ if (__isStringLike(coll) && __bothSmallInteger(p, l)) {
REGISTER int pos;
unsigned ch;
@@ -650,47 +650,47 @@
p = __INST(position);
l = __INST(readLimit);
- if (__isString(coll) && __bothSmallInteger(p, l)) {
- REGISTER unsigned char *chars;
- REGISTER unsigned ch;
- REGISTER int pos;
- int limit;
- int sz;
+ if (__isStringLike(coll) && __bothSmallInteger(p, l)) {
+ REGISTER unsigned char *chars;
+ REGISTER unsigned ch;
+ REGISTER int pos;
+ int limit;
+ int sz;
- pos = __intVal(p);
- /* make 1-based */
- pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
- if (pos <= 0) {
- RETURN ( nil );
- }
+ pos = __intVal(p);
+ /* make 1-based */
+ pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
+ if (pos <= 0) {
+ RETURN ( nil );
+ }
- limit = __intVal(l);
- sz = __qSize(coll) - OHDR_SIZE;
- if (limit > sz) {
- limit = sz;
- }
+ limit = __intVal(l);
+ sz = __qSize(coll) - OHDR_SIZE;
+ if (limit > sz) {
+ limit = sz;
+ }
- chars = (unsigned char *)(__stringVal(coll) + pos - 1);
- while (pos <= limit) {
- pos++;
- ch = *chars++;
- if ((ch > 0x20)
- || ((ch != ' ')
- && (ch != '\t')
- && (ch != '\r')
- && (ch != '\n')
- && (ch != '\f')
- && (ch != 0x0B))) {
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos-1);
- RETURN ( __MKCHARACTER(ch) );
- }
- }
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos);
- RETURN ( nil );
+ chars = (unsigned char *)(__stringVal(coll) + pos - 1);
+ while (pos <= limit) {
+ pos++;
+ ch = *chars++;
+ if ((ch > 0x20)
+ || ((ch != ' ')
+ && (ch != '\t')
+ && (ch != '\r')
+ && (ch != '\n')
+ && (ch != '\f')
+ && (ch != 0x0B))) {
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos-1);
+ RETURN ( __MKCHARACTER(ch) );
+ }
+ }
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos);
+ RETURN ( nil );
}
%}.
^ super skipSeparators
@@ -717,44 +717,44 @@
p = __INST(position);
l = __INST(readLimit);
- if (__isString(coll) && __bothSmallInteger(p, l)) {
- REGISTER unsigned char *chars;
- REGISTER unsigned ch;
- REGISTER int pos;
- int limit;
+ if (__isStringLike(coll) && __bothSmallInteger(p, l)) {
+ REGISTER unsigned char *chars;
+ REGISTER unsigned ch;
+ REGISTER int pos;
+ int limit;
- pos = __intVal(p);
- /* make 1-based */
- pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
- if (pos <= 0) {
- RETURN ( nil );
- }
+ pos = __intVal(p);
+ /* make 1-based */
+ pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
+ if (pos <= 0) {
+ RETURN ( nil );
+ }
- limit = __intVal(l);
- if (limit > (__qSize(coll) - OHDR_SIZE))
- limit = __qSize(coll) - OHDR_SIZE;
+ limit = __intVal(l);
+ if (limit > (__qSize(coll) - OHDR_SIZE))
+ limit = __qSize(coll) - OHDR_SIZE;
- chars = (unsigned char *)(__stringVal(coll) + pos - 1);
- while (pos <= limit) {
- ch = *chars++;
- if (((int)ch > 0x20)
- || (
- (ch != ' ')
- && (ch != '\t')
- && (ch != '\f')
- && (ch != '\b')
- && (ch != 0x0B))) {
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos);
- RETURN ( __MKCHARACTER(ch) );
- }
- pos++;
- }
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos);
- RETURN ( nil );
+ chars = (unsigned char *)(__stringVal(coll) + pos - 1);
+ while (pos <= limit) {
+ ch = *chars++;
+ if (((int)ch > 0x20)
+ || (
+ (ch != ' ')
+ && (ch != '\t')
+ && (ch != '\f')
+ && (ch != '\b')
+ && (ch != 0x0B))) {
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos);
+ RETURN ( __MKCHARACTER(ch) );
+ }
+ pos++;
+ }
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos);
+ RETURN ( nil );
}
%}
.
@@ -775,43 +775,43 @@
p = __INST(position);
l = __INST(readLimit);
- if (__isString(coll)
+ if (__isStringLike(coll)
&& __isCharacter(anObject)
&& __bothSmallInteger(p, l)) {
- REGISTER unsigned char *chars;
- REGISTER int pos, limit;
- unsigned ch;
- int sz;
+ REGISTER unsigned char *chars;
+ REGISTER int pos, limit;
+ unsigned ch;
+ int sz;
- pos = __intVal(p);
- /* make 1-based */
- pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
- if (pos <= 0) {
- RETURN ( nil );
- }
+ pos = __intVal(p);
+ /* make 1-based */
+ pos = pos + 1 - __intVal( @global(PositionableStream:ZeroPosition));
+ if (pos <= 0) {
+ RETURN ( nil );
+ }
- limit = __intVal(l);
- sz = __stringSize(coll);
- if (limit > sz) limit = sz;
+ limit = __intVal(l);
+ sz = __stringSize(coll);
+ if (limit > sz) limit = sz;
- chars = (unsigned char *)(__stringVal(coll) + pos - 1);
- ch = __intVal(_characterVal(anObject)) & 0xFF;
- while (pos < limit) {
- if (*chars == ch) {
- ch = *++chars;
- pos++;
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos);
- RETURN ( self );
- }
- chars++;
- pos++;
- }
- /* make ZeroPosition-based */
- pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
- __INST(position) = __mkSmallInteger(pos+1);
- RETURN ( nil );
+ chars = (unsigned char *)(__stringVal(coll) + pos - 1);
+ ch = __intVal(_characterVal(anObject)) & 0xFF;
+ while (pos < limit) {
+ if (*chars == ch) {
+ ch = *++chars;
+ pos++;
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos);
+ RETURN ( self );
+ }
+ chars++;
+ pos++;
+ }
+ /* make ZeroPosition-based */
+ pos = pos - 1 + __intVal( @global(PositionableStream:ZeroPosition));
+ __INST(position) = __mkSmallInteger(pos+1);
+ RETURN ( nil );
}
%}.
^ super skipThrough:anObject
@@ -828,9 +828,9 @@
!ReadStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.63 2009-10-08 08:43:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.64 2009-11-05 16:25:23 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.63 2009-10-08 08:43:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.64 2009-11-05 16:25:23 stefan Exp $'
! !