class: Smalltalk
authorClaus Gittinger <cg@exept.de>
Fri, 08 May 2015 01:58:03 +0200
changeset 18324 07428970dfd7
parent 18323 31a64a7d03fd
child 18325 208465f54abb
class: Smalltalk changed: #basicLoadPackage:fromDirectory:asAutoloaded: #initializeClass: #initializeSystem #loadPackageFromAbbrevFile:asAutoloaded: debug prints
Smalltalk.st
--- a/Smalltalk.st	Thu May 07 20:29:48 2015 +0200
+++ b/Smalltalk.st	Fri May 08 01:58:03 2015 +0200
@@ -546,19 +546,19 @@
     "sent from VM via #initializeModules"
 
     Error handle:[:ex |
-	ObjectMemory printStackBacktrace.
-	ClassesFailedToInitialize isNil ifTrue:[
-	    ClassesFailedToInitialize := IdentitySet new.
-	].
-	ClassesFailedToInitialize add:aClass.
-	('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR.
-	ex suspendedContext fullPrintAll.
-	'------------------------------------------------' errorPrintCR.
-	(Smalltalk commandLineArguments includes:'--debug') ifTrue:[
-	    ex reject
-	].
+        ObjectMemory printStackBacktrace.
+        ClassesFailedToInitialize isNil ifTrue:[
+            ClassesFailedToInitialize := IdentitySet new.
+        ].
+        ClassesFailedToInitialize add:aClass.
+        ('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR.
+        ex suspendedContext fullPrintAll.
+        '------------------------------------------------' errorPrintCR.
+        ((DebuggingStandAlone == true) or:[ Smalltalk commandLineArguments includes:'--debug']) ifTrue:[
+            ex reject
+        ].
     ] do:[
-	aClass initialize
+        aClass initialize
     ].
 
     "Modified: / 11-09-2011 / 17:01:32 / cg"
@@ -605,8 +605,8 @@
      Here, a few specific initializations are done, then the actual initialization is
      done inside an error handler in basicInitializeSystem.
      Notice:
-	this is NOT called when an image is restarted;
-	in this case the show starts in Smalltalk>>restart."
+        this is NOT called when an image is restarted;
+        in this case the show starts in Smalltalk>>restart."
 
     |idx|
 
@@ -616,7 +616,7 @@
     AbstractOperatingSystem initializeConcreteClass.
 
     CommandLineArguments isEmptyOrNil ifTrue:[
-	CommandLineArguments := #('stx') asOrderedCollection.
+        CommandLineArguments := #('stx') asOrderedCollection.
     ].
     CommandLine := CommandLineArguments copy.
     CommandLineArguments := CommandLineArguments asOrderedCollection.
@@ -628,42 +628,42 @@
     DebuggingStandAlone := false.
 
     StandAlone ifTrue:[
-	InfoPrinting := false.
-	ObjectMemory infoPrinting:false.
-	IgnoreAssertions := true.
-
-	idx := CommandLineArguments indexOf:'--debug'.
-	idx ~~ 0 ifTrue:[
-	    DebuggingStandAlone := true.
-	].
-	DebuggingStandAlone ifTrue:[
-	    Inspector := MiniInspector.
-	    Debugger := MiniDebugger.
-	    IgnoreAssertions := false.
-	].
+        InfoPrinting := false.
+        ObjectMemory infoPrinting:false.
+        IgnoreAssertions := true.
+
+        idx := CommandLineArguments indexOf:'--debug'.
+        idx ~~ 0 ifTrue:[
+            DebuggingStandAlone := true.
+        ].
+        DebuggingStandAlone ifTrue:[
+            Inspector := MiniInspector.
+            Debugger := MiniDebugger.
+            IgnoreAssertions := false.
+        ].
     ] ifFalse:[
-	"/
-	"/ define low-level debugging tools - graphical classes are not prepared yet
-	"/ to handle things.
-	"/ This will bring us into the MiniDebugger when an error occurs during startup.
-	"/
-	Inspector := MiniInspector.
-	Debugger := MiniDebugger.
-	IgnoreAssertions := false.
+        "/
+        "/ define low-level debugging tools - graphical classes are not prepared yet
+        "/ to handle things.
+        "/ This will bring us into the MiniDebugger when an error occurs during startup.
+        "/
+        Inspector := MiniInspector.
+        Debugger := MiniDebugger.
+        IgnoreAssertions := false.
     ].
 
     Error handle:[:ex |
-	StandAlone ifTrue:[
-	    DebuggingStandAlone ifFalse:[
-		'Startup Error - use --debug command line argument for more info' errorPrintCR.
-		Smalltalk exit:1.
-	    ].
-	    'Startup Error' errorPrintCR.
-	    thisContext fullPrintAll.
-	].
-	ex reject.
+        StandAlone ifTrue:[
+            DebuggingStandAlone ifFalse:[
+                'Startup Error - use "--debug" command line argument for more info' errorPrintCR.
+                Smalltalk exit:1.
+            ].
+            'Smalltalk [error]: Error during early initialization:' errorPrintCR.
+            thisContext fullPrintAll.
+        ].
+        ex reject.
     ] do:[
-	self basicInitializeSystem
+        self basicInitializeSystem
     ].
 
     "Modified: / 12-10-2010 / 11:27:47 / cg"
@@ -2209,12 +2209,12 @@
      loadOK "exePath" errorInInitialize|
 
     packageDirOrStringOrNil notNil ifTrue:[
-	packageDirOrNil := packageDirOrStringOrNil asFilename.
+        packageDirOrNil := packageDirOrStringOrNil asFilename.
     ].
     VerboseLoading ifTrue:[
-	silent := false
+        silent := false
     ] ifFalse:[
-	silent := (SilentLoading or:[ StandAlone ]) or:[ InfoPrinting not ].
+        silent := (SilentLoading or:[ StandAlone ]) or:[ InfoPrinting not ].
     ].
 
     "For now: have to read the project definition first!!
@@ -2225,112 +2225,112 @@
     "maybe, it is already in the image"
     projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
     (projectDefinitionClass notNil and:[projectDefinitionClass supportedOnPlatform not]) ifTrue:[
-	^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
+        ^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
     ].
 
     "Is there a shared library (.dll or .so) ?"
     binaryClassLibraryFilename := ObjectFileLoader
-				    binaryClassFilenameForPackage:aPackageString
-				    inDirectory:packageDirOrNil.
+                                    binaryClassFilenameForPackage:aPackageString
+                                    inDirectory:packageDirOrNil.
 
     (binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[
-	|loadErrorOccurred|
-
-	loadErrorOccurred := false.
-	ObjectFileLoader objectFileLoadErrorNotification handle:[:ex |
-	    loadErrorOccurred := true.
-	    ex proceedWith:true.
-	] do:[
-	    loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
-	    "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
-	].
-	(loadOK and:[loadErrorOccurred not]) ifTrue:[
-	    silent ifFalse:[
-		Transcript showCR:('loaded package: ' , aPackageString , ' from binary classLib file: ' , binaryClassLibraryFilename pathName).
-	    ].
-	    "now, all compiled classes have been loaded.
-	     keep classes in the package which are autoloaded as autoloaded."
-	    ^ true
-	].
-
-	loadErrorOccurred ifTrue:[
-	    self breakPoint:#cg.
-	    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
-	    projectDefinitionClass notNil ifTrue:[
-		projectDefinitionClass supportedOnPlatform ifTrue:[
-		    "/ load prerequisites...
-		    projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
-		    self breakPoint:#cg.
-		].
-	    ].
-	].
+        |loadErrorOccurred|
+
+        loadErrorOccurred := false.
+        ObjectFileLoader objectFileLoadErrorNotification handle:[:ex |
+            loadErrorOccurred := true.
+            ex proceedWith:true.
+        ] do:[
+            loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
+            "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
+        ].
+        (loadOK and:[loadErrorOccurred not]) ifTrue:[
+            silent ifFalse:[
+                Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from binary classLib file: ' , binaryClassLibraryFilename pathName).
+            ].
+            "now, all compiled classes have been loaded.
+             keep classes in the package which are autoloaded as autoloaded."
+            ^ true
+        ].
+
+        loadErrorOccurred ifTrue:[
+            self breakPoint:#cg.
+            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
+            projectDefinitionClass notNil ifTrue:[
+                projectDefinitionClass supportedOnPlatform ifTrue:[
+                    "/ load prerequisites...
+                    projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
+                    self breakPoint:#cg.
+                ].
+            ].
+        ].
     ].
     packageDirOrNil isNil ifTrue:[
-	^ PackageNotFoundError raiseRequestWith:aPackageString.
+        ^ PackageNotFoundError raiseRequestWith:aPackageString.
     ].
 
     "fallback - go through the project definition"
     projectDefinitionClass isNil ifTrue:[
-	projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
-	"/ try to load the project definition class
-	projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
-	projectDefinitionFilename exists ifFalse:[
-	    projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
-	].
-	projectDefinitionFilename exists ifTrue:[
-	    Class withoutUpdatingChangesDo:[
-		Smalltalk silentlyLoadingDo:[
-		    Error handle:[:ex |
-			"/ catch error during initialization;
-			ex suspendedContext withAllSendersDo:[:sender |
-			    sender selector == #initialize ifTrue:[
-				sender receiver isBehavior ifTrue:[
-				    sender receiver name = projectDefinitionClassName ifTrue:[
-					errorInInitialize := true
-				    ]
-				]
-			    ]
-			].
-			errorInInitialize ifFalse:[ ex reject ].
-		    ] do:[
-			projectDefinitionFilename fileIn.
-		    ].
-		].
-	    ].
-	    errorInInitialize ifTrue:[
-		Transcript showCR:'Smalltalk [info]: an error happened in #initialize - retry after loading package.'.
-	    ].
-	    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
-	].
+        projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
+        "/ try to load the project definition class
+        projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
+        projectDefinitionFilename exists ifFalse:[
+            projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
+        ].
+        projectDefinitionFilename exists ifTrue:[
+            Class withoutUpdatingChangesDo:[
+                Smalltalk silentlyLoadingDo:[
+                    Error handle:[:ex |
+                        "/ catch error during initialization;
+                        ex suspendedContext withAllSendersDo:[:sender |
+                            sender selector == #initialize ifTrue:[
+                                sender receiver isBehavior ifTrue:[
+                                    sender receiver name = projectDefinitionClassName ifTrue:[
+                                        errorInInitialize := true
+                                    ]
+                                ]
+                            ]
+                        ].
+                        errorInInitialize ifFalse:[ ex reject ].
+                    ] do:[
+                        projectDefinitionFilename fileIn.
+                    ].
+                ].
+            ].
+            errorInInitialize ifTrue:[
+                Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'.
+            ].
+            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
+        ].
     ].
     projectDefinitionClass notNil ifTrue:[
-	projectDefinitionClass autoload.
-	projectDefinitionClass supportedOnPlatform ifFalse:[
-	    ^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
-	].
-	projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
-	somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
-	errorInInitialize ifTrue:[
-	    Transcript showCR:('Smalltalk [info]: retrying #initialize').
-	    projectDefinitionClass initialize.
-	].
-	(silent not and:[somethingHasBeenLoaded]) ifTrue:[
-	    Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
-	].
-	^ true.
+        projectDefinitionClass autoload.
+        projectDefinitionClass supportedOnPlatform ifFalse:[
+            ^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
+        ].
+        projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
+        somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
+        errorInInitialize ifTrue:[
+            Transcript showCR:('Smalltalk [info]: retrying #initialize').
+            projectDefinitionClass initialize.
+        ].
+        (silent not and:[somethingHasBeenLoaded]) ifTrue:[
+            Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
+        ].
+        ^ true.
     ].
 
     "/ source files-file loading no longer supported
     "/ however, allow for autoload-stub loaded
     doLoadAsAutoloaded ifTrue:[
-	self
-	    recursiveInstallAutoloadedClassesFrom:packageDirOrNil
-	    rememberIn:(Set new)
-	    maxLevels:2
-	    noAutoload:false
-	    packageTop:packageDirOrNil
-	    showSplashInLevels:0.
-	^ true
+        self
+            recursiveInstallAutoloadedClassesFrom:packageDirOrNil
+            rememberIn:(Set new)
+            maxLevels:2
+            noAutoload:false
+            packageTop:packageDirOrNil
+            showSplashInLevels:0.
+        ^ true
     ].
 
     ^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'.
@@ -2691,13 +2691,13 @@
     Smalltalk installAutoloadedClassesFrom:abbrevFile pathName.
 
     doLoadAsAutoloaded ifFalse:[
-	"/ force autoloading...
-	Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload].
+        "/ force autoloading...
+        Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload].
     ].
 
     self loadExtensionsFromDirectory:packageDir.
     VerboseLoading ifTrue:[
-	Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName).
+        Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName).
     ].
     ^ true
 
@@ -8221,13 +8221,14 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1125 2015-04-29 11:23:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1126 2015-05-07 23:58:03 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1125 2015-04-29 11:23:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1126 2015-05-07 23:58:03 cg Exp $'
 !
 
 version_SVN
     ^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1  $'
 ! !
+