Cleanup: start REPL after all other startup processing jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 07 Jan 2017 22:58:16 +0000
branchjv
changeset 1486 f2eb1c4525e3
parent 1485 bde224d85196
child 1490 fa18770c50a9
Cleanup: start REPL after all other startup processing ...to unify the startup procedure for boyh GUI and REPL modes. Basically, it display is not opened / available, instead of opening a launcher window, start a REPL, the rest is the same (except that in REPL mode, display initialization is skipped, of course)
private.rc
smalltalk.rc
--- a/private.rc	Sat Dec 31 00:05:51 2016 +0000
+++ b/private.rc	Sat Jan 07 22:58:16 2017 +0000
@@ -61,11 +61,11 @@
 "/ set the package for fileIns done below
 "/
 Project notNil ifTrue:[
-    |p|
+	|p|
 
-    p := Project new.
-    p package:#'goody-fileIn'.
-    Project current:p.
+	p := Project new.
+	p package:#'goody-fileIn'.
+	Project current:p.
 ].
 !
 
@@ -77,17 +77,17 @@
 thisIsMySystem := (whoAmI = 'cg') and:[thisIsExeptsDomain].
 
 thisIsMySystem ifTrue:[
-    "/
-    "/ I want the hostname to be prepended to a windows label
-    "/
-    StandardSystemView includeHostNameInLabel:true.
+	"/
+	"/ I want the hostname to be prepended to a windows label
+	"/
+	StandardSystemView includeHostNameInLabel:true.
 ].
 
 thisIsMySystem ifTrue:[
-    "/
-    "/ I prefer a smaller menu font
-    "/
-    "/ MenuView defaultFont:(MenuView defaultFont size:10).
+	"/
+	"/ I prefer a smaller menu font
+	"/
+	"/ MenuView defaultFont:(MenuView defaultFont size:10).
 ].
 
 "/ add my private directories to the systemPath ...
@@ -95,18 +95,18 @@
 "/ However, I leave the code here to show how its done.
 "/
 thisIsMySystem ifTrue:[
-    #(
+	#(
 "/        '../../not_delivered'
 "/        '../../private_classes'
 "/        '../../fileIn/not_delivered'
 "/        '../../libpro'
-     ) do:[:p |
+	 ) do:[:p |
 	p asFilename exists ifTrue:[
-	    (Smalltalk systemPath includes:(p asFilename pathName)) ifFalse:[
+		(Smalltalk systemPath includes:(p asFilename pathName)) ifFalse:[
 		Smalltalk systemPath addFirst:(p asFilename pathName).
-	    ]
+		]
 	]
-    ].
+	].
 ].
 
 "/ since smalltalk keeps track of which directories exist
@@ -137,10 +137,10 @@
 "/     if you dont like this, comment the following lines.
 "/
 thisIsExeptsDomain ifTrue:[
-    HistoryManager notNil ifTrue:[
+	HistoryManager notNil ifTrue:[
 	'private.rc [info]: activating HistoryManager...' infoPrintCR.
 	HistoryManager activate.
-    ]
+	]
 ].
 
 "/ claus:
@@ -151,15 +151,15 @@
 "/
 "
 thisIsMySystem ifTrue:[
-    'private.rc [info]: starting RDoItServer...' infoPrintCR.
-    Autoload autoloadFailedSignal handle:[:ex |
+	'private.rc [info]: starting RDoItServer...' infoPrintCR.
+	Autoload autoloadFailedSignal handle:[:ex |
 	'private.rc [warning]: cannot load RDoItServer' errorPrintCR
 	ex return
-    ] do:[
+	] do:[
 	RDoItServer autoload.
 	RDoItServer start.
 	RDoItServer allowHost:'localhost'.
-    ]
+	]
 ].
 "
 
