handle the packageQuery when filing in
authorClaus Gittinger <cg@exept.de>
Thu, 22 Apr 1999 19:11:03 +0200
changeset 4113 ccb70141e908
parent 4112 5ee841c34b10
child 4114 9300fc0fae0e
handle the packageQuery when filing in (this will arrange for autoloaded methods to get a correct package)
Smalltalk.st
--- a/Smalltalk.st	Thu Apr 22 18:52:33 1999 +0200
+++ b/Smalltalk.st	Thu Apr 22 19:11:03 1999 +0200
@@ -2912,150 +2912,180 @@
             ok := false.
 
             shortName := self fileNameForClass:aClassName.
-            "
-             first, look for a loader-driver file (in fileIn/xxx.ld)
-            "
-            (ok := self fileIn:('fileIn/' , shortName , '.ld') lazy:loadLazy silent:beSilent)
-            ifFalse:[
+
+            Class packageQuerySignal answer:package
+            do:[
+
                 "
-                 try abbreviated driver-file (in fileIn/xxx.ld)
+                 first, look for a loader-driver file (in fileIn/xxx.ld)
                 "
-                shortName ~= aClassName ifTrue:[
-                    ok := self fileIn:('fileIn/' , longName , '.ld') lazy:loadLazy silent:beSilent
-                ].
-                ok ifFalse:[
+                (ok := self fileIn:('fileIn/' , shortName , '.ld') lazy:loadLazy silent:beSilent)
+                ifFalse:[
+                    "
+                     try abbreviated driver-file (in fileIn/xxx.ld)
                     "
-                     then, if dynamic linking is available, 
-                    "
-                    (LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[
-                        sharedLibExtension := ObjectFileLoader sharedLibraryExtension.
-
+                    shortName ~= aClassName ifTrue:[
+                        ok := self fileIn:('fileIn/' , longName , '.ld') lazy:loadLazy silent:beSilent
+                    ].
+                    ok ifFalse:[
                         "
-                         first look for a class packages shared binary in binary/xxx.o
+                         then, if dynamic linking is available, 
                         "
-                        libName := self libraryFileNameOfClass:aClassName.
-                        libName notNil ifTrue:[
-                            (ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension))
-                            ifFalse:[
-                                sharedLibExtension ~= '.o' ifTrue:[
-                                    ok := self fileInClass:aClassName fromObject:(libName, '.o')
-                                ]
+                        (LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[
+                            sharedLibExtension := ObjectFileLoader sharedLibraryExtension.
+
+                            "
+                             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, sharedLibExtension))
+                                ifFalse:[
+                                    sharedLibExtension ~= '.o' ifTrue:[
+                                        ok := self fileInClass:aClassName fromObject:(libName, '.o')
+                                    ]
+                                ].
                             ].
-                        ].
-
-                        "
-                         then, look for a shared binary in binary/xxx.o
-                        "
-                        ok ifFalse:[
-                            (ok := self fileInClass:aClassName fromObject:(shortName, sharedLibExtension))
-                            ifFalse:[
-                                sharedLibExtension ~= '.o' ifTrue:[
-                                    ok := self fileInClass:aClassName fromObject:(shortName, '.o')
-                                ].
-                                ok ifFalse:[
-                                    shortName ~= aClassName ifTrue:[
-                                        (ok := self fileInClass:aClassName fromObject:(longName, sharedLibExtension))
-                                        ifFalse:[
-                                            sharedLibExtension ~= '.o' ifTrue:[
-                                                ok := self fileInClass:aClassName fromObject:(longName, '.o')
+
+                            "
+                             then, look for a shared binary in binary/xxx.o
+                            "
+                            ok ifFalse:[
+                                (ok := self fileInClass:aClassName fromObject:(shortName, sharedLibExtension))
+                                ifFalse:[
+                                    sharedLibExtension ~= '.o' ifTrue:[
+                                        ok := self fileInClass:aClassName fromObject:(shortName, '.o')
+                                    ].
+                                    ok ifFalse:[
+                                        shortName ~= aClassName ifTrue:[
+                                            (ok := self fileInClass:aClassName fromObject:(longName, sharedLibExtension))
+                                            ifFalse:[
+                                                sharedLibExtension ~= '.o' ifTrue:[
+                                                    ok := self fileInClass:aClassName fromObject:(longName, '.o')
+                                                ]
                                             ]
-                                        ]
+                                        ].
                                     ].
                                 ].
                             ].
                         ].
-                    ].
-
-                    "
-                     if that did not work, look for a compiled-bytecode file ...
-                    "
-                    ok ifFalse:[
-                        (ok := self fileIn:(shortName , '.cls') lazy:loadLazy silent:beSilent)
-                        ifFalse:[
-                            shortName ~= aClassName ifTrue:[
-                                ok := self fileIn:(longName , '.cls') lazy:loadLazy silent:beSilent
-                            ]
-                        ]
-                    ].
-                    "
-                     if that did not work, and the classes package is known,
-                     look for an st-cls file 
-                     in a package subdir of the source-directory ...
-                    "
-                    ok ifFalse:[
-                        package notNil ifTrue:[
-                            (ok := self fileIn:(package , '/' , shortName , '.cls') lazy:loadLazy silent:beSilent)
+
+                        "
+                         if that did not work, look for a compiled-bytecode file ...
+                        "
+                        ok ifFalse:[
+                            (ok := self fileIn:(shortName , '.cls') lazy:loadLazy silent:beSilent)
                             ifFalse:[
                                 shortName ~= aClassName ifTrue:[
-                                    ok := self fileIn:(package , '/' , longName , '.cls') lazy:loadLazy silent:beSilent
-                                ]
-                            ]
-                        ]
-                    ].
-
-                    "
-                     if that did not work, look for an st-source file ...
-                    "
-                    ok ifFalse:[
-                        fn := shortName , '.st'.
-                        (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
-                        ifFalse:[
-                            shortName ~= longName ifTrue:[
-                                fn := longName , '.st'.
-                                ok := self fileIn:fn lazy:loadLazy silent:beSilent
-                            ].
-                            ok ifFalse:[
-                                "
-                                 ... and in the standard source-directory
-                                "
-                                fn := 'source/' , shortName , '.st'.
-                                (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
-                                ifFalse:[
-                                    shortName ~= longName ifTrue:[
-                                        fn := 'source/' , longName , '.st'.
-                                        ok := self fileIn:fn lazy:loadLazy silent:beSilent
-                                    ]
+                                    ok := self fileIn:(longName , '.cls') lazy:loadLazy silent:beSilent
                                 ]
                             ]
                         ].
                         "
                          if that did not work, and the classes package is known,
-                         look for an st-source file 
+                         look for an st-cls file 
                          in a package subdir of the source-directory ...
                         "
                         ok ifFalse:[
                             package notNil ifTrue:[
-                                fn := package , '/' , shortName , '.st'.
-                                (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
+                                (ok := self fileIn:(package , '/' , shortName , '.cls') lazy:loadLazy silent:beSilent)
                                 ifFalse:[
                                     shortName ~= aClassName ifTrue:[
-                                        fn := package , '/' , longName , '.st'.
-                                        ok := self fileIn:fn lazy:loadLazy silent:beSilent
-                                    ].
-                                    ok ifFalse:[
-                                        "
-                                         ... and in the standard source-directory
-                                        "
-                                        fn := 'source/' , package , '/' , shortName , '.st'.
-                                        (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
-                                        ifFalse:[
-                                            shortName ~= aClassName ifTrue:[
-                                                fn := 'source/' , package , '/' , longName , '.st'.
-                                                ok := self fileIn:fn lazy:loadLazy silent:beSilent
+                                        ok := self fileIn:(package , '/' , longName , '.cls') lazy:loadLazy silent:beSilent
+                                    ]
+                                ]
+                            ]
+                        ].
+
+                        "
+                         if that did not work, look for an st-source file ...
+                        "
+                        ok ifFalse:[
+                            fn := shortName , '.st'.
+                            (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
+                            ifFalse:[
+                                shortName ~= longName ifTrue:[
+                                    fn := longName , '.st'.
+                                    ok := self fileIn:fn lazy:loadLazy silent:beSilent
+                                ].
+                                ok ifFalse:[
+                                    "
+                                     ... and in the standard source-directory
+                                    "
+                                    fn := 'source/' , shortName , '.st'.
+                                    (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
+                                    ifFalse:[
+                                        shortName ~= longName ifTrue:[
+                                            fn := 'source/' , longName , '.st'.
+                                            ok := self fileIn:fn lazy:loadLazy silent:beSilent
+                                        ]
+                                    ]
+                                ]
+                            ].
+                            "
+                             if that did not work, and the classes package is known,
+                             look for an st-source file 
+                             in a package subdir of the source-directory ...
+                            "
+                            ok ifFalse:[
+                                package notNil ifTrue:[
+                                    fn := package , '/' , shortName , '.st'.
+                                    (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
+                                    ifFalse:[
+                                        shortName ~= aClassName ifTrue:[
+                                            fn := package , '/' , longName , '.st'.
+                                            ok := self fileIn:fn lazy:loadLazy silent:beSilent
+                                        ].
+                                        ok ifFalse:[
+                                            "
+                                             ... and in the standard source-directory
+                                            "
+                                            fn := 'source/' , package , '/' , shortName , '.st'.
+                                            (ok := self fileIn:fn lazy:loadLazy silent:beSilent)
+                                            ifFalse:[
+                                                shortName ~= aClassName ifTrue:[
+                                                    fn := 'source/' , package , '/' , longName , '.st'.
+                                                    ok := self fileIn:fn lazy:loadLazy silent:beSilent
+                                                ]
                                             ]
                                         ]
+                                    ].
+                                ]
+                            ].
+                            "
+                             if that did not work, and the classes package is known,
+                             look for a zipArchive containing a class entry.
+                            "
+                            ok ifFalse:[
+                                package notNil ifTrue:[
+                                    zarFn := package asFilename withSuffix:'zip'.
+                                    zarFn := self getSourceFileName:zarFn.
+                                    zarFn notNil ifTrue:[
+                                        zar := ZipArchive oldFileNamed:zarFn.
+                                        zar notNil ifTrue:[
+                                            entry := zar extract:(shortName , '.st').
+                                            (entry isNil and:[shortName ~= longName]) ifTrue:[
+                                                entry := zar extract:(longName , '.st').
+                                            ].
+                                            entry notNil ifTrue:[
+                                                ok := self 
+                                                        fileInStream:(entry asString readStream)
+                                                        lazy:loadLazy 
+                                                        silent:beSilent 
+                                                        logged:false
+                                                        addPath:nil
+                                            ].
+                                        ]
                                     ]
-                                ].
-                            ]
-                        ].
-                        "
-                         if that did not work, and the classes package is known,
-                         look for a zipArchive containing a class entry.
-                        "
-                        ok ifFalse:[
-                            package notNil ifTrue:[
-                                zarFn := package asFilename withSuffix:'zip'.
-                                zarFn := self getSourceFileName:zarFn.
+                                ]
+                            ].
+
+                            "
+                             if that did not work, 
+                             look for a zipArchive containing a class entry.
+                            "
+                            ok ifFalse:[
+                                zarFn := self getSourceFileName:'source.zip'.
                                 zarFn notNil ifTrue:[
                                     zar := ZipArchive oldFileNamed:zarFn.
                                     zar notNil ifTrue:[
@@ -3073,47 +3103,22 @@
                                         ].
                                     ]
                                 ]
-                            ]
-                        ].
-
-                        "
-                         if that did not work, 
-                         look for a zipArchive containing a class entry.
-                        "
-                        ok ifFalse:[
-                            zarFn := self getSourceFileName:'source.zip'.
-                            zarFn notNil ifTrue:[
-                                zar := ZipArchive oldFileNamed:zarFn.
-                                zar notNil ifTrue:[
-                                    entry := zar extract:(shortName , '.st').
-                                    (entry isNil and:[shortName ~= longName]) ifTrue:[
-                                        entry := zar extract:(longName , '.st').
-                                    ].
-                                    entry notNil ifTrue:[
-                                        ok := self 
-                                                fileInStream:(entry asString readStream)
-                                                lazy:loadLazy 
-                                                silent:beSilent 
-                                                logged:false
-                                                addPath:nil
-                                    ].
-                                ]
-                            ]
-                        ].
-                        ok ifFalse:[
-                            "
-                             new: if there is a sourceCodeManager, ask it for the classes sourceCode
-                            "
-                            (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
-                                inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName.
-                                inStream notNil ifTrue:[
-                                    fn := nil.
-                                    ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. 
-                                ]
+                            ].
+                            ok ifFalse:[
+                                "
+                                 new: if there is a sourceCodeManager, ask it for the classes sourceCode
+                                "
+                                (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
+                                    inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName.
+                                    inStream notNil ifTrue:[
+                                        fn := nil.
+                                        ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. 
+                                    ]
+                                ].
                             ].
                         ].
                     ].
-                ].
+                ]
             ]
         ].
 
@@ -4215,5 +4220,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.313 1999-04-22 15:38:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.314 1999-04-22 17:11:03 cg Exp $'
 ! !