Smalltalk.st
changeset 1650 b4b36961d1bc
parent 1647 6ccae4646a4a
child 1655 fb6ee1b55ec4
--- a/Smalltalk.st	Mon Sep 09 15:29:38 1996 +0200
+++ b/Smalltalk.st	Mon Sep 09 19:04:43 1996 +0200
@@ -10,14 +10,16 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.9 on 9-sep-1996 at 17:43:20'                    !
+
 Object subclass:#Smalltalk
 	instanceVariableNames:''
-	classVariableNames:'ExitBlocks CachedClasses SystemPath StartupClass StartupSelector
-		StartupArguments CommandLine CommandLineArguments
-		CachedAbbreviations SilentLoading Initializing StandAlone
-		LogDoits LoadBinaries RealSystemPath ResourcePath SourcePath
-		BitmapPath BinaryPath FileInPath ImageStartTime ImageRestartTime
-		DemoMode'
+	classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses SystemPath
+		StartupClass StartupSelector StartupArguments CommandLine
+		CommandLineArguments CachedAbbreviations SilentLoading
+		Initializing StandAlone LogDoits LoadBinaries RealSystemPath
+		ResourcePath SourcePath BitmapPath BinaryPath FileInPath
+		ImageStartTime ImageRestartTime DemoMode'
 	poolDictionaries:''
 	category:'System-Support'
 !
@@ -56,6 +58,17 @@
 
     [Class variables:]
 
+        StartBlocks     <Collection>    blocks to be executed in a separate process after
+                                        everything has been initialized. These blocks will
+                                        be deleted after execution and therefore not be
+                                        executed after an image restart. Initial processes
+                                        are usually started here.
+
+        ImageStartBlocks 
+                        <Collection>    blocks to be executed in a separate process after
+                                        everything has been initialized. These blocks will be
+                                        executed after an image restart.
+
         ExitBlocks      <Collection>    blocks to evaluate before system is
                                         left. Not currently used (GNU-ST compatibility).
 
@@ -91,6 +104,7 @@
 
 
 
+
     strictly private classVariables (helpers):
 
         CachedClasses   <Collection>    known classes (cached for faster class enumeration)
@@ -1080,6 +1094,39 @@
     ]
 !
 
+addImageStartBlock:aBlock
+    "{ Pragma: +optSpace }"
+
+    "add a blocks to be executed in a separate process after
+     everything has been initialized. These blocks will be
+     executed after an image restart."
+
+    ImageStartBlocks isNil ifTrue:[
+        ImageStartBlocks := OrderedCollection with:aBlock
+    ] ifFalse:[
+        ImageStartBlocks add:aBlock
+    ]
+
+    "Created: 9.9.1996 / 16:48:20 / stefan"
+!
+
+addStartBlock:aBlock
+    "{ Pragma: +optSpace }"
+
+    "add a blocks to be executed in a separate process after
+     everything has been initialized. These blocks will
+     be deleted after execution and therefore not be
+     executed after an image restart. Initial processes are usually started here."
+
+    StartBlocks isNil ifTrue:[
+        StartBlocks := OrderedCollection with:aBlock
+    ] ifFalse:[
+        StartBlocks add:aBlock
+    ]
+
+    "Created: 9.9.1996 / 16:46:53 / stefan"
+!
+
 exit
     "{ Pragma: +optSpace }"
 
@@ -1357,30 +1404,6 @@
 
     imageName := ObjectMemory imageName.
 
-    (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false" 
-        imageName isNil ifTrue:[
-            Transcript showCR:(self hello).
-            Transcript showCR:(self copyrightString).
-            Transcript cr.
-        ] ifFalse:[
-            Transcript cr.
-            Transcript showCR:('Smalltalk restarted from:'
-                                , imageName
-                                , ' (saved '
-                                , ObjectMemory imageSaveTime printString
-                                , ')' ).
-        ].
-        Transcript cr.
-
-        DemoMode ifTrue:[
-            Transcript showCR:'*** Restricted use:                              ***'.
-            Transcript showCR:'*** This program may be used for education only. ***'.
-            Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE  ***'.
-            Transcript showCR:'*** for more details.                            ***'.
-            Transcript cr.
-        ].
-    ].
-
     "
      if there is a display, start its event dispatcher 
     "
@@ -1390,6 +1413,48 @@
 
     Initializing := false.
 
+    mainProcess := [
+        StartBlocks notNil ifTrue:[
+            StartBlocks do:[:aBlock|
+                aBlock value
+            ].
+            StartBlocks := nil.
+        ].
+        ImageStartBlocks notNil ifTrue:[
+            ImageStartBlocks do:[:aBlock|
+                aBlock value
+            ].
+        ].
+        (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false" 
+            imageName isNil ifTrue:[
+                Transcript showCR:(self hello).
+                Transcript showCR:(self copyrightString).
+                Transcript cr.
+            ] ifFalse:[
+                Transcript cr.
+                Transcript showCR:('Smalltalk restarted from:'
+                                    , imageName
+                                    , ' (saved '
+                                    , ObjectMemory imageSaveTime printString
+                                    , ')' ).
+            ].
+            Transcript cr.
+
+            DemoMode ifTrue:[
+                Transcript showCR:'*** Restricted use:                              ***'.
+                Transcript showCR:'*** This program may be used for education only. ***'.
+                Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE  ***'.
+                Transcript showCR:'*** for more details.                            ***'.
+                Transcript cr.
+            ].
+        ].
+    ] newProcess.
+    mainProcess priority:8.
+    mainProcess name:'start block handler'.
+    mainProcess beGroupLeader.
+    mainProcess resume.
+
+
     (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
         "
          allow more customization by reading an image specific rc-file
@@ -1434,6 +1499,7 @@
 
     "Created: 18.7.1996 / 21:07:39 / cg"
     "Modified: 18.7.1996 / 21:14:56 / cg"
+    "Modified: 9.9.1996 / 17:42:50 / stefan"
 !
 
 readEvalPrint
@@ -3280,5 +3346,5 @@
 !Smalltalk  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.170 1996-09-07 12:11:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.171 1996-09-09 17:04:43 stefan Exp $'
 ! !