Smalltalk.st
changeset 345 cf2301210c47
parent 335 1f1cc22f2aa5
child 348 5ac1b6b43600
--- a/Smalltalk.st	Fri May 12 14:35:09 1995 +0200
+++ b/Smalltalk.st	Tue May 16 19:09:45 1995 +0200
@@ -27,7 +27,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.45 1995-05-03 15:30:43 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.46 1995-05-16 17:08:57 claus Exp $
 '!
 
 "
@@ -56,7 +56,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.45 1995-05-03 15:30:43 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.46 1995-05-16 17:08:57 claus Exp $
 "
 !
 
@@ -949,10 +949,19 @@
 %}
 !
 
+printPolyCaches
+    "dump poly caches.
+     WARNING: this method is for debugging only
+	      it will be removed without notice"
+%{
+    __dumpILCCaches();
+%}
+!
+
 printStackBacktrace
     "print a stack backtrace - then continue.
      WARNING: this method is for debugging only 
-	      it may be removed without notice"
+	      it will be removed without notice"
 
 %{
     printStack(__context);
@@ -1677,7 +1686,7 @@
     "read classname to filename mappings from include/abbrev.stc.
      sigh - all for those poor sys5.3 or MSDOS people with short filenames ..."
 
-    |aStream line index thisName abbrev|
+    |aStream line words|
 
     CachedAbbreviations := IdentityDictionary new.
     aStream := self systemFileStreamFor:'include/abbrev.stc'.
@@ -1686,19 +1695,57 @@
 	    line := aStream nextLine.
 	    line notNil ifTrue:[
 		(line startsWith:'#') ifFalse:[
-		    (line countWords == 2) ifTrue:[
-			index := line indexOfSeparatorStartingAt:1.
-			(index ~~ 0) ifTrue:[
-			    thisName := line copyTo:(index - 1).
-			    abbrev := (line copyFrom:index) withoutSeparators.
-			    CachedAbbreviations at:thisName asSymbol put:abbrev.
+		    words := line asCollectionOfWords.
+		    words size >= 2 ifTrue:[
+			CachedAbbreviations     
+				at:(words at:1) withoutSeparators asSymbol 
+				put:(words at:2) withoutSeparators.
+		    ]
+		]
+	    ]
+	].
+	aStream close
+    ]
+
+    "
+     Smalltalk readAbbreviations
+    "
+!
+
+libraryFileNameOfClass:aClassName
+    "read the abbreviation file 'abbrev.stc' for an entry for aClassName.
+     Return the third space-separated component, or nil if there is none.
+     A nil returns means that this class is either built-in or not present
+     in a package-class library (i.e. either as separate .o or separate .st file).
+     This names the classLibrary object (if any) of that class."
+
+    |aStream line words n|
+
+    aStream := self systemFileStreamFor:'include/abbrev.stc'.
+    aStream notNil ifTrue:[
+	[aStream atEnd] whileFalse:[
+	    line := aStream nextLine.
+	    line notNil ifTrue:[
+		(line startsWith:'#') ifFalse:[
+		    words := line asCollectionOfWords.
+		    (n := words size) > 1 ifTrue:[
+			(words at:1) = aClassName ifTrue:[
+			    n > 2 ifTrue:[
+				^ (words at:3) withoutSeparators
+			    ]
 			]
 		    ]
 		]
 	    ]
 	].
 	aStream close
-    ]
+    ].
+    ^ nil
+
+    "
+     Smalltalk libraryFileNameOfClass:'ClockView' 
+     Smalltalk libraryFileNameOfClass:'Bag' 
+    "
 !
 
 filenameAbbreviations
@@ -1769,7 +1816,7 @@
     "
 !
 
-fileInClassObject:aClassName from:aFileName
+fileInClass:aClassName fromObject:aFileName
     "read in the named object file and dynamic-link it into the system
      - look for it in some standard places;
      return true if ok, false if failed."
@@ -1785,7 +1832,8 @@
     ^ (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil
 
     "
-     Smalltalk fileInClassObject:'AbstractPath' from:'../goodies/Paths/AbstrPath.so' 
+     Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' 
+     Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' 
     "
 !
 
@@ -1945,11 +1993,14 @@
 
 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 wasLazy wasSilent|
+     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.
+     The argument doInit controlls if the class should be sent a #initialize after the
+     load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler
+     should not send notes to the transcript."
+
+    |shortName libName newClass ok wasLazy wasSilent|
 
     wasLazy := Compiler compileLazy:loadLazy.
     wasSilent := self silentLoading:beSilent.
@@ -1973,18 +2024,34 @@
 		].
 		ok ifFalse:[
 		    "
-		     then, if dynamic linking is available, look for a shared binary in binary/xxx.o
+		     then, if dynamic linking is available, 
 		    "
 		    ObjectFileLoader notNil ifTrue:[
-			(ok := self fileInClassObject:aClassName from:(aClassName, '.so'))
-			ifFalse:[
-			    (ok := self fileInClassObject:aClassName from:(aClassName, '.o'))
+			"
+			 first look for a class packages shared binary in binary/xxx.o
+			"
+			libName := self libraryFileNameOfClass:aClassName.
+			libName notNil ifTrue:[
+			    (ok := self fileInClass:aClassName fromObject:(libName, '.so'))
 			    ifFalse:[
-				shortName ~= aClassName ifTrue:[
-				    (ok := self fileInClassObject:aClassName from:(shortName, '.so'))
-				    ifFalse:[
-					ok := self fileInClassObject:aClassName from:(shortName, '.o')
-				    ]
+				ok := self fileInClass:aClassName fromObject:(libName, '.o')
+			    ].
+			].
+
+			"
+			 then, look for a shared binary in binary/xxx.o
+			"
+			ok ifFalse:[
+			    (ok := self fileInClass:aClassName fromObject:(aClassName, '.so'))
+			    ifFalse:[
+				(ok := self fileInClass:aClassName fromObject:(aClassName, '.o'))
+				ifFalse:[
+				    shortName ~= aClassName ifTrue:[
+					(ok := self fileInClass:aClassName fromObject:(shortName, '.so'))
+					ifFalse:[
+					    ok := self fileInClass:aClassName fromObject:(shortName, '.o')
+					]
+				    ].
 				].
 			    ].
 			].