--- a/PeekableStream.st Fri Mar 22 09:19:55 2013 +0000
+++ b/PeekableStream.st Mon Mar 25 23:04:02 2013 +0000
@@ -46,7 +46,6 @@
"
! !
-
!PeekableStream class methodsFor:'initialization'!
initialize
@@ -65,7 +64,6 @@
"Modified: / 23-10-2006 / 16:34:41 / cg"
! !
-
!PeekableStream class methodsFor:'Signal constants'!
currentFileInDirectoryQuerySignal
@@ -102,7 +100,6 @@
"Modified: / 23-10-2006 / 16:32:49 / cg"
! !
-
!PeekableStream class methodsFor:'queries'!
currentFileInDirectory
@@ -121,7 +118,6 @@
"Modified: / 23-10-2006 / 16:33:40 / cg"
! !
-
!PeekableStream methodsFor:'chunk input/output'!
nextChunk
@@ -223,7 +219,6 @@
^ theString
! !
-
!PeekableStream methodsFor:'fileIn'!
fileIn
@@ -265,7 +260,6 @@
"Modified: / 13.11.2001 / 10:14:04 / cg"
! !
-
!PeekableStream methodsFor:'positioning'!
skipAny:skipCollection
@@ -368,7 +362,6 @@
"
! !
-
!PeekableStream methodsFor:'private fileIn'!
basicFileInNotifying:someone passChunk:passChunk
@@ -376,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 signal.
- ((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
@@ -666,7 +516,6 @@
"/ self halt.
! !
-
!PeekableStream methodsFor:'reading'!
nextDecimalInteger
@@ -912,7 +761,6 @@
"Modified: 4.1.1997 / 23:38:05 / cg"
! !
-
!PeekableStream methodsFor:'reading-strings'!
nextAlphaNumericWord
@@ -1047,7 +895,6 @@
"Modified: 15.5.1996 / 17:51:42 / cg"
! !
-
!PeekableStream class methodsFor:'documentation'!
version