--- a/PeekableStream.st Wed Feb 05 18:19:20 2014 +0100
+++ b/PeekableStream.st Wed Feb 05 18:19:31 2014 +0100
@@ -225,15 +225,7 @@
"file in from the receiver, i.e. read chunks and evaluate them -
return the value of the last chunk."
- |notifiedLoader lastValue s|
-
- self isEncodedStream ifFalse:[
- s := EncodedStream decodedStreamFor:self.
- "/ may return myself, in case no decoding is required...
- s ~~ self ifTrue:[
- ^ s fileIn
- ]
- ].
+ |notifiedLoader lastValue|
SourceFileLoader notNil ifTrue:[
notifiedLoader := SourceFileLoader on:self.
@@ -377,154 +369,11 @@
return the value of the last chunk.
Someone (which is usually some codeView) is notified of errors."
- |lastValue pkg nameSpace usedNameSpaces
- packageQuerySignal nameSpaceQuerySignal usedNameSpaceQuerySignal
- changeDefaultApplicationNotificationSignal
- defaultApplicationQuerySignal defaultApplication
- confirmationQuerySignal handledSignals passedSignals askSomeoneForPackage outerContext askForVariableTypeOfUndeclaredQuery|
-
- self skipSeparators.
- lastValue := self peek.
- lastValue == $< ifTrue:[
- "/ assume, it's an xml file
- ^ self fileInXMLNotifying:someone passChunk:passChunk.
- ].
- lastValue == $# ifTrue:[
- "assume unix interpreter name:
- '#!!stx -e' or something like this"
- self nextPeek == $!! ifTrue:[
- "skip the unix command line"
- self nextLine
- ] ifFalse:[
- self error:'Invalid chunk start'
- ]
- ].
-
- Smalltalk::Compiler isNil ifTrue:[
- self isFileStream ifTrue:[
- Transcript show:('[' , self pathName , '] ').
- ].
- Transcript showCR:'cannot fileIn (no compiler).'.
- ^ nil.
- ].
-
- "/ support for V'Age applications
- defaultApplicationQuerySignal := Class defaultApplicationQuerySignal.
- changeDefaultApplicationNotificationSignal := Class changeDefaultApplicationNotificationSignal.
-
- "/ support for ST/X's nameSpaces & packages
- packageQuerySignal := Class packageQuerySignal.
- nameSpaceQuerySignal := Class nameSpaceQuerySignal.
- usedNameSpaceQuerySignal := Class usedNameSpaceQuerySignal.
-
- (someone respondsTo:#packageToInstall) ifTrue:[
- pkg := someone packageToInstall.
- askSomeoneForPackage := true.
- ] ifFalse:[
- pkg := packageQuerySignal query.
- askSomeoneForPackage := false.
- ].
- (someone respondsTo:#currentNameSpace) ifTrue:[
- nameSpace := someone currentNameSpace
- ] ifFalse:[
- nameSpace := nameSpaceQuerySignal query.
- ].
- (someone respondsTo:#usedNameSpaces) ifTrue:[
- usedNameSpaces := someone usedNameSpaces
- ] ifFalse:[
- usedNameSpaces := usedNameSpaceQuerySignal query.
- ].
- (someone respondsTo:#defaultApplication) ifTrue:[
- defaultApplication := someone defaultApplication
- ] ifFalse:[
- defaultApplication := defaultApplicationQuerySignal query.
- ].
-
- confirmationQuerySignal := Metaclass confirmationQuerySignal.
-
- handledSignals := SignalSet new.
- passedSignals := IdentitySet new.
-
- handledSignals add:changeDefaultApplicationNotificationSignal.
- passedSignals add:changeDefaultApplicationNotificationSignal.
- handledSignals add:defaultApplicationQuerySignal.
- passedSignals add:defaultApplicationQuerySignal.
+ ^(EncodedStream decodedStreamFor:self) basicFileInNotifying:someone passChunk:passChunk
- handledSignals add:packageQuerySignal.
- handledSignals add:usedNameSpaceQuerySignal.
- handledSignals add:nameSpaceQuerySignal.
- handledSignals add:confirmationQuerySignal.
- passedSignals add:confirmationQuerySignal.
- Parser notNil ifTrue:[
- "only if libcomp is present"
- "Also catch a 'Parser askForVariableTypeOfUndeclaredQuery' and proceed with nil.
- Imagine somebody has autodefine workspace variables on and then
- evaluate Smalltalk loadPackage:'xyz' that loads code from source (using file-in),
- certainly we don't want to compile workspace variable access for every
- not-yet-loaded class in some namespace.
- This is demonstrated by Regression::CompilerTests2>>test_01
- and this change actually fixes this test."
- askForVariableTypeOfUndeclaredQuery := Parser askForVariableTypeOfUndeclaredQuery.
- handledSignals add:askForVariableTypeOfUndeclaredQuery.
- ].
-
-
- outerContext := thisContext.
-
- handledSignals handle:[:ex |
- |sig|
-
- sig := ex creator.
- ((passedSignals includes:sig) and:[sig isHandledIn:outerContext]) ifTrue:[
- ex reject
- ].
-
- sig == changeDefaultApplicationNotificationSignal ifTrue:[
- "/ invoked via #becomeDefault to set the defaultApp and the package.
- "/ (only when filing in V'Age code)
- defaultApplication := ex parameter.
- pkg := defaultApplication name asSymbol.
- ex proceedWith:nil
- ].
- sig == defaultApplicationQuerySignal ifTrue:[
- "/ query for the application to add classes & methods into
- "/ (only when filing in V'Age code)
- ex proceedWith:defaultApplication
- ].
- sig == packageQuerySignal ifTrue:[
- "answer the package to use for classes & methods"
- askSomeoneForPackage ifTrue:[
- ex proceedWith:someone packageToInstall
- ] ifFalse:[
- ex proceedWith:pkg
- ]
- ].
- sig == usedNameSpaceQuerySignal ifTrue:[
- "answer the nameSpaces to be searched when encountering globals"
- ex proceedWith:usedNameSpaces
- ].
- sig == nameSpaceQuerySignal ifTrue:[
- "answer the nameSpace to install new classes in"
- ex proceedWith:nameSpace
- ].
- sig == confirmationQuerySignal ifTrue:[
- "don't pop up dialogs"
- ex proceedWith:false
- ].
- sig == askForVariableTypeOfUndeclaredQuery ifTrue:[
- "no autodefined variables or so"
- ex proceedWith:nil.
- ].
- ] do:[
- [self atEnd] whileFalse:[
- lastValue := self fileInNextChunkNotifying:someone passChunk:passChunk
- ]
- ].
- ^ lastValue
-
- "Modified: / 10.9.1999 / 16:54:01 / stefan"
- "Modified: / 16.11.2001 / 16:21:28 / cg"
- "Modified: / 18-03-2013 / 17:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-09-1999 / 16:54:01 / stefan"
+ "Modified: / 16-11-2001 / 16:21:28 / cg"
+ "Modified: / 25-03-2013 / 22:57:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
fileInNextChunkNotifying:someone
@@ -1049,11 +898,11 @@
!PeekableStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.44 2013-04-19 09:39:39 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.45 2014-02-05 17:19:31 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.44 2013-04-19 09:39:39 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PeekableStream.st,v 1.45 2014-02-05 17:19:31 cg Exp $'
! !