Class.st
changeset 4116 ea4fe17d575b
parent 4055 599e73eed11f
child 4288 51f416d3f15b
--- a/Class.st	Thu Apr 22 20:53:30 1999 +0200
+++ b/Class.st	Fri Apr 23 11:38:41 1999 +0200
@@ -3308,10 +3308,11 @@
      (this is done for backward compatibility,)
 
      For example: 
-	'....(libbasic)'                         -> module: stx directory: libbasic library: libbasic
-	'....(stx:libbasic)'                     -> module: stx directory: libbasic library: libbasic
-	'....(aeg:libIECInterface)'              -> module: aeg directory: libIECInterface library:libIECInterface
-	'....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase 
+        '....(libbasic)'                         -> module: stx directory: libbasic library: libbasic
+        '....(stx:libbasic)'                     -> module: stx directory: libbasic library: libbasic
+        '....(stx:foo:libbfoo)'                  -> module: stx directory: foo library: libfoo
+        '....(aeg:libIECInterface)'              -> module: aeg directory: libIECInterface library:libIECInterface
+        '....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase 
 
      The way how the sourceCodeManager uses this to find the source location
      depends on the scheme used. For CVS, the module is taken as the -d arg,
@@ -3319,11 +3320,11 @@
      Other schemes may do things differently - these are not yet specified.
 
      Caveat:
-	Encoding this info in the package string seems somewhat kludgy.
+        Encoding this info in the package string seems somewhat kludgy.
     "
 
     |owner sourceInfo packageString idx1 idx2 
-     moduleString directoryString libraryString components dirComponents mgr|
+     moduleString directoryString libraryString components component1 component2 dirComponents mgr|
 
     (owner := self owningClass) notNil ifTrue:[^ owner packageSourceCodeInfo].
 
@@ -3332,12 +3333,12 @@
     packageString := package asString.
     idx1 := packageString lastIndexOf:$(.
     idx1 ~~ 0 ifTrue:[
-	idx2 := packageString indexOf:$) startingAt:idx1+1.
-	idx2 ~~ 0 ifTrue:[
-	    sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1
-	]
+        idx2 := packageString indexOf:$) startingAt:idx1+1.
+        idx2 ~~ 0 ifTrue:[
+            sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1
+        ]
     ] ifFalse:[
-	sourceInfo := packageString
+        sourceInfo := packageString
     ].
 
     sourceInfo isNil ifTrue:[^ nil].
@@ -3345,71 +3346,77 @@
     components size == 0 ifTrue:[
 "/        moduleString := 'stx'.
 "/        directoryString := libraryString := ''.
-	^ nil
+        ^ nil
     ].
+
+    component1 := components at:1.
     components size == 1 ifTrue:[
-	"/ a single name given - the module becomes 'stx' or
-	"/ the very first directory component (if such a module exists).
-	"/ If the component includes slashes, its the directory
-	"/ otherwise the library
-	"/ 
-	dirComponents := Filename concreteClass components:(components at:1).     
-
-	(dirComponents size > 1
-	and:[(mgr := self sourceCodeManager) notNil
-	and:[mgr checkForExistingModule:dirComponents first]]) ifTrue:[
-	    moduleString := dirComponents first.
-	    directoryString := libraryString := (Filename fromComponents:(dirComponents copyFrom:2)) asString.
-	] ifFalse:[
-	    moduleString := 'stx'.
-	    directoryString := libraryString := components at:1.
-	].
-
-	(libraryString includes:$/) ifTrue:[
-	    libraryString := libraryString asFilename baseName
-	]
+        "/ a single name given - the module becomes 'stx' or
+        "/ the very first directory component (if such a module exists).
+        "/ If the component includes slashes, its the directory
+        "/ otherwise the library.
+        "/ 
+        dirComponents := Filename concreteClass components:component1.     
+        (dirComponents size > 1
+        and:[(mgr := self sourceCodeManager) notNil
+        and:[mgr checkForExistingModule:dirComponents first]]) ifTrue:[
+            moduleString := dirComponents first.
+            directoryString := libraryString := (Filename fromComponents:(dirComponents copyFrom:2)) asString.
+        ] ifFalse:[
+            "/ non-existing; assume directory under the stx package.
+            moduleString := 'stx'.
+            (component1 startsWith:'stx/') ifTrue:[
+                component1 := component1 copyFrom:5
+            ].
+            directoryString := libraryString := component1.
+        ].
+
+        (libraryString includes:$/) ifTrue:[
+            libraryString := libraryString asFilename baseName
+        ]
     ] ifFalse:[
-	components size == 2 ifTrue:[
-	    "/ two components - assume its the module and the directory; 
-	    "/ the library is assumed to be named after the directory
-	    "/ except, if slashes are in the name; then the libraryname
-	    "/ is the last component.
-	    "/
-	    moduleString := components at:1.
-	    directoryString := libraryString := components at:2.
-	    (libraryString includes:$/) ifTrue:[
-		libraryString := libraryString asFilename baseName
-	    ]
-	] ifFalse:[
-	    "/ all components given
-	    moduleString := components at:1.
-	    directoryString := components at:2.
-	    libraryString := components at:3.
-	]
+        component2 := components at:2.
+        components size == 2 ifTrue:[
+            "/ two components - assume its the module and the directory; 
+            "/ the library is assumed to be named after the directory
+            "/ except, if slashes are in the name; then the libraryname
+            "/ is the last component.
+            "/
+            moduleString := component1.
+            directoryString := libraryString := component2.
+            (libraryString includes:$/) ifTrue:[
+                libraryString := libraryString asFilename baseName
+            ]
+        ] ifFalse:[
+            "/ all components given
+            moduleString := component1.
+            directoryString := component2.
+            libraryString := components at:3.
+        ]
     ].
 
     libraryString isEmpty ifTrue:[
-	directoryString notEmpty ifTrue:[
-	    libraryString := directoryString asFilename baseName
-	].
-	libraryString isEmpty ifTrue:[
-	    "/ lets extract the library from the liblist file ...
-	    libraryString := Smalltalk libraryFileNameOfClass:self.
-	    libraryString isNil ifTrue:[^ nil].
-	]
+        directoryString notEmpty ifTrue:[
+            libraryString := directoryString asFilename baseName
+        ].
+        libraryString isEmpty ifTrue:[
+            "/ lets extract the library from the liblist file ...
+            libraryString := Smalltalk libraryFileNameOfClass:self.
+            libraryString isNil ifTrue:[^ nil].
+        ]
     ].
 
     moduleString isEmpty ifTrue:[
-	moduleString := 'stx'.
+        moduleString := 'stx'.
     ].
     directoryString isEmpty ifTrue:[
-	directoryString := libraryString.
+        directoryString := libraryString.
     ].
 
     ^ IdentityDictionary
-	with:(#module->moduleString)
-	with:(#directory->directoryString)
-	with:(#library->libraryString)
+        with:(#module->moduleString)
+        with:(#directory->directoryString)
+        with:(#library->libraryString)
 
     "
      Object packageSourceCodeInfo     
@@ -3934,5 +3941,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.335 1999-03-19 07:17:17 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.336 1999-04-23 09:38:41 cg Exp $'
 ! !