--- a/PosStream.st Mon Oct 10 01:29:01 1994 +0100
+++ b/PosStream.st Mon Oct 10 01:29:28 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -19,9 +19,9 @@
PositionableStream comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.15 1994-08-05 00:59:23 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.16 1994-10-10 00:27:25 claus Exp $
'!
!PositionableStream class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.15 1994-08-05 00:59:23 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.16 1994-10-10 00:27:25 claus Exp $
"
!
@@ -61,8 +61,11 @@
"setup the signal used to handle errors during fileIn"
ErrorDuringFileInSignal isNil ifTrue:[
- ErrorDuringFileInSignal := (Signal new) mayProceed:true.
- ErrorDuringFileInSignal notifierString:'error during fileIn'.
+ Object initialize.
+
+ ErrorDuringFileInSignal := Object errorSignal newSignalMayProceed:true.
+ ErrorDuringFileInSignal nameClass:self message:#errorDuringFileInSignal.
+ ErrorDuringFileInSignal notifierString:'error during fileIn'.
]
! !
@@ -150,7 +153,7 @@
otherwise stay and let position unchanged"
self next == something ifTrue:[
- ^ true
+ ^ true
].
self backStep.
^ false
@@ -236,47 +239,47 @@
inPrimitive := false.
[done] whileFalse:[
- ((index + 2) <= currSize) ifFalse:[
- newString := String new:(currSize * 2).
- newString replaceFrom:1 to:currSize with:theString.
- currSize := currSize * 2.
- theString := newString
- ].
- thisChar isNil ifTrue:[
- done := true
- ] ifFalse:[
- (thisChar == $% ) ifTrue:[
- nextChar := self peek.
- (nextChar == ${ ) ifTrue:[
- inPrimitive := true.
- index := index + 1.
- theString at:index put:thisChar.
- thisChar := self next
- ] ifFalse:[
- (nextChar == $} ) ifTrue:[
- inPrimitive := false.
- index := index + 1.
- theString at:index put:thisChar.
- thisChar := self next
- ]
- ]
- ] ifFalse:[
- inPrimitive ifFalse:[
- (thisChar == sep) ifTrue:[
- (self peek == sep) ifFalse:[
- done := true
- ] ifTrue:[
- self next
- ]
- ]
- ]
- ]
- ].
- done ifFalse:[
- index := index + 1.
- theString at:index put:thisChar.
- thisChar := self next
- ]
+ ((index + 2) <= currSize) ifFalse:[
+ newString := String new:(currSize * 2).
+ newString replaceFrom:1 to:currSize with:theString.
+ currSize := currSize * 2.
+ theString := newString
+ ].
+ thisChar isNil ifTrue:[
+ done := true
+ ] ifFalse:[
+ (thisChar == $% ) ifTrue:[
+ nextChar := self peek.
+ (nextChar == ${ ) ifTrue:[
+ inPrimitive := true.
+ index := index + 1.
+ theString at:index put:thisChar.
+ thisChar := self next
+ ] ifFalse:[
+ (nextChar == $} ) ifTrue:[
+ inPrimitive := false.
+ index := index + 1.
+ theString at:index put:thisChar.
+ thisChar := self next
+ ]
+ ]
+ ] ifFalse:[
+ inPrimitive ifFalse:[
+ (thisChar == sep) ifTrue:[
+ (self peek == sep) ifFalse:[
+ done := true
+ ] ifTrue:[
+ self next
+ ]
+ ]
+ ]
+ ]
+ ].
+ done ifFalse:[
+ index := index + 1.
+ theString at:index put:thisChar.
+ thisChar := self next
+ ]
].
(index == 0) ifTrue:[^ ''].
^ theString copyTo:index
@@ -298,48 +301,48 @@
endIndex := aString size.
[index <= endIndex] whileTrue:[
- next := aString indexOf:$% startingAt:index ifAbsent:[endIndex + 1].
- next := next min:
- (aString indexOf:${ startingAt:index ifAbsent:[endIndex + 1]).
- next := next min:
- (aString indexOf:$} startingAt:index ifAbsent:[endIndex + 1]).
- next := next min:
- (aString indexOf:sep startingAt:index ifAbsent:[endIndex + 1]).
+ next := aString indexOf:$% startingAt:index ifAbsent:[endIndex + 1].
+ next := next min:
+ (aString indexOf:${ startingAt:index ifAbsent:[endIndex + 1]).
+ next := next min:
+ (aString indexOf:$} startingAt:index ifAbsent:[endIndex + 1]).
+ next := next min:
+ (aString indexOf:sep startingAt:index ifAbsent:[endIndex + 1]).
- ((index == 1) and:[next == (endIndex + 1)]) ifTrue:[
- self nextPutAll:aString
- ] ifFalse:[
- self nextPutAll:(aString copyFrom:index to:(next - 1))
- ].
+ ((index == 1) and:[next == (endIndex + 1)]) ifTrue:[
+ self nextPutAll:aString
+ ] ifFalse:[
+ self nextPutAll:(aString copyFrom:index to:(next - 1))
+ ].
- index := next.
- (index <= endIndex) ifTrue:[
- character := aString at:index.
- (character == $% ) ifTrue:[
- gotPercent := true
- ] ifFalse:[
- (character == ${ ) ifTrue:[
- gotPercent ifTrue:[
- inPrimitive := true
- ]
- ] ifFalse:[
- (character == $} ) ifTrue:[
- gotPercent ifTrue:[
- inPrimitive := false
- ]
- ] ifFalse:[
- inPrimitive ifFalse:[
- (character == sep) ifTrue:[
- self nextPut:sep
- ]
- ]
- ]
- ].
- gotPercent := false
- ].
- self nextPut:character.
- index := index + 1
- ]
+ index := next.
+ (index <= endIndex) ifTrue:[
+ character := aString at:index.
+ (character == $% ) ifTrue:[
+ gotPercent := true
+ ] ifFalse:[
+ (character == ${ ) ifTrue:[
+ gotPercent ifTrue:[
+ inPrimitive := true
+ ]
+ ] ifFalse:[
+ (character == $} ) ifTrue:[
+ gotPercent ifTrue:[
+ inPrimitive := false
+ ]
+ ] ifFalse:[
+ inPrimitive ifFalse:[
+ (character == sep) ifTrue:[
+ self nextPut:sep
+ ]
+ ]
+ ]
+ ].
+ gotPercent := false
+ ].
+ self nextPut:character.
+ index := index + 1
+ ]
].
self nextPut:sep
! !
@@ -366,39 +369,39 @@
|lastValue|
- SignalSet anySignal handle:[:ex |
- |action what|
+ Object errorSignal handle:[:ex |
+ |action what|
- "handle the case where no GUI has been built in,
- just abort the fileIn with a notification"
+ "handle the case where no GUI has been built in,
+ just abort the fileIn with a notification"
- Display isNil ifTrue:[
- self notify:(ex signal notifierString ,
- ' in ' , ex suspendedContext sender receiver class name ,
- '>>>' , ex suspendedContext sender selector).
- ex return
- ].
+ Display isNil ifTrue:[
+ self notify:(ex signal notifierString ,
+ ' in ' , ex suspendedContext sender receiver class name ,
+ '>>>' , ex suspendedContext sender selector).
+ ex return
+ ].
- "otherwise ask what should be done now and either
- continue or abort the fileIn"
+ "otherwise ask what should be done now and either
+ continue or abort the fileIn"
- what := ex errorString.
- what isNil ifTrue:[
- what := ex signal notifierString.
- ].
- action := self askForDebug:('error in fileIn: ' , what) withCRs.
- action == #continue ifTrue:[
- ex proceed
- ].
- action == #abort ifTrue:[
- ex return
- ].
- Debugger enter:ex suspendedContext
- "ex reject"
+ what := ex errorString.
+ what isNil ifTrue:[
+ what := ex signal notifierString.
+ ].
+ action := self askForDebug:('error in fileIn: ' , what) withCRs.
+ action == #continue ifTrue:[
+ ex proceed
+ ].
+ action == #abort ifTrue:[
+ ex return
+ ].
+ Debugger enter:ex suspendedContext
+ "ex reject"
] do:[
- [self atEnd] whileFalse:[
- lastValue := self fileInNextChunkNotifying:someone
- ]
+ [self atEnd] whileFalse:[
+ lastValue := self fileInNextChunkNotifying:someone
+ ]
].
^ lastValue
!
@@ -407,27 +410,26 @@
"read next chunk, evaluate it and return the result;
someone (which is usually some codeView) is notified of errors."
- |aString sawExcla sep|
+ |aString sawExcla sep rslt|
sep := self class chunkSeparator.
self skipSeparators.
self atEnd ifFalse:[
- sawExcla := self peekFor:sep.
- aString := self nextChunk.
- aString size ~~ 0 ifTrue:[
- sawExcla ifFalse:[
- ^ Compiler evaluate:aString notifying:someone
- ].
- "
- usually, the chunk consists of some methodsFor:-expression
- evaluate it (usually returning a ClassCategoryReader) and
- let this reader compile the methods
- "
- ^ (Compiler evaluate:aString notifying:someone)
- fileInFrom:self notifying:someone
- ]
+ sawExcla := self peekFor:sep.
+ aString := self nextChunk.
+ aString size ~~ 0 ifTrue:[
+ rslt := Compiler evaluate:aString notifying:someone.
+ sawExcla ifTrue:[
+ "
+ usually, the above chunk consists of some methodsFor:-expression
+ in this case, the returned value is a ClassCategoryReader,
+ which is used to load & compile the methods ...
+ "
+ rslt := rslt fileInFrom:self notifying:someone
+ ]
+ ]
].
- ^ nil
+ ^ rslt
!
@@ -439,8 +441,8 @@
box := OptionBox title:message numberOfOptions:3.
box actions:(Array with:[^ #abort]
- with:[^ #debug]
- with:[^ #continue]).
+ with:[^ #debug]
+ with:[^ #continue]).
box buttonTitles:#('abort' 'debug' 'continue').
box showAtPointer.
^ #abort