Smalltalk.st
changeset 5410 859c010edb47
parent 5406 4a6995b61c0e
child 5419 5de8099c5ad2
--- a/Smalltalk.st	Fri Jun 23 20:54:30 2000 +0200
+++ b/Smalltalk.st	Fri Jun 23 20:57:24 2000 +0200
@@ -365,7 +365,10 @@
     __init_registered_modules__(3);
 
     @global(DemoMode) = __getDemoMode() ? true : false;
-%}
+    RETURN (self);
+%}.
+    ^ self primitiveFailed
+
 !
 
 initializeSystem
@@ -606,7 +609,8 @@
 %{  /* NOCONTEXT */
     RETURN ( __GLOBAL_GET(aKey) );
 %}.
-    self primitiveFailed
+    ^ self primitiveFailed
+
 !
 
 at:aKey ifAbsent:aBlock
@@ -688,7 +692,9 @@
 
 %{  /* NOCONTEXT */
     RETURN ( __GLOBAL_KEYKNOWN(aKey) );
-%}
+%}.
+    ^ self primitiveFailed
+
 !
 
 keyAtValue:anObject
@@ -715,22 +721,24 @@
 removeKey:aKey
     "remove the association stored under the key-argument from the globals dictionary.
      WARNING: 
-	this is somewhat dangerous: conceptionally, the association is removed,
-	to which machine & byte compiled code refers if it accesses a global.
-	If there are still global accesses in some literalArray or from machine-compiled code,
-	it continues to reference the globals value via that obsolete association and gets a nil
-	value.  (which is correct)
-	However, if that global is later reintroduced, a new association will be created and
-	the new global now referenced via the new association.
-	The old accesses will still see nil, although the globals value is actually non-nil
-	(this is questionable).
-	To avoid this problem, the #removeClass: method never removed the key."
+        this is somewhat dangerous: conceptionally, the association is removed,
+        to which machine & byte compiled code refers if it accesses a global.
+        If there are still global accesses in some literalArray or from machine-compiled code,
+        it continues to reference the globals value via that obsolete association and gets a nil
+        value.  (which is correct)
+        However, if that global is later reintroduced, a new association will be created and
+        the new global now referenced via the new association.
+        The old accesses will still see nil, although the globals value is actually non-nil
+        (this is questionable).
+        To avoid this problem, the #removeClass: method never removed the key."
 
     CachedClasses := nil.
 
 %{  /* NOCONTEXT */
     RETURN ( __GLOBAL_REMOVE(aKey) );
-%}
+%}.
+    ^ self primitiveFailed
+
 !
 
 values
@@ -1245,11 +1253,15 @@
     "call the dummy debug function, on which a breakpoint
      can be put in adb, sdb, dbx or gdb.
      WARNING: this method is for debugging only
-	      it will be removed without notice."
+              it will be removed without notice."
 %{
     __PATCHUPCONTEXTS(__context);
     __debugBreakPoint__();
-%}
+    RETURN(self);
+%}.
+    ^ self primitiveFailed
+
+
 !
 
 exitWithCoreDump
@@ -1274,7 +1286,9 @@
 %{
     __fatal0(__context, "fatalAbort");
     /* NEVER RETURNS */
-%}
+%}.
+    ^ self primitiveFailed
+
 !
 
 fatalAbort:aMessage
@@ -1287,13 +1301,15 @@
     char *msg;
 
     if (__isString(aMessage))
-	msg = (char *) __stringVal(aMessage);
+        msg = (char *) __stringVal(aMessage);
     else
-	msg = "fatalAbort";
+        msg = "fatalAbort";
 
     __fatal0(__context, msg);
     /* NEVER RETURNS */
-%}
+%}.
+    ^ self primitiveFailed
+
 ! !
 
 !Smalltalk class methodsFor:'enumerating'!
@@ -1677,7 +1693,8 @@
 %{  /* NOCONTEXT */
     RETURN ( __GLOBAL_GETCELL(aName) );
 %}.
-    self primitiveFailed
+    ^ self primitiveFailed
+
 !
 
 classNamed:aString
