--- a/ReadStream.st Tue Apr 02 18:30:51 1996 +0200
+++ b/ReadStream.st Wed Apr 03 00:06:56 1996 +0200
@@ -71,33 +71,33 @@
unsigned ch;
OBJ coll, p, l;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) {
- pos = _intVal(p);
- if (pos > 0 && pos <= _intVal(l)) {
+ pos = __intVal(p);
+ if (pos > 0 && pos <= __intVal(l)) {
OBJ cls;
cls = __qClass(coll);
- if (cls == String) {
- if (pos <= _stringSize(coll)) {
- _INST(position) = _MKSMALLINT(pos + 1);
- ch = _stringVal(coll)[pos-1];
- RETURN ( _MKCHARACTER(ch) );
+ if (cls == @global(String)) {
+ if (pos <= __stringSize(coll)) {
+ __INST(position) = __MKSMALLINT(pos + 1);
+ ch = __stringVal(coll)[pos-1];
+ RETURN ( __MKCHARACTER(ch) );
}
- } else if (cls == ByteArray) {
- if (pos <= _byteArraySize(coll)) {
- _INST(position) = _MKSMALLINT(pos + 1);
- ch = _ByteArrayInstPtr(coll)->ba_element[pos-1];
- RETURN ( _MKSMALLINT(ch) );
+ } else if (cls == @global(ByteArray)) {
+ if (pos <= __byteArraySize(coll)) {
+ __INST(position) = __MKSMALLINT(pos + 1);
+ ch = __ByteArrayInstPtr(coll)->ba_element[pos-1];
+ RETURN ( __MKSMALLINT(ch) );
}
- } else if (cls == Array) {
- if (pos <= _arraySize(coll)) {
- _INST(position) = _MKSMALLINT(pos + 1);
- RETURN ( _ArrayInstPtr(coll)->a_element[pos-1]);
+ } else if (cls == @global(Array)) {
+ if (pos <= __arraySize(coll)) {
+ __INST(position) = __MKSMALLINT(pos + 1);
+ RETURN ( __ArrayInstPtr(coll)->a_element[pos-1]);
}
}
}
@@ -125,18 +125,18 @@
OBJ coll, p, l;
OBJ __MKSTRING_L();
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll) && __bothSmallInteger(p, l)) {
- pos = _intVal(p);
- limit = _intVal(l);
+ pos = __intVal(p);
+ limit = __intVal(l);
sz = __qSize(coll) - OHDR_SIZE;
if (sz < limit)
limit = sz;
- cp = _stringVal(coll) + pos - 1;
+ cp = __stringVal(coll) + pos - 1;
for (;;) {
if (pos > limit) break;
@@ -167,7 +167,7 @@
cp++;
}
- _INST(position) = _MKSMALLINT(pos);
+ __INST(position) = __MKSMALLINT(pos);
buffer[len] = '\0';
RETURN ( (len != 0) ? __MKSTRING_L(buffer, len COMMA_CON) : nil );
}
@@ -188,18 +188,18 @@
int val = 0;
OBJ coll, p, l;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll) && __bothSmallInteger(p, l)) {
- pos = _intVal(p);
- limit = _intVal(l);
+ pos = __intVal(p);
+ limit = __intVal(l);
sz = __qSize(coll) - OHDR_SIZE;
if (sz < limit)
limit = sz;
- cp = _stringVal(coll) + pos - 1;
+ cp = __stringVal(coll) + pos - 1;
for (;;) {
if (pos > limit) break;
@@ -211,11 +211,11 @@
if (val > (_MAX_INT / 10)) goto oops;
cp++;
}
- _INST(position) = _MKSMALLINT(pos);
- return _MKSMALLINT(val);
+ __INST(position) = __MKSMALLINT(pos);
+ return __MKSMALLINT(val);
}
oops:
- value = _MKSMALLINT(val);
+ value = __MKSMALLINT(val);
%}
.
"fall-back for non-string streams - we have to continue where
@@ -238,20 +238,20 @@
%{ /* NOCONTEXT */
OBJ coll, l, p;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll) && __bothSmallInteger(p, l)) {
REGISTER int pos;
unsigned ch;
- pos = _intVal(p);
- if ((pos > 0) && (pos < _intVal(l)) && (pos < _stringSize(coll))) {
+ pos = __intVal(p);
+ if ((pos > 0) && (pos < __intVal(l)) && (pos < __stringSize(coll))) {
pos += 1;
- _INST(position) = _MKSMALLINT(pos);
- ch = _stringVal(coll)[pos-1];
- RETURN ( _MKCHARACTER(ch) );
+ __INST(position) = __MKSMALLINT(pos);
+ ch = __stringVal(coll)[pos-1];
+ RETURN ( __MKCHARACTER(ch) );
}
}
%}
@@ -275,18 +275,18 @@
OBJ coll, p, l;
OBJ __MKSTRING_L();
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll) && __bothSmallInteger(p, l)) {
- pos = _intVal(p);
- limit = _intVal(l);
+ pos = __intVal(p);
+ limit = __intVal(l);
sz = __qSize(coll) - OHDR_SIZE;
if (sz < limit)
limit = sz;
- cp = _stringVal(coll) + pos - 1;
+ cp = __stringVal(coll) + pos - 1;
len = 0;
for (;;) {
@@ -307,7 +307,7 @@
cp++;
}
- _INST(position) = _MKSMALLINT(pos);
+ __INST(position) = __MKSMALLINT(pos);
buffer[len] = '\0';
RETURN ( (len != 0) ? __MKSTRING_L(buffer, len COMMA_CON) : nil );
}
@@ -328,28 +328,28 @@
OBJ coll;
OBJ cls, p, l;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isNonNilObject(coll) && __bothSmallInteger(p, l)) {
- pos = _intVal(p);
- if (pos <= _intVal(l) && pos > 0) {
+ pos = __intVal(p);
+ if (pos <= __intVal(l) && pos > 0) {
cls = __qClass(coll);
- if (cls == String) {
- if (pos <= _stringSize(coll)) {
- ch = _stringVal(coll)[pos-1];
- RETURN ( _MKCHARACTER(ch) );
+ if (cls == @global(String)) {
+ if (pos <= __stringSize(coll)) {
+ ch = __stringVal(coll)[pos-1];
+ RETURN ( __MKCHARACTER(ch) );
}
- } else if (cls == ByteArray) {
- if (pos <= _byteArraySize(coll)) {
- ch = _ByteArrayInstPtr(coll)->ba_element[pos-1];
- RETURN ( _MKSMALLINT(ch) );
+ } else if (cls == @global(ByteArray)) {
+ if (pos <= __byteArraySize(coll)) {
+ ch = __ByteArrayInstPtr(coll)->ba_element[pos-1];
+ RETURN ( __MKSMALLINT(ch) );
}
- } else if (cls == Array) {
- if (pos <= _arraySize(coll)) {
- RETURN ( _ArrayInstPtr(coll)->a_element[pos-1]);
+ } else if (cls == @global(Array)) {
+ if (pos <= __arraySize(coll)) {
+ RETURN ( __ArrayInstPtr(coll)->a_element[pos-1]);
}
}
}
@@ -368,9 +368,9 @@
%{ /* NOCONTEXT */
OBJ coll, p, l;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll) && __bothSmallInteger(p, l)) {
REGISTER unsigned char *chars;
@@ -378,26 +378,26 @@
REGISTER int pos;
int limit;
- pos = _intVal(p);
+ pos = __intVal(p);
if (pos <= 0) {
RETURN ( nil );
}
- limit = _intVal(l);
+ limit = __intVal(l);
if (limit > (__qSize(coll) - OHDR_SIZE))
limit = __qSize(coll) - OHDR_SIZE;
- chars = (unsigned char *)(_stringVal(coll) + pos - 1);
+ chars = (unsigned char *)(__stringVal(coll) + pos - 1);
while (pos <= limit) {
ch = *chars++;
if ((ch != ' ') && (ch != '\t') && (ch != '\r')
&& (ch != '\n') && (ch != 0x0B)) {
- _INST(position) = _MKSMALLINT(pos);
- RETURN ( _MKCHARACTER(ch) );
+ __INST(position) = __MKSMALLINT(pos);
+ RETURN ( __MKCHARACTER(ch) );
}
pos++;
}
- _INST(position) = _MKSMALLINT(pos);
+ __INST(position) = __MKSMALLINT(pos);
RETURN ( nil );
}
%}
@@ -414,9 +414,9 @@
OBJ coll, p, l;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll) && __bothSmallInteger(p, l)) {
REGISTER unsigned char *chars;
@@ -424,25 +424,25 @@
REGISTER int pos;
int limit;
- pos = _intVal(p);
+ pos = __intVal(p);
if (pos <= 0) {
RETURN ( nil );
}
- limit = _intVal(l);
+ limit = __intVal(l);
if (limit > (__qSize(coll) - OHDR_SIZE))
limit = __qSize(coll) - OHDR_SIZE;
- chars = (unsigned char *)(_stringVal(coll) + pos - 1);
+ chars = (unsigned char *)(__stringVal(coll) + pos - 1);
while (pos <= limit) {
ch = *chars++;
if ((ch != ' ') && (ch != '\t') && (ch != '\r') && (ch != 0x0B)) {
- _INST(position) = _MKSMALLINT(pos);
- RETURN ( _MKCHARACTER(ch) );
+ __INST(position) = __MKSMALLINT(pos);
+ RETURN ( __MKCHARACTER(ch) );
}
pos++;
}
- _INST(position) = _MKSMALLINT(pos);
+ __INST(position) = __MKSMALLINT(pos);
RETURN ( nil );
}
%}
@@ -459,9 +459,9 @@
%{ /* NOCONTEXT */
OBJ coll, p, l;
- coll = _INST(collection);
- p = _INST(position);
- l = _INST(readLimit);
+ coll = __INST(collection);
+ p = __INST(position);
+ l = __INST(readLimit);
if (__isString(coll)
&& __isCharacter(anObject)
@@ -471,22 +471,22 @@
unsigned ch;
int sz;
- pos = _intVal(p);
+ pos = __intVal(p);
if (pos <= 0) {
RETURN ( nil );
}
- limit = _intVal(l);
- sz = _stringSize(coll);
+ limit = __intVal(l);
+ sz = __stringSize(coll);
if (limit > sz) limit = sz;
- chars = (unsigned char *)(_stringVal(coll) + pos - 1);
- ch = _intVal(_characterVal(anObject)) & 0xFF;
+ chars = (unsigned char *)(__stringVal(coll) + pos - 1);
+ ch = __intVal(_characterVal(anObject)) & 0xFF;
while (pos < limit) {
if (*chars == ch) {
ch = *++chars;
pos++;
- _INST(position) = _MKSMALLINT(pos);
+ __INST(position) = __MKSMALLINT(pos);
RETURN ( anObject );
}
chars++;
@@ -542,5 +542,5 @@
!ReadStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.23 1996-02-19 15:07:26 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.24 1996-04-02 22:05:14 cg Exp $'
! !