equal
deleted
inserted
replaced
54 self obsoleteMethodWarning:'WARNING: with: should not be used for ReadStreams - use #on:'. |
54 self obsoleteMethodWarning:'WARNING: with: should not be used for ReadStreams - use #on:'. |
55 ^ super with:aCollection |
55 ^ super with:aCollection |
56 ! ! |
56 ! ! |
57 |
57 |
58 |
58 |
59 |
|
60 !ReadStream methodsFor:'converting'! |
59 !ReadStream methodsFor:'converting'! |
61 |
60 |
62 readStream |
61 readStream |
63 "return a readStream from the receiver. Since this is already |
62 "return a readStream from the receiver. Since this is already |
64 a readStream, return self." |
63 a readStream, return self." |
71 a readStream, return self. |
70 a readStream, return self. |
72 |
71 |
73 This method has been defined for protocol copmatibility with Filename" |
72 This method has been defined for protocol copmatibility with Filename" |
74 |
73 |
75 ^ self |
74 ^ self |
|
75 ! |
|
76 |
|
77 upTo:anObject |
|
78 %{ |
|
79 OBJ _collection = __INST(collection); |
|
80 |
|
81 if (__isString(_collection) |
|
82 && __isCharacter(anObject)) { |
|
83 unsigned int ch = __intVal(__characterVal(anObject)); |
|
84 |
|
85 if (ch <= 0xFF) { |
|
86 int _startPos = __intVal(__INST(position)); |
|
87 int _endIndex; |
|
88 char *startPtr = __stringVal(_collection) + _startPos; |
|
89 char *foundPtr; |
|
90 OBJ rslt; |
|
91 |
|
92 _endIndex = __stringSize(_collection); |
|
93 if (__isInteger(__INST(readLimit))) { |
|
94 int _readLimit = __intVal(__INST(readLimit)); |
|
95 |
|
96 if (_readLimit < _endIndex) _endIndex = _readLimit; |
|
97 } |
|
98 |
|
99 foundPtr = memchr( startPtr, ch, _endIndex-_startPos); |
|
100 if (foundPtr == NULL) { |
|
101 // not found |
|
102 rslt = __MKSTRING_L(startPtr, _endIndex-_startPos); |
|
103 __INST(position) = __mkSmallInteger(_endIndex); |
|
104 } else { |
|
105 // found at foundPtr |
|
106 rslt = __MKSTRING_L(startPtr, foundPtr-startPtr); |
|
107 __INST(position) = __mkSmallInteger(_startPos + foundPtr-startPtr + 1); |
|
108 } |
|
109 RETURN (rslt); |
|
110 } |
|
111 } |
|
112 %}. |
|
113 ^ super upTo:anObject |
76 ! ! |
114 ! ! |
77 |
115 |
78 !ReadStream methodsFor:'emphasis'! |
116 !ReadStream methodsFor:'emphasis'! |
79 |
117 |
80 emphasis |
118 emphasis |
852 ! ! |
890 ! ! |
853 |
891 |
854 !ReadStream class methodsFor:'documentation'! |
892 !ReadStream class methodsFor:'documentation'! |
855 |
893 |
856 version |
894 version |
857 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.74 2014-03-04 12:40:49 stefan Exp $' |
895 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.75 2014-09-26 13:36:20 ca Exp $' |
858 ! |
896 ! |
859 |
897 |
860 version_CVS |
898 version_CVS |
861 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.74 2014-03-04 12:40:49 stefan Exp $' |
899 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.75 2014-09-26 13:36:20 ca Exp $' |
862 ! ! |
900 ! ! |
863 |
901 |