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