Autoload.st
changeset 3027 7d677a5ced41
parent 2691 33221e233f79
child 3151 018115a34d6f
--- a/Autoload.st	Wed Oct 15 13:14:56 1997 +0200
+++ b/Autoload.st	Wed Oct 15 14:30:19 1997 +0200
@@ -60,25 +60,25 @@
 
     [class variables:]
         
-        LazyLoading             <Boolean>       if true, the loaded classes 
-                                                methods will NOT be compiled at 
-                                                autoload time, but instead when 
-                                                first called. This allows for a 
-                                                faster load. However, expect short 
-                                                pauses later when the methods are
-                                                first executed.
+	LazyLoading             <Boolean>       if true, the loaded classes 
+						methods will NOT be compiled at 
+						autoload time, but instead when 
+						first called. This allows for a 
+						faster load. However, expect short 
+						pauses later when the methods are
+						first executed.
                                      
-        AutoloadFailedSignal    <Signal>        signal raised if an autoloaded 
-                                                classes source is not available.
+	AutoloadFailedSignal    <Signal>        signal raised if an autoloaded 
+						classes source is not available.
 
-        LoadedClasses           <Collection>    set of classes that heve been
-                                                autoloaded (for later unload)
+	LoadedClasses           <Collection>    set of classes that heve been
+						autoloaded (for later unload)
 
     [see also:]
-        Smalltalk
+	Smalltalk
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 "
 ! !
 
@@ -88,14 +88,14 @@
     "initialize the failure-signal"
 
     AutoloadFailedSignal isNil ifTrue:[
-        LazyLoading := false.
+	LazyLoading := false.
 
-        AutoloadFailedSignal := Object errorSignal newSignalMayProceed:true.
-        AutoloadFailedSignal nameClass:self message:#autoloadFailedSignal.
-        AutoloadFailedSignal notifierString:'autoload failed '.
+	AutoloadFailedSignal := Object errorSignal newSignalMayProceed:true.
+	AutoloadFailedSignal nameClass:self message:#autoloadFailedSignal.
+	AutoloadFailedSignal notifierString:'autoload failed '.
 
-        self setSuperclass:nil.
-        ObjectMemory flushCaches.
+	self setSuperclass:nil.
+	ObjectMemory flushCaches.
     ]
 
     "Modified: 20.5.1997 / 19:06:25 / cg"
@@ -130,11 +130,11 @@
 
     nameSymbol := aClassName asSymbol.
     (Smalltalk at:nameSymbol) isNil ifTrue:[
-        Autoload subclass:nameSymbol
-             instanceVariableNames:''
-             classVariableNames:''
-             poolDictionaries:''
-             category:aCategory.
+	Autoload subclass:nameSymbol
+	     instanceVariableNames:''
+	     classVariableNames:''
+	     poolDictionaries:''
+	     category:aCategory.
     ]
     "
      Autoload addClass:'Clock' inCategory:'autoloaded-Demos'
@@ -164,7 +164,7 @@
 
     myName := self name.
     aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr;
-            spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr.
+	    spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr.
     aStream nextPutAll:'to load, execute: '.
     aStream cr; cr; spaces:4; nextPutLine:myName  , ' autoload'.
     aStream cr; nextPutLine:'or use the browsers load-function (in the class menu).'.
