Smalltalk.st
changeset 216 a8abff749575
parent 213 3b56a17534fd
child 237 9a81ad92aa7b
--- a/Smalltalk.st	Thu Feb 02 13:13:16 1995 +0100
+++ b/Smalltalk.st	Thu Feb 02 13:23:05 1995 +0100
@@ -26,7 +26,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.28 1994-11-28 20:34:16 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.29 1995-02-02 12:22:37 claus Exp $
 '!
 
 "
@@ -55,7 +55,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.28 1994-11-28 20:34:16 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.29 1995-02-02 12:22:37 claus Exp $
 "
 !
 
@@ -151,7 +151,7 @@
      Smalltalk versionString
     "
 "
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.28 1994-11-28 20:34:16 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.29 1995-02-02 12:22:37 claus Exp $
 "
 !
 
@@ -510,13 +510,6 @@
     "
     Display notNil ifTrue:[
 	Display startDispatch.
-
-	"this is a leftover - will vanish"
-" "
-	ModalDisplay notNil ifTrue:[
-	    ModalDisplay startDispatch
-	]
-" "
     ].
 
     Initializing := false.
@@ -628,11 +621,6 @@
     "
     Display notNil ifTrue:[
 	Display startDispatch.
-" "
-	ModalDisplay notNil ifTrue:[
-	    ModalDisplay startDispatch
-	]
-" "
     ].
 
     "
@@ -990,7 +978,7 @@
     ExecutionTrace := nil
 ! !
 
-!Smalltalk class methodsFor:'enumeration'!
+!Smalltalk class methodsFor:'enumerating'!
 
 do:aBlock
     "evaluate the argument, aBlock for all values in the Smalltalk dictionary"
@@ -1066,16 +1054,6 @@
 %}
 !
 
-references:anObject
-    "return true, if I refer to the argument, anObject
-     must be reimplemented since Smalltalk is no real collection."
-
-    self do:[:o |
-	(o == anObject) ifTrue:[^ true]
-    ].
-    ^ false
-!
-
 allClasses
     "return a collection of all classes in the system"
 
@@ -1137,6 +1115,36 @@
 
     self do:[:element | element = something ifTrue:[^ true]].
     ^ false
+!
+
+references:anObject
+    "redefined, since the references are only kept in the VM's symbol table"
+
+    self keysAndValuesDo:[:key :val |
+	(key == anObject) ifTrue:[^ true].
+	(val == anObject ) ifTrue:[^ true].
+    ].
+    ^ super references:anObject
+!
+
+referencesDerivedInstanceOf:aClass
+    "redefined, since the references are only kept in the VM's symbol table"
+
+    self keysAndValuesDo:[:key :val |
+	(key isKindOf:aClass) ifTrue:[^ true].
+	(val isKindOf:aClass) ifTrue:[^ true].
+    ].
+    ^ super referencesDerivedInstanceOf:aClass
+!
+
+referencesInstanceOf:aClass
+    "redefined, since the references are only kept in the VM's symbol table"
+
+    self keysAndValuesDo:[:key :val |
+	(key isMemberOf:aClass) ifTrue:[^ true].
+	(val isMemberOf:aClass) ifTrue:[^ true].
+    ].
+    ^ super referencesInstanceOf:aClass
 ! !
 
 !Smalltalk class methodsFor:'class management'!
@@ -1456,7 +1464,7 @@
 
     OperatingSystem maxFileNameLength < (fileName size + 3) ifTrue:[
 	"this will only be triggered on sys5.3 type systems"
-	self error:'cant find short for ' , fileName , ' in abbreviation file'
+	self warn:'cant find short for ' , fileName , ' in abbreviation file'
     ].
     ^ fileName
 !
@@ -1489,6 +1497,20 @@
     "
 !
 
+silentFileIn:aFilename
+    "same as fileIn:, but do not output 'compiled...'-messages on Transcript.
+     Main use is during startup."
+
+    |wasSilent|
+
+    wasSilent := self silentLoading:true.
+    [
+	self fileIn:aFilename
+    ] valueNowOrOnUnwindDo:[
+	self silentLoading:wasSilent
+    ]
+!
+
 fileIn:aFileName
     "read in the named file - look for it in some standard places;
      return true if ok, false if failed"
@@ -1543,76 +1565,103 @@
      finally source file (.st) in that order.
      The file is first searched for using the class name, then the abbreviated name."
 
-    |shortName newClass ok nm|
+    ^ self fileInClass:aClassName initialize:true lazy:false silent:false
+!
+
+fileInClass:aClassName initialize:doInit
+    "find a source/object file for aClassName and -if found - load it.
+     search is in some standard places trying driver-file (.ld), object-file (.o) and 
+     finally source file (.st) in that order.
+     The file is first searched for using the class name, then the abbreviated name."
+
+    ^ self fileInClass:aClassName initialize:doInit lazy:false silent:false
+!
 
