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