@@ -176,45 +176,45 @@
     "
     fileName := Smalltalk fileNameForClass:myName.
     (ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[
-        (nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[
-            nm := nm , ' (a classLibrary, possibly including more classes)'
-        ] ifFalse:[
-            nm := Smalltalk getBinaryFileName:(fileName , '.so').
-            nm isNil ifTrue:[
-                nm := Smalltalk getBinaryFileName:(fileName , '.o')
-            ].
-            nm notNil ifTrue:[
-                nm := nm , ' (a classBinary)'
-            ]
-        ].
+	(nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[
+	    nm := nm , ' (a classLibrary, possibly including more classes)'
+	] ifFalse:[
+	    nm := Smalltalk getBinaryFileName:(fileName , '.so').
+	    nm isNil ifTrue:[
+		nm := Smalltalk getBinaryFileName:(fileName , '.o')
+	    ].
+	    nm notNil ifTrue:[
+		nm := nm , ' (a classBinary)'
+	    ]
+	].
     ].
     nm isNil ifTrue:[
-        nm := Smalltalk getFileInFileName:(fileName , '.st').
-        nm isNil ifTrue:[
-            nm := Smalltalk getSourceFileName:(fileName , '.st').
-        ].
+	nm := Smalltalk getFileInFileName:(fileName , '.st').
+	nm isNil ifTrue:[
+	    nm := Smalltalk getSourceFileName:(fileName , '.st').
+	].
     ].
     nm notNil ifTrue:[
-        aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'.
-        aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm.
-        nm asFilename isSymbolicLink ifTrue:[
-            aStream cr; cr.
-            aStream nextPutLine:'which is a link to: '; spaces:4; 
-                    nextPutAll:(nm asFilename linkInfo path).
-        ]
+	aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'.
+	aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm.
+	nm asFilename isSymbolicLink ifTrue:[
+	    aStream cr; cr.
+	    aStream nextPutLine:'which is a link to: '; spaces:4; 
+		    nextPutAll:(nm asFilename linkInfo path).
+	]
     ] ifFalse:[
-        aStream cr; nextPutLine:'There is currently no file to load ' , myName , ' from.'; cr.
+	aStream cr; nextPutLine:'There is currently no file to load ' , myName , ' from.'; cr.
 
-        (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
-            classFileName := Smalltalk fileNameForClass:myName.
-            packageDir := Smalltalk sourceDirectoryNameOfClass:myName.
-        ].
-        (classFileName notNil and:[packageDir notNil]) ifTrue:[
-            aStream nextPutAll:'When accessed, I''ll ask the sourceCodeManager to load the code 
+	(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
+	    classFileName := Smalltalk fileNameForClass:myName.
+	    packageDir := Smalltalk sourceDirectoryNameOfClass:myName.
+	].
+	(classFileName notNil and:[packageDir notNil]) ifTrue:[
+	    aStream nextPutAll:'When accessed, I''ll ask the sourceCodeManager to load the code 
 from "' , classFileName , '.st" in the "' , packageDir , '" package.'.
-        ] ifFalse:[
-            aStream nextPutAll:'When accessed, an error will be reported.'.
-        ]
+	] ifFalse:[
+	    aStream nextPutAll:'When accessed, an error will be reported.'.
+	]
     ].
     aStream cr; nextPutAll:'"'.
 
@@ -247,49 +247,50 @@
     "use this to force loading
      - it is defined a noop in all non-autoloading classes"
 
-    |mySelf myName newClass oldMeta project prevMode package|
+    |mySelf myName myNameSpace newClass oldMeta project prevMode package|
 
     mySelf := self.
     myName := self name asSymbol.
+    myNameSpace := self nameSpace.
 
     "remove myself - to avoid recompilation"
     Smalltalk at:myName put:nil.
 
     "load it"
     (Object infoPrinting and:[Smalltalk silentLoading ~~ true]) ifTrue:[
-        Transcript showCR:('autoloading ', myName , ' ...'); endEntry.
+	Transcript showCR:('autoloading ', myName , ' ...'); endEntry.
     ].
 
     [
-        prevMode := ClassCategoryReader sourceMode.
+	prevMode := ClassCategoryReader sourceMode.
 "/
 "/ no- do not do this; it may lead to trouble ...
 "/        ClassCategoryReader sourceMode:#reference.
 
-        "/
-        "/ in order to not get a package of private (or whatever),
-        "/ temporarily set the currentProject to nil.
-        "/ we will later set the classes package to something useful
-        "/
-        Project notNil ifTrue:[
-            project := Project current.
-            Project setProject:nil.
-        ].
+	"/
+	"/ in order to not get a package of private (or whatever),
+	"/ temporarily set the currentProject to nil.
+	"/ we will later set the classes package to something useful
+	"/
+	Project notNil ifTrue:[
+	    project := Project current.
+	    Project setProject:nil.
+	].
 
-        Class nameSpaceQuerySignal answer:Smalltalk 
-        do:[
-            Smalltalk fileInClass:myName initialize:false lazy:LazyLoading.
-        ].
-        ClassCategoryReader sourceMode:prevMode.
-        project notNil ifTrue:[
-            Project setProject:project.
-        ].
+	Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" 
+	do:[
+	    Smalltalk fileInClass:myName initialize:false lazy:LazyLoading.
+	].
+	ClassCategoryReader sourceMode:prevMode.
+	project notNil ifTrue:[
+	    Project setProject:project.
+	].
     ] valueOnUnwindDo:[
-        ClassCategoryReader sourceMode:prevMode.
-        project notNil ifTrue:[
-            Project setProject:project.
-        ].
-        Smalltalk at:myName put:mySelf.
+	ClassCategoryReader sourceMode:prevMode.
+	project notNil ifTrue:[
+	    Project setProject:project.
+	].
+	Smalltalk at:myName put:mySelf.
     ].
 
     "did it work ?"
@@ -298,25 +299,25 @@
 
     "no - report the error"
     newClass isNil ifTrue:[
-        "
-         this signal is raised, if an autoloaded class
-         cannot be loaded. Usually, this happends when
-         some sourcefile is missing, not readable or if 
-         an entry is missing in the abbreviation file.
-         Check for a readable file named <myName>.st 
-         in the 'source' directory and (if its a long fileName) 
-         for a corresponding entry in the abbreviation file
-         'include/abbrev.stc'.
-         Finally, your searchpath could be set wrong -
-         both 'source' and 'include' directories must be found in
-         one of the directories named in systemPath.
+	"
+	 this signal is raised, if an autoloaded class
+	 cannot be loaded. Usually, this happends when
+	 some sourcefile is missing, not readable or if 
+	 an entry is missing in the abbreviation file.
+	 Check for a readable file named <myName>.st 
+	 in the 'source' directory and (if its a long fileName) 
+	 for a corresponding entry in the abbreviation file
+	 'include/abbrev.stc'.
+	 Finally, your searchpath could be set wrong -
+	 both 'source' and 'include' directories must be found in
+	 one of the directories named in systemPath.
 
-         In the debugger, press 'abort' to continue execution.
-        " 
-        AutoloadFailedSignal
-            raiseRequestWith:self
-            errorString:('autoload of ' , myName , ' failed').
-        ^ nil
+	 In the debugger, press 'abort' to continue execution.
+	" 
+	AutoloadFailedSignal
+	    raiseRequestWith:self
+	    errorString:('autoload of ' , myName , ' failed').
+	^ nil
     ].
 
     "/
@@ -328,15 +329,15 @@
     newClass setPackageFromRevision.
     (newClass package isNil 
     or:[newClass package = 'no package']) ifTrue:[
-        package := self package.
-        (package notNil and:[package ~= 'no package'])
-        ifTrue:[
-            newClass setPackage:package.
-        ].
+	package := self package.
+	(package notNil and:[package ~= 'no package'])
+	ifTrue:[
+	    newClass setPackage:package.
+	].
     ].
 
     LoadedClasses isNil ifTrue:[
-        LoadedClasses := IdentitySet new.
+	LoadedClasses := IdentitySet new.
     ].
     LoadedClasses add:newClass.
 
@@ -354,17 +355,17 @@
     LoadedClasses rehash.
 
     (newClass class implements:#initialize) ifTrue:[
-        newClass initialize.
+	newClass initialize.
     ].
     newClass privateClassesDo:[:aPrivateClass |
-        (aPrivateClass class implements:#initialize) ifTrue:[
-            aPrivateClass initialize.
-        ]
+	(aPrivateClass class implements:#initialize) ifTrue:[
+	    aPrivateClass initialize.
+	]
     ].
     newClass postAutoload.
     ^ newClass
 
-    "Modified: 12.4.1997 / 15:42:29 / cg"
+    "Modified: 15.10.1997 / 03:44:25 / cg"
 ! !
 
 !Autoload class methodsFor:'message catching'!
@@ -399,11 +400,11 @@
     |newClass|
 
     self ~~ Autoload ifTrue:[
-        newClass := self autoload.
-        newClass notNil ifTrue:[
-            ^ newClass perform:(aMessage selector)
-                 withArguments:(aMessage arguments)
-        ]
+	newClass := self autoload.
+	newClass notNil ifTrue:[
+	    ^ newClass perform:(aMessage selector)
+		 withArguments:(aMessage arguments)
+	]
     ].
     ^ super doesNotUnderstand:aMessage
 
@@ -474,12 +475,12 @@
      loaded first"
 
     ^ self
-        subclass:nameSymbol     
-        instanceVariableNames:instVarNames 
-        classVariableNames:cVarNames 
-        poolDictionaries:pools 
-        category:cat
-        inEnvironment:(Class nameSpaceQuerySignal raise)
+	subclass:nameSymbol     
+	instanceVariableNames:instVarNames 
+	classVariableNames:cVarNames 
+	poolDictionaries:pools 
+	category:cat
+	inEnvironment:(Class nameSpaceQuerySignal raise)
 
     "Modified: 8.2.1997 / 20:06:22 / cg"
 !
@@ -492,20 +493,20 @@
 
     "take care: subclassing Autoload must still be possible"
     (self == Autoload) ifTrue:[
-        ^ super 
-            subclass:nameSymbol 
-            instanceVariableNames:instVarNames
-            classVariableNames:cVarNames
-            poolDictionaries:poolDicts
-            category:cat
-            inEnvironment:aNameSpace
+	^ super 
+	    subclass:nameSymbol 
+	    instanceVariableNames:instVarNames
+	    classVariableNames:cVarNames
+	    poolDictionaries:poolDicts
+	    category:cat
+	    inEnvironment:aNameSpace
     ].
 
     newClass := self autoload.
     sel := thisContext selector.
     args := thisContext args.
     newClass notNil ifTrue:[
-        ^ newClass perform:sel withArguments:args
+	^ newClass perform:sel withArguments:args
     ].
     ^ nil
 
@@ -520,19 +521,19 @@
 
     "take care: subclassing Autoload must still be possible"
     (self == Autoload) ifTrue:[
-        ^ super 
-            subclass:nameSymbol 
-            instanceVariableNames:instVarNames 
-            classVariableNames:cVarNames 
-            poolDictionaries:poolDicts 
-            privateIn:owningClass
+	^ super 
+	    subclass:nameSymbol 
+	    instanceVariableNames:instVarNames 
+	    classVariableNames:cVarNames 
+	    poolDictionaries:poolDicts 
+	    privateIn:owningClass
     ].
 
     newClass := self autoload.
     sel := thisContext selector.
     args := thisContext args.
     newClass notNil ifTrue:[
-        ^ newClass perform:sel withArguments:args
+	^ newClass perform:sel withArguments:args
     ].
     ^ nil
 
@@ -580,6 +581,6 @@
 !Autoload class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.75 1997-06-17 08:22:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.76 1997-10-15 12:30:19 cg Exp $'
 ! !
 Autoload initialize!