Autoload.st
changeset 7019 6591ea303fbd
parent 6768 4ccf91dfeba2
child 7092 630807cd320f
equal deleted inserted replaced
7018:5ceb0daa7b1b 7019:6591ea303fbd
   172      output some comment string making things clear in the browser."
   172      output some comment string making things clear in the browser."
   173 
   173 
   174     |myName fileName nm package|
   174     |myName fileName nm package|
   175 
   175 
   176     (self == Autoload) ifTrue:[
   176     (self == Autoload) ifTrue:[
   177 	^ super 
   177         ^ super 
   178 	    basicFileOutDefinitionOn:aStream 
   178             basicFileOutDefinitionOn:aStream 
   179 	    withNameSpace:forceNameSpace
   179             withNameSpace:forceNameSpace
   180 	    withPackage:withPackage
   180             withPackage:withPackage
   181     ].
   181     ].
   182 
   182 
   183     myName := self name.
   183     myName := self name.
   184     aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr;
   184     aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr;
   185 	    spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr.
   185             spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr.
   186     aStream nextPutAll:'to load, execute: '.
   186     aStream nextPutLine:'to load, execute: '.
   187     aStream cr; cr; spaces:4; nextPutLine:myName  , ' autoload'.
   187     aStream cr; spaces:4; nextPutLine:myName  , ' autoload'.
   188     aStream cr; nextPutLine:'or use the browsers load-function (in the class menu)'.
   188     aStream cr; nextPutLine:'or use the browsers load-function (in the class menu)'.
   189     aStream nextPutLine:'(double-click on the class will also load it).'.
   189     aStream nextPutLine:'(double-click on the class will also load it).'.
   190     "
   190     "
   191      the following is simply informative ...
   191      the following is simply informative ...
   192      actually, its a hack & kludge - there ought to be a method for this
   192      actually, its a hack & kludge - there ought to be a method for this
   193      in Smalltalk 
   193      in Smalltalk 
   194      (knowing the details of loading here is no good coding style)
   194      (knowing the details of loading here is no good coding style)
   195     "
   195     "
   196     fileName := Smalltalk fileNameForClass:myName.
   196     fileName := Smalltalk fileNameForClass:myName.
   197     (ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[
   197     (ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[
   198 	(nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[
   198         (nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[
   199 	    nm := nm , ' (a classLibrary, possibly including more classes)'
   199             nm := nm , ' (a classLibrary, possibly including more classes)'
   200 	] ifFalse:[
   200         ] ifFalse:[
   201 	    nm := Smalltalk getBinaryFileName:(fileName , '.so').
   201             nm := Smalltalk getBinaryFileName:(fileName , '.so').
   202 	    nm isNil ifTrue:[
   202             nm isNil ifTrue:[
   203 		nm := Smalltalk getBinaryFileName:(fileName , '.o')
   203                 nm := Smalltalk getBinaryFileName:(fileName , '.o')
   204 	    ].
   204             ].
   205 	    nm notNil ifTrue:[
   205             nm notNil ifTrue:[
   206 		nm := nm , ' (a classBinary)'
   206                 nm := nm , ' (a classBinary)'
   207 	    ]
   207             ]
   208 	].
   208         ].
   209     ].
   209     ].
   210     nm isNil ifTrue:[
   210     nm isNil ifTrue:[
   211 	package := self package.
   211         package := self package.
   212 	package notNil ifTrue:[
   212         package notNil ifTrue:[
   213 	    nm := Smalltalk getSourceFileName:((package copyReplaceAll:$: with:$/) , '/' , fileName , '.st').
   213             nm := Smalltalk getSourceFileName:((package copyReplaceAll:$: with:$/) , '/' , fileName , '.st').
   214 	].
   214         ].
   215 	nm isNil ifTrue:[
   215         nm isNil ifTrue:[
   216 	    nm := Smalltalk getSourceFileName:(fileName , '.st').
   216             nm := Smalltalk getSourceFileName:(fileName , '.st').
   217 	].
   217         ].
   218     ].
   218     ].
   219     nm notNil ifTrue:[
   219     nm notNil ifTrue:[
   220 	aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'.
   220         aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'.
   221 	aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm.
   221         aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm.
   222 	nm asFilename isSymbolicLink ifTrue:[
   222         nm asFilename isSymbolicLink ifTrue:[
   223 	    aStream cr; cr.
   223             aStream cr; cr.
   224 	    aStream nextPutLine:'which is a link to: '; spaces:4; 
   224             aStream nextPutLine:'which is a link to: '; spaces:4; 
   225 		    nextPutAll:(nm asFilename linkInfo path).
   225                     nextPutAll:(nm asFilename linkInfo path).
   226 	]
   226         ]
   227     ] ifFalse:[
   227     ] ifFalse:[
   228 	package := self package.
   228         package := self package.
   229 	(Smalltalk at:#SourceCodeManager) notNil ifTrue:[
   229         (Smalltalk at:#SourceCodeManager) notNil ifTrue:[
   230 	    aStream nextPutAll:'
   230             aStream nextPutAll:'
   231 When accessed, I''ll ask the sourceCodeManager to load the code 
   231 When accessed, I''ll ask the sourceCodeManager to load the code 
   232 from ''' , fileName , '.st'' in the ''' , package , ''' package.'.
   232 from ''' , fileName , '.st'' in the ''' , package , ''' package.'.
   233 	] ifFalse:[
   233         ] ifFalse:[
   234 	    aStream nextPutAll:'
   234             aStream nextPutAll:'
   235 When accessed, I''ll search for a file named 
   235 When accessed, I''ll search for a file named 
   236 ''' , fileName , '.st'' in the ''' , package , ''' package.
   236 ''' , fileName , '.st'' in the ''' , package , ''' package.
   237 
   237 
   238 Packages are tried along the packagePath, which is:
   238 Packages are tried along the packagePath, which is:
   239 ' , ((Smalltalk packagePath asStringCollection collect:[:each| '   ' , each]) asStringWith:Character cr). 
   239 ' , ((Smalltalk packagePath asStringCollection collect:[:each| '   ' , each]) asStringWith:Character cr). 
   240 	]
   240         ]
   241     ].
   241     ].
   242     aStream cr; nextPutAll:'"'.
   242     aStream cr; nextPutAll:'"'.
   243 
   243 
   244     "Created: / 5.1.1997 / 14:31:33 / cg"
   244     "Created: / 5.1.1997 / 14:31:33 / cg"
   245     "Modified: / 6.6.1999 / 15:17:30 / cg"
   245     "Modified: / 6.6.1999 / 15:17:30 / cg"
   634 ! !
   634 ! !
   635 
   635 
   636 !Autoload class methodsFor:'documentation'!
   636 !Autoload class methodsFor:'documentation'!
   637 
   637 
   638 version
   638 version
   639     ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.114 2002-09-25 08:25:28 penk Exp $'
   639     ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.115 2003-02-10 16:38:46 penk Exp $'
   640 ! !
   640 ! !
   641 
   641 
   642 Autoload initialize!
   642 Autoload initialize!