--- a/ExternalStream.st Thu Nov 02 20:57:11 1995 +0100
+++ b/ExternalStream.st Thu Nov 02 21:10:58 1995 +0100
@@ -24,7 +24,7 @@
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.60 1995-11-02 15:15:43 cg Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.61 1995-11-02 20:10:35 cg Exp $
'!
!ExternalStream primitiveDefinitions!
@@ -151,7 +151,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.60 1995-11-02 15:15:43 cg Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.61 1995-11-02 20:10:35 cg Exp $
"
!
@@ -434,7 +434,7 @@
if ((fp = _INST(filePointer)) != nil) {
_INST(filePointer) = nil;
__BEGIN_INTERRUPTABLE__
- fclose(MKFD(fp));
+ fclose(__FILEVal(fp));
__END_INTERRUPTABLE__
}
%}
@@ -663,7 +663,7 @@
OBJ fp;
if ((fp = _INST(filePointer)) != nil) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
RETURN ( __MKSMALLINT(fileno(f)) );
}
%}
@@ -858,7 +858,7 @@
if ((fp = _INST(filePointer)) != nil) {
if (__isSmallInteger(ioctlNumber)) {
ioNum = __intVal(ioctlNumber);
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
do {
@@ -899,7 +899,7 @@
if ((fp = _INST(filePointer)) != nil) {
if (__isSmallInteger(ioctlNumber)
&& (__isSmallInteger(arg) || __isBytes(arg))) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
ioNum = __intVal(ioctlNumber);
__BEGIN_INTERRUPTABLE__
@@ -945,7 +945,7 @@
_INST(lastErrorNumber) = nil;
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
do {
@@ -1042,7 +1042,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
if (__bothSmallInteger(count, start)) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
oClass = __Class(anObject);
switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
@@ -1124,7 +1124,7 @@
int first, second, err;
short value;
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -1183,7 +1183,7 @@
int first, second;
unsigned value;
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -1243,7 +1243,7 @@
int first, second, third, fourth;
int value;
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -1321,7 +1321,7 @@
int first, second, third, fourth;
unsigned int value;
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -1421,7 +1421,7 @@
&& (_INST(mode) != @symbol(readonly))) {
if (__isSmallInteger(aByteValue)) {
c = __intVal(aByteValue);
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
/*
*#ifdef OLD
@@ -1518,7 +1518,7 @@
}
cnt = __intVal(count);
offs = __intVal(start) - 1;
- f = MKFD(fp);
+ f = __FILEVal(fp);
nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
@@ -1592,7 +1592,7 @@
bytes[0] = num & 0xFF;
}
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
#ifdef OLD
if (_INST(buffered) == false) {
@@ -1656,7 +1656,7 @@
bytes[0] = num & 0xFF;
}
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
#ifdef OLD
if (_INST(buffered) == false) {
@@ -1721,7 +1721,7 @@
if (_INST(buffered) == true)
#endif
{
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -1768,7 +1768,7 @@
_INST(lastErrorNumber) = nil;
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -1854,7 +1854,7 @@
if (_INST(mode) != @symbol(readonly)) {
if (_INST(buffered) == true) {
__BEGIN_INTERRUPTABLE__
- fflush( MKFD(fp) );
+ fflush( __FILEVal(fp) );
__END_INTERRUPTABLE__
}
}
@@ -1863,7 +1863,8 @@
!
nextPut:aCharacter
- "write the argument, aCharacter - return nil if failed, self if ok"
+ "write the argument, aCharacter - return nil if failed, self if ok.
+ Only single-byte characters are currently supported"
%{ /* NOCONTEXT */
@@ -1877,9 +1878,9 @@
&& (_INST(mode) != @symbol(readonly))) {
if (_INST(binary) != true) {
if (__isCharacter(aCharacter)) {
- c = __intVal(__CharacterInstPtr(aCharacter)->c_asciivalue);
+ c = __intVal(__characterVal(aCharacter)) & 0xFF;
doWrite:
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
@@ -1957,7 +1958,7 @@
}
}
if (cp != NULL) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
#ifdef NONONO
@@ -2078,7 +2079,7 @@
}
}
if (cp != NULL) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
index1 = __intVal(start);
index2 = __intVal(stop);
if ((index1 < 1) || (index2 > len) || (index2 < index1)) {
@@ -2141,7 +2142,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(readonly))) {
if (_INST(binary) != true) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
@@ -2195,7 +2196,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
if (_INST(binary) != true) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
buffer[0] = 0;
@@ -2329,7 +2330,7 @@
&& (_INST(mode) != @symbol(readonly))) {
if (_INST(binary) != true) {
if (__isString(aString)) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
s = (char *) _stringVal(aString);
len = _stringSize(aString);
@@ -2427,8 +2428,8 @@
matchString = (char *) _stringVal(aStringOrNil);
matchLen = _stringSize(aStringOrNil);
}
- dst = MKFD(_INST(filePointer));
- src = MKFD(srcFilePointer);
+ dst = __FILEVal(_INST(filePointer));
+ src = __FILEVal(srcFilePointer);
__BEGIN_INTERRUPTABLE__
errno = 0;
@@ -2504,7 +2505,7 @@
matchString = (char *) _stringVal(aString);
l = _stringSize(aString);
- f = MKFD(_INST(filePointer));
+ f = __FILEVal(_INST(filePointer));
__READING__(f)
for (;;) {
@@ -2591,7 +2592,7 @@
}
_INST(lastErrorNumber) = nil;
if ((fp = _INST(filePointer)) != nil) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
#ifdef OLD
RETURN ( feof(f) ? _true : false );
#else
@@ -2781,7 +2782,9 @@
peekFor:anObject
"return true and move past next element, if next == something.
Otherwise, stay and return false. False is also returned
- when EOF is encountered."
+ when EOF is encountered.
+ The argument must be an integer if in binary, a character if in
+ text mode; only single byte characters are currently supported."
%{ /* NOCONTEXT */
@@ -2807,7 +2810,7 @@
}
}
- f = MKFD(fp);
+ f = __FILEVal(fp);
if (feof(f)) {
_INST(hitEOF) = true;
@@ -2862,7 +2865,8 @@
nextMatchFor:anObject
"skip all objects up-to and including anObject, return anObject on success,
nil if end-of-file is reached before. The next read operation will return
- the element after anObject."
+ the element after anObject.
+ Only single byte characters are currently supported."
%{ /* NOCONTEXT */
@@ -2885,7 +2889,7 @@
if (peekValue >= 0) {
_INST(position) = nil;
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -2931,7 +2935,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
if (_INST(binary) != true) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__READING__(f)
@@ -3029,7 +3033,8 @@
"skip all characters up-to and including aCharacter. Return the receiver if
skip was successfull, otherwise (i.e. if not found) return nil.
The next read operation will return the character after aCharacter.
- The argument, aCharacter must be character, or integer wehn in binary mode."
+ The argument, aCharacter must be character, or integer when in binary mode.
+ Only single byte characters are currently supported."
%{ /* NOCONTEXT */
@@ -3052,7 +3057,7 @@
/* Q: should we just say: "not found" ? */
if ((cSearch < 0) || (cSearch > 255)) goto badArgument;
- f = MKFD(fp);
+ f = __FILEVal(fp);
__READING__(f)
__BEGIN_INTERRUPTABLE__
@@ -3117,7 +3122,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
if (_INST(binary) != true) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
if (feof(f)) {
_INST(hitEOF) = true;
@@ -3186,7 +3191,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
if (_INST(binary) != true) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__READING__(f)
__BEGIN_INTERRUPTABLE__
@@ -3249,7 +3254,7 @@
if (((fp = _INST(filePointer)) != nil)
&& (_INST(mode) != @symbol(writeonly))) {
- f = MKFD(fp);
+ f = __FILEVal(fp);
__BEGIN_INTERRUPTABLE__
__READING__(f)
@@ -3369,7 +3374,7 @@
}
_INST(lastErrorNumber) = nil;
- f = MKFD(_INST(filePointer));
+ f = __FILEVal(_INST(filePointer));
__READING__(f)