--- a/ReadStr.st Wed Feb 15 11:24:35 1995 +0100
+++ b/ReadStr.st Wed Feb 15 11:25:20 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/ReadStr.st,v 1.10 1994-11-17 14:17:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ReadStr.st,v 1.11 1995-02-15 10:24:48 claus Exp $
'!
!ReadStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/ReadStr.st,v 1.10 1994-11-17 14:17:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ReadStr.st,v 1.11 1995-02-15 10:24:48 claus Exp $
"
!
@@ -74,16 +74,17 @@
REGISTER int pos;
unsigned ch;
OBJ coll;
- OBJ cls;
+ OBJ cls, p, l;
extern OBJ ByteArray;
coll = _INST(collection);
- if (_isNonNilObject(coll)
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
+ p = _INST(position);
+ l = _INST(readLimit);
- pos = _intVal(_INST(position));
- if (pos > _intVal(_INST(readLimit))) {
+ if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) {
+
+ pos = _intVal(p);
+ if (pos > _intVal(l)) {
RETURN ( nil );
}
@@ -123,15 +124,16 @@
REGISTER int pos;
unsigned ch;
- OBJ coll;
+ OBJ coll, p, l;
coll = _INST(collection);
- if (_isNonNilObject(coll)
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
+ p = _INST(position);
+ l = _INST(readLimit);
- pos = _intVal(_INST(position));
- if (pos > _intVal(_INST(readLimit))) {
+ if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) {
+
+ pos = _intVal(p);
+ if (pos > _intVal(l)) {
RETURN ( nil );
}
if (pos > 0) {
@@ -172,17 +174,18 @@
- tuned for speed on String-Streams for faster scanning"
%{ /* NOCONTEXT */
- OBJ coll;
+ OBJ coll, l, p;
coll = _INST(collection);
- if (__isString(coll)
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
+ p = _INST(position);
+ l = _INST(readLimit);
+
+ if (__isString(coll) && __bothSmallInteger(p, l)) {
REGISTER int pos;
unsigned ch;
- pos = _intVal(_INST(position));
- if (pos > _intVal(_INST(readLimit))) {
+ pos = _intVal(p);
+ if (pos > _intVal(l)) {
RETURN ( nil );
}
if ((pos > 0) && (pos <= _stringSize(coll))) {
@@ -213,16 +216,20 @@
REGISTER unsigned char *cp;
REGISTER unsigned ch;
int val = 0;
+ OBJ coll, p, l;
- if (__isString(_INST(collection))
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
- pos = _intVal(_INST(position));
- limit = _intVal(_INST(readLimit));
- sz = _qSize(_INST(collection)) - OHDR_SIZE;
+ coll = _INST(collection);
+ p = _INST(position);
+ l = _INST(readLimit);
+
+ if (__isString(coll) && __bothSmallInteger(p, l)) {
+
+ pos = _intVal(p);
+ limit = _intVal(l);
+ sz = _qSize(coll) - OHDR_SIZE;
if (sz < limit)
limit = sz;
- cp = _stringVal(_INST(collection)) + pos - 1;
+ cp = _stringVal(coll) + pos - 1;
for (;;) {
if (pos > limit) break;
@@ -254,6 +261,10 @@
!
nextWord
+ ^ self nextAlphaNumericWord
+!
+
+nextAlphaNumericWord
"read the next word (i.e. up to non letter-or-digit).
return a string containing those characters.
- tuned for speed on String-Streams for faster scanning"
@@ -265,16 +276,20 @@
char buffer[256];
REGISTER unsigned char *cp;
REGISTER unsigned ch;
+ OBJ coll, p, l;
- if (__isString(_INST(collection))
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
- pos = _intVal(_INST(position));
- limit = _intVal(_INST(readLimit));
- sz = _qSize(_INST(collection)) - OHDR_SIZE;
+ coll = _INST(collection);
+ p = _INST(position);
+ l = _INST(readLimit);
+
+ if (__isString(coll) && __bothSmallInteger(p, l)) {
+
+ pos = _intVal(p);
+ limit = _intVal(l);
+ sz = _qSize(coll) - OHDR_SIZE;
if (sz < limit)
limit = sz;
- cp = _stringVal(_INST(collection)) + pos - 1;
+ cp = _stringVal(coll) + pos - 1;
for (;;) {
if (pos > limit) break;
@@ -311,7 +326,7 @@
}
%}
.
- ^ super nextWord
+ ^ super nextAlphaNumericWord
!
nextSymbol
@@ -324,16 +339,20 @@
char buffer[256];
REGISTER unsigned char *cp;
REGISTER unsigned ch;
+ OBJ coll, p, l;
- if (__isString(_INST(collection))
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
- pos = _intVal(_INST(position));
- limit = _intVal(_INST(readLimit));
- sz = _qSize(_INST(collection)) - OHDR_SIZE;
+ coll = _INST(collection);
+ p = _INST(position);
+ l = _INST(readLimit);
+
+ if (__isString(coll) && __bothSmallInteger(p, l)) {
+
+ pos = _intVal(p);
+ limit = _intVal(l);
+ sz = _qSize(coll) - OHDR_SIZE;
if (sz < limit)
limit = sz;
- cp = _stringVal(_INST(collection)) + pos - 1;
+ cp = _stringVal(coll) + pos - 1;
len = 0;
for (;;) {
@@ -370,24 +389,26 @@
- reimplemented for speed on String-Streams for faster scanning"
%{ /* NOCONTEXT */
- OBJ coll;
+ OBJ coll, p, l;
coll = _INST(collection);
+ p = _INST(position);
+ l = _INST(readLimit);
+
if (__isString(coll)
&& __isCharacter(anObject)
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
+ && __bothSmallInteger(p, l)) {
REGISTER unsigned char *chars;
REGISTER int pos, limit;
unsigned ch;
int sz;
- pos = _intVal(_INST(position));
+ pos = _intVal(p);
if (pos <= 0) {
RETURN ( nil );
}
- limit = _intVal(_INST(readLimit));
+ limit = _intVal(l);
sz = _stringSize(coll);
if (limit > sz) limit = sz;
@@ -416,25 +437,28 @@
- reimplemented for speed on String-Streams for faster scanning"
%{ /* NOCONTEXT */
+ OBJ coll, p, l;
- if (__isString(_INST(collection))
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
+ coll = _INST(collection);
+ p = _INST(position);
+ l = _INST(readLimit);
+
+ if (__isString(coll) && __bothSmallInteger(p, l)) {
REGISTER unsigned char *chars;
REGISTER unsigned ch;
REGISTER int pos;
int limit;
- pos = _intVal(_INST(position));
+ pos = _intVal(p);
if (pos <= 0) {
RETURN ( nil );
}
- limit = _intVal(_INST(readLimit));
- if (limit > (_qSize(_INST(collection)) - OHDR_SIZE))
- limit = _qSize(_INST(collection)) - OHDR_SIZE;
+ limit = _intVal(l);
+ if (limit > (_qSize(coll) - OHDR_SIZE))
+ limit = _qSize(coll) - OHDR_SIZE;
- chars = (unsigned char *)(_stringVal(_INST(collection)) + pos - 1);
+ chars = (unsigned char *)(_stringVal(coll) + pos - 1);
while (pos <= limit) {
ch = *chars++;
if ((ch != ' ') && (ch != '\t') && (ch != '\r')
@@ -459,24 +483,28 @@
%{ /* NOCONTEXT */
- if (__isString(_INST(collection))
- && _isSmallInteger(_INST(position))
- && _isSmallInteger(_INST(readLimit))) {
+ OBJ coll, p, l;
+
+ coll = _INST(collection);
+ p = _INST(position);
+ l = _INST(readLimit);
+
+ if (__isString(coll) && __bothSmallInteger(p, l)) {
REGISTER unsigned char *chars;
REGISTER unsigned ch;
REGISTER int pos;
int limit;
- pos = _intVal(_INST(position));
+ pos = _intVal(p);
if (pos <= 0) {
RETURN ( nil );
}
- limit = _intVal(_INST(readLimit));
- if (limit > (_qSize(_INST(collection)) - OHDR_SIZE))
- limit = _qSize(_INST(collection)) - OHDR_SIZE;
+ limit = _intVal(l);
+ if (limit > (_qSize(coll) - OHDR_SIZE))
+ limit = _qSize(coll) - OHDR_SIZE;
- chars = (unsigned char *)(_stringVal(_INST(collection)) + pos - 1);
+ chars = (unsigned char *)(_stringVal(coll) + pos - 1);
while (pos <= limit) {
ch = *chars++;
if ((ch != ' ') && (ch != '\t') && (ch != '\r') && (ch != 0x0B)) {