start & restart actions merged into a common method.
authorClaus Gittinger <cg@exept.de>
Thu, 18 Jul 1996 21:15:47 +0200
changeset 1578 9df8cc1ec5c4
parent 1577 720f14f90e2c
child 1579 6993e41d4e6f
start & restart actions merged into a common method.
Smalltalk.st
--- a/Smalltalk.st	Thu Jul 18 20:56:04 1996 +0200
+++ b/Smalltalk.st	Thu Jul 18 21:15:47 1996 +0200
@@ -1353,6 +1353,93 @@
 
 !Smalltalk  class methodsFor:'startup'!
 
+mainStartup:graphicalMode
+    "common start/restart action, if there is a Display, initialize it
+     and start dispatching; otherwise go into a read-eval-print loop."
+
+    |mainProcess imageName|
+
+    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 
+    "
+    Display notNil ifTrue:[
+        Display startDispatch.
+    ].
+
+    Initializing := false.
+
+    (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
+        "
+         allow more customization by reading an image specific rc-file
+        "
+        imageName notNil ifTrue:[
+            (imageName endsWith:'.img') ifTrue:[
+                imageName := imageName copyWithoutLast:4
+            ].
+            self fileIn:(imageName , '.rc')
+        ].
+
+"/        Display notNil ifTrue:[
+"/            Display class exitOnLastClose:true.
+"/        ].
+"/      Processor exitWhenNoMoreUserProcesses:true.
+
+        mainProcess := [
+            StartupClass perform:StartupSelector withArguments:StartupArguments.
+            Smalltalk exit.
+        ] newProcess.
+        mainProcess priority:8.
+        mainProcess name:'main'.
+        mainProcess beGroupLeader.
+        mainProcess resume.
+    ].
+
+    "
+     if view-classes exist, start dispatching;
+     otherwise go into a read-eval-print loop
+    "
+    (Display notNil and:[graphicalMode]) ifTrue:[
+        Processor dispatchLoop.
+    ] ifFalse:[
+        StandAlone ifFalse:[
+            self readEvalPrint
+        ]
+    ].
+
+    "done - the last process finished"
+
+    self exit
+
+    "Created: 18.7.1996 / 21:07:39 / cg"
+    "Modified: 18.7.1996 / 21:14:56 / cg"
+!
+
 readEvalPrint
     "{ Pragma: +optSpace }"
 
@@ -1495,25 +1582,6 @@
         Transcript := Stderr
     ].
 
-    (SilentLoading == true) ifFalse:[
-        Transcript cr.
-        Transcript showCR:('Smalltalk restarted from:'
-                            , ObjectMemory 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.
-        ].
-    ].
-
-
     "/ give user a chance to re-customize things
     "/ reading if smalltalk_r.rc may be suppressed by the
     "/ -fastStart argument.
@@ -1527,56 +1595,9 @@
         ]
     ].
 
-    "/
-    "/ if there is a display, start its event dispatcher 
-
-    Display notNil ifTrue:[
-        Display startDispatch.
-    ].
-
-    "/
-    "/ this allows firing an application by defining
-    "/ these two globals during snapshot ... or in main
-
-    (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
-        "
-         allow more customization by reading an image specific rc-file
-        "
-        imageName := ObjectMemory imageName.
-        imageName notNil ifTrue:[
-            (imageName endsWith:'.img') ifTrue:[
-                imageName := imageName copyWithoutLast:4
-            ].
-            self fileIn:(imageName , '.rc')
-        ].
-        
-        Processor exitWhenNoMoreUserProcesses:true.
-
-        mainProcess := [
-            StartupClass perform:StartupSelector withArguments:StartupArguments.
-"/            Smalltalk exit.
-        ] newProcess.
-        mainProcess priority:8.
-        mainProcess name:'main'.
-        mainProcess beGroupLeader.
-        mainProcess resume.
-    ].
-
-    "/
-    "/ if view-classes exist, start dispatching;
-    "/ otherwise go into a read-eval-print loop
-
-    Display notNil ifTrue:[
-        Processor dispatchLoop
-    ] ifFalse:[
-        StandAlone ifFalse:[
-            self readEvalPrint
-        ]
-    ].
-
-    self exit
-
-    "Modified: 18.7.1996 / 20:16:27 / cg"
+    self mainStartup:true
+
+    "Modified: 18.7.1996 / 21:15:06 / cg"
 !
 
 start
@@ -1660,20 +1681,6 @@
         ].
     ].
 
-    (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false" 
-        Transcript showCR:(self hello).
-        Transcript showCR:(self copyrightString).
-        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.
-        ].
-    ].
-
     StandAlone ifTrue:[
         Debugger := Inspector := nil
     ] ifFalse:[
@@ -1684,48 +1691,9 @@
         self initStandardTools.
     ].
 
-    "
-     if there is a display, start its event dispatcher 
-    "
-    Display notNil ifTrue:[
-        Display startDispatch.
-    ].
-
-    Initializing := false.
-
-    (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
-"/        Display notNil ifTrue:[
-"/            Display class exitOnLastClose:true.
-"/        ].
-        Processor exitWhenNoMoreUserProcesses:true.
-
-        mainProcess := [
-            StartupClass perform:StartupSelector withArguments:StartupArguments.
-"/            Smalltalk exit.
-        ] newProcess.
-        mainProcess priority:8.
-        mainProcess name:'main'.
-        mainProcess beGroupLeader.
-        mainProcess resume.
-    ].
-
-    "
-     if view-classes exist, start dispatching;
-     otherwise go into a read-eval-print loop
-    "
-    (Display notNil and:[graphicalMode]) ifTrue:[
-        Processor dispatchLoop.
-    ] ifFalse:[
-        StandAlone ifFalse:[
-            self readEvalPrint
-        ]
-    ].
-
-    "done - the last process finished"
-
-    self exit
-
-    "Modified: 18.7.1996 / 20:16:32 / cg"
+    self mainStartup:graphicalMode
+
+    "Modified: 18.7.1996 / 21:13:44 / cg"
 ! !
 
 !Smalltalk  class methodsFor:'startup queries'!
@@ -3177,5 +3145,5 @@
 !Smalltalk  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.160 1996-07-18 18:16:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.161 1996-07-18 19:15:47 cg Exp $'
 ! !