@@ -182,15 +182,15 @@
 "/ systems without a Project class)
 
 Project notNil ifTrue:[
-    Project setDefaultProject.
-    "/ Project current package:#'private'.
+	Project setDefaultProject.
+	"/ Project current package:#'private'.
 ].
 !
 
 'MyWorkspace.wsp' asFilename exists ifFalse:[
-    'MyWorkspaceSample.wsp' asFilename exists ifTrue:[
+	'MyWorkspaceSample.wsp' asFilename exists ifTrue:[
 	'MyWorkspaceSample.wsp' asFilename copyTo:'MyWorkspace.wsp'
-    ]
+	]
 ].
 
 "/
@@ -199,22 +199,22 @@
 Smalltalk fileIn:('p_' , OperatingSystem getLoginName , '.rc').
 
 (Smalltalk commandLine includes:'-q') ifFalse:[
-    "/
-    "/ Object infoPrinting:
-    "/      this turns off/on information messages from classes
-    "/      (such as 'D8IMAGE: allocating colors ...'
-    "/
-    "/ ObjectMemory infoPrinting
-    "/      this turns off/on information messages from the VM
-    "/      (such as 'MEM: chitty chatty ...'
-    "/
+	"/
+	"/ Object infoPrinting:
+	"/      this turns off/on information messages from classes
+	"/      (such as 'D8IMAGE: allocating colors ...'
+	"/
+	"/ ObjectMemory infoPrinting
+	"/      this turns off/on information messages from the VM
+	"/      (such as 'MEM: chitty chatty ...'
+	"/
 
-    "/ Object infoPrinting:false.
-    "/ ObjectMemory infoPrinting:false.
-    OperatingSystem hasConsole ifTrue:[
+	"/ Object infoPrinting:false.
+	"/ ObjectMemory infoPrinting:false.
+	OperatingSystem hasConsole ifTrue:[
 	Object infoPrinting:true.
 	ObjectMemory infoPrinting:true.
-    ]
+	]
 ].
 
 "/
