author | Claus Gittinger <cg@exept.de> |
Fri, 06 Nov 2009 00:19:10 +0100 | |
changeset 12507 | 41ac4792b598 |
parent 12272 | 6d68662ed857 |
child 12836 | 16dfb973e06c |
permissions | -rw-r--r-- |
5271 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
" |
|
12272 | 12 |
'From Smalltalk/X, Version:5.4.6 on 14-10-2009 at 12:55:43' ! |
13 |
||
11112 | 14 |
"{ Package: 'stx:libbasic' }" |
5271 | 15 |
|
4509 | 16 |
Metaclass subclass:#AutoloadMetaclass |
17 |
instanceVariableNames:'' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Kernel-Classes' |
|
21 |
! |
|
22 |
||
23 |
!AutoloadMetaclass class methodsFor:'documentation'! |
|
24 |
||
5271 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
! |
|
39 |
||
4509 | 40 |
documentation |
41 |
" |
|
42 |
AutoloadMetaclass catches unhandled class methods, files in |
|
43 |
the corresponding code when first used and resends the catched |
|
44 |
message to the now existing class. |
|
45 |
||
46 |
Autoload installs AutoloadMetaclass as its metaclass in #initialize. |
|
47 |
||
48 |
[author:] |
|
49 |
Stefan Vogel |
|
50 |
||
51 |
[see also:] |
|
52 |
Autoload |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!AutoloadMetaclass methodsFor:'message catching'! |
|
57 |
||
58 |
doesNotUnderstand:aMessage |
|
59 |
"caught a message; load the class and retry the message" |
|
60 |
||
61 |
|newClass| |
|
62 |
||
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
63 |
(myClass isNil or:[myClass == Autoload]) ifTrue:[ |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
64 |
"take care: subclassing Autoload must still be possible" |
12272 | 65 |
^ self perform:aMessage selector inClass:Metaclass withArguments:aMessage arguments. |
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
66 |
] ifFalse:[ |
4509 | 67 |
newClass := myClass autoload. |
12267 | 68 |
(newClass notNil and:[newClass isLoaded]) ifTrue:[ |
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
69 |
^ aMessage sendTo:newClass class |
12267 | 70 |
] ifFalse:[ |
71 |
Transcript showCR:'Autoload [warning]: failed to autoload ',self name. |
|
72 |
]. |
|
4509 | 73 |
]. |
74 |
^ super doesNotUnderstand:aMessage |
|
75 |
||
76 |
" |
|
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
77 |
Wrapper unload. |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
78 |
Wrapper class xxx |
4509 | 79 |
|
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
80 |
Wrapper unload. |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
81 |
Wrapper |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
82 |
subclass:#TTTT |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
83 |
instanceVariableNames:'' |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
84 |
classVariableNames:'' |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
85 |
poolDictionaries:'' |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
86 |
category:'AAAA-Test' |
4509 | 87 |
" |
88 |
||
89 |
"Modified: / 3.8.1999 / 13:57:05 / stefan" |
|
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
90 |
! |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
91 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
92 |
new |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
93 |
"catch - load the class and send it to the real one" |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
94 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
95 |
^ self doesNotUnderstand:(Message selector:#new) |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
96 |
! |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
97 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
98 |
newClassBuilder |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
99 |
"catch - load the class and send it to the real one" |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
100 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
101 |
^ self doesNotUnderstand:(Message selector:#newClassBuilder) |
4509 | 102 |
! ! |
103 |
||
104 |
!AutoloadMetaclass class methodsFor:'documentation'! |
|
105 |
||
106 |
version |
|
12272 | 107 |
^ '$Header: /cvs/stx/stx/libbasic/AutoloadMetaclass.st,v 1.7 2009-10-14 11:36:30 stefan Exp $' |
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
108 |
! |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
109 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
110 |
version_CVS |
12272 | 111 |
^ '$Header: /cvs/stx/stx/libbasic/AutoloadMetaclass.st,v 1.7 2009-10-14 11:36:30 stefan Exp $' |
4509 | 112 |
! ! |