@@ -2061,18 +2078,18 @@
      if there is a display, start its event dispatcher 
     "
     Display notNil ifTrue:[
-	Display deviceIOTimeoutErrorSignal handlerBlock:[:ex |
-	    SaveEmergencyImage == true ifTrue:[
-		'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR.
-		ObjectMemory primSnapShotOn:'crash.img'.
-	    ].
-	    'Display [warning]: broken display connection - exit.' infoPrintCR.
-	    Smalltalk exit.
-	].
+        Display deviceIOTimeoutErrorSignal handlerBlock:[:ex |
+            SaveEmergencyImage == true ifTrue:[
+                'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR.
+                ObjectMemory primSnapShotOn:'crash.img'.
+            ].
+            'Display [warning]: broken display connection - exit.' infoPrintCR.
+            Smalltalk exit.
+        ].
 "/        Display deviceIOErrorSignal handlerBlock:[:ex |
 "/            'Display [warning]: I/O error on display connection - exit.' infoPrintCR.
 "/        ].
-	Display startDispatch.
+        Display startDispatch.
     ].
 
     Initializing := false.
@@ -2083,50 +2100,50 @@
     "/ Therefore, it is now done by an extra user-process.
 
     mainProcess := [
-	StartBlocks notNil ifTrue:[
-	    StartBlocks do:[:aBlock|
-		aBlock value
-	    ].
-	    StartBlocks := nil.
-	].
-	ImageStartBlocks notNil ifTrue:[
-	    ImageStartBlocks do:[:aBlock|
-		aBlock value
-	    ].
-	].
-	StandAlone ifFalse:[
-	    (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false" 
-		thisIsARestart ifTrue:[
-		    Transcript cr.
-		    Transcript showCR:('Smalltalk restarted from:'
-					, imageName
-					, ' (saved '
-					, ObjectMemory imageSaveTime printString
-					, ')' ).
-		] ifFalse:[
-		    Transcript showCR:(self hello).
-		    Transcript showCR:(self copyrightString).
-		    Transcript cr.
-		].
-		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.
-	    ].
-	].
-
-	thisIsARestart ifTrue:[
-	    "/
-	    "/ the final late notification - users can now assume that
-	    "/ views, forms etc. have been recreated.
-
-	    ObjectMemory changed:#returnFromSnapshot.
-	]
+        StartBlocks notNil ifTrue:[
+            StartBlocks do:[:aBlock|
+                aBlock value
+            ].
+            StartBlocks := nil.
+        ].
+        ImageStartBlocks notNil ifTrue:[
+            ImageStartBlocks do:[:aBlock|
+                aBlock value
+            ].
+        ].
+        StandAlone==true ifFalse:[
+            (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false" 
+                thisIsARestart ifTrue:[
+                    Transcript cr.
+                    Transcript showCR:('Smalltalk restarted from:'
+                                        , imageName
+                                        , ' (saved '
+                                        , ObjectMemory imageSaveTime printString
+                                        , ')' ).
+                ] ifFalse:[
+                    Transcript showCR:(self hello).
+                    Transcript showCR:(self copyrightString).
+                    Transcript cr.
+                ].
+                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.
+            ].
+        ].
+
+        thisIsARestart ifTrue:[
+            "/
+            "/ the final late notification - users can now assume that
+            "/ views, forms etc. have been recreated.
+
+            ObjectMemory changed:#returnFromSnapshot.
+        ]
 
     ] newProcess.
     mainProcess priority:8.
@@ -2139,40 +2156,40 @@
     "/ message.
 
     (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
-	"
-	 allow more customization by reading an image specific rc-file
-	"
-	thisIsARestart ifTrue:[
-	    (imageName asFilename hasSuffix:'img') ifTrue:[
-		imageName := imageName copyWithoutLast:4
-	    ].
-	    self fileIn:(imageName , '.rc')
-	].
+        "
+         allow more customization by reading an image specific rc-file
+        "
+        thisIsARestart ifTrue:[
+            (imageName asFilename hasSuffix:'img') ifTrue:[
+                imageName := imageName copyWithoutLast:4
+            ].
+            self fileIn:(imageName , '.rc')
+        ].
 
 "/        Display notNil ifTrue:[
 "/            Display class exitOnLastClose:true.
 "/        ].
 "/        Processor exitWhenNoMoreUserProcesses:true.
 
-	standAloneProcess := [
-	    StartupClass perform:StartupSelector withArguments:StartupArguments.
-	    "/
-	    "/ non-GUI apps exit after the startup;
-	    "/ assume that GUI apps have created & opened some view ...
-	    "/
-	    Display isNil ifTrue:[
-		Smalltalk exit.
-	    ].
-	    "/
-	    "/ GUI apps exit after the last user process has finished
-	    "/
-	    Display class exitOnLastClose:true.
-	    Processor exitWhenNoMoreUserProcesses:true.
-	] newProcess.
-	standAloneProcess priority:8.
-	standAloneProcess name:'main'.
-	standAloneProcess beGroupLeader.
-	standAloneProcess resume.
+        standAloneProcess := [
+            StartupClass perform:StartupSelector withArguments:StartupArguments.
+            "/
+            "/ non-GUI apps exit after the startup;
+            "/ assume that GUI apps have created & opened some view ...
+            "/
+            Display isNil ifTrue:[
+                Smalltalk exit.
+            ].
+            "/
+            "/ GUI apps exit after the last user process has finished
+            "/
+            Display class exitOnLastClose:true.
+            Processor exitWhenNoMoreUserProcesses:true.
+        ] newProcess.
+        standAloneProcess priority:8.
+        standAloneProcess name:'main'.
+        standAloneProcess beGroupLeader.
+        standAloneProcess resume.
     ].
 
     "