@@ -225,66 +225,66 @@
     |idx file|
 
     Smalltalk addStartBlock:[
-	|i fn|
-
-	"/
-	"/ start some views ...
-	"/ you can add all stuff you'd like to come up by default
-	"/ the first time.
-	"/
-
-	'private.rc [info]: starting Launcher...' infoPrintCR.
-	NewLauncher open.
+        Display isNil ifTrue:[
+            '' errorPrintCR.
+            'Textmode (enter smalltalk expressions terminated by single exclamation mark;' errorPrintCR.
+            OperatingSystem isUNIXlike ifTrue:[
+                '          CTRL-D to leave line-by-line interpreter.)' errorPrintCR.
+            ] ifFalse:[
+                '          CTRL-Z to leave line-by-line interpreter.)' errorPrintCR.
+            ].
+            Smalltalk readEvalPrintLoop.            
+            Smalltalk exit.
+        ] ifFalse:[
+            |i fn|
 
-	((Smalltalk commandLineArguments includes:'--quick')
-	or:[(Smalltalk commandLineArguments includes:'--faststart')
-	or:[(Smalltalk commandLineArguments includes:'--fastStart')]])
-	ifFalse:[
-	    "/
-	    "/ disable this if you don't like the other window to come up
-	    "/
-	    'private.rc [info]: starting SystemWorkspace...' infoPrintCR.
-	    WorkspaceApplication openSystemWorkspace.
-	].
+            "/
+            "/ start some views ...
+            "/ you can add all stuff you'd like to come up by default
+            "/ the first time.
+            "/
+
+            'private.rc [info]: starting Launcher...' infoPrintCR.
+            NewLauncher open.
 
-	UserPreferences current showTipOfTheDayAtStartup ifTrue:[
-	    'private.rc [info]: starting DidYouKnow...' infoPrintCR.
-	    DidYouKnowTipViewer open
-	].
-
-	"/
-	"/ start a SystemBrowser
-	"/ - I dont want one (using Launcher)
-	"/
-	"/ NewSystemBrowser open.
+            ((Smalltalk commandLineArguments includes:'--quick')
+            or:[(Smalltalk commandLineArguments includes:'--faststart')
+            or:[(Smalltalk commandLineArguments includes:'--fastStart')]])
+            ifFalse:[
+                "/
+                "/ disable this if you don't like the other window to come up
+                "/
+                'private.rc [info]: starting SystemWorkspace...' infoPrintCR.
+                WorkspaceApplication openSystemWorkspace.
+            ].
 
-	"/
-	"/ start a FileBrowser
-	"/ - I dont want one (using Launcher)
-	"/
-	"/ FileBrowserV2 open.
+            UserPreferences current showTipOfTheDayAtStartup ifTrue:[
+                'private.rc [info]: starting DidYouKnow...' infoPrintCR.
+                DidYouKnowTipViewer open
+            ].
 
-	UserPreferences current flyByHelpActive ifTrue:[
-	    FlyByHelp start
-	].
+            UserPreferences current flyByHelpActive ifTrue:[
+                FlyByHelp start
+            ].
 
-	"/ an additional --run <file> argument...
-	(i := Smalltalk commandLineArguments indexOf:'--run') ~~ 0 ifTrue:[
-	    fn := Smalltalk commandLineArguments at:i+1.
-	    ('private.rc [info]: executing "',fn,'"...') infoPrintCR.
-	    Smalltalk fileIn:fn.
-	]
+            "/ an additional --run <file> argument...
+            (i := Smalltalk commandLineArguments indexOf:'--run') ~~ 0 ifTrue:[
+                fn := Smalltalk commandLineArguments at:i+1.
+                ('private.rc [info]: executing "',fn,'"...') infoPrintCR.
+                Smalltalk fileIn:fn.
+            ]
+        ].
     ].
 
     idx := Smalltalk commandLineArguments indexOf:'--edit'.
     idx ~~ 0 ifTrue:[
-	file := Smalltalk commandLineArguments at:idx+1.
-	Smalltalk commandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
-	Smalltalk addStartBlock:
-	    [
-		(UserPreferences current changeSetBrowserClass)
-		    openOnFile:file asFilename
-	    ].
+    file := Smalltalk commandLineArguments at:idx+1.
+    Smalltalk commandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
+    Smalltalk addStartBlock:
+    	[
+    	(UserPreferences current changeSetBrowserClass)
+    		openOnFile:file asFilename
+    	].
     ].
 ].
 
--- a/smalltalk.rc	Sat Dec 31 00:05:51 2016 +0000
+++ b/smalltalk.rc	Sat Jan 07 22:58:16 2017 +0000
@@ -222,20 +222,8 @@
 	'smalltalk.rc [info]: opening display...' infoPrintCR.
 	Screen openDefaultDisplay:nil.
     ] on:Screen deviceOpenErrorSignal do:[:ex|
-	('smalltalk.rc [warning]: no display connection to: ', ex parameter printString) errorPrintCR.
-	'smalltalk.rc [info]: either set the DISPLAY environment variable,' infoPrintCR.
-	'smalltalk.rc [info]: or start smalltalk with a -display argument.' infoPrintCR.
-	Smalltalk isStandAloneApp ifFalse:[
-	    '' errorPrintCR.
-	    'Textmode (enter smalltalk expressions terminated by single exclamation mark;' errorPrintCR.
-	    OperatingSystem isUNIXlike ifTrue:[
-		'          CTRL-D to leave line-by-line interpreter.)' errorPrintCR.
-	    ] ifFalse:[
-		'          CTRL-Z to leave line-by-line interpreter.)' errorPrintCR.
-	    ].
-	    Smalltalk readEvalPrint.
-	].
-	Smalltalk exit
+	('smalltalk.rc [info]: failed to open display: ', ex description) infoPrintCR.
+	Smalltalk beHeadless: true.
     ].
 ].