author | Claus Gittinger <cg@exept.de> |
Mon, 02 Aug 1999 18:06:38 +0200 | |
changeset 4496 | 28f3f57dbe60 |
parent 4401 | d9667432d35b |
child 4511 | da0b327f3204 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
154 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
620 | 13 |
nil subclass:#Autoload |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
14 |
instanceVariableNames:'' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
15 |
classVariableNames:'LazyLoading AutoloadFailedSignal LoadedClasses' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
16 |
poolDictionaries:'' |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
17 |
category:'Kernel-Classes' |
1 | 18 |
! |
19 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
20 |
!Autoload class methodsFor:'documentation'! |
68 | 21 |
|
88 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
154 | 25 |
All Rights Reserved |
88 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
68 | 36 |
documentation |
37 |
" |
|
38 |
In memory limited systems (as my 8Mb 386 is) all seldom-used classes are made |
|
2662 | 39 |
subclasses of this class. |
40 |
Autoload catches all messages and files-In the corresponding code |
|
41 |
when first used. |
|
2689 | 42 |
Then the caught message is resent to the (now existing) class. |
2662 | 43 |
|
44 |
Class files are searched along the searchPath (see Smalltalk), |
|
45 |
and any of binary-classFile, byteCode-classFile or sourceFile are |
|
46 |
loaded, whichever is found first. For binaries to be loaded, |
|
47 |
these must be found in the 'bin' directory. Sources must be found |
|
48 |
in the 'source' directory. |
|
49 |
(Usually, Autoload classes finds the source file and loads that one). |
|
50 |
||
51 |
When started, the patches startup script arranges for the abbreviation |
|
52 |
file 'include/abbrev.stc' to be read and installs autoload stubs for |
|
53 |
all classes listed in that file, which do not exists already. |
|
54 |
The abbreviation file is maintained by the production environment |
|
55 |
and updated by makefile rules - therefore, it should not be edited |
|
56 |
manually. |
|
68 | 57 |
|
58 |
Late addition: above comment is no longer true - I have made now almost |
|
59 |
all Demos & Goodies be autoloaded ... even for big systems. |
|
60 |
||
1278 | 61 |
[class variables:] |
92 | 62 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
63 |
LazyLoading <Boolean> if true, the loaded classes |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
64 |
methods will NOT be compiled at |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
65 |
autoload time, but instead when |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
66 |
first called. This allows for a |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
67 |
faster load. However, expect short |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
68 |
pauses later when the methods are |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
69 |
first executed. |
126 | 70 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
71 |
AutoloadFailedSignal <Signal> signal raised if an autoloaded |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
72 |
classes source is not available. |
922 | 73 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
74 |
LoadedClasses <Collection> set of classes that heve been |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
75 |
autoloaded (for later unload) |
1292 | 76 |
|
2662 | 77 |
[see also:] |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
78 |
Smalltalk |
2662 | 79 |
|
1292 | 80 |
[author:] |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
81 |
Claus Gittinger |
68 | 82 |
" |
83 |
! ! |
|
84 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
85 |
!Autoload class methodsFor:'initialization'! |
126 | 86 |
|
87 |
initialize |
|
2223 | 88 |
"initialize the failure-signal" |
89 |
||
126 | 90 |
AutoloadFailedSignal isNil ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
91 |
LazyLoading := false. |
2654 | 92 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
93 |
AutoloadFailedSignal := Object errorSignal newSignalMayProceed:true. |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
94 |
AutoloadFailedSignal nameClass:self message:#autoloadFailedSignal. |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
95 |
AutoloadFailedSignal notifierString:'autoload failed '. |
197 | 96 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
97 |
self setSuperclass:nil. |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
98 |
ObjectMemory flushCaches. |
126 | 99 |
] |
2223 | 100 |
|
2654 | 101 |
"Modified: 20.5.1997 / 19:06:25 / cg" |
126 | 102 |
! ! |
103 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
104 |
!Autoload class methodsFor:'Signal constants'! |
126 | 105 |
|
106 |
autoloadFailedSignal |
|
107 |
"return the signal raised when an autoload fails" |
|
108 |
||
109 |
^ AutoloadFailedSignal |
|
110 |
! ! |
|
111 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
112 |
!Autoload class methodsFor:'adding/removing autoloaded classes'! |
359 | 113 |
|
216 | 114 |
addClass:aClassName |
4052 | 115 |
"given a name, install a corresponding autoload class stub for it. |
116 |
Return the (autoload-) stubClass or nil, if no new class was created." |
|
1277 | 117 |
|
4052 | 118 |
^ self addClass:aClassName inCategory:'autoloaded-Classes' |
216 | 119 |
|
120 |
" |
|
121 |
Autoload addClass:'Clock' |
|
122 |
" |
|
1277 | 123 |
|
124 |
"Modified: 24.4.1996 / 19:54:16 / cg" |
|
216 | 125 |
! |
126 |
||
127 |
addClass:aClassName inCategory:aCategory |
|
4052 | 128 |
"given a name, install a corresponding autoload class stub for it. |
129 |
Return the (autoload-) stubClass or nil, if no new class was created." |
|
1277 | 130 |
|
4052 | 131 |
|nameSymbol cls| |
216 | 132 |
|
133 |
nameSymbol := aClassName asSymbol. |
|
134 |
(Smalltalk at:nameSymbol) isNil ifTrue:[ |
|
4052 | 135 |
cls := Autoload |
136 |
subclass:nameSymbol |
|
137 |
instanceVariableNames:'' |
|
138 |
classVariableNames:'' |
|
139 |
poolDictionaries:'' |
|
140 |
category:aCategory. |
|
141 |
]. |
|
142 |
^ cls |
|
143 |
||
216 | 144 |
" |
145 |
Autoload addClass:'Clock' inCategory:'autoloaded-Demos' |
|
146 |
" |
|
1277 | 147 |
|
148 |
"Modified: 24.4.1996 / 19:54:20 / cg" |
|
620 | 149 |
! |
150 |
||
151 |
removeClass:aClass |
|
1277 | 152 |
"remove a class from the list of loaded classes" |
153 |
||
620 | 154 |
LoadedClasses remove:aClass ifAbsent:[] |
1277 | 155 |
|
156 |
"Modified: 24.4.1996 / 19:54:35 / cg" |
|
620 | 157 |
! ! |
158 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
159 |
!Autoload class methodsFor:'fileout'! |
620 | 160 |
|
2067 | 161 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace |
620 | 162 |
"print an expression to define myself on aStream. |
163 |
Since autoloaded classes dont know their real definition, simply |
|
164 |
output some comment string making things clear in the browser." |
|
165 |
||
4016 | 166 |
|myName fileName nm mgr classFileName packageDir package| |
620 | 167 |
|
2067 | 168 |
(self == Autoload) ifTrue:[^ super basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace]. |
620 | 169 |
|
170 |
myName := self name. |
|
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
171 |
aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr; |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
172 |
spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr. |
620 | 173 |
aStream nextPutAll:'to load, execute: '. |
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
174 |
aStream cr; 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
|
175 |
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
|
176 |
aStream nextPutLine:'(double-click on the class will also load it).'. |
620 | 177 |
" |
178 |
the following is simply informative ... |
|
179 |
actually, its a hack & kludge - there ought to be a method for this |
|
180 |
in Smalltalk |
|
181 |
(knowing the details of loading here is no good coding style) |
|
182 |
" |
|
183 |
fileName := Smalltalk fileNameForClass:myName. |
|
184 |
(ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[ |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
185 |
(nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
186 |
nm := nm , ' (a classLibrary, possibly including more classes)' |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
187 |
] ifFalse:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
188 |
nm := Smalltalk getBinaryFileName:(fileName , '.so'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
189 |
nm isNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
190 |
nm := Smalltalk getBinaryFileName:(fileName , '.o') |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
191 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
192 |
nm notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
193 |
nm := nm , ' (a classBinary)' |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
194 |
] |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
195 |
]. |
620 | 196 |
]. |
197 |
nm isNil ifTrue:[ |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
198 |
package := self package. |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
199 |
package notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
200 |
nm := Smalltalk getSourceFileName:((package copyReplaceAll:$: with:$/) , '/' , fileName , '.st'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
201 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
202 |
nm isNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
203 |
nm := Smalltalk getSourceFileName:(fileName , '.st'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
204 |
]. |
620 | 205 |
]. |
206 |
nm notNil ifTrue:[ |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
207 |
aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
208 |
aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
209 |
nm asFilename isSymbolicLink ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
210 |
aStream cr; cr. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
211 |
aStream nextPutLine:'which is a link to: '; spaces:4; |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
212 |
nextPutAll:(nm asFilename linkInfo path). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
213 |
] |
620 | 214 |
] ifFalse:[ |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
215 |
aStream cr; nextPutLine:'There is currently no file to load ' , myName , ' from.'; cr. |
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
216 |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
217 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
218 |
classFileName := Smalltalk fileNameForClass:myName. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
219 |
packageDir := Smalltalk sourceDirectoryNameOfClass:myName. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
220 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
221 |
(classFileName notNil and:[packageDir notNil]) ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
222 |
aStream nextPutAll:'When accessed, I''ll ask the sourceCodeManager to load the code |
4279
3de9eb5ae5e8
oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents:
4114
diff
changeset
|
223 |
from ''' , classFileName , '.st'' in the ''' , packageDir , ''' package.'. |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
224 |
] ifFalse:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
225 |
aStream nextPutAll:'When accessed, an error will be reported.'. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
226 |
] |
620 | 227 |
]. |
228 |
aStream cr; nextPutAll:'"'. |
|
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
229 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
230 |
"Created: / 5.1.1997 / 14:31:33 / cg" |
4280
f100fa94428f
oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents:
4279
diff
changeset
|
231 |
"Modified: / 6.6.1999 / 15:17:30 / cg" |
620 | 232 |
! ! |
233 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
234 |
!Autoload class methodsFor:'lazy compilation'! |
620 | 235 |
|
236 |
compileLazy |
|
237 |
"return the lazy loading flag - if on, fileIn is much faster, |
|
238 |
but pauses are to be expected later, since methods are compiled |
|
239 |
when first executed." |
|
240 |
||
241 |
^ LazyLoading |
|
242 |
! |
|
243 |
||
244 |
compileLazy:aBoolean |
|
245 |
"turn on/off lazy loading - if on, fileIn is much faster, |
|
246 |
but pauses are to be expected later, since methods are compiled |
|
247 |
when first executed. |
|
248 |
If you like it, add a line to your startup file." |
|
249 |
||
250 |
LazyLoading := aBoolean |
|
216 | 251 |
! ! |
252 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
253 |
!Autoload class methodsFor:'loading'! |
1 | 254 |
|
255 |
autoload |
|
256 |
"use this to force loading |
|
2062 | 257 |
- it is defined a noop in all non-autoloading classes" |
1 | 258 |
|
4033 | 259 |
|mySelf myName myNameSpace newClass oldMeta project prevMode |
260 |
package newPackage| |
|
1 | 261 |
|
262 |
mySelf := self. |
|
164 | 263 |
myName := self name asSymbol. |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
264 |
myNameSpace := self nameSpace. |
1 | 265 |
|
266 |
"remove myself - to avoid recompilation" |
|
164 | 267 |
Smalltalk at:myName put:nil. |
1 | 268 |
|
2 | 269 |
"load it" |
1566 | 270 |
(Object infoPrinting and:[Smalltalk silentLoading ~~ true]) ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
271 |
Transcript showCR:('autoloading ', myName , ' ...'); endEntry. |
1564
f3f9736bd0fa
suppress load messages, if infoPrinting is turned off
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
272 |
]. |
1 | 273 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
274 |
[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
275 |
prevMode := ClassCategoryReader sourceMode. |
1720 | 276 |
"/ |
277 |
"/ no- do not do this; it may lead to trouble ... |
|
278 |
"/ ClassCategoryReader sourceMode:#reference. |
|
1694
29791fde790e
autoload classes keep source reference
Claus Gittinger <cg@exept.de>
parents:
1674
diff
changeset
|
279 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
280 |
"/ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
281 |
"/ in order to not get a package of private (or whatever), |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
282 |
"/ temporarily set the currentProject to nil. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
283 |
"/ we will later set the classes package to something useful |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
284 |
"/ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
285 |
Project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
286 |
project := Project current. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
287 |
Project setProject:nil. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
288 |
]. |
2375
7eb1b35edc33
autoload into Smalltalk nameSpace - by default.
Claus Gittinger <cg@exept.de>
parents:
2366
diff
changeset
|
289 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
290 |
Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
291 |
do:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
292 |
package := self package. |
4114
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
293 |
"/ package notNil ifTrue:[ |
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
294 |
"/ (package includes:$:) ifTrue:[ |
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
295 |
"/ package := package asString copyReplaceAll:$: with:$/ |
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
296 |
"/ ] ifFalse:[ |
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
297 |
"/ package := 'stx/' , package |
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
298 |
"/ ] |
9300fc0fae0e
do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents:
4054
diff
changeset
|
299 |
"/ ]. |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
300 |
|
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
301 |
(Smalltalk |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
302 |
fileInClass:myName |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
303 |
package:package |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
304 |
initialize:false |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
305 |
lazy:LazyLoading |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
306 |
silent:nil) isNil ifTrue:[ |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
307 |
"/ temporary: try without stx/package prefix |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
308 |
"/ this will vanishas soon as source-directory |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
309 |
"/ is always guaranteed to contain an stx-subtree |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
310 |
(package startsWith:'stx/') ifTrue:[ |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
311 |
package := package copyFrom:5. |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
312 |
Smalltalk |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
313 |
fileInClass:myName |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
314 |
package:package |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
315 |
initialize:false |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
316 |
lazy:LazyLoading |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
317 |
silent:nil. |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
318 |
] |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
319 |
] |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
320 |
]. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
321 |
ClassCategoryReader sourceMode:prevMode. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
322 |
project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
323 |
Project setProject:project. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
324 |
]. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
325 |
] valueOnUnwindDo:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
326 |
ClassCategoryReader sourceMode:prevMode. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
327 |
project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
328 |
Project setProject:project. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
329 |
]. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
330 |
Smalltalk at:myName put:mySelf. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
331 |
]. |
1 | 332 |
|
333 |
"did it work ?" |
|
164 | 334 |
newClass := Smalltalk at:myName. |
335 |
Smalltalk at:myName put:mySelf. "will be undone by become:" |
|
1 | 336 |
|
138 | 337 |
"no - report the error" |
1 | 338 |
newClass isNil ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
339 |
" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
340 |
this signal is raised, if an autoloaded class |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
341 |
cannot be loaded. Usually, this happends when |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
342 |
some sourcefile is missing, not readable or if |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
343 |
an entry is missing in the abbreviation file. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
344 |
Check for a readable file named <myName>.st |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
345 |
in the 'source' directory and (if its a long fileName) |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
346 |
for a corresponding entry in the abbreviation file |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
347 |
'include/abbrev.stc'. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
348 |
Finally, your searchpath could be set wrong - |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
349 |
both 'source' and 'include' directories must be found in |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
350 |
one of the directories named in systemPath. |
154 | 351 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
352 |
In the debugger, press 'abort' to continue execution. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
353 |
" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
354 |
AutoloadFailedSignal |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
355 |
raiseRequestWith:self |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
356 |
errorString:('autoload of ' , myName , ' failed'). |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
357 |
^ nil |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
358 |
]. |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
359 |
|
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
360 |
"/ |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
361 |
"/ 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
|
362 |
"/ 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
|
363 |
"/ info encoded. (binary classes have it) |
2057
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
364 |
"/ 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
|
365 |
"/ |
4033 | 366 |
newClass setPackageFromRevision. |
4011 | 367 |
|
4033 | 368 |
newPackage := newClass package. |
369 |
(newPackage isNil or:[newPackage = 'no package']) ifTrue:[ |
|
370 |
(package notNil and:[package ~= 'no package']) ifTrue:[ |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
371 |
newClass setPackage:package. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
372 |
]. |
1 | 373 |
]. |
374 |
||
216 | 375 |
LoadedClasses isNil ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
376 |
LoadedClasses := IdentitySet new. |
216 | 377 |
]. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
378 |
LoadedClasses add:newClass. |
216 | 379 |
|
154 | 380 |
"wow - it worked. now the big trick ..." |
1 | 381 |
|
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
382 |
"/ newClass class setSoleInstance:self. "/ will be undone by become ... |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
383 |
oldMeta := self class. |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
384 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
385 |
"/ 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
|
386 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
387 |
self becomeSameAs:newClass. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
388 |
oldMeta becomeSameAs:newClass class. |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
389 |
|
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
390 |
ObjectMemory flushCaches. |
216 | 391 |
LoadedClasses rehash. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
392 |
|
3443
d57ea75d3ac5
oops - must send #initialize to all privateClasses.
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
393 |
newClass initializeWithAllPrivateClasses. |
886 | 394 |
newClass postAutoload. |
395 |
^ newClass |
|
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
396 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
397 |
"Modified: / 5.3.1999 / 12:59:13 / cg" |
1 | 398 |
! ! |
399 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
400 |
!Autoload class methodsFor:'message catching'! |
1 | 401 |
|
620 | 402 |
basicNew |
1277 | 403 |
"catch basicNew - load the class and send it to the real one" |
620 | 404 |
|
405 |
^ self doesNotUnderstand:(Message selector:#basicNew) |
|
1277 | 406 |
|
407 |
"Modified: 24.4.1996 / 19:53:10 / cg" |
|
620 | 408 |
! |
409 |
||
410 |
basicNew:arg |
|
1277 | 411 |
"catch basicNew: - load the class and send it to the real one" |
620 | 412 |
|
413 |
^ self doesNotUnderstand:(Message selector:#basicNew: with:arg) |
|
1277 | 414 |
|
415 |
"Modified: 24.4.1996 / 19:53:16 / cg" |
|
620 | 416 |
! |
417 |
||
418 |
comment |
|
419 |
"return the classes comment. |
|
420 |
Autoloaded classes have no comment; but I myself have one" |
|
421 |
||
422 |
(self == Autoload) ifTrue:[^ super comment]. |
|
423 |
^ 'not yet loaded' |
|
424 |
! |
|
425 |
||
1 | 426 |
doesNotUnderstand:aMessage |
2689 | 427 |
"caught a message; load the class and retry the message" |
1 | 428 |
|
429 |
|newClass| |
|
430 |
||
164 | 431 |
self ~~ Autoload ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
432 |
newClass := self autoload. |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
433 |
newClass notNil ifTrue:[ |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
434 |
^ newClass perform:(aMessage selector) |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
435 |
withArguments:(aMessage arguments) |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
436 |
] |
1 | 437 |
]. |
789
155eca125ef0
return value from doesNotUnderstand (so handler can return a value)
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
438 |
^ super doesNotUnderstand:aMessage |
1277 | 439 |
|
440 |
"Modified: 24.4.1996 / 19:53:27 / cg" |
|
1 | 441 |
! |
442 |
||
4301
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
443 |
loadAndResendMessage |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
444 |
"common helper to autoload a class and define a subclass of it by sending |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
445 |
the sender-message again. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
446 |
This is invoked by all #subClass... definition messages." |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
447 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
448 |
|sel args newClass| |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
449 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
450 |
sel := thisContext sender selector. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
451 |
args := thisContext sender args. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
452 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
453 |
"take care: subclassing Autoload must still be possible" |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
454 |
(self == Autoload) ifTrue:[ |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
455 |
^ self perform:sel inClass:Autoload class superclass withArguments:args |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
456 |
]. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
457 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
458 |
newClass := self autoload. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
459 |
newClass notNil ifTrue:[ |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
460 |
^ newClass perform:sel withArguments:args |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
461 |
]. |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
462 |
^ nil |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
463 |
|
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
464 |
"Created: 8.2.1997 / 19:42:47 / cg" |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
465 |
! |
e74e49f4e8e2
changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents:
4280
diff
changeset
|
466 |
|
1 | 467 |
new |
2663 | 468 |
"catch new - load the class and resend #new to the real one" |
1 | 469 |
|
470 |
^ self doesNotUnderstand:(Message selector:#new) |
|
1277 | 471 |
|
2663 | 472 |
"Modified: 26.5.1997 / 14:59:52 / cg" |
1 | 473 |
! |
474 |
||
475 |
new:arg |
|
2663 | 476 |
"catch new: - load the class and resend #new: it to the real one" |
1 | 477 |
|
478 |
^ self doesNotUnderstand:(Message selector:#new: with:arg) |
|
1277 | 479 |
|
2663 | 480 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
1 | 481 |
! |
482 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
483 |
readFrom:aStream |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
484 |
"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
|
485 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
486 |
^ self doesNotUnderstand:(Message selector:#readFrom: with:aStream) |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
487 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
488 |
"Created: 22.5.1996 / 23:44:23 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
489 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
490 |
|
1437 | 491 |
readFrom:aStream onError:exceptionBlock |
492 |
"catch - load the class and send it to the real one" |
|
493 |
||
494 |
^ self doesNotUnderstand:(Message selector:#readFrom:onError: with:aStream with:exceptionBlock) |
|
495 |
||
496 |
"Created: 22.5.1996 / 23:03:39 / stefan" |
|
497 |
! |
|
498 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
499 |
readFromString:aString |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
500 |
"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
|
501 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
502 |
^ self doesNotUnderstand:(Message selector:#readFromString: with:aString) |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
503 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
504 |
"Created: 22.5.1996 / 23:46:15 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
505 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
506 |
|
1437 | 507 |
readFromString:aString onError:exceptionBlock |
508 |
"catch - load the class and send it to the real one" |
|
509 |
||
510 |
^ self doesNotUnderstand:(Message selector:#readFromString:onError: with:aString with:exceptionBlock) |
|
511 |
||
512 |
"Created: 22.5.1996 / 23:04:49 / stefan" |
|
513 |
! |
|
514 |
||
2691
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
515 |
respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
516 |
"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
|
517 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
518 |
self == Autoload ifTrue:[ |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
519 |
^ super respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
520 |
]. |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
521 |
^ self doesNotUnderstand:(Message selector:#respondsTo: with:aSelector) |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
522 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
523 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
1 | 524 |
! ! |
11 | 525 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
526 |
!Autoload class methodsFor:'queries'! |
356 | 527 |
|
620 | 528 |
isBehavior |
529 |
"return true if the recevier is some kind of class. |
|
530 |
Autoloaded classes are definitely; therefore return true." |
|
164 | 531 |
|
620 | 532 |
^ true |
533 |
! |
|
356 | 534 |
|
729 | 535 |
isBuiltInClass |
1266 | 536 |
"return true if this class is known by the run-time-system. |
537 |
Returns false here." |
|
538 |
||
729 | 539 |
^ false |
540 |
||
541 |
"Created: 10.12.1995 / 00:28:22 / cg" |
|
1266 | 542 |
"Modified: 23.4.1996 / 15:55:36 / cg" |
729 | 543 |
! |
544 |
||
620 | 545 |
isLoaded |
3287 | 546 |
"return true, if the class has been loaded. |
547 |
Autoload itself is loaded, subclasses are not. |
|
548 |
This allows testing wether a class has already been loaded." |
|
620 | 549 |
|
550 |
^ (self == Autoload) |
|
3287 | 551 |
|
552 |
"Modified: / 16.2.1998 / 11:57:35 / stefan" |
|
620 | 553 |
! |
554 |
||
922 | 555 |
loadedClasses |
556 |
"return the set of classes that were autoloaded" |
|
557 |
||
4496 | 558 |
^ LoadedClasses ? #() |
922 | 559 |
! |
560 |
||
4401
d9667432d35b
privateClasses and allPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4301
diff
changeset
|
561 |
privateClassesOrAll:allOfThem |
4000 | 562 |
"an autoloaded class has none" |
563 |
||
564 |
^ #() |
|
565 |
! |
|
566 |
||
620 | 567 |
wasAutoloaded:aClass |
922 | 568 |
"return true, if aClass was autoloaded" |
569 |
||
620 | 570 |
^ LoadedClasses notNil and:[LoadedClasses includes:aClass] |
11 | 571 |
! ! |
620 | 572 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
573 |
!Autoload class methodsFor:'documentation'! |
661 | 574 |
|
575 |
version |
|
4496 | 576 |
^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.95 1999-08-02 16:05:52 cg Exp $' |
661 | 577 |
! ! |
620 | 578 |
Autoload initialize! |