changed: #start
authorClaus Gittinger <cg@exept.de>
Thu, 14 Jul 2011 17:57:03 +0200
changeset 13506 b44b0948b6f5
parent 13505 3149df906108
child 13507 8a63453a75ec
changed: #start only attempt to read a command file if it exists
Smalltalk.st
--- a/Smalltalk.st	Wed Jul 13 15:32:55 2011 +0200
+++ b/Smalltalk.st	Thu Jul 14 17:57:03 2011 +0200
@@ -1039,6 +1039,7 @@
     "Created: 20.6.1997 / 16:58:28 / cg"
 ! !
 
+
 !Smalltalk class methodsFor:'browsing'!
 
 browseAllCallsOn:aSelectorSymbol
@@ -3967,156 +3968,156 @@
      while reading patches- and rc-file, do not add things into change-file
     "
     Class withoutUpdatingChangesDo:[
-	|commandFile defaultRC prevCatchSetting|
-
-	didReadRCFile := false.
-
-	StandAlone ifFalse:[
-	    "/
-	    "/ 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:[
-		idx := CommandLineArguments indexOf:'--silent'.
-	    ].
-	    idx ~~ 0 ifTrue:[
-		Object infoPrinting:false.
-		ObjectMemory infoPrinting:false.
-		CommandLineArguments removeAtIndex:idx.
-	    ].
-
-	    "/ look for a '-e filename' or '--execute filename' argument
-	    "/ this will force fileIn of filename only, no standard startup.
-
-	    idx := CommandLineArguments indexOf:'-e'.
-	    idx == 0 ifTrue:[
-		idx := CommandLineArguments indexOf:'--execute'.
-		idx == 0 ifTrue:[
-		    idx := CommandLineArguments indexOf:'--script'.
-		    idx ~~ 0 ifTrue:[
-			SilentLoading := true.
-		    ].
-		].
-	    ].
-	    idx ~~ 0 ifTrue:[
-		CommandName := arg := CommandLineArguments at:idx + 1.
-
-		CommandLineArguments
-		    removeAtIndex:idx+1; removeAtIndex:idx.
-
-		arg = '-' ifTrue:[
-		    self fileInStream:Stdin
-			   lazy:nil
-			   silent:nil
-			   logged:false
-			   addPath:nil
-		] ifFalse:[
-		    self fileIn:arg.
-		].
-		self exit
-	    ].
-
-	    "/ look for a '-E expr' or '--eval expr' argument
-	    "/ this will force evaluation of expr only, no standard startup
-	    idx := CommandLineArguments indexOf:'-E'.
-	    idx == 0 ifTrue:[
-		idx := CommandLineArguments indexOf:'--eval'.
-	    ].
-	    idx ~~ 0 ifTrue:[
-		arg := CommandLineArguments at:idx + 1.
-
-		CommandLineArguments
-		    removeAtIndex:idx+1; removeAtIndex:idx.
-
-		self
-		    fileInStream:arg readStream
-		    lazy:nil
-		    silent:nil
-		    logged:false
-		    addPath:nil.
-
-		self exit
-	    ].
-
-	    "look for a '-f filename' or '--file filename' argument
-	     this will force evaluation of filename instead of smalltalk.rc"
-
-	    idx := CommandLineArguments indexOf:'-f'.
-	    idx == 0 ifTrue:[
-		idx := CommandLineArguments indexOf:'--file'.
-	    ].
-	    idx ~~ 0 ifTrue:[
-		CommandName := commandFile := CommandLineArguments at:idx+1.
-		CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
-	    ].
-	].
-
-	commandFile notNil ifTrue:[
-	    (self secureFileIn:commandFile) ifFalse:[
-		('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR.
-		OperatingSystem exit:1.
-	    ].
-	] ifFalse:[
-	    "/ look for <command>.rc
-	    "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
-
-	    commandFile := self commandName asFilename withSuffix:'rc'.
-	    (didReadRCFile := self secureFileIn:commandFile) ifFalse:[
-		StandAlone ifFalse:[
-		    defaultRC := 'smalltalk.rc'
-		] ifTrue:[
-		    defaultRC := 'stxapp.rc'
-		].
-
-		didReadRCFile := self secureFileIn:defaultRC.
-		didReadRCFile ifFalse:[
-		    StandAlone ifFalse:[
-			'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
-			graphicalMode := false.
-		    ]
-		]
-	    ].
-
-	    "/ ('StandAlone is %1' bindWith:StandAlone) printCR.
-	    "/ ('Headless is %1' bindWith:HeadlessOperation) printCR.
-	    "/ ('Display is %1' bindWith:Display) printCR.
-	    "/ ('Screen is %1' bindWith:Screen) printCR.
-
-	    didReadRCFile ifFalse:[
-		self secureFileIn:'private.rc'.
-
-		"/
-		"/ No RC file found;
-		"/ Setup more default stuff
-		"/
-		StandAlone ifFalse:[
-		    "/ its a smalltalk - proceed in interpreter.
-		    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
-		    graphicalMode := false.
-		].
-
-		"/ setup more defaults...
-		ObjectMemory startBackgroundCollectorAt:5.
-		ObjectMemory startBackgroundFinalizationAt:5.
-		self addStartBlock:[
-		    Processor startTimeSlicing.
-		    Processor supportDynamicPriorities:true.
-		    ObjectMemory backgroundCollectProcess priorityRange:(4 to:9).
-		    ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9).
-		].
-	    ].
-	].
+        |commandFile defaultRC prevCatchSetting|
+
+        didReadRCFile := false.
+
+        StandAlone ifFalse:[
+            "/
+            "/ 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:[
+                idx := CommandLineArguments indexOf:'--silent'.
+            ].
+            idx ~~ 0 ifTrue:[
+                Object infoPrinting:false.
+                ObjectMemory infoPrinting:false.
+                CommandLineArguments removeAtIndex:idx.
+            ].
+
+            "/ look for a '-e filename' or '--execute filename' argument
+            "/ this will force fileIn of filename only, no standard startup.
+
+            idx := CommandLineArguments indexOf:'-e'.
+            idx == 0 ifTrue:[
+                idx := CommandLineArguments indexOf:'--execute'.
+                idx == 0 ifTrue:[
+                    idx := CommandLineArguments indexOf:'--script'.
+                    idx ~~ 0 ifTrue:[
+                        SilentLoading := true.
+                    ].
+                ].
+            ].
+            idx ~~ 0 ifTrue:[
+                CommandName := arg := CommandLineArguments at:idx + 1.
+
+                CommandLineArguments
+                    removeAtIndex:idx+1; removeAtIndex:idx.
+
+                arg = '-' ifTrue:[
+                    self fileInStream:Stdin
+                           lazy:nil
+                           silent:nil
+                           logged:false
+                           addPath:nil
+                ] ifFalse:[
+                    self fileIn:arg.
+                ].
+                self exit
+            ].
+
+            "/ look for a '-E expr' or '--eval expr' argument
+            "/ this will force evaluation of expr only, no standard startup
+            idx := CommandLineArguments indexOf:'-E'.
+            idx == 0 ifTrue:[
+                idx := CommandLineArguments indexOf:'--eval'.
+            ].
+            idx ~~ 0 ifTrue:[
+                arg := CommandLineArguments at:idx + 1.
+
+                CommandLineArguments
+                    removeAtIndex:idx+1; removeAtIndex:idx.
+
+                self
+                    fileInStream:arg readStream
+                    lazy:nil
+                    silent:nil
+                    logged:false
+                    addPath:nil.
+
+                self exit
+            ].
+
+            "look for a '-f filename' or '--file filename' argument
+             this will force evaluation of filename instead of smalltalk.rc"
+
+            idx := CommandLineArguments indexOf:'-f'.
+            idx == 0 ifTrue:[
+                idx := CommandLineArguments indexOf:'--file'.
+            ].
+            idx ~~ 0 ifTrue:[
+                CommandName := commandFile := CommandLineArguments at:idx+1.
+                CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
+            ].
+        ].
+
+        commandFile notNil ifTrue:[
+            (self secureFileIn:commandFile) ifFalse:[
+                ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR.
+                OperatingSystem exit:1.
+            ].
+        ] ifFalse:[
+            "/ look for <command>.rc
+            "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
+
+            commandFile := self commandName asFilename withSuffix:'rc'.
+            (didReadRCFile := commandFile exists and:[self secureFileIn:commandFile]) ifFalse:[
+                StandAlone ifFalse:[
+                    defaultRC := 'smalltalk.rc' asFilename
+                ] ifTrue:[
+                    defaultRC := 'stxapp.rc' asFilename
+                ].
+
+                didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC].
+                didReadRCFile ifFalse:[
+                    StandAlone ifFalse:[
+                        'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
+                        graphicalMode := false.
+                    ]
+                ]
+            ].
+
+            "/ ('StandAlone is %1' bindWith:StandAlone) printCR.
+            "/ ('Headless is %1' bindWith:HeadlessOperation) printCR.
+            "/ ('Display is %1' bindWith:Display) printCR.
+            "/ ('Screen is %1' bindWith:Screen) printCR.
+
+            didReadRCFile ifFalse:[
+                'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ].
+
+                "/
+                "/ No RC file found;
+                "/ Setup more default stuff
+                "/
+                StandAlone ifFalse:[
+                    "/ its a smalltalk - proceed in interpreter.
+                    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
+                    graphicalMode := false.
+                ].
+
+                "/ setup more defaults...
+                ObjectMemory startBackgroundCollectorAt:5.
+                ObjectMemory startBackgroundFinalizationAt:5.
+                self addStartBlock:[
+                    Processor startTimeSlicing.
+                    Processor supportDynamicPriorities:true.
+                    ObjectMemory backgroundCollectProcess priorityRange:(4 to:9).
+                    ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9).
+                ].
+            ].
+        ].
     ].
 
     HeadlessOperation ifTrue:[
-	graphicalMode := false.
+        graphicalMode := false.
     ].
 
     self mainStartup:graphicalMode
 
-    "Modified: / 06-12-2006 / 15:39:17 / cg"
+    "Modified: / 14-07-2011 / 17:56:41 / cg"
 !
 
 startStartBlockProcess
@@ -7597,7 +7598,7 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.955 2011-07-04 10:34:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.956 2011-07-14 15:57:03 cg Exp $'
 !
 
 version_SVN