@@ -2181,12 +2198,12 @@
     "
     ((Display notNil and:[graphicalMode]) 
     or:[standAloneProcess notNil
-    or:[HeadlessOperation]]) ifTrue:[
-	Processor dispatchLoop.
+    or:[HeadlessOperation == true]]) ifTrue:[
+        Processor dispatchLoop.
     ] ifFalse:[
-	StandAlone ifFalse:[
-	    self readEvalPrint
-	]
+        StandAlone==true ifFalse:[
+            self readEvalPrint
+        ]
     ].
 
     "done - the last process finished"
@@ -2415,123 +2432,123 @@
     "/ 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 prevCatchSetting|
-
-	"/
-	"/ 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; 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; removeAtIndex:idx.
-	].
-
-	"/ patches are installed, even if system methods are
-	"/ overwritten.
-
-	prevCatchSetting := Class catchMethodRedefinitions.
-	Class catchMethodRedefinitions:false.
-
-	(self secureFileIn:(myName asFilename withSuffix:'pch')) ifFalse:[
-	    StandAlone ifFalse:[
-		self secureFileIn:'patches'.
-	    ].
-	].
-
-	Class catchMethodRedefinitions:prevCatchSetting.
-
-	"/ then look for <command>.rc
-	"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
-
-	(self secureFileIn:(myName asFilename withSuffix:'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:[
-		    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
-		    graphicalMode := false.
-		]
-	    ]
-	].
+        |myName defaultRC prevCatchSetting|
+
+        "/
+        "/ 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; 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; removeAtIndex:idx.
+        ].
+
+        "/ patches are installed, even if system methods are
+        "/ overwritten.
+
+        prevCatchSetting := Class catchMethodRedefinitions.
+        Class catchMethodRedefinitions:false.
+
+        (self secureFileIn:(myName asFilename withSuffix:'pch')) ifFalse:[
+            StandAlone ifFalse:[
+                self secureFileIn:'patches'.
+            ].
+        ].
+
+        Class catchMethodRedefinitions:prevCatchSetting.
+
+        "/ then look for <command>.rc
+        "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
+
+        (self secureFileIn:(myName asFilename withSuffix:'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:[
+                    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
+                    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 or:[HeadlessOperation]) ifTrue:[
-	graphicalMode := false.
+    (Display isNil or:[HeadlessOperation==true]) ifTrue:[
+        graphicalMode := false.
     ].
 
     self mainStartup:graphicalMode
@@ -5295,7 +5312,7 @@
 
     RETURN (__MKSTRING(__getConfigurationString() COMMA_SND));
 %}.
-    ^ 'unknown/unknown'
+    ^ self primitiveFailed
 
     "
      Smalltalk configuration
@@ -5313,7 +5330,8 @@
 #endif
 
     RETURN (__getCopyrightString());
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      Smalltalk copyrightString
@@ -5331,7 +5349,9 @@
 #endif
 
     RETURN (__getDistributorString());
-%}
+%}.
+    ^ self primitiveFailed
+
     "
      Smalltalk distributorString
     "
@@ -5510,7 +5530,8 @@
     extern OBJ __getRel();
 
     RETURN (__getRel());
-%}
+%}.
+    ^ self primitiveFailed
 
     "
      Smalltalk releaseIdentification
@@ -5592,7 +5613,9 @@
     extern char *__getBuildDateString();
 
     RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) );
-%}
+%}.
+    ^ self primitiveFailed
+
     "
      Smalltalk versionDate
     "
@@ -5617,5 +5640,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.450 2000-06-23 08:18:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.451 2000-06-23 18:56:24 cg Exp $'
 ! !