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