--- a/WriteStream.st Wed Mar 16 10:40:51 1994 +0100
+++ b/WriteStream.st Wed Mar 30 11:38:21 1994 +0200
@@ -22,12 +22,18 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-Streams for writing into - this implementation currently DOES change the identity if the
-streamed-upon collection if it cannot grow. Thus its slightly incompatible to ST-80 since
-aStream contents does not always return the original collection. This will change soon.
+$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.7 1994-03-30 09:34:16 claus Exp $
+'!
+
+!WriteStream class methodsFor:'documentation'!
-$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.6 1994-02-25 13:07:09 claus Exp $
-'!
+documentation
+"
+ Streams for writing into - this implementation currently DOES change the identity if the
+ streamed-upon collection if it cannot grow. Thus its slightly incompatible to ST-80 since
+ aStream contents does not always return the original collection. This may change.
+"
+! !
!WriteStream class methodsFor:'instance creation'!
@@ -36,6 +42,7 @@
writing is limited to the elements in the range start to last."
|newStream|
+
newStream := super on:aCollection from:start to:last.
newStream writeLimit:last.
^ newStream
@@ -98,19 +105,20 @@
REGISTER int pos;
unsigned ch;
OBJ coll;
+ OBJ t;
coll = _INST(collection);
if (_isNonNilObject(coll)
- && _isSmallInteger(_INST(position))) {
-
- pos = _intVal(_INST(position));
+ && _isSmallInteger(t = _INST(position))) {
- if (_isSmallInteger(_INST(writeLimit))
- && (pos <= _intVal(_INST(writeLimit)))
- && (pos > 0)) {
+ pos = _intVal(t);
+
+ if (_isSmallInteger(t = _INST(writeLimit))
+ && (pos <= _intVal(t)) && (pos > 0)) {
OBJ cls;
cls = _qClass(coll);
+#ifdef NOTDEF
if (cls == String) {
if (__isCharacter(anObject)
&& (pos <= _stringSize(coll))) {
@@ -122,7 +130,9 @@
}
RETURN ( anObject );
}
- } else if (cls == ByteArray) {
+ } else
+#endif
+ if (cls == ByteArray) {
if (_isSmallInteger(anObject)
&& ((ch = _intVal(anObject)) >= 0)
&& (ch <= 255)
@@ -135,7 +145,9 @@
}
RETURN ( anObject );
}
- } else if (cls == Array) {
+#ifdef NOTDEF
+ } else
+ if (cls == Array) {
if (pos <= _arraySize(coll)) {
_ArrayInstPtr(coll)->a_element[pos-1] = anObject;
__STORE(coll, anObject);
@@ -146,6 +158,7 @@
}
RETURN ( anObject );
}
+#endif
}
}
}
@@ -165,7 +178,7 @@
Redefined to avoid count grows of the underlying collection -
instead a single grow on the final size is performed."
- |nMore final|
+ |final|
final := position + count - 1.
(final > collection size) ifTrue:[