added hook for 2nd stage initialization
authorClaus Gittinger <cg@exept.de>
Wed, 08 Jan 1997 20:07:09 +0100
changeset 2090 42653edf4cc5
parent 2089 30ef18ddd015
child 2091 c11bb3e29a1b
added hook for 2nd stage initialization via ObjectMemory changed:#initialized.
Smalltalk.st
--- a/Smalltalk.st	Wed Jan 08 18:31:33 1997 +0100
+++ b/Smalltalk.st	Wed Jan 08 20:07:09 1997 +0100
@@ -298,32 +298,33 @@
     "initialize all other classes; setup dispatcher processes etc.
      This one is the first entry into the smalltalk world right after startup,
      ususally followed by Smalltalk>>start.
-     Notice: this is not called when an image is restarted; in this
-     case the show starts in Smalltalk>>restart."
+     Notice: 
+        this is not called when an image is restarted; in this
+        case the show starts in Smalltalk>>restart."
 
     SilentLoading := false.
     Initializing := true.
 
-    "
-     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
-    "
+    "/
+    "/ 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.
 
-    "
-     start catching SIGSEGV and SIGBUS
-    "
+    "/
+    "/ start catching SIGSEGV and SIGBUS
+    "/
     OperatingSystem enableHardSignalInterrupts.
 
     self initGlobalsFromEnvironment.
 
-    "
-     sorry - there are some, which MUST be initialized before ..
-     reason: if any error happens during init, we need Signals, Stdout etc. to be there
-    "
+    "/
+    "/ sorry - there are some, which MUST be initialized before ..
+    "/ reason: if any error happens during init, we need Signals, Stdout etc. to be there
+    "/
     Object initialize.
     Signal initialize.
     ObjectMemory initialize.
@@ -332,53 +333,55 @@
 
     self initStandardStreams.    "/ setup Stdin, Stdout etc.
 
-    "
-     sorry, path must be set before ...
-     reason: some classes need it during initialize (they might need resources, bitmaps etc)
-    "
+    "/
+    "/ sorry, path must be set before ...
+    "/ reason: some classes need it during initialize (they might need resources, bitmaps etc)
+    "/
     self initSystemPath.
 
-    "
-     must init display here - some classes (Color, Form) need it during initialize
-    "
+    "/
+    "/ must init display here - some classes (Color, Form) need it during initialize
+    "/"
     Workstation notNil ifTrue:[
-	Workstation initialize
+        Workstation initialize
     ].
 
     Compiler := ByteCodeCompiler.
     Compiler isNil ifTrue:[
-	"
-	 ByteCodeCompiler is not in the system (i.e. has not been linked in)
-	 this allows at least immediate evaluations for runtime systems without compiler
-	 NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
-	"
-	Compiler := Parser
+        "
+         ByteCodeCompiler is not in the system (i.e. has not been linked in)
+         this allows at least immediate evaluations for runtime systems without compiler
+         NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
+        "
+        Compiler := Parser
     ].
 
-    "
-     another one, to be initialized before others
-    "
+    "/
+    "/ another one, to be initialized before others
+    "/
     ProcessorScheduler initialize.
 
-    "
-     now, finally, initialize all other classes
-    "
+    "/
+    "/ now, finally, initialize all other classes
+    "/
     self initializeModules.
 
-"/    self allBehaviorsDo:[:aClass |
-"/ 'init ' print. aClass name printNL.
-"/      aClass initialize
-"/    ].
-
     ImageStartTime := AbsoluteTime now.
 
     Display notNil ifTrue:[
-	Display initialize.
+        Display initialize.
     ].
     self initInterrupts.
     self initUserPreferences.
 
-    "Modified: 13.12.1995 / 17:43:27 / cg"
+    "/
+    "/ give classes a chance to perform 2nd-level initialization
+    "/ now, we are certain, that all other classes have been initialized
+    "/ (especially: streams and signals can now be used)
+    "/
+    ObjectMemory changed:#initialized.
+
+    "Modified: 8.1.1997 / 19:57:59 / cg"
 !
 
 isInitialized
