author | Claus Gittinger <cg@exept.de> |
Fri, 05 Mar 1999 12:58:38 +0100 | |
changeset 4025 | d9b9a5e77f1a |
parent 4016 | e0fc2cf0cf03 |
child 4033 | 6bd3f16bc897 |
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 |
1277 | 115 |
"given a name, install a corresponding autoload class stub for it" |
116 |
||
216 | 117 |
self addClass:aClassName inCategory:'autoloaded-Classes' |
118 |
||
119 |
" |
|
120 |
Autoload addClass:'Clock' |
|
121 |
" |
|
1277 | 122 |
|
123 |
"Modified: 24.4.1996 / 19:54:16 / cg" |
|
216 | 124 |
! |
125 |
||
126 |
addClass:aClassName inCategory:aCategory |
|
1277 | 127 |
"given a name, install a corresponding autoload class stub for it" |
128 |
||
216 | 129 |
|nameSymbol| |
130 |
||
131 |
nameSymbol := aClassName asSymbol. |
|
132 |
(Smalltalk at:nameSymbol) isNil ifTrue:[ |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
133 |
Autoload subclass:nameSymbol |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
134 |
instanceVariableNames:'' |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
135 |
classVariableNames:'' |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
136 |
poolDictionaries:'' |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
137 |
category:aCategory. |
216 | 138 |
] |
139 |
" |
|
140 |
Autoload addClass:'Clock' inCategory:'autoloaded-Demos' |
|
141 |
" |
|
1277 | 142 |
|
143 |
"Modified: 24.4.1996 / 19:54:20 / cg" |
|
620 | 144 |
! |
145 |
||
146 |
removeClass:aClass |
|
1277 | 147 |
"remove a class from the list of loaded classes" |
148 |
||
620 | 149 |
LoadedClasses remove:aClass ifAbsent:[] |
1277 | 150 |
|
151 |
"Modified: 24.4.1996 / 19:54:35 / cg" |
|
620 | 152 |
! ! |
153 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
154 |
!Autoload class methodsFor:'fileout'! |
620 | 155 |
|
2067 | 156 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace |
620 | 157 |
"print an expression to define myself on aStream. |
158 |
Since autoloaded classes dont know their real definition, simply |
|
159 |
output some comment string making things clear in the browser." |
|
160 |
||
4016 | 161 |
|myName fileName nm mgr classFileName packageDir package| |
620 | 162 |
|
2067 | 163 |
(self == Autoload) ifTrue:[^ super basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace]. |
620 | 164 |
|
165 |
myName := self name. |
|
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
166 |
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
|
167 |
spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr. |
620 | 168 |
aStream nextPutAll:'to load, execute: '. |
1952
18cfc11b49fa
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
169 |
aStream cr; cr; spaces:4; nextPutLine:myName , ' autoload'. |
2019 | 170 |
aStream cr; nextPutLine:'or use the browsers load-function (in the class menu).'. |
620 | 171 |
" |
172 |
the following is simply informative ... |
|
173 |
actually, its a hack & kludge - there ought to be a method for this |
|
174 |
in Smalltalk |
|
175 |
(knowing the details of loading here is no good coding style) |
|
176 |
" |
|
177 |
fileName := Smalltalk fileNameForClass:myName. |
|
178 |
(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
|
179 |
(nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
180 |
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
|
181 |
] ifFalse:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
182 |
nm := Smalltalk getBinaryFileName:(fileName , '.so'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
183 |
nm isNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
184 |
nm := Smalltalk getBinaryFileName:(fileName , '.o') |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
185 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
186 |
nm notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
187 |
nm := nm , ' (a classBinary)' |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
188 |
] |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
189 |
]. |
620 | 190 |
]. |
191 |
nm isNil ifTrue:[ |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
192 |
package := self package. |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
193 |
package notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
194 |
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
|
195 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
196 |
nm isNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
197 |
nm := Smalltalk getSourceFileName:(fileName , '.st'). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
198 |
]. |
620 | 199 |
]. |
200 |
nm notNil ifTrue:[ |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
201 |
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
|
202 |
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
|
203 |
nm asFilename isSymbolicLink ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
204 |
aStream cr; cr. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
205 |
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
|
206 |
nextPutAll:(nm asFilename linkInfo path). |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
207 |
] |
620 | 208 |
] ifFalse:[ |
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
209 |
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
|
210 |
|
4014
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
211 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
212 |
classFileName := Smalltalk fileNameForClass:myName. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
213 |
packageDir := Smalltalk sourceDirectoryNameOfClass:myName. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
214 |
]. |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
215 |
(classFileName notNil and:[packageDir notNil]) ifTrue:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
216 |
aStream nextPutAll:'When accessed, I''ll ask the sourceCodeManager to load the code |
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
217 |
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
|
218 |
] ifFalse:[ |
e9040614767a
search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents:
4011
diff
changeset
|
219 |
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
|
220 |
] |
620 | 221 |
]. |
222 |
aStream cr; nextPutAll:'"'. |
|
709
c31cbd5e5323
more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents:
661
diff
changeset
|
223 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
224 |
"Created: / 5.1.1997 / 14:31:33 / cg" |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
225 |
"Modified: / 5.3.1999 / 12:56:57 / cg" |
620 | 226 |
! ! |
227 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
228 |
!Autoload class methodsFor:'lazy compilation'! |
620 | 229 |
|
230 |
compileLazy |
|
231 |
"return the lazy loading flag - if on, fileIn is much faster, |
|
232 |
but pauses are to be expected later, since methods are compiled |
|
233 |
when first executed." |
|
234 |
||
235 |
^ LazyLoading |
|
236 |
! |
|
237 |
||
238 |
compileLazy:aBoolean |
|
239 |
"turn on/off lazy loading - if on, fileIn is much faster, |
|
240 |
but pauses are to be expected later, since methods are compiled |
|
241 |
when first executed. |
|
242 |
If you like it, add a line to your startup file." |
|
243 |
||
244 |
LazyLoading := aBoolean |
|
216 | 245 |
! ! |
246 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
247 |
!Autoload class methodsFor:'loading'! |
1 | 248 |
|
249 |
autoload |
|
250 |
"use this to force loading |
|
2062 | 251 |
- it is defined a noop in all non-autoloading classes" |
1 | 252 |
|
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
253 |
|mySelf myName myNameSpace newClass oldMeta project prevMode package| |
1 | 254 |
|
255 |
mySelf := self. |
|
164 | 256 |
myName := self name asSymbol. |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
257 |
myNameSpace := self nameSpace. |
1 | 258 |
|
259 |
"remove myself - to avoid recompilation" |
|
164 | 260 |
Smalltalk at:myName put:nil. |
1 | 261 |
|
2 | 262 |
"load it" |
1566 | 263 |
(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
|
264 |
Transcript showCR:('autoloading ', myName , ' ...'); endEntry. |
1564
f3f9736bd0fa
suppress load messages, if infoPrinting is turned off
Claus Gittinger <cg@exept.de>
parents:
1438
diff
changeset
|
265 |
]. |
1 | 266 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
267 |
[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
268 |
prevMode := ClassCategoryReader sourceMode. |
1720 | 269 |
"/ |
270 |
"/ no- do not do this; it may lead to trouble ... |
|
271 |
"/ ClassCategoryReader sourceMode:#reference. |
|
1694
29791fde790e
autoload classes keep source reference
Claus Gittinger <cg@exept.de>
parents:
1674
diff
changeset
|
272 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
273 |
"/ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
274 |
"/ 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
|
275 |
"/ 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
|
276 |
"/ 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
|
277 |
"/ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
278 |
Project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
279 |
project := Project current. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
280 |
Project setProject:nil. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
281 |
]. |
2375
7eb1b35edc33
autoload into Smalltalk nameSpace - by default.
Claus Gittinger <cg@exept.de>
parents:
2366
diff
changeset
|
282 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
283 |
Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
284 |
do:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
285 |
package := self package. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
286 |
package notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
287 |
(package includes:$:) ifTrue:[ |
3655 | 288 |
package := package asString copyReplaceAll:$: with:$/ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
289 |
] ifFalse:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
290 |
package := 'stx/' , package |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
291 |
] |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
292 |
]. |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
293 |
|
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
294 |
(Smalltalk |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
295 |
fileInClass:myName |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
296 |
package:package |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
297 |
initialize:false |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
298 |
lazy:LazyLoading |
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
299 |
silent:nil) isNil ifTrue:[ |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
300 |
"/ temporary: try without stx/package prefix |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
301 |
"/ 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
|
302 |
"/ 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
|
303 |
(package startsWith:'stx/') ifTrue:[ |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
304 |
package := package copyFrom:5. |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
305 |
Smalltalk |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
306 |
fileInClass:myName |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
307 |
package:package |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
308 |
initialize:false |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
309 |
lazy:LazyLoading |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
310 |
silent:nil. |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
311 |
] |
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
312 |
] |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
313 |
]. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
314 |
ClassCategoryReader sourceMode:prevMode. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
315 |
project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
316 |
Project setProject:project. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
317 |
]. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
318 |
] valueOnUnwindDo:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
319 |
ClassCategoryReader sourceMode:prevMode. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
320 |
project notNil ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
321 |
Project setProject:project. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
322 |
]. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
323 |
Smalltalk at:myName put:mySelf. |
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
324 |
]. |
1 | 325 |
|
326 |
"did it work ?" |
|
164 | 327 |
newClass := Smalltalk at:myName. |
328 |
Smalltalk at:myName put:mySelf. "will be undone by become:" |
|
1 | 329 |
|
138 | 330 |
"no - report the error" |
1 | 331 |
newClass isNil ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
332 |
" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
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
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
'include/abbrev.stc'. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
341 |
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
|
342 |
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
|
343 |
one of the directories named in systemPath. |
154 | 344 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
345 |
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
|
346 |
" |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
347 |
AutoloadFailedSignal |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
348 |
raiseRequestWith:self |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
349 |
errorString:('autoload of ' , myName , ' failed'). |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
350 |
^ nil |
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
351 |
]. |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
352 |
|
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
353 |
"/ |
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
354 |
"/ 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
|
355 |
"/ 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
|
356 |
"/ info encoded. (binary classes have it) |
2057
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
357 |
"/ 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
|
358 |
"/ |
4011 | 359 |
|
2057
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
360 |
newClass setPackageFromRevision. |
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
361 |
(newClass package isNil |
35003ed4b817
care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents:
2019
diff
changeset
|
362 |
or:[newClass package = 'no package']) ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
363 |
package := self package. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
364 |
(package notNil and:[package ~= 'no package']) |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
365 |
ifTrue:[ |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
366 |
newClass setPackage:package. |
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
367 |
]. |
1 | 368 |
]. |
369 |
||
216 | 370 |
LoadedClasses isNil ifTrue:[ |
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
371 |
LoadedClasses := IdentitySet new. |
216 | 372 |
]. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
373 |
LoadedClasses add:newClass. |
216 | 374 |
|
154 | 375 |
"wow - it worked. now the big trick ..." |
1 | 376 |
|
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
377 |
"/ 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
|
378 |
oldMeta := self class. |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
379 |
|
3267
870789c08fad
do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents:
3151
diff
changeset
|
380 |
"/ 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
|
381 |
|
860
b3ffea40999a
use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents:
789
diff
changeset
|
382 |
self becomeSameAs:newClass. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
383 |
oldMeta becomeSameAs:newClass class. |
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
384 |
|
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
385 |
ObjectMemory flushCaches. |
216 | 386 |
LoadedClasses rehash. |
921
4db7603f9506
rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents:
886
diff
changeset
|
387 |
|
3443
d57ea75d3ac5
oops - must send #initialize to all privateClasses.
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
388 |
newClass initializeWithAllPrivateClasses. |
886 | 389 |
newClass postAutoload. |
390 |
^ newClass |
|
938
a23bc7f62ed1
set package info when autoloading
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
391 |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
392 |
"Modified: / 5.3.1999 / 12:59:13 / cg" |
1 | 393 |
! ! |
394 |
||
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
395 |
!Autoload class methodsFor:'message catching'! |
1 | 396 |
|
620 | 397 |
basicNew |
1277 | 398 |
"catch basicNew - load the class and send it to the real one" |
620 | 399 |
|
400 |
^ self doesNotUnderstand:(Message selector:#basicNew) |
|
1277 | 401 |
|
402 |
"Modified: 24.4.1996 / 19:53:10 / cg" |
|
620 | 403 |
! |
404 |
||
405 |
basicNew:arg |
|
1277 | 406 |
"catch basicNew: - load the class and send it to the real one" |
620 | 407 |
|
408 |
^ self doesNotUnderstand:(Message selector:#basicNew: with:arg) |
|
1277 | 409 |
|
410 |
"Modified: 24.4.1996 / 19:53:16 / cg" |
|
620 | 411 |
! |
412 |
||
413 |
comment |
|
414 |
"return the classes comment. |
|
415 |
Autoloaded classes have no comment; but I myself have one" |
|
416 |
||
417 |
(self == Autoload) ifTrue:[^ super comment]. |
|
418 |
^ 'not yet loaded' |
|
419 |
! |
|
420 |
||
1 | 421 |
doesNotUnderstand:aMessage |
2689 | 422 |
"caught a message; load the class and retry the message" |
1 | 423 |
|
424 |
|newClass| |
|
425 |
||
164 | 426 |
self ~~ Autoload ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
427 |
newClass := self autoload. |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
428 |
newClass notNil ifTrue:[ |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
429 |
^ newClass perform:(aMessage selector) |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
430 |
withArguments:(aMessage arguments) |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
431 |
] |
1 | 432 |
]. |
789
155eca125ef0
return value from doesNotUnderstand (so handler can return a value)
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
433 |
^ super doesNotUnderstand:aMessage |
1277 | 434 |
|
435 |
"Modified: 24.4.1996 / 19:53:27 / cg" |
|
1 | 436 |
! |
437 |
||
438 |
new |
|
2663 | 439 |
"catch new - load the class and resend #new to the real one" |
1 | 440 |
|
441 |
^ self doesNotUnderstand:(Message selector:#new) |
|
1277 | 442 |
|
2663 | 443 |
"Modified: 26.5.1997 / 14:59:52 / cg" |
1 | 444 |
! |
445 |
||
446 |
new:arg |
|
2663 | 447 |
"catch new: - load the class and resend #new: it to the real one" |
1 | 448 |
|
449 |
^ self doesNotUnderstand:(Message selector:#new: with:arg) |
|
1277 | 450 |
|
2663 | 451 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
1 | 452 |
! |
453 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
454 |
readFrom:aStream |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
455 |
"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
|
456 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
457 |
^ self doesNotUnderstand:(Message selector:#readFrom: with:aStream) |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
458 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
459 |
"Created: 22.5.1996 / 23:44:23 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
460 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
461 |
|
1437 | 462 |
readFrom:aStream onError:exceptionBlock |
463 |
"catch - load the class and send it to the real one" |
|
464 |
||
465 |
^ self doesNotUnderstand:(Message selector:#readFrom:onError: with:aStream with:exceptionBlock) |
|
466 |
||
467 |
"Created: 22.5.1996 / 23:03:39 / stefan" |
|
468 |
! |
|
469 |
||
1438
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
470 |
readFromString:aString |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
471 |
"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
|
472 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
473 |
^ self doesNotUnderstand:(Message selector:#readFromString: with:aString) |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
474 |
|
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
475 |
"Created: 22.5.1996 / 23:46:15 / stefan" |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
476 |
! |
76fdecf85f9e
Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents:
1437
diff
changeset
|
477 |
|
1437 | 478 |
readFromString:aString onError:exceptionBlock |
479 |
"catch - load the class and send it to the real one" |
|
480 |
||
481 |
^ self doesNotUnderstand:(Message selector:#readFromString:onError: with:aString with:exceptionBlock) |
|
482 |
||
483 |
"Created: 22.5.1996 / 23:04:49 / stefan" |
|
484 |
! |
|
485 |
||
2691
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
486 |
respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
487 |
"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
|
488 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
489 |
self == Autoload ifTrue:[ |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
490 |
^ super respondsTo:aSelector |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
491 |
]. |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
492 |
^ self doesNotUnderstand:(Message selector:#respondsTo: with:aSelector) |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
493 |
|
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
494 |
"Modified: 26.5.1997 / 14:59:58 / cg" |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
495 |
! |
33221e233f79
when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents:
2689
diff
changeset
|
496 |
|
2366
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
497 |
subclass:nameSymbol instanceVariableNames:instVarNames classVariableNames:cVarNames poolDictionaries:pools category:cat |
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
498 |
"catch subclass creation - this forces missing superclasses to be |
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
499 |
loaded first" |
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
500 |
|
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
501 |
^ self |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
502 |
subclass:nameSymbol |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
503 |
instanceVariableNames:instVarNames |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
504 |
classVariableNames:cVarNames |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
505 |
poolDictionaries:pools |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
506 |
category:cat |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
507 |
inEnvironment:(Class nameSpaceQuerySignal raise) |
2366
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
508 |
|
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
509 |
"Modified: 8.2.1997 / 20:06:22 / cg" |
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
510 |
! |
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
511 |
|
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
512 |
subclass:nameSymbol instanceVariableNames:instVarNames classVariableNames:cVarNames poolDictionaries:poolDicts category:cat inEnvironment:aNameSpace |
2 | 513 |
"catch subclass creation - this forces missing superclasses to be |
514 |
loaded first" |
|
515 |
||
68 | 516 |
|newClass sel args| |
1 | 517 |
|
2 | 518 |
"take care: subclassing Autoload must still be possible" |
1 | 519 |
(self == Autoload) ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
520 |
^ super |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
521 |
subclass:nameSymbol |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
522 |
instanceVariableNames:instVarNames |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
523 |
classVariableNames:cVarNames |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
524 |
poolDictionaries:poolDicts |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
525 |
category:cat |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
526 |
inEnvironment:aNameSpace |
1 | 527 |
]. |
2366
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
528 |
|
1 | 529 |
newClass := self autoload. |
68 | 530 |
sel := thisContext selector. |
531 |
args := thisContext args. |
|
1 | 532 |
newClass notNil ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
533 |
^ newClass perform:sel withArguments:args |
1 | 534 |
]. |
535 |
^ nil |
|
2366
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
536 |
|
bbe8c60d7c9f
additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents:
2223
diff
changeset
|
537 |
"Created: 8.2.1997 / 19:42:47 / cg" |
2531
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
538 |
! |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
539 |
|
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
540 |
subclass:nameSymbol instanceVariableNames:instVarNames classVariableNames:cVarNames poolDictionaries:poolDicts privateIn:owningClass |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
541 |
"catch subclass creation - this forces missing superclasses to be |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
542 |
loaded first" |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
543 |
|
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
544 |
|newClass sel args| |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
545 |
|
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
546 |
"take care: subclassing Autoload must still be possible" |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
547 |
(self == Autoload) ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
548 |
^ super |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
549 |
subclass:nameSymbol |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
550 |
instanceVariableNames:instVarNames |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
551 |
classVariableNames:cVarNames |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
552 |
poolDictionaries:poolDicts |
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
553 |
privateIn:owningClass |
2531
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
554 |
]. |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
555 |
|
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
556 |
newClass := self autoload. |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
557 |
sel := thisContext selector. |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
558 |
args := thisContext args. |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
559 |
newClass notNil ifTrue:[ |
3027
7d677a5ced41
care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents:
2691
diff
changeset
|
560 |
^ newClass perform:sel withArguments:args |
2531
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
561 |
]. |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
562 |
^ nil |
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
563 |
|
1e22ac3610a4
care for private classes being subclass of an autoloadedClass.
ca
parents:
2375
diff
changeset
|
564 |
"Created: 8.2.1997 / 19:42:47 / cg" |
1 | 565 |
! ! |
11 | 566 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
567 |
!Autoload class methodsFor:'queries'! |
356 | 568 |
|
4011 | 569 |
allPrivateClassesDo:aBlock |
570 |
"an autoloaded class has none" |
|
571 |
! |
|
572 |
||
620 | 573 |
isBehavior |
574 |
"return true if the recevier is some kind of class. |
|
575 |
Autoloaded classes are definitely; therefore return true." |
|
164 | 576 |
|
620 | 577 |
^ true |
578 |
! |
|
356 | 579 |
|
729 | 580 |
isBuiltInClass |
1266 | 581 |
"return true if this class is known by the run-time-system. |
582 |
Returns false here." |
|
583 |
||
729 | 584 |
^ false |
585 |
||
586 |
"Created: 10.12.1995 / 00:28:22 / cg" |
|
1266 | 587 |
"Modified: 23.4.1996 / 15:55:36 / cg" |
729 | 588 |
! |
589 |
||
620 | 590 |
isLoaded |
3287 | 591 |
"return true, if the class has been loaded. |
592 |
Autoload itself is loaded, subclasses are not. |
|
593 |
This allows testing wether a class has already been loaded." |
|
620 | 594 |
|
595 |
^ (self == Autoload) |
|
3287 | 596 |
|
597 |
"Modified: / 16.2.1998 / 11:57:35 / stefan" |
|
620 | 598 |
! |
599 |
||
922 | 600 |
loadedClasses |
601 |
"return the set of classes that were autoloaded" |
|
602 |
||
603 |
^ LoadedClasses |
|
604 |
! |
|
605 |
||
4000 | 606 |
privateClasses |
607 |
"an autoloaded class has none" |
|
608 |
||
609 |
^ #() |
|
610 |
! |
|
611 |
||
620 | 612 |
wasAutoloaded:aClass |
922 | 613 |
"return true, if aClass was autoloaded" |
614 |
||
620 | 615 |
^ LoadedClasses notNil and:[LoadedClasses includes:aClass] |
11 | 616 |
! ! |
620 | 617 |
|
1862
e8f44f10f1ab
changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents:
1720
diff
changeset
|
618 |
!Autoload class methodsFor:'documentation'! |
661 | 619 |
|
620 |
version |
|
4025
d9b9a5e77f1a
when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents:
4016
diff
changeset
|
621 |
^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.86 1999-03-05 11:58:38 cg Exp $' |
661 | 622 |
! ! |
620 | 623 |
Autoload initialize! |