--- a/Class.st Tue Feb 25 11:17:54 2003 +0100
+++ b/Class.st Tue Feb 25 12:48:02 2003 +0100
@@ -638,7 +638,7 @@
classFilename notNil ifTrue:[
stream := self sourceStream.
stream notNil ifTrue:[
- stream position:comment - 1 + (PositionableStream zeroPosition).
+ stream position1Based:comment.
string := String readFrom:stream onError:''.
stream close.
^ string
@@ -650,6 +650,7 @@
"
Object comment
+ RunArray comment
"
!
@@ -3514,7 +3515,7 @@
classFilename notNil ifTrue:[
stream := self sourceStream.
stream notNil ifTrue:[
- stream position:pos + (PositionableStream zeroPosition).
+ stream position0Based:pos.
string := stream nextChunk.
stream close.
^ string
@@ -3525,6 +3526,12 @@
^ pos
"Modified: 15.1.1997 / 15:29:30 / stefan"
+
+ "
+ ExternalStream primitiveFunctionsString
+ ExternalStream primitiveDefinitionsString
+ ExternalStream primitiveVariablesString
+ "
!
setPrimitiveSpecsAt:index to:aString
@@ -4719,7 +4726,7 @@
'Class [info]: position error when accessing source' infoPrintCR.
^ false
] do:[
- aStream position:pos.
+ aStream position1Based:pos.
].
src := aStream nextChunk.
aStream position:oldPos.
@@ -4766,5 +4773,5 @@
!Class class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.420 2003-02-24 17:01:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.421 2003-02-25 11:48:02 cg Exp $'
! !
--- a/ClassCategoryReader.st Tue Feb 25 11:17:54 2003 +0100
+++ b/ClassCategoryReader.st Tue Feb 25 12:48:02 2003 +0100
@@ -292,7 +292,7 @@
done := aStream atEnd.
done ifFalse:[
canMakeSourceRef ifTrue:[
- pos := aStream position
+ pos := aStream position1Based
].
aString := aStream nextChunk.
aStream skipSeparators.
@@ -337,7 +337,7 @@
SourceMode == #sourceReference ifTrue:[
s := sourceFile asFilename appendingWriteStream.
s setToEnd.
- pos := s position.
+ pos := s position1Based.
s nextChunkPut:src.
s close.
].
@@ -434,6 +434,7 @@
!ClassCategoryReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.49 2001-12-12 15:25:27 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.50 2003-02-25 11:47:55 cg Exp $'
! !
+
ClassCategoryReader initialize!
--- a/Collection.st Tue Feb 25 11:17:54 2003 +0100
+++ b/Collection.st Tue Feb 25 12:48:02 2003 +0100
@@ -2041,7 +2041,7 @@
] ifFalse:[
s := WriteStream on:(String new:50).
].
- limit := s position + self maxPrint.
+ limit := s position1Based + self maxPrint.
self printElementsDo:[:element |
firstOne ifFalse:[
@@ -2049,7 +2049,7 @@
] ifTrue:[
firstOne := false
].
- (s position >= limit) ifTrue:[
+ (s position1Based >= limit) ifTrue:[
s ~~ aStream ifTrue:[
aStream nextPutAll:(s contents).
].
@@ -2484,7 +2484,7 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.134 2003-02-07 09:51:37 penk Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.135 2003-02-25 11:47:47 cg Exp $'
! !
Collection initialize!
--- a/ExternalStream.st Tue Feb 25 11:17:54 2003 +0100
+++ b/ExternalStream.st Tue Feb 25 12:48:02 2003 +0100
@@ -2796,45 +2796,46 @@
__INST(lastErrorNumber) = nil;
if (__isString(aString)) {
- matchString = (char *) __stringVal(aString);
- l = __stringSize(aString);
-
- f = __FILEVal(__INST(filePointer));
- __READING__(f)
-
- for (;;) {
- FTELL(f, lastpos);
- if (!gotFirst) {
- firstpos = lastpos;
- gotFirst = 1;
- }
-
- __BEGIN_INTERRUPTABLE__
- do {
- cp = fgets(buffer, sizeof(buffer)-1, f);
- } while ((cp == NULL) && ferror(f) && (__threadErrno == EINTR) && (clearerr(f), 1));
- buffer[sizeof(buffer)-1] = '\0';
- __END_INTERRUPTABLE__
-
- if (cp == NULL) {
- if (ferror(f)) {
- __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
- goto err;
- } else {
- FSEEK(f, firstpos);
- RETURN (nil);
- }
- }
- if (strncmp(cp, matchString, l) == 0) {
- FSEEK(f, lastpos);
- break;
- }
- }
- /* remove EOL character */
- cp = buffer;
- while (*cp && (*cp != '\n') && (*cp != '\r')) cp++;
- *cp = '\0';
- RETURN ( __MKSTRING(buffer) );
+ matchString = (char *) __stringVal(aString);
+ l = __stringSize(aString);
+
+ f = __FILEVal(__INST(filePointer));
+ __READING__(f)
+
+ for (;;) {
+ FTELL(f, lastpos);
+ if (!gotFirst) {
+ firstpos = lastpos;
+ gotFirst = 1;
+ }
+
+ __BEGIN_INTERRUPTABLE__
+ do {
+ cp = fgets(buffer, sizeof(buffer)-1, f);
+ } while ((cp == NULL) && ferror(f) && (__threadErrno == EINTR) && (clearerr(f), 1));
+ buffer[sizeof(buffer)-1] = '\0';
+ __END_INTERRUPTABLE__
+
+ if (cp == NULL) {
+ if (ferror(f)) {
+ __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
+ goto err;
+ } else {
+ FSEEK(f, firstpos);
+ RETURN (nil);
+ }
+ }
+ if (strncmp(cp, matchString, l) == 0) {
+ FSEEK(f, lastpos);
+ break;
+ }
+ }
+ /* remove EOL character */
+ cp = buffer;
+ while (*cp && (*cp != '\n') && (*cp != '\r')) cp++;
+ *cp = '\0';
+ __INST(position) = nil; /* unknown */
+ RETURN ( __MKSTRING(buffer) );
}
err: ;
@@ -2849,16 +2850,16 @@
firstPos := self position.
[self atEnd] whileFalse:[
- lastPos := self position.
- line := self nextLine.
- line isNil ifTrue:[
- self position:firstPos.
- ^ nil
- ].
- (line startsWith:aString) ifTrue:[
- self position:lastPos.
- ^ line
- ]
+ lastPos := self position.
+ line := self nextLine.
+ line isNil ifTrue:[
+ self position:firstPos.
+ ^ nil
+ ].
+ (line startsWith:aString) ifTrue:[
+ self position:lastPos.
+ ^ line
+ ]
].
self position:firstPos.
^ nil
@@ -4349,21 +4350,25 @@
buffer := self contentsSpecies new:4096.
[self atEnd] whileFalse:[
- count := self nextAvailableBytes:4096 into:buffer startingAt:1.
- count ~~ 0 ifTrue:[
- answerStream isNil ifTrue:[
- answerStream := WriteStream with:buffer.
- answerStream position:ZeroPosition+count.
- buffer := self contentsSpecies new:4096.
- ] ifFalse:[
- answerStream nextPutAll:buffer startingAt:1 to:count.
- ].
- ].
+ count := self nextAvailableBytes:4096 into:buffer startingAt:1.
+ count ~~ 0 ifTrue:[
+ answerStream isNil ifTrue:[
+ answerStream := WriteStream with:buffer.
+ answerStream position0Based:count.
+ buffer := self contentsSpecies new:4096.
+ ] ifFalse:[
+ answerStream nextPutAll:buffer startingAt:1 to:count.
+ ].
+ ].
].
answerStream isNil ifTrue:[^ self contentsSpecies new].
^ answerStream contents
- "Created: 25.4.1996 / 14:40:31 / cg"
+ "
+ ('smalltalk.rc' asFilename readStream upToEnd)
+ =
+ ('smalltalk.rc' asFilename readStream contentsOfEntireFile)
+ "
! !
!ExternalStream methodsFor:'reimplemented for speed'!
@@ -5786,7 +5791,7 @@
!ExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.249 2003-02-25 10:16:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.250 2003-02-25 11:47:40 cg Exp $'
! !
ExternalStream initialize!
--- a/Method.st Tue Feb 25 11:17:54 2003 +0100
+++ b/Method.st Tue Feb 25 12:48:02 2003 +0100
@@ -599,7 +599,7 @@
Stream positionErrorSignal handle:[:ex |
^ nil
] do:[
- aStream position:sourcePosition abs.
+ aStream position1Based:sourcePosition abs.
].
^ aStream nextChunk.
!
@@ -2883,7 +2883,7 @@
!Method class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.248 2003-01-31 17:34:43 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.249 2003-02-25 11:47:14 cg Exp $'
! !
Method initialize!
--- a/PositionableStream.st Tue Feb 25 11:17:54 2003 +0100
+++ b/PositionableStream.st Tue Feb 25 12:48:02 2003 +0100
@@ -985,19 +985,19 @@
if no match was found, the receiver will be positioned at the end.
This is redefined here, to make use of positioning."
- |buffer l first idx|
+ |buffer len first idx|
- l := aCollection size.
+ len := aCollection size.
first := aCollection at:1.
[self atEnd] whileFalse:[
- buffer := self nextAvailable:l.
- buffer = aCollection ifTrue:[
- ^ self
- ].
- idx := buffer indexOf:first startingAt:2.
- idx == 0 ifFalse:[
- self position:(self position - l + idx - 1)
- ]
+ buffer := self nextAvailable:len.
+ buffer = aCollection ifTrue:[
+ ^ self
+ ].
+ idx := buffer indexOf:first startingAt:2.
+ idx == 0 ifFalse:[
+ self position:(self position - len + idx - 1)
+ ]
].
^ nil
@@ -1029,21 +1029,21 @@
return nil if not found, self otherwise.
On a successful match, the next read will return elements of aCollection."
- |oldPos buffer l first idx|
+ |oldPos buffer len first idx|
oldPos := self position.
- l := aCollection size.
+ len := aCollection size.
first := aCollection at:1.
[self atEnd] whileFalse:[
- buffer := self next:l.
- buffer = aCollection ifTrue:[
- self position:(self position - l).
- ^ self
- ].
- idx := buffer indexOf:first startingAt:2.
- idx == 0 ifFalse:[
- self position:(self position - l + idx - 1)
- ]
+ buffer := self next:len.
+ buffer = aCollection ifTrue:[
+ self position:(self position - len).
+ ^ self
+ ].
+ idx := buffer indexOf:first startingAt:2.
+ idx == 0 ifFalse:[
+ self position:(self position - len + idx - 1)
+ ]
].
self position:oldPos.
^ nil
@@ -1193,7 +1193,7 @@
!PositionableStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.122 2003-02-25 10:16:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.123 2003-02-25 11:46:48 cg Exp $'
! !
PositionableStream initialize!
--- a/Smalltalk.st Tue Feb 25 11:17:54 2003 +0100
+++ b/Smalltalk.st Tue Feb 25 12:48:02 2003 +0100
@@ -3212,33 +3212,33 @@
newStream := 'src.tmp' asFilename writeStream.
newStream isNil ifTrue:[
- self error:'cannot create new temporary source file' mayProceed:true.
- ^ self
+ self error:'cannot create new temporary source file' mayProceed:true.
+ ^ self
].
table := IdentityDictionary new:100.
Method allSubInstancesDo:[:aMethod |
- source := nil.
- aMethod sourcePosition notNil ifTrue:[
- aMethod sourceFilename = 'st.src' ifTrue:[
- source := aMethod source.
- ]
- ] ifFalse:[
- source := aMethod source
- ].
-
- source notNil ifTrue:[
- pos := newStream position.
- newStream nextChunkPut:source.
-
- "
- dont change the methods info - maybe some write error
- occurs later, in that case we abort and leave everything
- untouched.
- "
- table at:aMethod put:pos
- ]
+ source := nil.
+ aMethod sourcePosition notNil ifTrue:[
+ aMethod sourceFilename = 'st.src' ifTrue:[
+ source := aMethod source.
+ ]
+ ] ifFalse:[
+ source := aMethod source
+ ].
+
+ source notNil ifTrue:[
+ pos := newStream position1Based.
+ newStream nextChunkPut:source.
+
+ "
+ dont change the methods info - maybe some write error
+ occurs later, in that case we abort and leave everything
+ untouched.
+ "
+ table at:aMethod put:pos
+ ]
].
newStream close.
@@ -3253,7 +3253,7 @@
source reference"
table keysAndValuesDo:[:aMethod :pos |
- aMethod localSourceFilename:fileName position:pos.
+ aMethod localSourceFilename:fileName position:pos.
"/ aMethod printCR.
].
@@ -3278,25 +3278,25 @@
newStream := 'src.tmp' asFilename writeStream.
newStream isNil ifTrue:[
- self error:'cannot create new temporary source file' mayProceed:true.
- ^ self
+ self error:'cannot create new temporary source file' mayProceed:true.
+ ^ self
].
table := IdentityDictionary new:100.
Method allSubInstancesDo:[:aMethod |
- source := aMethod source.
- source notNil ifTrue:[
- pos := newStream position.
- newStream nextChunkPut:source.
-
- "
- dont change the methods info - maybe some write error
- occurs later, in that case we abort and leave everything
- untouched.
- "
- table at:aMethod put:pos
- ]
+ source := aMethod source.
+ source notNil ifTrue:[
+ pos := newStream position1Based.
+ newStream nextChunkPut:source.
+
+ "
+ dont change the methods info - maybe some write error
+ occurs later, in that case we abort and leave everything
+ untouched.
+ "
+ table at:aMethod put:pos
+ ]
].
newStream close.
@@ -3311,7 +3311,7 @@
source reference"
table keysAndValuesDo:[:aMethod :pos |
- aMethod localSourceFilename:fileName position:pos.
+ aMethod localSourceFilename:fileName position:pos.
"/ aMethod printCR.
].
@@ -6399,5 +6399,5 @@
!Smalltalk class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.561 2003-02-19 18:05:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.562 2003-02-25 11:46:01 cg Exp $'
! !