@@ -1756,116 +1759,120 @@
     "/ turn off info messages in standAlone app
     "/
     StandAlone ifTrue:[
-	InfoPrinting := false.
-	ObjectMemory infoPrinting:false.
-	idx := CommandLineArguments indexOf:'-debug'.
-	idx ~~ 0 ifTrue:[
-	    CommandLineArguments removeAtIndex:idx.
-	    debuggingStandAlone := true
-	]
+        InfoPrinting := false.
+        ObjectMemory infoPrinting:false.
+        idx := CommandLineArguments indexOf:'-debug'.
+        idx ~~ 0 ifTrue:[
+            CommandLineArguments removeAtIndex:idx.
+            debuggingStandAlone := true
+        ]
     ].
 
     "
      while reading patches- and rc-file, do not add things into change-file
     "
     Class withoutUpdatingChangesDo:[
-	|myName defaultRC|
-
-
-	idx := CommandLineArguments indexOf:'-q'.
-	idx ~~ 0 ifTrue:[
-	    Object infoPrinting:false.
-	    ObjectMemory infoPrinting:false.
-	    CommandLineArguments removeAtIndex:idx.
-	].
-
-	StandAlone ifFalse:[
-	    "/ look for a '-e filename' argument - this will force evaluation of
-	    "/ filename only, no standard startup
-
-	    idx := CommandLineArguments indexOf:'-e'.
-	    idx ~~ 0 ifTrue:[
-		arg := CommandLineArguments at:idx + 1.
-
-		CommandLineArguments removeAtIndex:idx+1.
-		CommandLineArguments removeAtIndex:idx.
-
-		arg = '-' ifTrue:[
-		    self fileInStream:Stdin
-			   lazy:nil
-			   silent:nil
-			   logged:false
-			   addPath:nil
-		] ifFalse:[
-		    self fileIn:arg.
-		].
-		self exit
-	    ].
-	].
-
-	"/ if there is a <command>.pch, that patches file is read.
-	"/ otherwise, look for a patches file.
-	"/ BUT: the patches file is not read in StandAlone operation
-
-	myName := self commandName.
-
-	"/ look for a '-f filename' argument - this will force evaluation of
-	"/ filename instead of smalltalk.rc
-
-	idx := CommandLineArguments indexOf:'-f'.
-	idx ~~ 0 ifTrue:[
-	    myName := (CommandLineArguments at:idx + 1).
-	    CommandLineArguments removeAtIndex:idx+1.
-	    CommandLineArguments removeAtIndex:idx.
-	].
-
-	(self secureFileIn:(myName , '.pch')) ifFalse:[
-	    StandAlone ifFalse:[
-		self secureFileIn:'patches'.
-	    ].
-	].
-
-	"/ then look for <command>.rc
-	"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
+        |myName defaultRC|
+
+        "/
+        "/ look for any '-q', '-e' or '-f' command line arguments
+        "/ and handle them;
+        "/ read startup and patches file
+        "/
+        idx := CommandLineArguments indexOf:'-q'.
+        idx ~~ 0 ifTrue:[
+            Object infoPrinting:false.
+            ObjectMemory infoPrinting:false.
+            CommandLineArguments removeAtIndex:idx.
+        ].
+
+        StandAlone ifFalse:[
+            "/ look for a '-e filename' argument - this will force evaluation of
+            "/ filename only, no standard startup
+
+            idx := CommandLineArguments indexOf:'-e'.
+            idx ~~ 0 ifTrue:[
+                arg := CommandLineArguments at:idx + 1.
+
+                CommandLineArguments removeAtIndex:idx+1.
+                CommandLineArguments removeAtIndex:idx.
+
+                arg = '-' ifTrue:[
+                    self fileInStream:Stdin
+                           lazy:nil
+                           silent:nil
+                           logged:false
+                           addPath:nil
+                ] ifFalse:[
+                    self fileIn:arg.
+                ].
+                self exit
+            ].
+        ].
+
+        "/ if there is a <command>.pch, that patches file is read.
+        "/ otherwise, look for a patches file.
+        "/ BUT: the patches file is not read in StandAlone operation
+
+        myName := self commandName.
+
+        "/ look for a '-f filename' argument - this will force evaluation of
+        "/ filename instead of smalltalk.rc
+
+        idx := CommandLineArguments indexOf:'-f'.
+        idx ~~ 0 ifTrue:[
+            myName := (CommandLineArguments at:idx + 1).
+            CommandLineArguments removeAtIndex:idx+1.
+            CommandLineArguments removeAtIndex:idx.
+        ].
+
+        (self secureFileIn:(myName , '.pch')) ifFalse:[
+            StandAlone ifFalse:[
+                self secureFileIn:'patches'.
+            ].
+        ].
+
+        "/ then look for <command>.rc
+        "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
         
-	(self secureFileIn:(myName , '.rc')) ifFalse:[
-	    StandAlone ifFalse:[
-		defaultRC := 'smalltalk.rc'
-	    ] ifTrue:[
-		defaultRC := 'stxapp.rc'
-	    ].
-
-	    "/ no .rc file where executable is; try default smalltalk.rc (or stxapp.rc)
-
-	    (self secureFileIn:defaultRC) ifFalse:[
-		StandAlone ifFalse:[
-		    Transcript showCR:'SMALLTALK: no startup rc-file found. Going into line-by-line interpreter.'.
-		    graphicalMode := false.
-		]
-	    ]
-	].
+        (self secureFileIn:(myName , '.rc')) ifFalse:[
+            StandAlone ifFalse:[
+                defaultRC := 'smalltalk.rc'
+            ] ifTrue:[
+                defaultRC := 'stxapp.rc'
+            ].
+
+            "/ no .rc file where executable is; try default smalltalk.rc (or stxapp.rc)
+
+            (self secureFileIn:defaultRC) ifFalse:[
+                StandAlone ifFalse:[
+                    Transcript showCR:'SMALLTALK: no startup rc-file found. Going into line-by-line interpreter.'.
+                    graphicalMode := false.
+                ]
+            ]
+        ].
     ].
 
     StandAlone ifTrue:[
-	Debugger := Inspector := nil.
-	debuggingStandAlone ifTrue:[
-	    Debugger := MiniDebugger.
-	].
+        Debugger := Inspector := nil.
+        debuggingStandAlone ifTrue:[
+            Debugger := MiniDebugger.
+        ].
     ] ifFalse:[
-	"
-	 enable the graphical debugger/inspector 
-	 (they could have been (re)defined as autoloaded in the patches file)
-	"
-	self initStandardTools.
+        "
+         enable the graphical debugger/inspector 
+         (they could have been (re)defined as autoloaded in the patches file)
+        "
+        self initStandardTools.
     ].
 
     Display isNil ifTrue:[
-	graphicalMode := false.
+        graphicalMode := false.
     ].
 
     self mainStartup:graphicalMode
 
-    "Modified: 29.7.1996 / 17:04:44 / cg"
+    "Modified: 8.1.1997 / 19:52:38 / cg"
 ! !
 
 !Smalltalk class methodsFor:'startup queries'!
@@ -3498,5 +3505,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.208 1997-01-08 17:31:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.209 1997-01-08 19:07:09 cg Exp $'
 ! !