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