--- a/ReadStream.st Thu Sep 25 21:42:55 2014 +0200
+++ b/ReadStream.st Fri Sep 26 15:36:20 2014 +0200
@@ -56,7 +56,6 @@
! !
-
!ReadStream methodsFor:'converting'!
readStream
@@ -73,6 +72,45 @@
This method has been defined for protocol copmatibility with Filename"
^ self
+!
+
+upTo:anObject
+%{
+ OBJ _collection = __INST(collection);
+
+ if (__isString(_collection)
+ && __isCharacter(anObject)) {
+ unsigned int ch = __intVal(__characterVal(anObject));
+
+ if (ch <= 0xFF) {
+ int _startPos = __intVal(__INST(position));
+ int _endIndex;
+ char *startPtr = __stringVal(_collection) + _startPos;
+ char *foundPtr;
+ OBJ rslt;
+
+ _endIndex = __stringSize(_collection);
+ if (__isInteger(__INST(readLimit))) {
+ int _readLimit = __intVal(__INST(readLimit));
+
+ if (_readLimit < _endIndex) _endIndex = _readLimit;
+ }
+
+ foundPtr = memchr( startPtr, ch, _endIndex-_startPos);
+ if (foundPtr == NULL) {
+ // not found
+ rslt = __MKSTRING_L(startPtr, _endIndex-_startPos);
+ __INST(position) = __mkSmallInteger(_endIndex);
+ } else {
+ // found at foundPtr
+ rslt = __MKSTRING_L(startPtr, foundPtr-startPtr);
+ __INST(position) = __mkSmallInteger(_startPos + foundPtr-startPtr + 1);
+ }
+ RETURN (rslt);
+ }
+ }
+%}.
+ ^ super upTo:anObject
! !
!ReadStream methodsFor:'emphasis'!
@@ -854,10 +892,10 @@
!ReadStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.74 2014-03-04 12:40:49 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.75 2014-09-26 13:36:20 ca Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.74 2014-03-04 12:40:49 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.75 2014-09-26 13:36:20 ca Exp $'
! !