PositionableStream.st
changeset 7573 5c0f8cd19b66
parent 7503 ddabde2900d2
child 7578 9ac1e4ee012a
equal deleted inserted replaced
7572:43341d5aef04 7573:5c0f8cd19b66
   368 	  onCancel:#abort.
   368 	  onCancel:#abort.
   369 
   369 
   370     "Modified: 10.1.1997 / 18:00:56 / cg"
   370     "Modified: 10.1.1997 / 18:00:56 / cg"
   371 !
   371 !
   372 
   372 
       
   373 basicFileInNotifying:someone passChunk:passChunk
       
   374     "central method to file in from the receiver, i.e. read chunks and evaluate them -
       
   375      return the value of the last chunk.
       
   376      Someone (which is usually some codeView) is notified of errors."
       
   377 
       
   378     |lastValue pkg spc spaces
       
   379      packageQuerySignal nameSpaceQuerySignal usedNameSpaceQuerySignal
       
   380      changeDefaultApplicationNotificationSignal
       
   381      defaultApplicationQuerySignal defaultApplication
       
   382      confirmationQuerySignal handledSignals passedSignals
       
   383      dontAskSignals askSomeoneForPackage redef outerContext|
       
   384 
       
   385     self skipSeparators.
       
   386     lastValue := self peek.
       
   387     lastValue == $< ifTrue:[
       
   388         "/ assume, its an xml file
       
   389         ^ self fileInXMLNotifying:someone passChunk:passChunk.
       
   390     ].
       
   391     lastValue == $# ifTrue:[
       
   392         "assume unix interpreter name:
       
   393          '#!!stx -e' or something like this"
       
   394         self nextPeek == $!! ifTrue:[
       
   395             "skip the unix command line"
       
   396             self nextLine
       
   397         ] ifFalse:[
       
   398              self error:'Invalid chunk start'
       
   399         ]
       
   400     ].
       
   401 
       
   402     Smalltalk::Compiler isNil ifTrue:[
       
   403         self isFileStream ifTrue:[
       
   404             Transcript show:('[' , self pathName , '] ').
       
   405         ].
       
   406         Transcript showCR:'cannot fileIn (no compiler).'.
       
   407         ^ nil.
       
   408     ].
       
   409 
       
   410     "/ support for V'Age applications
       
   411     defaultApplicationQuerySignal := Class defaultApplicationQuerySignal.
       
   412     changeDefaultApplicationNotificationSignal := Class changeDefaultApplicationNotificationSignal.
       
   413 
       
   414     "/ support for ST/X's namespaces & packages
       
   415     packageQuerySignal := Class packageQuerySignal.
       
   416     nameSpaceQuerySignal := Class nameSpaceQuerySignal.
       
   417     usedNameSpaceQuerySignal := Class usedNameSpaceQuerySignal.
       
   418 
       
   419     (someone respondsTo:#packageToInstall) ifFalse:[
       
   420         pkg := packageQuerySignal query.
       
   421         askSomeoneForPackage := false.
       
   422     ] ifTrue:[
       
   423         pkg := someone packageToInstall.
       
   424         askSomeoneForPackage := true.
       
   425     ].
       
   426     (someone respondsTo:#currentNameSpace) ifFalse:[
       
   427         spc := nameSpaceQuerySignal query.
       
   428     ] ifTrue:[
       
   429         spc := someone currentNameSpace
       
   430     ].
       
   431     (someone respondsTo:#usedNameSpaces) ifFalse:[
       
   432         spaces := usedNameSpaceQuerySignal query.
       
   433     ] ifTrue:[
       
   434         spaces := someone usedNameSpaces
       
   435     ].
       
   436     (someone respondsTo:#defaultApplication) ifFalse:[
       
   437         defaultApplication := defaultApplicationQuerySignal query.
       
   438     ] ifTrue:[
       
   439         defaultApplication := someone defaultApplication
       
   440     ].
       
   441 
       
   442     confirmationQuerySignal := Metaclass confirmationQuerySignal.
       
   443 
       
   444     passedSignals := IdentitySet new.
       
   445 
       
   446     handledSignals := SignalSet new.
       
   447     handledSignals add:changeDefaultApplicationNotificationSignal.
       
   448     passedSignals add:changeDefaultApplicationNotificationSignal.
       
   449     handledSignals add:defaultApplicationQuerySignal.
       
   450     passedSignals add:defaultApplicationQuerySignal.
       
   451 
       
   452     handledSignals add:packageQuerySignal.
       
   453     handledSignals add:usedNameSpaceQuerySignal.
       
   454     handledSignals add:nameSpaceQuerySignal.
       
   455 
       
   456     handledSignals add:Error.
       
   457     passedSignals add:Error.
       
   458 
       
   459     handledSignals add:(Class methodRedefinitionSignal).
       
   460     passedSignals add:(Class methodRedefinitionSignal).
       
   461     handledSignals add:(Class classRedefinitionSignal).
       
   462     passedSignals add:(Class classRedefinitionSignal).
       
   463     handledSignals add:confirmationQuerySignal.
       
   464     passedSignals add:confirmationQuerySignal.
       
   465 
       
   466     outerContext := thisContext.
       
   467 
       
   468     handledSignals handle:[:ex |
       
   469         |sig action what sender msg param oldPackage newPackage proceedValue
       
   470          canContinueForAll|
       
   471 
       
   472         sig := ex signal.
       
   473 "/sig == packageQuerySignal ifTrue:[
       
   474 "/self halt.
       
   475 "/].
       
   476         (passedSignals includes:sig) ifTrue:[
       
   477             (sig isHandledIn:outerContext) ifTrue:[
       
   478                 ex reject
       
   479             ]
       
   480         ].
       
   481         
       
   482         sig == changeDefaultApplicationNotificationSignal ifTrue:[
       
   483             "/ invoked via #becomeDefault to set the defaultApp and the package.
       
   484             "/ (only when filing in V'Age code)
       
   485             defaultApplication := ex parameter.
       
   486             pkg := defaultApplication name asSymbol.
       
   487             ex proceedWith:nil
       
   488         ].
       
   489         sig == defaultApplicationQuerySignal ifTrue:[
       
   490             "/ query for the application to add classes & methods into
       
   491             "/ (only when filing in V'Age code)
       
   492             ex proceedWith:defaultApplication
       
   493         ].
       
   494         sig == packageQuerySignal ifTrue:[
       
   495             "/ query for the package to use for classes & methods
       
   496             askSomeoneForPackage ifTrue:[
       
   497                 ex proceedWith:someone packageToInstall
       
   498             ] ifFalse:[
       
   499                 ex proceedWith:pkg
       
   500             ]
       
   501         ].
       
   502         sig == usedNameSpaceQuerySignal ifTrue:[
       
   503             "/ query for the namespaces searched when encountering globals
       
   504             ex proceedWith:spaces
       
   505         ].
       
   506         sig == nameSpaceQuerySignal ifTrue:[
       
   507             "/ query for the namespace to install new classes in
       
   508             ex proceedWith:spc
       
   509         ].
       
   510         sig == confirmationQuerySignal ifTrue:[
       
   511             ex proceedWith:false "/ no dialogs popping up
       
   512         ].
       
   513 
       
   514         sig == Stream endOfStreamSignal ifTrue:[
       
   515             ex reject
       
   516         ].
       
   517 
       
   518         sig == Signal noHandlerSignal ifTrue:[
       
   519             ex parameter rejected ifTrue:[
       
   520                 ex reject
       
   521             ].
       
   522         ].
       
   523 
       
   524         (dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[
       
   525             ex proceedWith:(dontAskSignals at:sig)
       
   526         ].
       
   527 
       
   528         canContinueForAll := false.
       
   529         redef := false.
       
   530 
       
   531         "/ for your convenience ...
       
   532         (sig == Class methodRedefinitionSignal) ifTrue:[
       
   533             param := ex parameter. "/ an association: oldMethod -> newMethod
       
   534             oldPackage := param key package.
       
   535             newPackage := param value package.
       
   536             msg := 'trying to overwrite method:\\    ' , param key whoString , '\\in package ''' 
       
   537                    , oldPackage , ''' with method from package ''' , newPackage , ''''.
       
   538             canContinueForAll := true.
       
   539         ] ifFalse:[
       
   540             (sig == Class classRedefinitionSignal) ifTrue:[
       
   541                 param := ex parameter. "/ an association: oldClass -> newClass
       
   542                 
       
   543                 oldPackage := param key package.
       
   544                 newPackage := param value package.
       
   545                 msg := 'trying to redefine class: ' , param key name allBold , '\\in package ''' 
       
   546                        , oldPackage , ''' with new definition from package ''' , newPackage , ''''.
       
   547                 canContinueForAll := true.
       
   548                 redef := true.
       
   549             ] ifFalse:[
       
   550                 msg := 'error in fileIn: %1'
       
   551             ]
       
   552         ].
       
   553 
       
   554         what := ex description.
       
   555         what isNil ifTrue:[
       
   556             what := ex signal notifierString.
       
   557         ].
       
   558 
       
   559         "/ handle the case where no GUI has been built in,
       
   560         "/ just abort the fileIn with a notification
       
   561 
       
   562         Display isNil ifTrue:[
       
   563             sender := ex suspendedContext sender.
       
   564             self notify:(what , 
       
   565                          ' in ' , sender receiver class name ,
       
   566                          '>>>' , sender selector).
       
   567             ex return
       
   568         ].
       
   569 
       
   570         msg := msg bindWith:what.
       
   571 
       
   572         sig == HaltInterrupt ifTrue:[
       
   573             sender := ex suspendedContext.
       
   574             msg := msg , ('\\in ' , sender receiver class name , '>>>' , sender selector) withCRs
       
   575         ].
       
   576 
       
   577         "/ otherwise ask what should be done now and either
       
   578         "/ continue or abort the fileIn
       
   579 Transcript showCR:Screen current.
       
   580         redef ifTrue:[
       
   581             action := OptionBox 
       
   582                           request:(msg withCRs) 
       
   583                           label:'Class redefinition in fileIn'
       
   584                           form:(WarningBox iconBitmap)
       
   585 "/ cg: now always keep the old packageID
       
   586 "/                          buttonLabels:#('cancel' 'skip' 'debug' 'keep' 'keep all' 'continue' 'continue all')
       
   587 "/                          values:#(#abort #skip #debug #keep #keepAll #continue #continueForAll)
       
   588                           buttonLabels:#('Cancel' 'Skip' 'Debug' 'Continue' 'Continue All')
       
   589                           values:#(#abort #skip #debug #keep #keepAll)
       
   590                           default:#continue
       
   591                           onCancel:#abort.
       
   592         ] ifFalse:[
       
   593             action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
       
   594         ].
       
   595         action == #continueForAll ifTrue:[
       
   596             dontAskSignals isNil ifTrue:[
       
   597                 dontAskSignals := IdentityDictionary new.
       
   598             ].
       
   599             dontAskSignals at:sig put:#continue.
       
   600             action := proceedValue := #continue.
       
   601         ] ifFalse:[
       
   602             action == #keepForAll ifTrue:[
       
   603                 dontAskSignals isNil ifTrue:[
       
   604                     dontAskSignals := IdentityDictionary new.
       
   605                 ].
       
   606                 dontAskSignals at:sig put:#keep.
       
   607                 action := #continue.
       
   608                 proceedValue := #keep.
       
   609             ] ifFalse:[
       
   610                 action == #keep ifTrue:[
       
   611                     action := #continue.
       
   612                     proceedValue := #keep.
       
   613                 ].
       
   614             ].
       
   615         ].
       
   616 
       
   617         action == #continue ifTrue:[
       
   618             ex proceedWith:(proceedValue ? #continue)
       
   619         ].
       
   620         action == #abort ifTrue:[
       
   621             AbortSignal raise.
       
   622             ex return
       
   623         ].
       
   624         action == #cancelAll ifTrue:[
       
   625             AbortAllSignal raise.
       
   626             ex return
       
   627         ].
       
   628         action == #skip ifTrue:[
       
   629             ex proceedWith:nil
       
   630         ].
       
   631         action == #debug ifTrue:[
       
   632             Debugger enter:ex suspendedContext 
       
   633                      withMessage:ex description 
       
   634                      mayProceed:true.
       
   635             ex proceedWith:proceedValue
       
   636         ].
       
   637 
       
   638         "/ (ex signal) enterDebuggerWith:ex message:what.
       
   639         ex reject
       
   640     ] do:[
       
   641         [self atEnd] whileFalse:[
       
   642             lastValue := self fileInNextChunkNotifying:someone passChunk:passChunk
       
   643         ]
       
   644     ].
       
   645     ^ lastValue
       
   646 
       
   647     "Modified: / 10.9.1999 / 16:54:01 / stefan"
       
   648     "Modified: / 16.11.2001 / 16:21:28 / cg"
       
   649 !
       
   650 
   373 fileIn
   651 fileIn
   374     "file in from the receiver, i.e. read chunks and evaluate them -
   652     "file in from the receiver, i.e. read chunks and evaluate them -
   375      return the value of the last chunk."
   653      return the value of the last chunk."
   376 
   654 
   377     |oldPath val notifiedLoader|
   655     |notifiedLoader|
   378 
   656 
   379     SourceFileLoader notNil ifTrue:[
   657     SourceFileLoader notNil ifTrue:[
   380 	notifiedLoader := SourceFileLoader on:self.
   658         notifiedLoader := SourceFileLoader on:self.
   381     ].
   659     ].
   382 
   660 
   383     self isFileStream ifFalse:[
   661     ^ self fileInNotifying:notifiedLoader passChunk:true.
   384 	^ self fileInNotifying:notifiedLoader passChunk:true.
       
   385     ].
       
   386 
       
   387     [   |thisDirectory|
       
   388 
       
   389 	oldPath := Smalltalk systemPath.
       
   390 	thisDirectory := self pathName asFilename directory.
       
   391 	Smalltalk systemPath:(oldPath copy addFirst:thisDirectory pathName; yourself).
       
   392 	CurrentFileInDirectoryQuerySignal answer:thisDirectory do:[
       
   393 	    val := self fileInNotifying:notifiedLoader passChunk:true.
       
   394 	]
       
   395     ] ensure:[
       
   396 	Smalltalk systemPath:oldPath.
       
   397     ].
       
   398     ^ val
       
   399 
       
   400     "Modified: / 16.10.1999 / 12:25:27 / cg"
       
   401 !
   662 !
   402 
   663 
   403 fileInBinary
   664 fileInBinary
   404     "file in from the receiver, i.e. read binary stored classes and/or objects.
   665     "file in from the receiver, i.e. read binary stored classes and/or objects.
   405      Return the last object."
   666      Return the last object."
   523     ^ rslt
   784     ^ rslt
   524 
   785 
   525     "Modified: 14.10.1997 / 17:10:35 / cg"
   786     "Modified: 14.10.1997 / 17:10:35 / cg"
   526 !
   787 !
   527 
   788 
   528 fileInNotifying:someone passChunk:passChunk
   789 fileInNotifying:notifiedLoader passChunk:passChunk
   529     "central method to file in from the receiver, i.e. read chunks and evaluate them -
   790     "central method to file in from the receiver, i.e. read chunks and evaluate them -
   530      return the value of the last chunk.
   791      return the value of the last chunk.
   531      Someone (which is usually some codeView) is notified of errors."
   792      Someone (which is usually some codeView) is notified of errors."
   532 
   793 
   533     |lastValue pkg spc spaces
   794     self isFileStream ifFalse:[
   534      packageQuerySignal nameSpaceQuerySignal usedNameSpaceQuerySignal
   795         ^ self basicFileInNotifying:notifiedLoader passChunk:passChunk.
   535      changeDefaultApplicationNotificationSignal
   796     ].
   536      defaultApplicationQuerySignal defaultApplication
   797 
   537      confirmationQuerySignal handledSignals passedSignals
   798     ^ self fileInNotifying:notifiedLoader passChunk:passChunk inDirectory:(self pathName asFilename directory).
   538      dontAskSignals askSomeoneForPackage redef outerContext|
   799 !
   539 
   800 
   540     self skipSeparators.
   801 fileInNotifying:notifiedLoader passChunk:passChunk inDirectory:aDirectory
   541     lastValue := self peek.
   802     "central method to file in from the receiver, i.e. read chunks and evaluate them -
   542     lastValue == $< ifTrue:[
   803      return the value of the last chunk.
   543         "/ assume, its an xml file
   804      Someone (which is usually some codeView) is notified of errors."
   544         ^ self fileInXMLNotifying:someone passChunk:passChunk.
   805 
   545     ].
   806     |oldPath val|
   546     lastValue == $# ifTrue:[
   807 
   547         "assume unix interpreter name:
   808     [   
   548          '#!!stx -e' or something like this"
   809         |thisDirectory|
   549         self nextPeek == $!! ifTrue:[
   810 
   550             "skip the unix command line"
   811         thisDirectory := aDirectory asFilename.
   551             self nextLine
   812 
   552         ] ifFalse:[
   813         oldPath := Smalltalk systemPath.
   553              self error:'Invalid chunk start'
   814         Smalltalk systemPath:(oldPath copy addFirst:thisDirectory pathName; yourself).
       
   815         CurrentFileInDirectoryQuerySignal answer:thisDirectory do:[
       
   816             val := self basicFileInNotifying:notifiedLoader passChunk:passChunk.
   554         ]
   817         ]
   555     ].
   818     ] ensure:[
   556 
   819         Smalltalk systemPath:oldPath.
   557     Smalltalk::Compiler isNil ifTrue:[
   820     ].
   558         self isFileStream ifTrue:[
   821     ^ val
   559             Transcript show:('[' , self pathName , '] ').
       
   560         ].
       
   561         Transcript showCR:'cannot fileIn (no compiler).'.
       
   562         ^ nil.
       
   563     ].
       
   564 
       
   565     "/ support for V'Age applications
       
   566     defaultApplicationQuerySignal := Class defaultApplicationQuerySignal.
       
   567     changeDefaultApplicationNotificationSignal := Class changeDefaultApplicationNotificationSignal.
       
   568 
       
   569     "/ support for ST/X's namespaces & packages
       
   570     packageQuerySignal := Class packageQuerySignal.
       
   571     nameSpaceQuerySignal := Class nameSpaceQuerySignal.
       
   572     usedNameSpaceQuerySignal := Class usedNameSpaceQuerySignal.
       
   573 
       
   574     (someone respondsTo:#packageToInstall) ifFalse:[
       
   575         pkg := packageQuerySignal query.
       
   576         askSomeoneForPackage := false.
       
   577     ] ifTrue:[
       
   578         pkg := someone packageToInstall.
       
   579         askSomeoneForPackage := true.
       
   580     ].
       
   581     (someone respondsTo:#currentNameSpace) ifFalse:[
       
   582         spc := nameSpaceQuerySignal query.
       
   583     ] ifTrue:[
       
   584         spc := someone currentNameSpace
       
   585     ].
       
   586     (someone respondsTo:#usedNameSpaces) ifFalse:[
       
   587         spaces := usedNameSpaceQuerySignal query.
       
   588     ] ifTrue:[
       
   589         spaces := someone usedNameSpaces
       
   590     ].
       
   591     (someone respondsTo:#defaultApplication) ifFalse:[
       
   592         defaultApplication := defaultApplicationQuerySignal query.
       
   593     ] ifTrue:[
       
   594         defaultApplication := someone defaultApplication
       
   595     ].
       
   596 
       
   597     confirmationQuerySignal := Metaclass confirmationQuerySignal.
       
   598 
       
   599     passedSignals := IdentitySet new.
       
   600 
       
   601     handledSignals := SignalSet new.
       
   602     handledSignals add:changeDefaultApplicationNotificationSignal.
       
   603     passedSignals add:changeDefaultApplicationNotificationSignal.
       
   604     handledSignals add:defaultApplicationQuerySignal.
       
   605     passedSignals add:defaultApplicationQuerySignal.
       
   606 
       
   607     handledSignals add:packageQuerySignal.
       
   608     handledSignals add:usedNameSpaceQuerySignal.
       
   609     handledSignals add:nameSpaceQuerySignal.
       
   610 
       
   611     handledSignals add:Error.
       
   612     passedSignals add:Error.
       
   613 
       
   614     handledSignals add:(Class methodRedefinitionSignal).
       
   615     passedSignals add:(Class methodRedefinitionSignal).
       
   616     handledSignals add:(Class classRedefinitionSignal).
       
   617     passedSignals add:(Class classRedefinitionSignal).
       
   618     handledSignals add:confirmationQuerySignal.
       
   619     passedSignals add:confirmationQuerySignal.
       
   620 
       
   621     outerContext := thisContext.
       
   622 
       
   623     handledSignals handle:[:ex |
       
   624         |sig action what sender msg param oldPackage newPackage proceedValue
       
   625          canContinueForAll|
       
   626 
       
   627         sig := ex signal.
       
   628 "/sig == packageQuerySignal ifTrue:[
       
   629 "/self halt.
       
   630 "/].
       
   631         (passedSignals includes:sig) ifTrue:[
       
   632             (sig isHandledIn:outerContext) ifTrue:[
       
   633                 ex reject
       
   634             ]
       
   635         ].
       
   636         
       
   637         sig == changeDefaultApplicationNotificationSignal ifTrue:[
       
   638             "/ invoked via #becomeDefault to set the defaultApp and the package.
       
   639             "/ (only when filing in V'Age code)
       
   640             defaultApplication := ex parameter.
       
   641             pkg := defaultApplication name asSymbol.
       
   642             ex proceedWith:nil
       
   643         ].
       
   644         sig == defaultApplicationQuerySignal ifTrue:[
       
   645             "/ query for the application to add classes & methods into
       
   646             "/ (only when filing in V'Age code)
       
   647             ex proceedWith:defaultApplication
       
   648         ].
       
   649         sig == packageQuerySignal ifTrue:[
       
   650             "/ query for the package to use for classes & methods
       
   651             askSomeoneForPackage ifTrue:[
       
   652                 ex proceedWith:someone packageToInstall
       
   653             ] ifFalse:[
       
   654                 ex proceedWith:pkg
       
   655             ]
       
   656         ].
       
   657         sig == usedNameSpaceQuerySignal ifTrue:[
       
   658             "/ query for the namespaces searched when encountering globals
       
   659             ex proceedWith:spaces
       
   660         ].
       
   661         sig == nameSpaceQuerySignal ifTrue:[
       
   662             "/ query for the namespace to install new classes in
       
   663             ex proceedWith:spc
       
   664         ].
       
   665         sig == confirmationQuerySignal ifTrue:[
       
   666             ex proceedWith:false "/ no dialogs popping up
       
   667         ].
       
   668 
       
   669         sig == Stream endOfStreamSignal ifTrue:[
       
   670             ex reject
       
   671         ].
       
   672 
       
   673         sig == Signal noHandlerSignal ifTrue:[
       
   674             ex parameter rejected ifTrue:[
       
   675                 ex reject
       
   676             ].
       
   677         ].
       
   678 
       
   679         (dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[
       
   680             ex proceedWith:(dontAskSignals at:sig)
       
   681         ].
       
   682 
       
   683         canContinueForAll := false.
       
   684         redef := false.
       
   685 
       
   686         "/ for your convenience ...
       
   687         (sig == Class methodRedefinitionSignal) ifTrue:[
       
   688             param := ex parameter. "/ an association: oldMethod -> newMethod
       
   689             oldPackage := param key package.
       
   690             newPackage := param value package.
       
   691             msg := 'trying to overwrite method:\\    ' , param key whoString , '\\in package ''' 
       
   692                    , oldPackage , ''' with method from package ''' , newPackage , ''''.
       
   693             canContinueForAll := true.
       
   694         ] ifFalse:[
       
   695             (sig == Class classRedefinitionSignal) ifTrue:[
       
   696                 param := ex parameter. "/ an association: oldClass -> newClass
       
   697                 
       
   698                 oldPackage := param key package.
       
   699                 newPackage := param value package.
       
   700                 msg := 'trying to redefine class: ' , param key name allBold , '\\in package ''' 
       
   701                        , oldPackage , ''' with new definition from package ''' , newPackage , ''''.
       
   702                 canContinueForAll := true.
       
   703                 redef := true.
       
   704             ] ifFalse:[
       
   705                 msg := 'error in fileIn: %1'
       
   706             ]
       
   707         ].
       
   708 
       
   709         what := ex description.
       
   710         what isNil ifTrue:[
       
   711             what := ex signal notifierString.
       
   712         ].
       
   713 
       
   714         "/ handle the case where no GUI has been built in,
       
   715         "/ just abort the fileIn with a notification
       
   716 
       
   717         Display isNil ifTrue:[
       
   718             sender := ex suspendedContext sender.
       
   719             self notify:(what , 
       
   720                          ' in ' , sender receiver class name ,
       
   721                          '>>>' , sender selector).
       
   722             ex return
       
   723         ].
       
   724 
       
   725         msg := msg bindWith:what.
       
   726 
       
   727         sig == HaltInterrupt ifTrue:[
       
   728             sender := ex suspendedContext.
       
   729             msg := msg , ('\\in ' , sender receiver class name , '>>>' , sender selector) withCRs
       
   730         ].
       
   731 
       
   732         "/ otherwise ask what should be done now and either
       
   733         "/ continue or abort the fileIn
       
   734         redef ifTrue:[
       
   735             action := OptionBox 
       
   736                           request:(msg withCRs) 
       
   737                           label:'Class redefinition in fileIn'
       
   738                           form:(WarningBox iconBitmap)
       
   739 "/ cg: now always keep the old packageID
       
   740 "/                          buttonLabels:#('cancel' 'skip' 'debug' 'keep' 'keep all' 'continue' 'continue all')
       
   741 "/                          values:#(#abort #skip #debug #keep #keepAll #continue #continueForAll)
       
   742                           buttonLabels:#('Cancel' 'Skip' 'Debug' 'Continue' 'Continue All')
       
   743                           values:#(#abort #skip #debug #keep #keepAll)
       
   744                           default:#continue
       
   745                           onCancel:#abort.
       
   746         ] ifFalse:[
       
   747             action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
       
   748         ].
       
   749         action == #continueForAll ifTrue:[
       
   750             dontAskSignals isNil ifTrue:[
       
   751                 dontAskSignals := IdentityDictionary new.
       
   752             ].
       
   753             dontAskSignals at:sig put:#continue.
       
   754             action := proceedValue := #continue.
       
   755         ] ifFalse:[
       
   756             action == #keepForAll ifTrue:[
       
   757                 dontAskSignals isNil ifTrue:[
       
   758                     dontAskSignals := IdentityDictionary new.
       
   759                 ].
       
   760                 dontAskSignals at:sig put:#keep.
       
   761                 action := #continue.
       
   762                 proceedValue := #keep.
       
   763             ] ifFalse:[
       
   764                 action == #keep ifTrue:[
       
   765                     action := #continue.
       
   766                     proceedValue := #keep.
       
   767                 ].
       
   768             ].
       
   769         ].
       
   770 
       
   771         action == #continue ifTrue:[
       
   772             ex proceedWith:(proceedValue ? #continue)
       
   773         ].
       
   774         action == #abort ifTrue:[
       
   775             AbortSignal raise.
       
   776             ex return
       
   777         ].
       
   778         action == #cancelAll ifTrue:[
       
   779             AbortAllSignal raise.
       
   780             ex return
       
   781         ].
       
   782         action == #skip ifTrue:[
       
   783             ex proceedWith:nil
       
   784         ].
       
   785         action == #debug ifTrue:[
       
   786             Debugger enter:ex suspendedContext 
       
   787                      withMessage:ex description 
       
   788                      mayProceed:true.
       
   789             ex proceedWith:proceedValue
       
   790         ].
       
   791 
       
   792         "/ (ex signal) enterDebuggerWith:ex message:what.
       
   793         ex reject
       
   794     ] do:[
       
   795         [self atEnd] whileFalse:[
       
   796             lastValue := self fileInNextChunkNotifying:someone passChunk:passChunk
       
   797         ]
       
   798     ].
       
   799     ^ lastValue
       
   800 
       
   801     "Modified: / 10.9.1999 / 16:54:01 / stefan"
       
   802     "Modified: / 16.11.2001 / 16:21:28 / cg"
       
   803 !
   822 !
   804 
   823 
   805 fileInXMLNotifying:someone passChunk:passChunk
   824 fileInXMLNotifying:someone passChunk:passChunk
   806     "filein an XML source file (format as in campSmalltalk DTD)"
   825     "filein an XML source file (format as in campSmalltalk DTD)"
   807 
   826 
  1190 ! !
  1209 ! !
  1191 
  1210 
  1192 !PositionableStream class methodsFor:'documentation'!
  1211 !PositionableStream class methodsFor:'documentation'!
  1193 
  1212 
  1194 version
  1213 version
  1195     ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.131 2003-07-14 10:50:45 stefan Exp $'
  1214     ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.132 2003-08-23 12:09:21 cg Exp $'
  1196 ! !
  1215 ! !
  1197 
  1216 
  1198 PositionableStream initialize!
  1217 PositionableStream initialize!