-    Class withoutUpdatingChangesDo:
+fileInClass:aClassName initialize:doInit lazy:loadLazy
+    "find a source/object file for aClassName and -if found - load it.
+     search is in some standard places trying driver-file (.ld), object-file (.o) and 
+     finally source file (.st) in that order.
+     The file is first searched for using the class name, then the abbreviated name."
+
+     ^ self fileInClass:aClassName initialize:doInit lazy:loadLazy silent:false
+!
+
+fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent 
+    "find a source/object file for aClassName and -if found - load it.
+     search is in some standard places trying driver-file (.ld), object-file (.o) and 
+     finally source file (.st) in that order.
+     The file is first searched for using the class name, then the abbreviated name."
+
+    |shortName newClass ok nm wasLazy wasSilent|
+
+    wasLazy := Compiler compileLazy:loadLazy.
+    wasSilent := self silentLoading:beSilent.
+
     [
-	"
-	 first, look for a loader-driver file (in fileIn/xxx.ld)
-	"
-	(self fileIn:('fileIn/' , aClassName , '.ld'))
-	ifFalse:[
-	    shortName := self fileNameForClass:aClassName.
-	    "
-	     try abbreviated driver-file (in fileIn/xxx.ld)
+	Class withoutUpdatingChangesDo:
+	[
 	    "
-	    (self fileIn:('fileIn/' , shortName , '.ld'))
+	     first, look for a loader-driver file (in fileIn/xxx.ld)
+	    "
+	    (self fileIn:('fileIn/' , aClassName , '.ld'))
 	    ifFalse:[
+		shortName := self fileNameForClass:aClassName.
 		"
-		 then, if dynamic linking is available, look for a shared binary in binary/xxx.o
+		 try abbreviated driver-file (in fileIn/xxx.ld)
 		"
-		ObjectFileLoader notNil ifTrue:[
-		    nm := 'binary/' , aClassName.
-		    (self fileInClassObject:aClassName from:(nm , '.so'))
-		    ifFalse:[
-			(self fileInClassObject:aClassName from:(nm , '.o'))
+		(self fileIn:('fileIn/' , shortName , '.ld'))
+		ifFalse:[
+		    "
+		     then, if dynamic linking is available, look for a shared binary in binary/xxx.o
+		    "
+		    ObjectFileLoader notNil ifTrue:[
+			nm := 'binary/' , aClassName.
+			(self fileInClassObject:aClassName from:(nm , '.so'))
 			ifFalse:[
-			    nm := 'binary/' , shortName.
-			    (self fileInClassObject:aClassName from:(nm , '.so'))
+			    (self fileInClassObject:aClassName from:(nm , '.o'))
 			    ifFalse:[
-				ok := self fileInClassObject:aClassName from:(nm , '.o')
+				nm := 'binary/' , shortName.
+				(self fileInClassObject:aClassName from:(nm , '.so'))
+				ifFalse:[
+				    ok := self fileInClassObject:aClassName from:(nm , '.o')
+				].
 			    ].
 			].
 		    ].
-		].
 
-		"
-		 if that did not work, look for an st-source file ...
-		"
-		ok ifFalse:[
-		    (self fileIn:(aClassName , '.st'))
-		    ifFalse:[
-			(self fileIn:(shortName , '.st')) 
+		    "
+		     if that did not work, look for an st-source file ...
+		    "
+		    ok ifFalse:[
+			(self fileIn:(aClassName , '.st'))
 			ifFalse:[
-			    "
-			     ... and in the standard source-directory
-			    "
-			    (self fileIn:('source/' , aClassName , '.st'))
+			    (self fileIn:(shortName , '.st')) 
 			    ifFalse:[
-				ok := self fileIn:('source/' , shortName , '.st')
+				"
+				 ... and in the standard source-directory
+				"
+				(self fileIn:('source/' , aClassName , '.st'))
+				ifFalse:[
+				    ok := self fileIn:('source/' , shortName , '.st')
+				]
 			    ]
 			]
 		    ]
-		]
-	    ].
-	]
+		].
+	    ]
+	].
+	newClass := self at:(aClassName asSymbol).
+	newClass notNil ifTrue:[
+	    doInit ifTrue:[
+		newClass initialize
+	    ]
+	].
+    ] valueNowOrOnUnwindDo:[
+	Compiler compileLazy:wasLazy. 
+	self silentLoading:wasSilent
     ].
-    newClass := self at:(aClassName asSymbol).
-    newClass notNil ifTrue:[newClass initialize]
-!
 
-silentFileIn:aFilename
-    "same as fileIn:, but do not output 'compiled...'-messages on Transcript.
-     Main use is during startup."
-
-    |wasSilent|
-
-    wasSilent := self silentLoading:true.
-    [
-	self fileIn:aFilename
-    ] valueNowOrOnUnwindDo:[
-	self silentLoading:wasSilent
-    ]
+    ^ newClass
 !
 
 compressSources