author | ps |
Thu, 30 Dec 1999 12:07:15 +0100 | |
changeset 5156 | f7d6a1e1a890 |
parent 5076 | a927e67cf1db |
child 5345 | e7c6030aa2b5 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
154 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
620 | 13 |
nil subclass:#Autoload |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
14 |
instanceVariableNames:'' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
15 |
classVariableNames:'LazyLoading AutoloadFailedSignal LoadedClasses' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
16 |
poolDictionaries:'' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
17 |
category:'Kernel-Classes' |
1 | 18 |
! |
19 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
20 |
!Autoload class methodsFor:'documentation'! |
68 | 21 |
|
88 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
154 | 25 |
All Rights Reserved |
88 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
68 | 36 |
documentation |
37 |
" |
|
38 |
In memory limited systems (as my 8Mb 386 is) all seldom-used classes are made |
|
2662 | 39 |
subclasses of this class. |
40 |
Autoload catches all messages and files-In the corresponding code |
|
41 |
when first used. |
|
2689 | 42 |
Then the caught message is resent to the (now existing) class. |
2662 | 43 |
|
44 |
Class files are searched along the searchPath (see Smalltalk), |
|
45 |
and any of binary-classFile, byteCode-classFile or sourceFile are |
|
46 |
loaded, whichever is found first. For binaries to be loaded, |
|
47 |
these must be found in the 'bin' directory. Sources must be found |
|
48 |
in the 'source' directory. |
|
49 |
(Usually, Autoload classes finds the source file and loads that one). |
|
50 |
||
51 |
When started, the patches startup script arranges for the abbreviation |
|
52 |
file 'include/abbrev.stc' to be read and installs autoload stubs for |
|
53 |
all classes listed in that file, which do not exists already. |
|
54 |
The abbreviation file is maintained by the production environment |
|
55 |
and updated by makefile rules - therefore, it should not be edited |
|
56 |
manually. |
|
68 | 57 |
|
58 |
Late addition: above comment is no longer true - I have made now almost |
|
59 |
all Demos & Goodies be autoloaded ... even for big systems. |
|
60 |
||
1278 | 61 |
[class variables:] |
92 | 62 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
63 |
LazyLoading <Boolean> if true, the loaded classes |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
64 |
methods will NOT be compiled at |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
65 |
autoload time, but instead when |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
66 |
first called. This allows for a |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
67 |
faster load. However, expect short |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
68 |
pauses later when the methods are |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
69 |
first executed. |
126 | 70 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
71 |
AutoloadFailedSignal <Signal> signal raised if an autoloaded |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
72 |
classes source is not available. |
922 | 73 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
74 |
LoadedClasses <Collection> set of classes that heve been |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
75 |
autoloaded (for later unload) |
1292 | 76 |
|
2662 | 77 |
[see also:] |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
78 |
Smalltalk |
2662 | 79 |
|
1292 | 80 |
[author:] |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
81 |
Claus Gittinger |
68 | 82 |
" |
83 |
! ! |
|
84 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
85 |
!Autoload class methodsFor:'initialization'! |
126 | 86 |
|
87 |
initialize |
|
2223 | 88 |
"initialize the failure-signal" |
89 |
||
126 | 90 |
AutoloadFailedSignal isNil ifTrue:[ |
4511
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
91 |
LazyLoading := false. |
2654 | 92 |
|
4511
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
93 |
AutoloadFailedSignal := Object errorSignal newSignalMayProceed:true. |
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
94 |
AutoloadFailedSignal nameClass:self message:#autoloadFailedSignal. |
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
95 |
AutoloadFailedSignal notifierString:'autoload failed'. |
197 | 96 |
|
4511
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
97 |
self class changeClassTo:AutoloadMetaclass. |
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
98 |
self setSuperclass:nil. |
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
99 |
ObjectMemory flushCaches. |
5005 | 100 |
]. |
101 |
||
102 |
self ~~ Autoload ifTrue:[ |
|
103 |
^ self doesNotUnderstand:(Message selector:#initialize) |
|
104 |
]. |
|
2223 | 105 |
|
4511
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
106 |
"Modified: / 20.5.1997 / 19:06:25 / cg" |
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
107 |
"Modified: / 3.8.1999 / 14:23:30 / stefan" |
126 | 108 |
! ! |
109 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
110 |
!Autoload class methodsFor:'Signal constants'! |
126 | 111 |
|
112 |
autoloadFailedSignal |
|
113 |
"return the signal raised when an autoload fails" |
|
114 |
||
115 |
^ AutoloadFailedSignal |
|
116 |
! ! |
|
117 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
118 |
!Autoload class methodsFor:'adding/removing autoloaded classes'! |
359 | 119 |
|
216 | 120 |
addClass:aClassName |
4052 | 121 |
"given a name, install a corresponding autoload class stub for it. |
122 |
Return the (autoload-) stubClass or nil, if no new class was created." |
|
1277 | 123 |
|
4052 | 124 |
^ self addClass:aClassName inCategory:'autoloaded-Classes' |
216 | 125 |
|
126 |
" |
|
127 |
Autoload addClass:'Clock' |
|
128 |
" |
|
1277 | 129 |
|
130 |
"Modified: 24.4.1996 / 19:54:16 / cg" |
|
216 | 131 |
! |
132 |
||
133 |
addClass:aClassName inCategory:aCategory |
|
4052 | 134 |
"given a name, install a corresponding autoload class stub for it. |
135 |
Return the (autoload-) stubClass or nil, if no new class was created." |
|
1277 | 136 |
|
4052 | 137 |
|nameSymbol cls| |
216 | 138 |
|
139 |
nameSymbol := aClassName asSymbol. |
|
140 |
(Smalltalk at:nameSymbol) isNil ifTrue:[ |
|
4052 | 141 |
cls := Autoload |
142 |
subclass:nameSymbol |
|
143 |
instanceVariableNames:'' |
|
144 |
classVariableNames:'' |
|
145 |
poolDictionaries:'' |
|
146 |
category:aCategory. |
|
147 |
]. |
|
148 |
^ cls |
|
149 |
||
216 | 150 |
" |
151 |
Autoload addClass:'Clock' inCategory:'autoloaded-Demos' |
|
152 |
" |
|
1277 | 153 |
|
154 |
"Modified: 24.4.1996 / 19:54:20 / cg" |
|
620 | 155 |
! |
156 |
||
157 |
removeClass:aClass |
|
1277 | 158 |
"remove a class from the list of loaded classes" |
159 |
||
620 | 160 |
LoadedClasses remove:aClass ifAbsent:[] |
1277 | 161 |
|
162 |
"Modified: 24.4.1996 / 19:54:35 / cg" |
|
620 | 163 |
! ! |
164 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
165 |
!Autoload class methodsFor:'fileout'! |
620 | 166 |
|
2067 | 167 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace |
620 | 168 |
"print an expression to define myself on aStream. |
169 |
Since autoloaded classes dont know their real definition, simply |
|
170 |
output some comment string making things clear in the browser." |
|
171 |
||
5076 | 172 |
|myName fileName nm mgr classFileName package| |
620 | 173 |
|
2067 | 174 |
(self == Autoload) ifTrue:[^ super basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace]. |
620 | 175 |
|
176 |
myName := self name. |
|
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
177 |
aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr; |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
178 |
spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr. |
620 | 179 |
aStream nextPutAll:'to load, execute: '. |
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
180 |
aStream cr; cr; spaces:4; nextPutLine:myName , ' autoload'. |
4280
f100fa94428f
oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents:
4279
diff
changeset
|
181 |
aStream cr; nextPutLine:'or use the browsers load-function (in the class menu)'. |
f100fa94428f
oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents:
4279
diff
changeset
|
182 |
aStream nextPutLine:'(double-click on the class will also load it).'. |
620 | 183 |
" |
184 |
the following is simply informative ... |
|
185 |
actually, its a hack & kludge - there ought to be a method for this |
|
186 |
in Smalltalk |
|
187 |
(knowing the details of loading here is no good coding style) |
|
188 |
" |
|
189 |
fileName := Smalltalk fileNameForClass:myName. |
|
190 |
(ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[ |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
191 |
(nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
192 |
nm := nm , ' (a classLibrary, possibly including more classes)' |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
193 |
] ifFalse:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
194 |
nm := Smalltalk getBinaryFileName:(fileName , '.so'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
195 |
nm isNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
196 |
nm := Smalltalk getBinaryFileName:(fileName , '.o') |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
197 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
198 |
nm notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
199 |
nm := nm , ' (a classBinary)' |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
200 |
] |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
201 |
]. |
620 | 202 |
]. |
203 |
nm isNil ifTrue:[ |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
204 |
package := self package. |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
205 |
package notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
206 |
nm := Smalltalk getSourceFileName:((package copyReplaceAll:$: with:$/) , '/' , fileName , '.st'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
207 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
208 |
nm isNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
209 |
nm := Smalltalk getSourceFileName:(fileName , '.st'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
210 |
]. |
620 | 211 |
]. |
212 |
nm notNil ifTrue:[ |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
213 |
aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
214 |
aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
215 |
nm asFilename isSymbolicLink ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
216 |
aStream cr; cr. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
217 |
aStream nextPutLine:'which is a link to: '; spaces:4; |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
218 |
nextPutAll:(nm asFilename linkInfo path). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
219 |
] |
620 | 220 |
] ifFalse:[ |
5076 | 221 |
package := self package. |
222 |
(Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
223 |
aStream nextPutAll:' |
|
224 |
When accessed, I''ll ask the sourceCodeManager to load the code |
|
225 |
from ''' , fileName , '.st'' in the ''' , package , ''' package.'. |
|
226 |
] ifFalse:[ |
|
227 |
aStream nextPutAll:' |
|
228 |
When accessed, I''ll search for a file named |
|
229 |
''' , fileName , '.st'' in the ''' , package , ''' package. |
|
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
230 |
|
5076 | 231 |
Packages are tried along the packagePath, which is: |
232 |
' , ((Smalltalk packagePath asStringCollection collect:[:each| ' ' , each]) asStringWith:Character cr). |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
233 |
] |
620 | 234 |
]. |
235 |
aStream cr; nextPutAll:'"'. |
|
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
236 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
237 |
"Created: / 5.1.1997 / 14:31:33 / cg" |
4280
f100fa94428f
oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents:
4279
diff
changeset
|
238 |
"Modified: / 6.6.1999 / 15:17:30 / cg" |
620 | 239 |
! ! |
240 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
241 |
!Autoload class methodsFor:'lazy compilation'! |
620 | 242 |
|
243 |
compileLazy |
|
244 |
"return the lazy loading flag - if on, fileIn is much faster, |
|
245 |
but pauses are to be expected later, since methods are compiled |
|
246 |
when first executed." |
|
247 |
||
248 |
^ LazyLoading |
|
249 |
! |
|
250 |
||
251 |
compileLazy:aBoolean |
|
252 |
"turn on/off lazy loading - if on, fileIn is much faster, |
|
253 |
but pauses are to be expected later, since methods are compiled |
|
254 |
when first executed. |
|
255 |
If you like it, add a line to your startup file." |
|
256 |
||
257 |
LazyLoading := aBoolean |
|
216 | 258 |
! ! |
259 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
260 |
!Autoload class methodsFor:'loading'! |
1 | 261 |
|
262 |
autoload |
|
263 |
"use this to force loading |
|
2062 | 264 |
- it is defined a noop in all non-autoloading classes" |
1 | 265 |
|
4033 | 266 |
|mySelf myName myNameSpace newClass oldMeta project prevMode |
267 |
package newPackage| |
|
1 | 268 |
|
269 |
mySelf := self. |
|
164 | 270 |
myName := self name asSymbol. |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
271 |
myNameSpace := self nameSpace. |
1 | 272 |
|
4775 | 273 |
"/ recheck - in case my class somehow came into the system |
274 |
"/ (by loading a binary...) |
|
275 |
(newClass := Smalltalk at:myName) ~~ self ifTrue:[ |
|
276 |
(newClass isBehavior and:[newClass isLoaded]) ifTrue:[ |
|
277 |
('Autoload [info]: already loaded: ', myName , '.') infoPrintCR. |
|
278 |
self class becomeSameAs:newClass class. |
|
279 |
self becomeSameAs:newClass. |
|
280 |
||
281 |
ObjectMemory flushCaches. |
|
282 |
^ newClass |
|
283 |
]. |
|
284 |
]. |
|
285 |
||
1 | 286 |
"remove myself - to avoid recompilation" |
164 | 287 |
Smalltalk at:myName put:nil. |
1 | 288 |
|
2 | 289 |
"load it" |
1566 | 290 |
(Object infoPrinting and:[Smalltalk silentLoading ~~ true]) ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
291 |
Transcript showCR:('autoloading ', myName , ' ...'); endEntry. |
1564
f3f9736bd0fa
suppress load messages, if infoPrinting is turned off
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
292 |
]. |
1 | 293 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
294 |
[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
295 |
prevMode := ClassCategoryReader sourceMode. |
1720 | 296 |
"/ |
297 |
"/ no- do not do this; it may lead to trouble ... |
|
298 |
"/ ClassCategoryReader sourceMode:#reference. |
|
1694
29791fde790e
autoload classes keep source reference
Claus Gittinger <cg@exept.de>
parents:
1674
diff
changeset
|
299 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
300 |
"/ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
301 |
"/ in order to not get a package of private (or whatever), |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
302 |
"/ temporarily set the currentProject to nil. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
303 |
"/ we will later set the classes package to something useful |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
304 |
"/ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
305 |
Project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
306 |
project := Project current. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
307 |
Project setProject:nil. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
308 |
]. |
2375
7eb1b35edc33
autoload into Smalltalk nameSpace - by default.
Claus Gittinger <cg@exept.de>
parents:
2366
diff
changeset
|
309 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
310 |
Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
311 |
do:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
312 |
package := self package. |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
313 |
(Smalltalk |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
314 |
fileInClass:myName |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
315 |
package:package |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
316 |
initialize:false |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
317 |
lazy:LazyLoading |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
318 |
silent:nil) isNil ifTrue:[ |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
319 |
"/ temporary: try without stx/package prefix |
5046 | 320 |
"/ this will vanish as soon as source-directory |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
321 |
"/ is always guaranteed to contain an stx-subtree |
5046 | 322 |
((package startsWith:'stx/') |
323 |
or:[package startsWith:'stx:']) ifTrue:[ |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
324 |
package := package copyFrom:5. |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
325 |
Smalltalk |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
326 |
fileInClass:myName |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
327 |
package:package |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
328 |
initialize:false |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
329 |
lazy:LazyLoading |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
330 |
silent:nil. |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
331 |
] |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
332 |
] |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
333 |
]. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
334 |
ClassCategoryReader sourceMode:prevMode. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
335 |
project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
336 |
Project setProject:project. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
337 |
]. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
338 |
] valueOnUnwindDo:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
339 |
ClassCategoryReader sourceMode:prevMode. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
340 |
project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
341 |
Project setProject:project. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
342 |
]. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
343 |
Smalltalk at:myName put:mySelf. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
344 |
]. |
1 | 345 |
|
346 |
"did it work ?" |
|
164 | 347 |
newClass := Smalltalk at:myName. |
348 |
Smalltalk at:myName put:mySelf. "will be undone by become:" |
|
1 | 349 |
|
138 | 350 |
"no - report the error" |
1 | 351 |
newClass isNil ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
352 |
" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
353 |
this signal is raised, if an autoloaded class |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
354 |
cannot be loaded. Usually, this happends when |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
355 |
some sourcefile is missing, not readable or if |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
356 |
an entry is missing in the abbreviation file. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
357 |
Check for a readable file named <myName>.st |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
358 |
in the 'source' directory and (if its a long fileName) |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
359 |
for a corresponding entry in the abbreviation file |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
360 |
'include/abbrev.stc'. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
361 |
Finally, your searchpath could be set wrong - |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
362 |
both 'source' and 'include' directories must be found in |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
363 |
one of the directories named in systemPath. |
154 | 364 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
365 |
In the debugger, press 'abort' to continue execution. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
366 |
" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
367 |
AutoloadFailedSignal |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
368 |
raiseRequestWith:self |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
369 |
errorString:('autoload of ' , myName , ' failed'). |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
370 |
^ nil |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
371 |
]. |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
372 |
|
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
373 |
"/ |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
374 |
"/ autoloaded classes get their package from the revision (if present) |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
375 |
"/ this only happens with autoloaded sourceFiles which have no package |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
376 |
"/ info encoded. (binary classes have it) |
2057
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
377 |
"/ If there is no such information, give it my package (if I have one) |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
378 |
"/ |
4033 | 379 |
newClass setPackageFromRevision. |
4011 | 380 |
|
4033 | 381 |
newPackage := newClass package. |
382 |
(newPackage isNil or:[newPackage = 'no package']) ifTrue:[ |
|
383 |
(package notNil and:[package ~= 'no package']) ifTrue:[ |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
384 |
newClass setPackage:package. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
385 |
]. |
1 | 386 |
]. |
387 |
||
216 | 388 |
LoadedClasses isNil ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
389 |
LoadedClasses := IdentitySet new. |
216 | 390 |
]. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
391 |
LoadedClasses add:newClass. |
216 | 392 |
|
154 | 393 |
"wow - it worked. now the big trick ..." |
1 | 394 |
|
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
395 |
"/ newClass class setSoleInstance:self. "/ will be undone by become ... |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
396 |
oldMeta := self class. |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
397 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
398 |
"/ self setName:(self name , ' (auto)'). |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
399 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
400 |
self becomeSameAs:newClass. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
401 |
oldMeta becomeSameAs:newClass class. |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
402 |
|
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
403 |
ObjectMemory flushCaches. |
216 | 404 |
LoadedClasses rehash. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
405 |
|
3443
d57ea75d3ac5
oops - must send #initialize to all privateClasses.
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
406 |
newClass initializeWithAllPrivateClasses. |
886 | 407 |
newClass postAutoload. |
408 |
^ newClass |
|
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
409 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
410 |
"Modified: / 5.3.1999 / 12:59:13 / cg" |
1 | 411 |
! ! |
412 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
413 |
!Autoload class methodsFor:'message catching'! |
1 | 414 |
|
620 | 415 |
basicNew |
1277 | 416 |
"catch basicNew - load the class and send it to the real one" |
620 | 417 |
|
418 |
^ self doesNotUnderstand:(Message selector:#basicNew) |
|
1277 | 419 |
|
420 |
"Modified: 24.4.1996 / 19:53:10 / cg" |
|
620 | 421 |
! |
422 |
||
423 |
basicNew:arg |
|
1277 | 424 |
"catch basicNew: - load the class and send it to the real one" |
620 | 425 |
|
426 |
^ self doesNotUnderstand:(Message selector:#basicNew: with:arg) |
|
1277 | 427 |
|
428 |
"Modified: 24.4.1996 / 19:53:16 / cg" |
|
620 | 429 |
! |
430 |
||
431 |
comment |
|
432 |
"return the classes comment. |
|
433 |
Autoloaded classes have no comment; but I myself have one" |
|
434 |
||
435 |
(self == Autoload) ifTrue:[^ super comment]. |
|
436 |
^ 'not yet loaded' |
|
437 |
! |
|
438 |
||
1 | 439 |
doesNotUnderstand:aMessage |
2689 | 440 |
"caught a message; load the class and retry the message" |
1 | 441 |
|
442 |
|newClass| |
|
443 |
||
164 | 444 |
self ~~ Autoload ifTrue:[ |
4576 | 445 |
newClass := self autoload. |
446 |
newClass notNil ifTrue:[ |
|
447 |
^ aMessage sendTo:newClass |
|
448 |
] |
|
1 | 449 |
]. |
789
155eca125ef0
return value from doesNotUnderstand (so handler can return a value)
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
450 |
^ super doesNotUnderstand:aMessage |
1277 | 451 |
|
452 |
"Modified: 24.4.1996 / 19:53:27 / cg" |
|
1 | 453 |
! |
454 |
||
4301
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
455 |
loadAndResendMessage |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
456 |
"common helper to autoload a class and define a subclass of it by sending |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
457 |
the sender-message again. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
458 |
This is invoked by all #subClass... definition messages." |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
459 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
460 |
|sel args newClass| |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
461 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
462 |
sel := thisContext sender selector. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
463 |
args := thisContext sender args. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
464 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
465 |
"take care: subclassing Autoload must still be possible" |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
466 |
(self == Autoload) ifTrue:[ |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
467 |
^ self perform:sel inClass:Autoload class superclass withArguments:args |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
468 |
]. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
469 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
470 |
newClass := self autoload. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
471 |
newClass notNil ifTrue:[ |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
472 |
^ newClass perform:sel withArguments:args |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
473 |
]. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
474 |
^ nil |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
475 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
476 |
"Created: 8.2.1997 / 19:42:47 / cg" |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
477 |
! |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
478 |
|
1 | 479 |
new |
2663 | 480 |
"catch new - load the class and resend #new to the real one" |
1 | 481 |
|
482 |
^ self doesNotUnderstand:(Message selector:#new) |
|
1277 | 483 |
|
2663 | 484 |
"Modified: 26.5.1997 / 14:59:52 / cg" |
1 | 485 |
! |
486 |
||
487 |
new:arg |
|
2663 | 488 |
"catch new: - load the class and resend #new: it to the real one" |
1 | 489 |
|
490 |
^ self doesNotUnderstand:(Message selector:#new: with:arg) |
|
1277 | 491 |
|
2663 | 492 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
1 | 493 |
! |
494 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
495 |
readFrom:aStream |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
496 |
"catch - load the class and send it to the real one" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
497 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
498 |
^ self doesNotUnderstand:(Message selector:#readFrom: with:aStream) |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
499 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
500 |
"Created: 22.5.1996 / 23:44:23 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
501 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
502 |
|
1437 | 503 |
readFrom:aStream onError:exceptionBlock |
504 |
"catch - load the class and send it to the real one" |
|
505 |
||
506 |
^ self doesNotUnderstand:(Message selector:#readFrom:onError: with:aStream with:exceptionBlock) |
|
507 |
||
508 |
"Created: 22.5.1996 / 23:03:39 / stefan" |
|
509 |
! |
|
510 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
511 |
readFromString:aString |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
512 |
"catch - load the class and send it to the real one" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
513 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
514 |
^ self doesNotUnderstand:(Message selector:#readFromString: with:aString) |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
515 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
516 |
"Created: 22.5.1996 / 23:46:15 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
517 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
518 |
|
1437 | 519 |
readFromString:aString onError:exceptionBlock |
520 |
"catch - load the class and send it to the real one" |
|
521 |
||
522 |
^ self doesNotUnderstand:(Message selector:#readFromString:onError: with:aString with:exceptionBlock) |
|
523 |
||
524 |
"Created: 22.5.1996 / 23:04:49 / stefan" |
|
525 |
! |
|
526 |
||
2691
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
527 |
respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
528 |
"catch respondsTo: - load the class and resend #respondsTo: it to the real one" |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
529 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
530 |
self == Autoload ifTrue:[ |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
531 |
^ super respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
532 |
]. |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
533 |
^ self doesNotUnderstand:(Message selector:#respondsTo: with:aSelector) |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
534 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
535 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
1 | 536 |
! ! |
11 | 537 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
538 |
!Autoload class methodsFor:'queries'! |
356 | 539 |
|
620 | 540 |
isBehavior |
541 |
"return true if the recevier is some kind of class. |
|
542 |
Autoloaded classes are definitely; therefore return true." |
|
164 | 543 |
|
620 | 544 |
^ true |
545 |
! |
|
356 | 546 |
|
729 | 547 |
isBuiltInClass |
1266 | 548 |
"return true if this class is known by the run-time-system. |
549 |
Returns false here." |
|
550 |
||
729 | 551 |
^ false |
552 |
||
553 |
"Created: 10.12.1995 / 00:28:22 / cg" |
|
1266 | 554 |
"Modified: 23.4.1996 / 15:55:36 / cg" |
729 | 555 |
! |
556 |
||
620 | 557 |
isLoaded |
3287 | 558 |
"return true, if the class has been loaded. |
559 |
Autoload itself is loaded, subclasses are not. |
|
560 |
This allows testing wether a class has already been loaded." |
|
620 | 561 |
|
562 |
^ (self == Autoload) |
|
3287 | 563 |
|
564 |
"Modified: / 16.2.1998 / 11:57:35 / stefan" |
|
620 | 565 |
! |
566 |
||
922 | 567 |
loadedClasses |
568 |
"return the set of classes that were autoloaded" |
|
569 |
||
4496 | 570 |
^ LoadedClasses ? #() |
922 | 571 |
! |
572 |
||
4401
d9667432d35b
privateClasses and allPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4301
diff
changeset
|
573 |
privateClassesOrAll:allOfThem |
4000 | 574 |
"an autoloaded class has none" |
575 |
||
576 |
^ #() |
|
577 |
! |
|
578 |
||
620 | 579 |
wasAutoloaded:aClass |
922 | 580 |
"return true, if aClass was autoloaded" |
581 |
||
620 | 582 |
^ LoadedClasses notNil and:[LoadedClasses includes:aClass] |
11 | 583 |
! ! |
620 | 584 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
585 |
!Autoload class methodsFor:'documentation'! |
661 | 586 |
|
587 |
version |
|
5076 | 588 |
^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.101 1999-12-03 18:28:39 cg Exp $' |
661 | 589 |
! ! |
620 | 590 |
Autoload initialize! |