author | Claus Gittinger <cg@exept.de> |
Wed, 05 Jul 2006 16:21:44 +0200 | |
changeset 9422 | 82a0ea18b63b |
parent 9373 | e312f2f2901c |
child 9428 | a46275bc78e7 |
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 |
||
5345 | 13 |
"{ Package: 'stx:libbasic' }" |
14 |
||
620 | 15 |
nil subclass:#Autoload |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
16 |
instanceVariableNames:'' |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
17 |
classVariableNames:'LazyLoading AutoloadFailedSignal LoadedClasses InProgressClasses' |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
18 |
poolDictionaries:'' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
19 |
category:'Kernel-Classes' |
1 | 20 |
! |
21 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
22 |
!Autoload class methodsFor:'documentation'! |
68 | 23 |
|
88 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
154 | 27 |
All Rights Reserved |
88 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
68 | 38 |
documentation |
39 |
" |
|
40 |
In memory limited systems (as my 8Mb 386 is) all seldom-used classes are made |
|
2662 | 41 |
subclasses of this class. |
42 |
Autoload catches all messages and files-In the corresponding code |
|
43 |
when first used. |
|
2689 | 44 |
Then the caught message is resent to the (now existing) class. |
2662 | 45 |
|
46 |
Class files are searched along the searchPath (see Smalltalk), |
|
47 |
and any of binary-classFile, byteCode-classFile or sourceFile are |
|
48 |
loaded, whichever is found first. For binaries to be loaded, |
|
49 |
these must be found in the 'bin' directory. Sources must be found |
|
50 |
in the 'source' directory. |
|
51 |
(Usually, Autoload classes finds the source file and loads that one). |
|
52 |
||
53 |
When started, the patches startup script arranges for the abbreviation |
|
54 |
file 'include/abbrev.stc' to be read and installs autoload stubs for |
|
7280
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
55 |
all classes listed in that file, which do not exist already. |
2662 | 56 |
The abbreviation file is maintained by the production environment |
57 |
and updated by makefile rules - therefore, it should not be edited |
|
58 |
manually. |
|
68 | 59 |
|
60 |
Late addition: above comment is no longer true - I have made now almost |
|
61 |
all Demos & Goodies be autoloaded ... even for big systems. |
|
62 |
||
1278 | 63 |
[class variables:] |
92 | 64 |
|
7280
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
65 |
LazyLoading <Boolean> if true, the loaded classes |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
66 |
methods will NOT be compiled at |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
67 |
autoload time, but instead when |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
68 |
first called. This allows for a |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
69 |
faster load. However, expect short |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
70 |
pauses later when the methods are |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
71 |
first executed. |
126 | 72 |
|
7280
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
73 |
AutoloadFailedSignal <Signal> signal raised if an autoloaded |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
74 |
classes source is not available. |
922 | 75 |
|
7280
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
76 |
LoadedClasses <Collection> set of classes that heve been |
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
77 |
autoloaded (for later unload) |
1292 | 78 |
|
2662 | 79 |
[see also:] |
7280
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
80 |
Smalltalk |
2662 | 81 |
|
1292 | 82 |
[author:] |
7280
7afcccb7c856
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
7178
diff
changeset
|
83 |
Claus Gittinger |
68 | 84 |
" |
85 |
! ! |
|
86 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
87 |
!Autoload class methodsFor:'initialization'! |
126 | 88 |
|
89 |
initialize |
|
2223 | 90 |
"initialize the failure-signal" |
91 |
||
126 | 92 |
AutoloadFailedSignal isNil ifTrue:[ |
7092
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
93 |
LazyLoading := false. |
2654 | 94 |
|
7092
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
95 |
AutoloadFailedSignal := Error newSignalMayProceed:true. |
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
96 |
AutoloadFailedSignal nameClass:self message:#autoloadFailedSignal. |
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
97 |
AutoloadFailedSignal notifierString:'autoload failed'. |
197 | 98 |
|
7092
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
99 |
self class changeClassTo:AutoloadMetaclass. |
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
100 |
self setSuperclass:nil. |
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
101 |
ObjectMemory flushCaches. |
5005 | 102 |
]. |
8316 | 103 |
LoadedClasses isNil ifTrue:[ |
104 |
LoadedClasses := IdentitySet new. |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
105 |
InProgressClasses := IdentitySet new. |
8316 | 106 |
]. |
5005 | 107 |
|
108 |
self ~~ Autoload ifTrue:[ |
|
7092
630807cd320f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
7019
diff
changeset
|
109 |
^ self doesNotUnderstand:(Message selector:#initialize) |
5005 | 110 |
]. |
2223 | 111 |
|
4511
da0b327f3204
Use AutoloadMetaclass to load a class on unhandled class methods.
Stefan Vogel <sv@exept.de>
parents:
4496
diff
changeset
|
112 |
"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
|
113 |
"Modified: / 3.8.1999 / 14:23:30 / stefan" |
126 | 114 |
! ! |
115 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
116 |
!Autoload class methodsFor:'Signal constants'! |
126 | 117 |
|
118 |
autoloadFailedSignal |
|
119 |
"return the signal raised when an autoload fails" |
|
120 |
||
121 |
^ AutoloadFailedSignal |
|
122 |
! ! |
|
123 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
124 |
!Autoload class methodsFor:'adding/removing autoloaded classes'! |
359 | 125 |
|
216 | 126 |
addClass:aClassName |
4052 | 127 |
"given a name, install a corresponding autoload class stub for it. |
128 |
Return the (autoload-) stubClass or nil, if no new class was created." |
|
1277 | 129 |
|
4052 | 130 |
^ self addClass:aClassName inCategory:'autoloaded-Classes' |
216 | 131 |
|
132 |
" |
|
133 |
Autoload addClass:'Clock' |
|
134 |
" |
|
1277 | 135 |
|
136 |
"Modified: 24.4.1996 / 19:54:16 / cg" |
|
216 | 137 |
! |
138 |
||
139 |
addClass:aClassName inCategory:aCategory |
|
4052 | 140 |
"given a name, install a corresponding autoload class stub for it. |
141 |
Return the (autoload-) stubClass or nil, if no new class was created." |
|
1277 | 142 |
|
4052 | 143 |
|nameSymbol cls| |
216 | 144 |
|
145 |
nameSymbol := aClassName asSymbol. |
|
146 |
(Smalltalk at:nameSymbol) isNil ifTrue:[ |
|
5903 | 147 |
cls := Autoload |
148 |
subclass:nameSymbol |
|
149 |
instanceVariableNames:'' |
|
150 |
classVariableNames:'' |
|
151 |
poolDictionaries:'' |
|
152 |
category:aCategory. |
|
4052 | 153 |
]. |
154 |
^ cls |
|
155 |
||
216 | 156 |
" |
157 |
Autoload addClass:'Clock' inCategory:'autoloaded-Demos' |
|
158 |
" |
|
1277 | 159 |
|
160 |
"Modified: 24.4.1996 / 19:54:20 / cg" |
|
620 | 161 |
! |
162 |
||
163 |
removeClass:aClass |
|
1277 | 164 |
"remove a class from the list of loaded classes" |
165 |
||
620 | 166 |
LoadedClasses remove:aClass ifAbsent:[] |
1277 | 167 |
|
168 |
"Modified: 24.4.1996 / 19:54:35 / cg" |
|
620 | 169 |
! ! |
170 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
171 |
!Autoload class methodsFor:'fileout'! |
620 | 172 |
|
5345 | 173 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace withPackage:withPackage |
620 | 174 |
"print an expression to define myself on aStream. |
8316 | 175 |
Since autoloaded classes don't know their real definition, simply |
620 | 176 |
output some comment string making things clear in the browser." |
177 |
||
5820 | 178 |
|myName fileName nm package| |
620 | 179 |
|
5345 | 180 |
(self == Autoload) ifTrue:[ |
7019 | 181 |
^ super |
182 |
basicFileOutDefinitionOn:aStream |
|
183 |
withNameSpace:forceNameSpace |
|
184 |
withPackage:withPackage |
|
5345 | 185 |
]. |
620 | 186 |
|
187 |
myName := self name. |
|
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
188 |
aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr; |
7019 | 189 |
spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr. |
190 |
aStream nextPutLine:'to load, execute: '. |
|
191 |
aStream 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
|
192 |
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
|
193 |
aStream nextPutLine:'(double-click on the class will also load it).'. |
620 | 194 |
" |
195 |
the following is simply informative ... |
|
196 |
actually, its a hack & kludge - there ought to be a method for this |
|
197 |
in Smalltalk |
|
198 |
(knowing the details of loading here is no good coding style) |
|
199 |
" |
|
200 |
fileName := Smalltalk fileNameForClass:myName. |
|
201 |
(ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[ |
|
7019 | 202 |
(nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[ |
203 |
nm := nm , ' (a classLibrary, possibly including more classes)' |
|
204 |
] ifFalse:[ |
|
205 |
nm := Smalltalk getBinaryFileName:(fileName , '.so'). |
|
206 |
nm isNil ifTrue:[ |
|
207 |
nm := Smalltalk getBinaryFileName:(fileName , '.o') |
|
208 |
]. |
|
209 |
nm notNil ifTrue:[ |
|
210 |
nm := nm , ' (a classBinary)' |
|
211 |
] |
|
212 |
]. |
|
620 | 213 |
]. |
214 |
nm isNil ifTrue:[ |
|
7019 | 215 |
package := self package. |
216 |
package notNil ifTrue:[ |
|
217 |
nm := Smalltalk getSourceFileName:((package copyReplaceAll:$: with:$/) , '/' , fileName , '.st'). |
|
218 |
]. |
|
219 |
nm isNil ifTrue:[ |
|
220 |
nm := Smalltalk getSourceFileName:(fileName , '.st'). |
|
221 |
]. |
|
620 | 222 |
]. |
223 |
nm notNil ifTrue:[ |
|
7744 | 224 |
aStream |
225 |
cr; |
|
226 |
nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'; |
|
227 |
nextPutLine:'from: '; spaces:4; nextPutAll:nm. |
|
228 |
||
7019 | 229 |
nm asFilename isSymbolicLink ifTrue:[ |
230 |
aStream cr; cr. |
|
7744 | 231 |
aStream |
232 |
nextPutLine:'which is a link to: '; |
|
233 |
spaces:4; |
|
234 |
nextPutAll:(nm asFilename linkInfo path). |
|
7019 | 235 |
] |
620 | 236 |
] ifFalse:[ |
7019 | 237 |
package := self package. |
238 |
(Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
239 |
aStream nextPutAll:' |
|
5076 | 240 |
When accessed, I''ll ask the sourceCodeManager to load the code |
241 |
from ''' , fileName , '.st'' in the ''' , package , ''' package.'. |
|
7019 | 242 |
] ifFalse:[ |
243 |
aStream nextPutAll:' |
|
5076 | 244 |
When accessed, I''ll search for a file named |
245 |
''' , 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
|
246 |
|
5076 | 247 |
Packages are tried along the packagePath, which is: |
248 |
' , ((Smalltalk packagePath asStringCollection collect:[:each| ' ' , each]) asStringWith:Character cr). |
|
7019 | 249 |
] |
620 | 250 |
]. |
251 |
aStream cr; nextPutAll:'"'. |
|
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
252 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
253 |
"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
|
254 |
"Modified: / 6.6.1999 / 15:17:30 / cg" |
620 | 255 |
! ! |
256 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
257 |
!Autoload class methodsFor:'lazy compilation'! |
620 | 258 |
|
259 |
compileLazy |
|
260 |
"return the lazy loading flag - if on, fileIn is much faster, |
|
261 |
but pauses are to be expected later, since methods are compiled |
|
262 |
when first executed." |
|
263 |
||
264 |
^ LazyLoading |
|
265 |
! |
|
266 |
||
267 |
compileLazy:aBoolean |
|
268 |
"turn on/off lazy loading - if on, fileIn is much faster, |
|
269 |
but pauses are to be expected later, since methods are compiled |
|
270 |
when first executed. |
|
271 |
If you like it, add a line to your startup file." |
|
272 |
||
273 |
LazyLoading := aBoolean |
|
216 | 274 |
! ! |
275 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
276 |
!Autoload class methodsFor:'loading'! |
1 | 277 |
|
278 |
autoload |
|
279 |
"use this to force loading |
|
2062 | 280 |
- it is defined a noop in all non-autoloading classes" |
1 | 281 |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
282 |
|myName myNameSpace newClass project prevMode package| |
1 | 283 |
|
164 | 284 |
myName := self name asSymbol. |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
285 |
myNameSpace := self nameSpace. |
1 | 286 |
|
9422 | 287 |
(InProgressClasses includes:self) ifTrue:[ |
288 |
AutoloadFailedSignal |
|
289 |
raiseRequestWith:self |
|
290 |
errorString:('autoload of ' , myName , ' failed (recursive invocation)'). |
|
291 |
^ nil. |
|
292 |
]. |
|
293 |
||
4775 | 294 |
"/ recheck - in case my class somehow came into the system |
295 |
"/ (by loading a binary...) |
|
296 |
(newClass := Smalltalk at:myName) ~~ self ifTrue:[ |
|
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
297 |
(newClass isBehavior and:[newClass isLoaded]) ifTrue:[ |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
298 |
(Object infoPrinting and:[Smalltalk silentLoading ~~ true]) ifTrue:[ |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
299 |
Transcript showCR:('Autoload [info]: already loaded: ', myName , '.'); endEntry. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
300 |
]. |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
301 |
self class becomeSameAs:newClass class. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
302 |
self becomeSameAs:newClass. |
4775 | 303 |
|
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
304 |
ObjectMemory flushCaches. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
305 |
^ newClass |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
306 |
]. |
4775 | 307 |
]. |
308 |
||
2 | 309 |
"load it" |
1566 | 310 |
(Object infoPrinting and:[Smalltalk silentLoading ~~ true]) ifTrue:[ |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
311 |
Transcript showCR:('autoloading ', myName , ' ...'); endEntry. |
1564
f3f9736bd0fa
suppress load messages, if infoPrinting is turned off
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
312 |
]. |
1 | 313 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
314 |
[ |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
315 |
InProgressClasses add:self. |
5902 | 316 |
|
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
317 |
prevMode := ClassCategoryReader sourceMode. |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
318 |
"/ no- do not do this; it may lead to trouble ... |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
319 |
"/ ClassCategoryReader sourceMode:#reference. |
1694
29791fde790e
autoload classes keep source reference
Claus Gittinger <cg@exept.de>
parents:
1674
diff
changeset
|
320 |
|
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
321 |
"/ |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
322 |
"/ in order to not get a package of private (or whatever), |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
323 |
"/ temporarily set the currentProject to nil. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
324 |
"/ we will later set the classes package to something useful |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
325 |
"/ |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
326 |
Project notNil ifTrue:[ |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
327 |
project := Project current. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
328 |
Project setProject:nil. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
329 |
]. |
2375
7eb1b35edc33
autoload into Smalltalk nameSpace - by default.
Claus Gittinger <cg@exept.de>
parents:
2366
diff
changeset
|
330 |
|
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
331 |
package := self package. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
332 |
Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
333 |
do:[ |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
334 |
Class packageQuerySignal answer:package |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
335 |
do:[ |
6081
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
336 |
Class classConventionViolationConfirmationQuerySignal answer:true |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
337 |
do:[ |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
338 |
(Smalltalk |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
339 |
fileInClass:myName |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
340 |
package:package |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
341 |
initialize:false |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
342 |
lazy:LazyLoading |
8431
3e06c959dcff
#autoload - raise error if fileIn fails.
Stefan Vogel <sv@exept.de>
parents:
8382
diff
changeset
|
343 |
silent:nil) |
3e06c959dcff
#autoload - raise error if fileIn fails.
Stefan Vogel <sv@exept.de>
parents:
8382
diff
changeset
|
344 |
isNil ifTrue:[ |
6081
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
345 |
"/ temporary: try without stx/package prefix |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
346 |
"/ this will vanish as soon as source-directory |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
347 |
"/ is always guaranteed to contain an stx-subtree |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
348 |
((package startsWith:'stx/') |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
349 |
or:[package startsWith:'stx:']) ifTrue:[ |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
350 |
package := package copyFrom:5. |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
351 |
Smalltalk |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
352 |
fileInClass:myName |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
353 |
package:package |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
354 |
initialize:false |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
355 |
lazy:LazyLoading |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
356 |
silent:nil. |
fedbf974cfe8
dont ask for variable-name conventions while autoloading
Claus Gittinger <cg@exept.de>
parents:
6075
diff
changeset
|
357 |
] |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
358 |
] |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
359 |
] |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
360 |
] |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
361 |
]. |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
362 |
] ensure:[ |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
363 |
"restore previous state" |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
364 |
ClassCategoryReader sourceMode:prevMode. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
365 |
project notNil ifTrue:[ |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
366 |
Project setProject:project. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
367 |
]. |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
368 |
"rehash is needed, because a #become: could have changed the classes identity" |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
369 |
InProgressClasses |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
370 |
rehash; |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
371 |
remove:self ifAbsent:[]. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
372 |
]. |
1 | 373 |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
374 |
" |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
375 |
NOTE: ClassLoader did already perform a #becomeSameAs: |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
376 |
of the loaded class to the new class. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
377 |
|
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
378 |
So some of the code below is no longer needed. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
379 |
" |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
380 |
|
1 | 381 |
"did it work ?" |
164 | 382 |
newClass := Smalltalk at:myName. |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
383 |
newClass ~~ self ifTrue:[ |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
384 |
"reinstall the autoload class, this will be undone by #become:" |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
385 |
Smalltalk at:myName put:self. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
386 |
]. |
1 | 387 |
|
138 | 388 |
"no - report the error" |
8431
3e06c959dcff
#autoload - raise error if fileIn fails.
Stefan Vogel <sv@exept.de>
parents:
8382
diff
changeset
|
389 |
(newClass isNil or:[newClass isLoaded not]) ifTrue:[ |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
390 |
" |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
391 |
USER INFORMATION: |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
392 |
this exception has been raised because an autoloaded class |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
393 |
could not be loaded. Usually, this happens when |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
394 |
the classes sourcefile is missing, unreadable or if |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
395 |
an entry is missing in the abbreviation file. |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
396 |
|
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
397 |
Check for a readable file named <myName>.st |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
398 |
in the 'source' directory and (if its a long fileName) |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
399 |
for a corresponding entry in the abbreviation file |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
400 |
'include/abbrev.stc'. |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
401 |
Finally, your searchpath could be set wrong - |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
402 |
both 'source' and 'include' directories must be found in |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
403 |
one of the directories named in systemPath. |
154 | 404 |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
405 |
In the debugger, press 'Abort' to continue execution. |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
406 |
" |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
407 |
AutoloadFailedSignal |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
408 |
raiseRequestWith:self |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
409 |
errorString:('autoload of ' , myName , ' failed'). |
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
410 |
^ nil |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
411 |
]. |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
412 |
|
5463
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
413 |
newClass setPackage:package. |
6075
57f3ae8d2a28
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
5903
diff
changeset
|
414 |
newClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | mthd setPackage:package]. |
5527
2817d7e173de
set project of all autoloaded methods
Claus Gittinger <cg@exept.de>
parents:
5475
diff
changeset
|
415 |
|
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
416 |
"/ |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
417 |
"/ 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
|
418 |
"/ 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
|
419 |
"/ info encoded. (binary classes have it) |
2057
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
420 |
"/ 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
|
421 |
"/ |
5463
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
422 |
"/ newClass setPackageFromRevision. |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
423 |
"/ |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
424 |
"/ newPackage := newClass package. |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
425 |
"/ (newPackage isNil or:[newPackage = 'no package']) ifTrue:[ |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
426 |
"/ (package notNil and:[package ~= 'no package']) ifTrue:[ |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
427 |
"/ newClass setPackage:package. |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
428 |
"/ ]. |
18ec3ac68106
preserve the package when autoloading
Claus Gittinger <cg@exept.de>
parents:
5345
diff
changeset
|
429 |
"/ ]. |
1 | 430 |
|
216 | 431 |
|
154 | 432 |
"wow - it worked. now the big trick ..." |
1 | 433 |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
434 |
"/ newClass class setSoleInstance:self. "/ will be undone by become ... |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
435 |
"/ 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
|
436 |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
437 |
Smalltalk changed:#aboutToAutoloadClass with:(self -> newClass). |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
438 |
newClass ~~ self ifTrue:[ |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
439 |
self dependents do:[:aDependent | |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
440 |
newClass addDependent:aDependent |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
441 |
]. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
442 |
self class becomeSameAs:newClass class. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
443 |
self becomeSameAs:newClass. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
444 |
|
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
445 |
ObjectMemory flushCaches. |
7178 | 446 |
]. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
447 |
|
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
448 |
"the rehash here is pure superstition" |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
449 |
LoadedClasses rehash; add:newClass. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
450 |
|
3443
d57ea75d3ac5
oops - must send #initialize to all privateClasses.
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
451 |
newClass initializeWithAllPrivateClasses. |
886 | 452 |
newClass postAutoload. |
5705
543d3e8ef7c6
send a change notification when autoloading
Claus Gittinger <cg@exept.de>
parents:
5527
diff
changeset
|
453 |
|
543d3e8ef7c6
send a change notification when autoloading
Claus Gittinger <cg@exept.de>
parents:
5527
diff
changeset
|
454 |
Smalltalk changed:#classDefinition with:newClass. |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
455 |
self changed:#loaded with:newClass. |
886 | 456 |
^ newClass |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
457 |
|
9422 | 458 |
"Modified: / 05-07-2006 / 15:35:56 / cg" |
1 | 459 |
! ! |
460 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
461 |
!Autoload class methodsFor:'message catching'! |
1 | 462 |
|
6251 | 463 |
at:arg |
464 |
"catch at: - redefined because its understood" |
|
465 |
||
8482 | 466 |
^ self doesNotUnderstand:(Message selector:#at: argument:arg) |
6251 | 467 |
! |
468 |
||
620 | 469 |
basicNew |
1277 | 470 |
"catch basicNew - load the class and send it to the real one" |
620 | 471 |
|
472 |
^ self doesNotUnderstand:(Message selector:#basicNew) |
|
1277 | 473 |
|
474 |
"Modified: 24.4.1996 / 19:53:10 / cg" |
|
620 | 475 |
! |
476 |
||
477 |
basicNew:arg |
|
1277 | 478 |
"catch basicNew: - load the class and send it to the real one" |
620 | 479 |
|
8482 | 480 |
^ self doesNotUnderstand:(Message selector:#basicNew: argument:arg) |
1277 | 481 |
|
482 |
"Modified: 24.4.1996 / 19:53:16 / cg" |
|
620 | 483 |
! |
484 |
||
8185 | 485 |
classResources |
8316 | 486 |
"catch classResources - load the class and resend to the real one" |
8185 | 487 |
|
488 |
^ self doesNotUnderstand:(Message selector:#classResources) |
|
489 |
! |
|
490 |
||
620 | 491 |
comment |
492 |
"return the classes comment. |
|
493 |
Autoloaded classes have no comment; but I myself have one" |
|
494 |
||
495 |
(self == Autoload) ifTrue:[^ super comment]. |
|
496 |
^ 'not yet loaded' |
|
497 |
! |
|
498 |
||
6768 | 499 |
copy |
500 |
"catch copy - load the class and resend #copy to the real one" |
|
501 |
||
502 |
^ self doesNotUnderstand:(Message selector:#copy) |
|
503 |
! |
|
504 |
||
1 | 505 |
doesNotUnderstand:aMessage |
2689 | 506 |
"caught a message; load the class and retry the message" |
1 | 507 |
|
508 |
|newClass| |
|
509 |
||
164 | 510 |
self ~~ Autoload ifTrue:[ |
7178 | 511 |
newClass := self autoload. |
512 |
newClass notNil ifTrue:[ |
|
513 |
^ aMessage sendTo:newClass |
|
514 |
] |
|
1 | 515 |
]. |
789
155eca125ef0
return value from doesNotUnderstand (so handler can return a value)
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
516 |
^ super doesNotUnderstand:aMessage |
1277 | 517 |
|
518 |
"Modified: 24.4.1996 / 19:53:27 / cg" |
|
1 | 519 |
! |
520 |
||
7574 | 521 |
error |
522 |
"catch error - load the class and resend #error to the real one" |
|
523 |
||
524 |
^ self doesNotUnderstand:(Message selector:#error) |
|
525 |
! |
|
526 |
||
8709
25088287bbd0
Catch #fromString: (for autoloaded classes from Dolphin)
Stefan Vogel <sv@exept.de>
parents:
8590
diff
changeset
|
527 |
fromString:aString |
25088287bbd0
Catch #fromString: (for autoloaded classes from Dolphin)
Stefan Vogel <sv@exept.de>
parents:
8590
diff
changeset
|
528 |
"catch - load the class and send it to the real one" |
25088287bbd0
Catch #fromString: (for autoloaded classes from Dolphin)
Stefan Vogel <sv@exept.de>
parents:
8590
diff
changeset
|
529 |
|
25088287bbd0
Catch #fromString: (for autoloaded classes from Dolphin)
Stefan Vogel <sv@exept.de>
parents:
8590
diff
changeset
|
530 |
^ self doesNotUnderstand:(Message selector:#fromString: argument:aString) |
25088287bbd0
Catch #fromString: (for autoloaded classes from Dolphin)
Stefan Vogel <sv@exept.de>
parents:
8590
diff
changeset
|
531 |
! |
25088287bbd0
Catch #fromString: (for autoloaded classes from Dolphin)
Stefan Vogel <sv@exept.de>
parents:
8590
diff
changeset
|
532 |
|
1 | 533 |
new |
2663 | 534 |
"catch new - load the class and resend #new to the real one" |
1 | 535 |
|
536 |
^ self doesNotUnderstand:(Message selector:#new) |
|
1277 | 537 |
|
2663 | 538 |
"Modified: 26.5.1997 / 14:59:52 / cg" |
1 | 539 |
! |
540 |
||
541 |
new:arg |
|
2663 | 542 |
"catch new: - load the class and resend #new: it to the real one" |
1 | 543 |
|
8482 | 544 |
^ self doesNotUnderstand:(Message selector:#new: argument:arg) |
1277 | 545 |
|
2663 | 546 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
1 | 547 |
! |
548 |
||
9373
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
549 |
privateClassesAt:aClassNameString |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
550 |
"catch - load the class and send it to the real one" |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
551 |
|
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
552 |
self == Autoload ifTrue:[ |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
553 |
^ super privateClassesAt:aClassNameString. |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
554 |
]. |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
555 |
^ self doesNotUnderstand:(Message selector:#privateClassesAt: argument:aClassNameString) |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
556 |
! |
e312f2f2901c
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9218
diff
changeset
|
557 |
|
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
558 |
readFrom:aStream |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
559 |
"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
|
560 |
|
8482 | 561 |
^ self doesNotUnderstand:(Message selector:#readFrom: argument:aStream) |
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
562 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
563 |
"Created: 22.5.1996 / 23:44:23 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
564 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
565 |
|
1437 | 566 |
readFrom:aStream onError:exceptionBlock |
567 |
"catch - load the class and send it to the real one" |
|
568 |
||
569 |
^ self doesNotUnderstand:(Message selector:#readFrom:onError: with:aStream with:exceptionBlock) |
|
570 |
||
571 |
"Created: 22.5.1996 / 23:03:39 / stefan" |
|
572 |
! |
|
573 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
574 |
readFromString:aString |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
575 |
"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
|
576 |
|
8482 | 577 |
^ self doesNotUnderstand:(Message selector:#readFromString: argument:aString) |
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
578 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
579 |
"Created: 22.5.1996 / 23:46:15 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
580 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
581 |
|
1437 | 582 |
readFromString:aString onError:exceptionBlock |
583 |
"catch - load the class and send it to the real one" |
|
584 |
||
585 |
^ self doesNotUnderstand:(Message selector:#readFromString:onError: with:aString with:exceptionBlock) |
|
586 |
||
587 |
"Created: 22.5.1996 / 23:04:49 / stefan" |
|
588 |
! |
|
589 |
||
2691
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
590 |
respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
591 |
"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
|
592 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
593 |
self == Autoload ifTrue:[ |
7178 | 594 |
^ super respondsTo:aSelector |
2691
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
595 |
]. |
8482 | 596 |
^ self doesNotUnderstand:(Message selector:#respondsTo: argument:aSelector) |
2691
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
597 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
598 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
8306 | 599 |
! |
600 |
||
601 |
subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
602 |
"create a new class as a subclass of an existing class (the receiver). |
|
603 |
The subclass will have indexed variables if the receiving-class has." |
|
604 |
||
605 |
^ self loadAndResendMessage |
|
606 |
! |
|
607 |
||
608 |
subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat classInstanceVariableNames:classInstanceVariableNames |
|
609 |
"create a new class as a subclass of an existing class (the receiver). |
|
610 |
The subclass will have indexed variables if the receiving-class has." |
|
611 |
||
612 |
^ self loadAndResendMessage |
|
613 |
! |
|
614 |
||
615 |
subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat inEnvironment:aNameSpace |
|
616 |
"create a new class as a subclass of an existing class (the receiver). |
|
617 |
The subclass will have indexed variables if the receiving-class has." |
|
618 |
||
619 |
^ self loadAndResendMessage |
|
620 |
! |
|
621 |
||
622 |
subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
623 |
"create a new class as a subclass of an existing class (the receiver). |
|
624 |
The subclass will have indexed variables if the receiving-class has." |
|
625 |
||
626 |
^ self loadAndResendMessage |
|
627 |
! |
|
628 |
||
629 |
variableByteSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
630 |
"create a new class as a subclass of an existing class (the receiver) |
|
631 |
in which the subclass has indexable byte-sized nonpointer variables" |
|
632 |
||
633 |
^ self loadAndResendMessage |
|
634 |
! |
|
635 |
||
636 |
variableByteSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
637 |
"create a new class as a subclass of an existing class (the receiver) |
|
638 |
in which the subclass has indexable byte-sized nonpointer variables" |
|
639 |
||
640 |
^ self loadAndResendMessage |
|
641 |
! |
|
642 |
||
643 |
variableDoubleSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
644 |
"create a new class as a subclass of an existing class (the receiver) |
|
645 |
in which the subclass has indexable double-sized nonpointer variables" |
|
646 |
||
647 |
^ self loadAndResendMessage |
|
648 |
! |
|
649 |
||
650 |
variableDoubleSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
651 |
"create a new class as a subclass of an existing class (the receiver) |
|
652 |
in which the subclass has indexable double-sized nonpointer variables" |
|
653 |
||
654 |
^ self loadAndResendMessage |
|
655 |
! |
|
656 |
||
657 |
variableFloatSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
658 |
"create a new class as a subclass of an existing class (the receiver) |
|
659 |
in which the subclass has indexable float-sized nonpointer variables" |
|
660 |
||
661 |
^ self loadAndResendMessage |
|
662 |
! |
|
663 |
||
664 |
variableFloatSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
665 |
"create a new class as a subclass of an existing class (the receiver) |
|
666 |
in which the subclass has indexable float-sized nonpointer variables" |
|
667 |
||
668 |
^ self loadAndResendMessage |
|
669 |
! |
|
670 |
||
671 |
variableLongLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
672 |
"create a new class as a subclass of an existing class (the receiver) |
|
673 |
in which the subclass has indexable unsigned long-long-sized nonpointer variables" |
|
674 |
||
675 |
^ self loadAndResendMessage |
|
676 |
! |
|
677 |
||
678 |
variableLongLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
679 |
"create a new class as a subclass of an existing class (the receiver) |
|
680 |
in which the subclass has indexable longlong-sized nonpointer variables" |
|
681 |
||
682 |
^ self loadAndResendMessage |
|
683 |
! |
|
684 |
||
685 |
variableLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
686 |
"create a new class as a subclass of an existing class (the receiver) |
|
687 |
in which the subclass has indexable long-sized nonpointer variables" |
|
688 |
||
689 |
^ self loadAndResendMessage |
|
690 |
! |
|
691 |
||
692 |
variableLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
693 |
"create a new class as a subclass of an existing class (the receiver) |
|
694 |
in which the subclass has indexable long-sized nonpointer variables" |
|
695 |
||
696 |
^ self loadAndResendMessage |
|
697 |
! |
|
698 |
||
699 |
variableSignedLongLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
700 |
"create a new class as a subclass of an existing class (the receiver) |
|
701 |
in which the subclass has indexable signed long-long-sized nonpointer variables" |
|
702 |
||
703 |
^ self loadAndResendMessage |
|
704 |
! |
|
705 |
||
706 |
variableSignedLongLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
707 |
"create a new class as a subclass of an existing class (the receiver) |
|
708 |
in which the subclass has indexable signed longlong-sized nonpointer variables" |
|
709 |
||
710 |
^ self loadAndResendMessage |
|
711 |
! |
|
712 |
||
713 |
variableSignedLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
714 |
"create a new class as a subclass of an existing class (the receiver) |
|
715 |
in which the subclass has indexable signed long-sized nonpointer variables" |
|
716 |
||
717 |
^ self loadAndResendMessage |
|
718 |
! |
|
719 |
||
720 |
variableSignedLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
721 |
"create a new class as a subclass of an existing class (the receiver) |
|
722 |
in which the subclass has indexable signed long-sized nonpointer variables" |
|
723 |
||
724 |
^ self loadAndResendMessage |
|
725 |
! |
|
726 |
||
727 |
variableSignedWordSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
728 |
"create a new class as a subclass of an existing class (the receiver) |
|
729 |
in which the subclass has indexable word-sized signed nonpointer variables" |
|
730 |
||
731 |
^ self loadAndResendMessage |
|
732 |
! |
|
733 |
||
734 |
variableSignedWordSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
735 |
"create a new class as a subclass of an existing class (the receiver) |
|
736 |
in which the subclass has indexable word-sized signed nonpointer variables" |
|
737 |
||
738 |
^ self loadAndResendMessage |
|
739 |
! |
|
740 |
||
741 |
variableSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
742 |
"create a new class as a subclass of an existing class (the receiver) |
|
743 |
in which the subclass has indexable pointer variables" |
|
744 |
||
745 |
^ self loadAndResendMessage |
|
746 |
! |
|
747 |
||
748 |
variableSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat classInstanceVariableNames:classInstanceVariableNames |
|
749 |
"create a new class as a subclass of an existing class (the receiver) |
|
750 |
in which the subclass has indexable pointer variables" |
|
751 |
||
752 |
^ self loadAndResendMessage |
|
753 |
! |
|
754 |
||
755 |
variableSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
756 |
"create a new class as a subclass of an existing class (the receiver) |
|
757 |
in which the subclass has indexable pointer variables" |
|
758 |
||
759 |
^ self loadAndResendMessage |
|
760 |
! |
|
761 |
||
762 |
variableWordSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat |
|
763 |
"create a new class as a subclass of an existing class (the receiver) |
|
764 |
in which the subclass has indexable word-sized nonpointer variables" |
|
765 |
||
766 |
^ self loadAndResendMessage |
|
767 |
! |
|
768 |
||
769 |
variableWordSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:aClass |
|
770 |
"create a new class as a subclass of an existing class (the receiver) |
|
771 |
in which the subclass has indexable word-sized nonpointer variables" |
|
772 |
||
773 |
^ self loadAndResendMessage |
|
1 | 774 |
! ! |
11 | 775 |
|
8316 | 776 |
!Autoload class methodsFor:'private'! |
777 |
||
778 |
loadAndResendMessage |
|
779 |
"common helper to autoload a class and define a subclass of it by sending |
|
780 |
the sender-message again. |
|
781 |
This is invoked by all #subClass... definition messages." |
|
782 |
||
783 |
|sel args newClass| |
|
784 |
||
785 |
sel := thisContext sender selector. |
|
786 |
args := thisContext sender args. |
|
787 |
||
788 |
"take care: subclassing Autoload must still be possible" |
|
789 |
(self == Autoload) ifTrue:[ |
|
790 |
^ self perform:sel inClass:Autoload class superclass withArguments:args |
|
791 |
]. |
|
792 |
||
793 |
newClass := self autoload. |
|
794 |
newClass notNil ifTrue:[ |
|
795 |
^ newClass perform:sel withArguments:args |
|
796 |
]. |
|
797 |
^ nil |
|
798 |
||
799 |
"Created: 8.2.1997 / 19:42:47 / cg" |
|
800 |
! ! |
|
801 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
802 |
!Autoload class methodsFor:'queries'! |
356 | 803 |
|
5902 | 804 |
accepts:aSignal |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
805 |
"redefined to avoid recursive autoload. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
806 |
(#autoload eventually raises QueryExceptions. |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
807 |
These exception may send #accepts: to exception classes |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
808 |
that are currently being loaded)" |
5902 | 809 |
|
810 |
|newClass| |
|
811 |
||
812 |
self isBeingLoaded ifFalse:[ |
|
7178 | 813 |
newClass := self autoload. |
814 |
newClass notNil ifTrue:[ |
|
815 |
^ newClass accepts:aSignal |
|
816 |
]. |
|
5902 | 817 |
]. |
818 |
^ false |
|
819 |
! |
|
820 |
||
620 | 821 |
isBehavior |
9218 | 822 |
"return true, if the receiver is describing another objects behavior. |
620 | 823 |
Autoloaded classes are definitely; therefore return true." |
164 | 824 |
|
620 | 825 |
^ true |
826 |
! |
|
356 | 827 |
|
5902 | 828 |
isBeingLoaded |
8588
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
829 |
"answer true if the class loading is currently in process" |
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
830 |
|
4bf5e572f5d9
Fix recursive autoloading of exception classes.
Stefan Vogel <sv@exept.de>
parents:
8482
diff
changeset
|
831 |
^ (self ~~ Autoload) and:[InProgressClasses includes:self] |
5902 | 832 |
|
833 |
"Modified: / 16.2.1998 / 11:57:35 / stefan" |
|
834 |
! |
|
835 |
||
729 | 836 |
isBuiltInClass |
1266 | 837 |
"return true if this class is known by the run-time-system. |
838 |
Returns false here." |
|
839 |
||
729 | 840 |
^ false |
841 |
||
842 |
"Created: 10.12.1995 / 00:28:22 / cg" |
|
1266 | 843 |
"Modified: 23.4.1996 / 15:55:36 / cg" |
729 | 844 |
! |
845 |
||
620 | 846 |
isLoaded |
3287 | 847 |
"return true, if the class has been loaded. |
848 |
Autoload itself is loaded, subclasses are not. |
|
849 |
This allows testing wether a class has already been loaded." |
|
620 | 850 |
|
851 |
^ (self == Autoload) |
|
3287 | 852 |
|
853 |
"Modified: / 16.2.1998 / 11:57:35 / stefan" |
|
620 | 854 |
! |
855 |
||
922 | 856 |
loadedClasses |
857 |
"return the set of classes that were autoloaded" |
|
858 |
||
8316 | 859 |
^ LoadedClasses |
922 | 860 |
! |
861 |
||
4401
d9667432d35b
privateClasses and allPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4301
diff
changeset
|
862 |
privateClassesOrAll:allOfThem |
4000 | 863 |
"an autoloaded class has none" |
864 |
||
865 |
^ #() |
|
866 |
! |
|
867 |
||
620 | 868 |
wasAutoloaded:aClass |
922 | 869 |
"return true, if aClass was autoloaded" |
870 |
||
8316 | 871 |
^ LoadedClasses includes:aClass |
11 | 872 |
! ! |
620 | 873 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
874 |
!Autoload class methodsFor:'documentation'! |
661 | 875 |
|
876 |
version |
|
9422 | 877 |
^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.132 2006-07-05 14:21:44 cg Exp $' |
661 | 878 |
! ! |
6768 | 879 |
|
620 | 880 |
Autoload initialize! |