author | Claus Gittinger <cg@exept.de> |
Wed, 07 Feb 1996 15:11:43 +0100 | |
changeset 939 | ffee570b0f09 |
parent 912 | a009f25a6800 |
child 943 | 57641242a972 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
159 | 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 |
||
13 |
Class subclass:#Metaclass |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
14 |
instanceVariableNames:'myClass' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
15 |
classVariableNames:'' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
16 |
poolDictionaries:'' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
17 |
category:'Kernel-Classes' |
1 | 18 |
! |
19 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
20 |
!Metaclass class methodsFor:'documentation'! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
21 |
|
88 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
159 | 25 |
All Rights Reserved |
1 | 26 |
|
88 | 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 |
" |
|
621 | 34 |
! |
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
every classes class is a subclass of Metaclass. |
|
39 |
(i.e. every class is the sole instance of its Metaclass) |
|
40 |
Metaclass provides support for creating new (sub)classes and/or |
|
41 |
changing the definition of an already existing class. |
|
42 |
" |
|
88 | 43 |
! ! |
1 | 44 |
|
356 | 45 |
!Metaclass class methodsFor:'creating metaclasses'! |
46 |
||
47 |
new |
|
48 |
"creating a new metaclass - have to set the new classes |
|
49 |
flags correctly to have it behave like a metaclass ... |
|
50 |
Not for normal applications - creating new metaclasses is a very |
|
51 |
tricky thing; should be left to the gurus ;-)" |
|
52 |
||
53 |
|newMetaclass| |
|
54 |
||
55 |
newMetaclass := super new. |
|
56 |
newMetaclass instSize:(Class instSize). |
|
57 |
newMetaclass setSuperclass:Class. |
|
58 |
||
59 |
^ newMetaclass |
|
60 |
||
61 |
" |
|
62 |
Metaclass new <- new metaclass |
|
63 |
Metaclass new new <- new class |
|
64 |
Metaclass new new new <- new instance |
|
65 |
" |
|
66 |
! ! |
|
67 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
68 |
!Metaclass methodsFor:'accessing'! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
69 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
70 |
name |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
71 |
"return my name - that is the name of my sole class, with 'class' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
72 |
appended. Currently, this is incompatible to ST-80 (which appends ' class') |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
73 |
and will be changed (have to check for side effects first ...)" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
74 |
|
682
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
75 |
|nm| |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
76 |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
77 |
myClass isNil ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
78 |
^ 'someMetaclass' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
79 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
80 |
"/ ^ myClass name , ' class' |
682
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
81 |
|
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
82 |
(nm := myClass name) isNil ifTrue:[ |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
83 |
'oops - no name in my class' errorPrintNL. |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
84 |
name notNil ifTrue:[ |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
85 |
^ name |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
86 |
]. |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
87 |
]. |
a10f434805a7
be somewhat more robust against bad classnames ...
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
88 |
^ nm , 'class' |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
89 |
! ! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
90 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
91 |
!Metaclass methodsFor:'class instance variables'! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
92 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
93 |
instanceVariableNames:aString |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
94 |
"changing / adding class-inst vars - |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
95 |
this actually creates a new metaclass and class, leaving the original |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
96 |
classes around as obsolete classes. This may also be true for all subclasses, |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
97 |
if class instance variables are added/removed. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
98 |
Existing instances continue to be defined by their original classes. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
99 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
100 |
Time will show, if this is an acceptable behavior or if we should migrate |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
101 |
instances to become insts. of the new classes." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
102 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
103 |
|newClass newMetaclass nClassInstVars oldClass |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
104 |
allSubclasses oldVars |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
105 |
oldNames newNames addedNames |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
106 |
oldOffsets newOffsets offset changeSet delta |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
107 |
oldToNew newSubMeta newSub oldSubMeta oldSuper |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
108 |
commonClassInstVars currentProject t| |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
109 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
110 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
111 |
cleanup needed here: extract common things with name:inEnvironment:... |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
112 |
and restructure things ... currently way too complex. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
113 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
114 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
115 |
oldVars := self instanceVariableString. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
116 |
aString = oldVars ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
117 |
" |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
118 |
Transcript showCr:'no change (', oldVars , ') -> (', aString , ')'. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
119 |
" |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
120 |
^ self |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
121 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
122 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
123 |
oldNames := oldVars asCollectionOfWords. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
124 |
newNames := aString asCollectionOfWords. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
125 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
126 |
oldNames = newNames ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
127 |
" |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
128 |
Transcript showCr:'no real change'. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
129 |
" |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
130 |
"no real change (just formatting)" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
131 |
self setInstanceVariableString:aString. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
132 |
^ self |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
133 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
134 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
135 |
"/ " |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
136 |
"/ let user confirm, if any name is no good (and was good before) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
137 |
"/ " |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
138 |
"/ (oldNames inject:true |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
139 |
"/ into:[:okSoFar :word | |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
140 |
"/ okSoFar and:[word first isUppercase] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
141 |
"/ ]) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
142 |
"/ ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
143 |
"/ "was ok before" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
144 |
"/ (newNames inject:true |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
145 |
"/ into:[:okSoFar :word | |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
146 |
"/ okSoFar and:[word first isUppercase] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
147 |
"/ ]) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
148 |
"/ ifFalse:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
149 |
"/ (self confirm:'class instance variable names should start with an uppercase letter |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
150 |
"/(by convention only) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
151 |
"/ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
152 |
"/install anyway ?' withCRs) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
153 |
"/ ifFalse:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
154 |
"/ ^ nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
155 |
"/ ] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
156 |
"/ ] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
157 |
"/ ]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
158 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
159 |
nClassInstVars := newNames size. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
160 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
161 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
162 |
Transcript showCr:'create new class/metaclass'. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
163 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
164 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
165 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
166 |
create the new metaclass |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
167 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
168 |
newMetaclass := Metaclass new. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
169 |
newMetaclass setSuperclass:superclass. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
170 |
newMetaclass instSize:(superclass instSize + nClassInstVars). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
171 |
(nClassInstVars ~~ 0) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
172 |
newMetaclass setInstanceVariableString:aString |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
173 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
174 |
"/ newMetaclass flags:(Behavior flagBehavior "flagNotIndexed"). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
175 |
newMetaclass setName:name. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
176 |
newMetaclass classVariableString:classvars. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
177 |
newMetaclass category:category. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
178 |
newMetaclass setComment:(self comment). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
179 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
180 |
"find the class which is my sole instance" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
181 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
182 |
t := Smalltalk allClasses select:[:element | element class == self]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
183 |
(t size ~~ 1) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
184 |
self error:'oops - I should have exactly one instance'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
185 |
^ nil |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
186 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
187 |
oldClass := t anElement. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
188 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
189 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
190 |
create the new class |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
191 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
192 |
newClass := newMetaclass new. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
193 |
newClass setSuperclass:(oldClass superclass). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
194 |
newClass instSize:(oldClass instSize). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
195 |
newClass flags:(oldClass flags). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
196 |
newClass setName:(oldClass name). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
197 |
newClass setInstanceVariableString:(oldClass instanceVariableString). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
198 |
newClass classVariableString:(oldClass classVariableString). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
199 |
newClass setComment:(oldClass comment). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
200 |
newClass category:(oldClass category). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
201 |
(t := oldClass primitiveSpec) notNil ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
202 |
newClass primitiveSpec:t. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
203 |
newClass setClassFilename:(oldClass classFilename). |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
204 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
205 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
206 |
"/ set the new classes package |
566
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
207 |
"/ from the old package |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
208 |
|
566
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
209 |
t := oldClass package. |
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
210 |
newMetaclass package:t. |
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
211 |
newClass package:t. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
212 |
|
723
ebc969b4678d
preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
213 |
"/ and keep the binary revision |
ebc969b4678d
preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
214 |
newClass setBinaryRevision:(oldClass revision). |
ebc969b4678d
preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
215 |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
216 |
changeSet := Set new. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
217 |
((oldNames size == 0) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
218 |
or:[newNames startsWith:oldNames]) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
219 |
"new variable(s) has/have been added - old methods still work" |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
220 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
221 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
222 |
Transcript showCr:'copying methods ...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
223 |
Transcript endEntry. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
224 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
225 |
self copyMethodsFrom:self for:newMetaclass. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
226 |
self copyMethodsFrom:oldClass for:newClass. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
227 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
228 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
229 |
but have to recompile methods accessing stuff now defined |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
230 |
(it might have been a global before ...) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
231 |
" |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
232 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
233 |
addedNames := newNames select:[:nm | (oldNames includes:nm) not]. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
234 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
235 |
Transcript showCr:'recompiling methods accessing ' , addedNames printString , '...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
236 |
Transcript endEntry. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
237 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
238 |
"recompile class-methods" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
239 |
newMetaclass recompileMethodsAccessingAny:addedNames. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
240 |
] ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
241 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
242 |
create the changeSet; thats the set of class instvar names |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
243 |
which have changed their position or are new |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
244 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
245 |
offset := 0. oldOffsets := Dictionary new. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
246 |
oldNames do:[:nm | offset := offset + 1. oldOffsets at:nm put:offset]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
247 |
offset := 0. newOffsets := Dictionary new. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
248 |
newNames do:[:nm | offset := offset + 1. newOffsets at:nm put:offset]. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
249 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
250 |
oldOffsets associationsDo:[:a | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
251 |
|k| |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
252 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
253 |
k := a key. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
254 |
(newOffsets includesKey:k) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
255 |
changeSet add:k |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
256 |
] ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
257 |
(a value ~~ (newOffsets at:k)) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
258 |
changeSet add:k |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
259 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
260 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
261 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
262 |
newOffsets associationsDo:[:a | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
263 |
|k| |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
264 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
265 |
k := a key. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
266 |
(oldOffsets includesKey:k) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
267 |
changeSet add:k |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
268 |
] ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
269 |
(a value ~~ (oldOffsets at:k)) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
270 |
changeSet add:k |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
271 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
272 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
273 |
]. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
274 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
275 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
276 |
Transcript showCr:'recompiling methods accessing ' , changeSet printString , ' ...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
277 |
Transcript endEntry. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
278 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
279 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
280 |
recompile class-methods |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
281 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
282 |
self copyInvalidatedMethodsFrom:self for:newMetaclass accessingAny:changeSet. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
283 |
newMetaclass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject). |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
284 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
285 |
self copyMethodsFrom:oldClass for:newClass. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
286 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
287 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
288 |
delta := newNames size - oldNames size. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
289 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
290 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
291 |
get list of all subclasses - do before superclass is changed |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
292 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
293 |
allSubclasses := oldClass allSubclasses. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
294 |
allSubclasses := allSubclasses asSortedCollection:[:a :b | |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
295 |
b isSubclassOf:a |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
296 |
]. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
297 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
298 |
oldToNew := IdentityDictionary new. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
299 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
300 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
301 |
create a new class tree, based on new version |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
302 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
303 |
allSubclasses do:[:aSubclass | |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
304 |
oldSuper := aSubclass superclass. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
305 |
oldSubMeta := aSubclass class. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
306 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
307 |
newSubMeta := Metaclass new. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
308 |
oldSuper == oldClass ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
309 |
newSubMeta setSuperclass:newMetaclass. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
310 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
311 |
newSubMeta setSuperclass:(oldToNew at:oldSuper) class. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
312 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
313 |
newSubMeta instSize:(oldSubMeta instSize + delta). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
314 |
newSubMeta flags:(oldSubMeta flags). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
315 |
newSubMeta setName:(oldSubMeta name). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
316 |
newSubMeta setInstanceVariableString:(oldSubMeta instanceVariableString). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
317 |
newSubMeta classVariableString:(oldSubMeta classVariableString). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
318 |
newSubMeta setComment:(oldSubMeta comment). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
319 |
newSubMeta category:(oldSubMeta category). |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
320 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
321 |
newSub := newSubMeta new. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
322 |
oldSuper == oldClass ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
323 |
newSub setSuperclass:newClass. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
324 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
325 |
newSub setSuperclass:(oldToNew at:oldSuper). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
326 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
327 |
newSub setSelectorArray:(aSubclass selectorArray). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
328 |
newSub setMethodArray:(aSubclass methodArray). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
329 |
newSub setName:(aSubclass name). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
330 |
newSub classVariableString:(aSubclass classVariableString). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
331 |
newSub setComment:(aSubclass comment). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
332 |
newSub category:(aSubclass category). |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
333 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
334 |
oldToNew at:aSubclass put:newSub. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
335 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
336 |
aSubclass category:'obsolete'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
337 |
aSubclass class category:'obsolete'. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
338 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
339 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
340 |
"recompile what needs to be" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
341 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
342 |
delta == 0 ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
343 |
"only have to recompile class methods accessing |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
344 |
class instvars from changeset |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
345 |
" |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
346 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
347 |
allSubclasses do:[:oldSubclass | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
348 |
|newSubclass| |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
349 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
350 |
newSubclass := oldToNew at:oldSubclass. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
351 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
352 |
Transcript showCr:'recompiling class methods of ' , newSubclass class name , |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
353 |
' accessing any of ' , changeSet printString. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
354 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
355 |
newSubclass class recompileMethodsAccessingAny:changeSet. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
356 |
] |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
357 |
] ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
358 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
359 |
have to recompile all class methods accessing class instvars |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
360 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
361 |
commonClassInstVars := oldClass class allInstVarNames. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
362 |
changeSet do:[:v | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
363 |
commonClassInstVars remove:v ifAbsent:[] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
364 |
]. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
365 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
366 |
allSubclasses do:[:oldSubclass | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
367 |
|newSubclass classInstVars| |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
368 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
369 |
newSubclass := oldToNew at:oldSubclass. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
370 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
371 |
classInstVars := newSubclass class allInstVarNames asSet. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
372 |
classInstVars removeAll:commonClassInstVars. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
373 |
classInstVars addAll:changeSet. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
374 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
375 |
Transcript showCr:'recompiling class methods of ' , newSubclass class name , |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
376 |
' accessing any of ' , classInstVars printString. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
377 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
378 |
newSubclass class recompileMethodsAccessingAny:classInstVars. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
379 |
] |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
380 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
381 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
382 |
self addChangeRecordForClassInstvars:newClass. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
383 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
384 |
"install all new classes" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
385 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
386 |
Smalltalk at:(oldClass name asSymbol) put:newClass. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
387 |
ObjectMemory flushCachesFor:oldClass. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
388 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
389 |
allSubclasses do:[:oldClass | |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
390 |
|newClass| |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
391 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
392 |
newClass := oldToNew at:oldClass. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
393 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
394 |
Transcript showCr:'install ' , newClass name , '(' , newClass category , ')' , |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
395 |
' as ' , newClass name. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
396 |
" |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
397 |
Smalltalk at:newClass name asSymbol put:newClass. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
398 |
ObjectMemory flushCachesFor:oldClass. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
399 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
400 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
401 |
"tell dependents ..." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
402 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
403 |
oldClass changed:#definition. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
404 |
self changed:#definition. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
405 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
406 |
^ newMetaclass |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
407 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
408 |
"Created: 29.10.1995 / 19:57:08 / cg" |
723
ebc969b4678d
preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
409 |
"Modified: 9.12.1995 / 17:05:44 / cg" |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
410 |
! ! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
411 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
412 |
!Metaclass methodsFor:'copying'! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
413 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
414 |
postCopy |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
415 |
"redefined - a copy may have a new instance" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
416 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
417 |
myClass := nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
418 |
! ! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
419 |
|
1 | 420 |
!Metaclass methodsFor:'creating classes'! |
421 |
||
422 |
name:newName inEnvironment:aSystemDictionary |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
423 |
subclassOf:aClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
424 |
instanceVariableNames:stringOfInstVarNames |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
425 |
variable:variableBoolean |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
426 |
words:wordsBoolean |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
427 |
pointers:pointersBoolean |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
428 |
classVariableNames:stringOfClassVarNames |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
429 |
poolDictionaries:stringOfPoolNames |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
430 |
category:categoryString |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
431 |
comment:commentString |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
432 |
changed:changed |
1 | 433 |
|
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
434 |
^ self |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
435 |
name:newName |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
436 |
inEnvironment:aSystemDictionary |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
437 |
subclassOf:aClass |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
438 |
instanceVariableNames:stringOfInstVarNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
439 |
variable:variableBoolean |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
440 |
words:wordsBoolean |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
441 |
pointers:pointersBoolean |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
442 |
classVariableNames:stringOfClassVarNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
443 |
poolDictionaries:stringOfPoolNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
444 |
category:categoryString |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
445 |
comment:commentString |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
446 |
changed:changed |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
447 |
classInstanceVariableNames:'' |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
448 |
|
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
449 |
"Modified: 22.1.1996 / 13:18:08 / cg" |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
450 |
! |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
451 |
|
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
452 |
name:newName inEnvironment:aSystemDictionary |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
453 |
subclassOf:aClass |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
454 |
instanceVariableNames:stringOfInstVarNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
455 |
variable:variableBoolean |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
456 |
words:wordsBoolean |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
457 |
pointers:pointersBoolean |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
458 |
classVariableNames:stringOfClassVarNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
459 |
poolDictionaries:stringOfPoolNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
460 |
category:categoryString |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
461 |
comment:commentString |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
462 |
changed:changed |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
463 |
classInstanceVariableNames:stringOfClassInstVarNames |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
464 |
|
13 | 465 |
"this is the main workhorse for installing new classes - special care |
466 |
has to be taken, when changing an existing classes definition. In this |
|
467 |
case, some or all of the methods and subclasses methods have to be |
|
468 |
recompiled. |
|
469 |
Also, the old class(es) are still kept (but not accessable as a global), |
|
470 |
to allow existing instances some life. |
|
471 |
This might change in the future. |
|
472 |
" |
|
473 |
||
1 | 474 |
|newClass newMetaclass nInstVars nameString classSymbol oldClass |
175 | 475 |
classVarChange instVarChange superClassChange newComment |
308 | 476 |
changeSet1 changeSet2 addedNames |
326 | 477 |
anyChange oldInstVars newInstVars oldClassVars newClassVars superFlags newFlags |
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
478 |
project currentProject t nClassInstVars| |
13 | 479 |
|
68 | 480 |
"NOTICE: |
481 |
this method is too complex and should be splitted into managable pieces ... |
|
159 | 482 |
I dont like it anymore :-) |
356 | 483 |
(well, at least, its a good test for the compilers ability |
484 |
to handle big, complex methods ;-) |
|
485 |
take it as an example of bad coding style ... |
|
486 |
||
487 |
ST-80 uses a ClassBuilder object to collect the work and perform all updates; |
|
488 |
this method may be changed to do something similar in the future ... |
|
68 | 489 |
" |
13 | 490 |
|
328 | 491 |
project := Project. "/ have to fetch this before, in case its autoloaded |
492 |
||
13 | 493 |
newName = aClass name ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
494 |
self error:'trying to create circular class definition'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
495 |
^ nil |
13 | 496 |
]. |
1 | 497 |
|
49 | 498 |
"check for invalid subclassing of UndefinedObject and SmallInteger" |
499 |
aClass canBeSubclassed ifFalse:[ |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
500 |
self error:('it is not possible to subclass ' , aClass name). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
501 |
^ nil |
49 | 502 |
]. |
503 |
||
1 | 504 |
nInstVars := stringOfInstVarNames countWords. |
505 |
nameString := newName asString. |
|
13 | 506 |
classSymbol := newName asSymbol. |
1 | 507 |
newComment := commentString. |
508 |
||
13 | 509 |
"look, if it already exists as a class" |
870 | 510 |
aSystemDictionary notNil ifTrue:[ |
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
511 |
oldClass := aSystemDictionary at:classSymbol ifAbsent:[nil]. |
870 | 512 |
]. |
866
615ea25db48b
dont copy comment from autoloaded classes
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
513 |
(oldClass isBehavior and:[oldClass isLoaded]) ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
514 |
oldClass := nil. |
68 | 515 |
] ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
516 |
oldClass name ~= classSymbol ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
517 |
(self confirm:(classSymbol , ' is an alias for ' , oldClass name , '\\continue ?') withCRs) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
518 |
ifFalse:[^ self]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
519 |
oldClass := nil |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
520 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
521 |
"/ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
522 |
"/ some consisteny checks |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
523 |
"/ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
524 |
oldClass superclass notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
525 |
oldClass allSuperclasses do:[:cls | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
526 |
cls name = nameString ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
527 |
self error:'trying to create circular class definition'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
528 |
^ nil |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
529 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
530 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
531 |
]. |
13 | 532 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
533 |
aClass superclass notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
534 |
aClass allSuperclasses do:[:cls | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
535 |
cls name = nameString ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
536 |
self error:'trying to create circular class definition'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
537 |
^ nil |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
538 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
539 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
540 |
]. |
328 | 541 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
542 |
newComment isNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
543 |
newComment := oldClass comment |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
544 |
]. |
68 | 545 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
546 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
547 |
warn, if it exists with different category and different instvars, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
548 |
and the existing is not an autoload class. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
549 |
Usually, this indicates that someone wants to create a new class with |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
550 |
a name, which already exists (it happened a few times to myself, while |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
551 |
I wanted to create a new class called ReturnNode ...). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
552 |
This will be much less of a problem, once multiple name spaces are |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
553 |
implemented and classes can be put into separate packages. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
554 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
555 |
oldClass isLoaded ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
556 |
oldClass category ~= categoryString ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
557 |
oldClass instanceVariableString asCollectionOfWords |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
558 |
~= stringOfInstVarNames asCollectionOfWords ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
559 |
(self confirm:'a class named ' , oldClass name , |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
560 |
' already exists -\\create (i.e. change) anyway ?' withCRs) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
561 |
ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
562 |
^ nil |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
563 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
564 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
565 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
566 |
]. |
362 | 567 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
568 |
"/ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
569 |
"/ hints - warn, if creating a variableSubclass of a Set |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
570 |
"/ (common error - containers in ST/X do not use variable-slots) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
571 |
"/ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
572 |
((variableBoolean == true) and:[pointersBoolean]) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
573 |
(oldClass isKindOf:Set class) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
574 |
(self confirm:'ST/X Set & Dictionary are not variable-classes\create anyway ?' withCRs) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
575 |
ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
576 |
^ nil |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
577 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
578 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
579 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
580 |
] |
1 | 581 |
]. |
582 |
||
68 | 583 |
" |
584 |
Check for some 'considered bad-style' things, like lower case names. |
|
585 |
But only do these checks for new classes - |
|
586 |
- thus, once confirmed, the warnings will not come again and again. |
|
587 |
||
588 |
NOTICE: |
|
195 | 589 |
I dont like the confirmers there - we need a notifying: argument, to give |
44 | 590 |
the outer codeview a chance to highlight the error. |
68 | 591 |
(but thats how its defined in the book - maybe I will change anyway). |
592 |
" |
|
44 | 593 |
oldClass isNil ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
594 |
(self checkConventionsFor:newName |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
595 |
instVarNames:stringOfInstVarNames |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
596 |
classVarNames:stringOfClassVarNames) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
597 |
^ nil |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
598 |
] |
44 | 599 |
]. |
600 |
||
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
601 |
nClassInstVars := stringOfClassInstVarNames countWords. |
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
602 |
|
1 | 603 |
"create the metaclass first" |
604 |
newMetaclass := Metaclass new. |
|
605 |
newMetaclass setSuperclass:(aClass class). |
|
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
606 |
newMetaclass instSize:(aClass class instSize + nClassInstVars). |
175 | 607 |
newMetaclass setName:(nameString , 'class') asSymbol. |
1 | 608 |
newMetaclass classVariableString:'' "stringOfClassVarNames". |
226 | 609 |
"/ newMetaclass setComment:newComment category:categoryString. |
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
610 |
newMetaclass setInstanceVariableString:stringOfClassInstVarNames. |
326 | 611 |
|
195 | 612 |
"then let the new meta create the class" |
1 | 613 |
newClass := newMetaclass new. |
614 |
newClass setSuperclass:aClass. |
|
615 |
newClass instSize:(aClass instSize + nInstVars). |
|
175 | 616 |
newClass setName:classSymbol. |
617 |
newClass setComment:newComment category:categoryString. |
|
1 | 618 |
|
362 | 619 |
"/ set the new classes package |
566
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
620 |
"/ but prefer the old package |
362 | 621 |
|
566
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
622 |
oldClass notNil ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
623 |
t := oldClass package. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
624 |
newClass setBinaryRevision:(oldClass revision). |
566
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
625 |
] ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
626 |
project notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
627 |
currentProject := project current. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
628 |
currentProject notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
629 |
t := currentProject packageName. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
630 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
631 |
]. |
566
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
632 |
]. |
3d2527a9e96d
preserve package when class definition changes - its required for the SourceCodeManager
Claus Gittinger <cg@exept.de>
parents:
544
diff
changeset
|
633 |
t notNil ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
634 |
newMetaclass package:t. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
635 |
newClass package:t. |
362 | 636 |
]. |
637 |
||
68 | 638 |
" |
639 |
Allowing non-booleans as variableBoolean |
|
640 |
is a hack for backward (ST-80) compatibility: |
|
641 |
||
642 |
ST-80 code will pass true or false as variableBoolean, |
|
643 |
while ST/X also calls it with symbols such as #float, #double etc. |
|
644 |
" |
|
1 | 645 |
(variableBoolean == true) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
646 |
pointersBoolean ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
647 |
newFlags := Behavior flagPointers |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
648 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
649 |
wordsBoolean ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
650 |
newFlags := Behavior flagWords |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
651 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
652 |
newFlags := Behavior flagBytes |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
653 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
654 |
] |
1 | 655 |
] ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
656 |
(variableBoolean == #float) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
657 |
newFlags := Behavior flagFloats |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
658 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
659 |
(variableBoolean == #double) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
660 |
newFlags := Behavior flagDoubles |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
661 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
662 |
(variableBoolean == #long) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
663 |
newFlags := Behavior flagLongs |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
664 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
665 |
newFlags := Behavior flagNotIndexed |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
666 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
667 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
668 |
]. |
1 | 669 |
]. |
68 | 670 |
superFlags := aClass flags bitAnd:(Behavior maskIndexType bitInvert). "preserve other bits" |
671 |
oldClass notNil ifTrue:[ |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
672 |
oldClass isBuiltInClass ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
673 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
674 |
special care when redefining Method, Block and other built-in classes, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
675 |
which might have other flag bits ... |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
676 |
" |
49 | 677 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
678 |
newFlags := newFlags bitOr:(oldClass flags bitAnd:(Behavior maskIndexType bitInvert)) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
679 |
] |
68 | 680 |
]. |
681 |
newClass flags:(newFlags bitOr:superFlags). "preserve inherited special bits" |
|
1 | 682 |
|
683 |
(nInstVars ~~ 0) ifTrue:[ |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
684 |
newClass setInstanceVariableString:stringOfInstVarNames |
1 | 685 |
]. |
686 |
oldClass notNil ifTrue:[ |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
687 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
688 |
setting first will make new class clear obsolete classvars |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
689 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
690 |
newClass setClassVariableString:(oldClass classVariableString). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
691 |
(t := oldClass primitiveSpec) notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
692 |
newClass primitiveSpec:t. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
693 |
newClass setClassFilename:(oldClass classFilename). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
694 |
] |
1 | 695 |
]. |
696 |
newClass classVariableString:stringOfClassVarNames. |
|
697 |
||
68 | 698 |
" |
699 |
for new classes, we are almost done here |
|
77 | 700 |
(also for autoloaded classes) |
68 | 701 |
" |
77 | 702 |
(oldClass isNil or:[oldClass isLoaded not]) ifTrue:[ |
904
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
703 |
(oldClass isNil and:[changed]) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
704 |
self addChangeRecordForClass:newClass. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
705 |
]. |
1 | 706 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
707 |
commentString notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
708 |
newClass comment:commentString |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
709 |
]. |
68 | 710 |
|
870 | 711 |
aSystemDictionary notNil ifTrue:[ |
712 |
aSystemDictionary at:classSymbol put:newClass. |
|
713 |
]. |
|
314 | 714 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
715 |
oldClass isNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
716 |
project notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
717 |
currentProject := project current. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
718 |
currentProject notNil ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
719 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
720 |
new classes get the package assigned |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
721 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
722 |
newClass package:(currentProject packageName asSymbol) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
723 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
724 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
725 |
]. |
314 | 726 |
|
870 | 727 |
aSystemDictionary notNil ifTrue:[ |
728 |
aSystemDictionary changed:#newClass with:newClass. |
|
729 |
]. |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
730 |
^ newClass |
2 | 731 |
]. |
732 |
||
10 | 733 |
|
68 | 734 |
" |
735 |
here comes the hard part - we are actually changing the |
|
736 |
definition of an existing class .... |
|
737 |
Try hard to get away WITHOUT recompiling, since it makes all |
|
738 |
compiled code into interpreted ... |
|
739 |
" |
|
740 |
||
10 | 741 |
oldInstVars := oldClass instanceVariableString asCollectionOfWords. |
742 |
newInstVars := newClass instanceVariableString asCollectionOfWords. |
|
743 |
oldClassVars := oldClass classVariableString asCollectionOfWords. |
|
744 |
newClassVars := newClass classVariableString asCollectionOfWords. |
|
745 |
||
68 | 746 |
" |
747 |
we are on the bright side of life, if the instance layout and |
|
748 |
inheritance do not change. |
|
749 |
In this case, we can go ahead and patch the class object. |
|
750 |
" |
|
2 | 751 |
(oldClass superclass == newClass superclass) ifTrue:[ |
752 |
(oldClass instSize == newClass instSize) ifTrue:[ |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
753 |
(oldClass flags == newClass flags) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
754 |
(oldClass name = newClass name) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
755 |
(oldInstVars = newInstVars) ifTrue:[ |
68 | 756 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
757 |
(newComment ~= oldClass comment) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
758 |
oldClass setComment:newComment. "writes a change-chunk" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
759 |
oldClass changed:#comment with:oldClass comment. |
904
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
760 |
changed ifTrue:[ |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
761 |
self addChangeRecordForClassComment:oldClass. |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
762 |
] |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
763 |
]. |
10 | 764 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
765 |
(oldClassVars = newClassVars) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
766 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
767 |
really no change (just comment and/or category) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
768 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
769 |
anyChange := false. |
10 | 770 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
771 |
oldClass setInstanceVariableString:(newClass instanceVariableString). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
772 |
oldClass setClassVariableString:(newClass classVariableString). |
68 | 773 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
774 |
oldClass category ~= categoryString ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
775 |
oldClass category:categoryString. |
904
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
776 |
changed ifTrue:[ |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
777 |
self addChangeRecordForClass:newClass. |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
778 |
]. |
870 | 779 |
aSystemDictionary notNil ifTrue:[ |
780 |
"notify change of category" |
|
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
781 |
aSystemDictionary changed:#organization |
870 | 782 |
] |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
783 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
784 |
"notify change of class" |
159 | 785 |
"/ oldClass changed. |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
786 |
^ oldClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
787 |
]. |
33 | 788 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
789 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
790 |
when we arrive here, class variables have changed |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
791 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
792 |
oldClass category ~= categoryString ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
793 |
"notify change of organization" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
794 |
oldClass category:categoryString. |
870 | 795 |
aSystemDictionary notNil ifTrue:[ |
796 |
"notify change of organization" |
|
797 |
aSystemDictionary changed:#organization |
|
798 |
]. |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
799 |
]. |
33 | 800 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
801 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
802 |
set class variable string; |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
803 |
this also updates the set of class variables |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
804 |
by creating new / deleting obsolete ones. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
805 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
806 |
oldClass classVariableString:stringOfClassVarNames. |
33 | 807 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
808 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
809 |
get the set of changed class variables |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
810 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
811 |
changeSet1 := Set new. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
812 |
oldClassVars do:[:nm | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
813 |
(newClassVars includes:nm) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
814 |
changeSet1 add:nm |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
815 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
816 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
817 |
newClassVars do:[:nm | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
818 |
(oldClassVars includes:nm) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
819 |
changeSet1 add:nm |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
820 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
821 |
]. |
33 | 822 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
823 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
824 |
recompile all methods accessing set of changed classvars |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
825 |
here and also in all subclasses ... |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
826 |
" |
159 | 827 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
828 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
829 |
dont update change file for the recompilation |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
830 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
831 |
Class withoutUpdatingChangesDo:[ |
33 | 832 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
833 |
Transcript showCr:'recompiling class & inst methods accessing ' , changeSet1 printString. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
834 |
Transcript endEntry. |
33 | 835 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
836 |
oldClass withAllSubclasses do:[:aClass | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
837 |
aClass class recompileMethodsAccessingAny:changeSet1. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
838 |
aClass recompileMethodsAccessingAny:changeSet1. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
839 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
840 |
]. |
33 | 841 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
842 |
"notify change of class" |
904
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
843 |
changed ifTrue:[ |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
844 |
self addChangeRecordForClass:oldClass. |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
845 |
]. |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
846 |
oldClass changed:#definition. |
33 | 847 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
848 |
^ oldClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
849 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
850 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
851 |
] |
2 | 852 |
] |
853 |
]. |
|
854 |
||
68 | 855 |
" |
856 |
here we enter the darkness of mordor ... |
|
159 | 857 |
since instance variable layout and/or inheritance has changed. |
68 | 858 |
" |
2 | 859 |
(newComment ~= oldClass comment) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
860 |
newClass comment:newComment |
2 | 861 |
]. |
862 |
||
863 |
superClassChange := oldClass superclass ~~ newClass superclass. |
|
1 | 864 |
|
68 | 865 |
" |
866 |
dont allow built-in classes to be modified this way |
|
867 |
" |
|
3 | 868 |
(oldClass notNil and:[oldClass isBuiltInClass and:[superClassChange]]) ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
869 |
self error:'the inheritance of this class is fixed - you cannot change it'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
870 |
^ oldClass |
3 | 871 |
]. |
872 |
||
68 | 873 |
" |
874 |
catch special case, where superclass changed its layout and thus |
|
875 |
forced redefinition of this class; |
|
876 |
only log if this is not the case. |
|
877 |
" |
|
904
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
878 |
changed ifTrue:[ |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
879 |
(superClassChange |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
880 |
and:[(oldClass superclass isNil or:[oldClass superclass name = newClass superclass name]) |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
881 |
and:[(oldClassVars = newClassVars) |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
882 |
and:[(oldInstVars = newInstVars) |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
883 |
and:[newComment = oldClass comment]]]]) ifFalse:[ |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
884 |
self addChangeRecordForClass:newClass. |
be65513cde2a
dont write change records if the changed: arg is false
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
885 |
] |
2 | 886 |
]. |
887 |
||
68 | 888 |
" |
889 |
care for class methods ... |
|
890 |
" |
|
2 | 891 |
changeSet1 := Set new. |
1 | 892 |
|
2 | 893 |
classVarChange := false. |
894 |
||
895 |
superClassChange ifTrue:[ |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
896 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
897 |
superclass changed: |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
898 |
must recompile all class methods accessing ANY classvar |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
899 |
( |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
900 |
actually, we could be less strict and handle the case where |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
901 |
both the old and the new superclass have a common ancestor, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
902 |
and both have no new classvariables in between. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
903 |
This would speedup the case when a class is inserted into |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
904 |
the inheritance chain. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
905 |
) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
906 |
" |
1 | 907 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
908 |
oldClass allClassVarNames do:[:nm | changeSet1 add:nm]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
909 |
newClass allClassVarNames do:[:nm | changeSet1 add:nm]. |
2 | 910 |
|
911 |
" " |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
912 |
Transcript showCr:'recompiling class methods accessing any classvar'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
913 |
Transcript endEntry. |
2 | 914 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
915 |
self copyInvalidatedMethodsFrom:(oldClass class) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
916 |
for:newMetaclass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
917 |
accessingAny:changeSet1 |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
918 |
orSuper:true. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
919 |
newMetaclass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject). |
2 | 920 |
] ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
921 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
922 |
same superclass, find out which classvars have changed |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
923 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
924 |
classVarChange := oldClassVars ~= newClassVars. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
925 |
classVarChange ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
926 |
oldClassVars do:[:nm | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
927 |
(newClassVars includes:nm) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
928 |
changeSet1 add:nm |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
929 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
930 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
931 |
newClassVars do:[:nm | |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
932 |
(oldClassVars includes:nm) ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
933 |
changeSet1 add:nm |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
934 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
935 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
936 |
]. |
1 | 937 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
938 |
classVarChange ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
939 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
940 |
must recompile some class-methods |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
941 |
" |
2 | 942 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
943 |
Transcript showCr:'recompiling class methods accessing ' , changeSet1 printString. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
944 |
Transcript endEntry. |
68 | 945 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
946 |
self copyInvalidatedMethodsFrom:(oldClass class) for:newMetaclass accessingAny:changeSet1. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
947 |
newMetaclass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
948 |
] ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
949 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
950 |
class methods still work |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
951 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
952 |
self copyMethodsFrom:(oldClass class) for:newMetaclass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
953 |
]. |
2 | 954 |
]. |
1 | 955 |
|
68 | 956 |
" |
957 |
care for instance methods ... |
|
958 |
" |
|
959 |
||
2 | 960 |
superClassChange ifTrue:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
961 |
"superclass changed, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
962 |
must recompile all methods accessing any class or instvar. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
963 |
If number of instvars (i.e. the instances instSize) is the same, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
964 |
we can limit the set of recompiled instance methods to those methods, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
965 |
which refer to an instvar with a different inst-index |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
966 |
" |
13 | 967 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
968 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
969 |
the changeset consists of instance variables, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
970 |
with a different position |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
971 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
972 |
changeSet2 := self differentInstanceVariableOffsetsIn:oldClass and:newClass. |
13 | 973 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
974 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
975 |
merge in the changed class variables |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
976 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
977 |
changeSet1 do:[:nm | changeSet2 add:nm]. |
68 | 978 |
|
13 | 979 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
980 |
Transcript showCr:'recompiling instance methods accessing ' , changeSet2 printString , ' ...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
981 |
Transcript endEntry. |
13 | 982 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
983 |
self copyInvalidatedMethodsFrom:oldClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
984 |
for:newClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
985 |
accessingAny:changeSet2 |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
986 |
orSuper:true. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
987 |
newClass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject). |
13 | 988 |
|
2 | 989 |
] ifFalse:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
990 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
991 |
same inheritance ... |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
992 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
993 |
instVarChange := oldInstVars ~= newInstVars. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
994 |
instVarChange ifFalse:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
995 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
996 |
same instance variables ... |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
997 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
998 |
classVarChange ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
999 |
"recompile all inst methods accessing changed classvars" |
1 | 1000 |
|
2 | 1001 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1002 |
Transcript showCr:'recompiling instance methods accessing ' , changeSet1 printString , ' ...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1003 |
Transcript endEntry. |
2 | 1004 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1005 |
self copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:changeSet1. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1006 |
newClass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1007 |
] |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1008 |
] ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1009 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1010 |
dont allow built-in classes to be modified |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1011 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1012 |
(oldClass notNil and:[oldClass isBuiltInClass and:[instVarChange]]) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1013 |
self error:'the layout of this class is fixed - you cannot change it'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1014 |
^ oldClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1015 |
]. |
3 | 1016 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1017 |
((oldInstVars size == 0) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1018 |
or:[newInstVars startsWith:oldInstVars]) ifTrue:[ |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1019 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1020 |
only new inst variable(s) has/have been added - |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1021 |
old methods still work (the existing inst-indices are still valid) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1022 |
" |
68 | 1023 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1024 |
Transcript showCr:'copying methods ...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1025 |
Transcript endEntry. |
68 | 1026 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1027 |
self copyMethodsFrom:oldClass for:newClass. |
2 | 1028 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1029 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1030 |
but: we have to recompile all methods accessing new instars |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1031 |
(it might have been a classVar/global before ...) |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1032 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1033 |
addedNames := newInstVars select:[:nm | (oldInstVars includes:nm) not]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1034 |
"merge in class variables" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1035 |
changeSet1 do:[:nm | addedNames add:nm]. |
1 | 1036 |
|
2 | 1037 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1038 |
Transcript showCr:'recompiling instance methods accessing ' , addedNames printString , '...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1039 |
Transcript endEntry. |
2 | 1040 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1041 |
newClass recompileMethodsAccessingAny:addedNames. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1042 |
] ifFalse:[ |
2 | 1043 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1044 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1045 |
the changeset consists of instance variables, |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1046 |
with a different position |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1047 |
" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1048 |
changeSet2 := self differentInstanceVariableOffsetsIn:oldClass and:newClass. |
1 | 1049 |
|
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1050 |
"merge in the class variables" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1051 |
changeSet1 do:[:nm | changeSet2 add:nm]. |
2 | 1052 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1053 |
Transcript showCr:'recompiling instance methods accessing ' , changeSet2 printString , ' ...'. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1054 |
Transcript endEntry. |
2 | 1055 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1056 |
self copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:changeSet2. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1057 |
newClass recompileInvalidatedMethods:(Metaclass compiledMethodAt:#invalidCodeObject). |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1058 |
]. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1059 |
]. |
2 | 1060 |
]. |
1 | 1061 |
|
68 | 1062 |
" |
1063 |
WOW, everything done for this class |
|
1064 |
what about subclasses ? |
|
1065 |
" |
|
2 | 1066 |
|
68 | 1067 |
" |
1068 |
update superclass of immediate subclasses - |
|
1069 |
this forces recompilation (recursively) if needed |
|
1070 |
(dont update change file for the subclass changes) |
|
1071 |
" |
|
202 | 1072 |
Class withoutUpdatingChangesDo:[ |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1073 |
oldClass subclassesDo:[:aClass | |
2 | 1074 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1075 |
Transcript showCr:'changing superclass of:' , aClass name. |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1076 |
Transcript endEntry. |
2 | 1077 |
" " |
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1078 |
aClass superclass:newClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1079 |
] |
2 | 1080 |
]. |
1081 |
||
68 | 1082 |
" |
1083 |
change category in oldClass - so we see immediately what it is ... |
|
1084 |
" |
|
1085 |
oldClass category:'obsolete'. |
|
1086 |
oldClass class category:'obsolete'. |
|
1087 |
||
1088 |
" |
|
1089 |
and make the new class globally known |
|
1090 |
" |
|
870 | 1091 |
aSystemDictionary notNil ifTrue:[ |
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1092 |
aSystemDictionary at:classSymbol put:newClass. |
68 | 1093 |
|
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1094 |
oldClass category ~= categoryString ifTrue:[ |
870 | 1095 |
"notify change of organization" |
1096 |
aSystemDictionary changed:#organization |
|
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1097 |
]. |
68 | 1098 |
]. |
1099 |
||
1100 |
" |
|
1101 |
Not becoming the old class creates some update problems; |
|
1102 |
the browsers must check carefully - a simple identity compare is |
|
159 | 1103 |
not enough ... |
68 | 1104 |
QUESTION: is this a good idea ? |
1105 |
" |
|
1106 |
||
1107 |
newClass dependents:(oldClass dependents). |
|
202 | 1108 |
newClass changed:#definition. |
68 | 1109 |
|
159 | 1110 |
"just to make certain ... - tell dependents of oldClass, that something changed |
85 | 1111 |
(systemBrowsers will react on this, and update their views)" |
159 | 1112 |
oldClass changed:#definition with:newClass. |
68 | 1113 |
|
2 | 1114 |
ObjectMemory flushCaches. |
68 | 1115 |
|
1 | 1116 |
^ newClass |
723
ebc969b4678d
preserve binaryRevision when adding instVars
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
1117 |
|
885
ca805f0f4984
changed class creation to allow create including classInstVars (may be used to avoid recompilation)
Claus Gittinger <cg@exept.de>
parents:
870
diff
changeset
|
1118 |
"Modified: 22.1.1996 / 13:17:13 / cg" |
621 | 1119 |
! |
1120 |
||
1121 |
new |
|
1122 |
"create & return a new metaclass (a classes class). |
|
1123 |
Since metaclasses only have one instance (the class), |
|
1124 |
complain if there is already one. |
|
1125 |
You get a new class by sending #new to the returned metaclass |
|
1126 |
(confusing - isn't it ?)" |
|
1127 |
||
1128 |
|newClass| |
|
1129 |
||
1130 |
myClass notNil ifTrue:[ |
|
1131 |
^ self error:'Each metaclass may only have one instance'. |
|
1132 |
]. |
|
1133 |
newClass := self basicNew. |
|
1134 |
newClass setSuperclass:Object |
|
1135 |
selectors:(Array new:0) |
|
1136 |
methods:(Array new:0) |
|
1137 |
instSize:0 |
|
1138 |
flags:(Behavior flagBehavior). |
|
1139 |
newClass setName:'someClass'. |
|
1140 |
myClass := newClass. |
|
1141 |
^ newClass |
|
1 | 1142 |
! ! |
1143 |
||
1144 |
!Metaclass methodsFor:'private'! |
|
1145 |
||
739
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1146 |
setSoleInstance:aClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1147 |
myClass := aClass |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1148 |
|
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1149 |
"Created: 12.12.1995 / 13:46:22 / cg" |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1150 |
! |
63566c9b691a
oops - after autoloading, the metaClasses soleInstance still pointed to the
Claus Gittinger <cg@exept.de>
parents:
723
diff
changeset
|
1151 |
|
621 | 1152 |
anyInvalidatedMethodsIn:aClass |
1153 |
"return true, if aClass has any invalidated methods in it" |
|
1154 |
||
1155 |
|trap trapCode trapByteCode| |
|
1156 |
||
1157 |
trap := Metaclass compiledMethodAt:#invalidCodeObject. |
|
1158 |
trapCode := trap code. |
|
1159 |
trapByteCode := trap byteCode. |
|
68 | 1160 |
|
621 | 1161 |
aClass methodArray do:[:aMethod | |
1162 |
trapCode notNil ifTrue:[ |
|
1163 |
(aMethod code = trapCode) ifTrue:[^ true] |
|
1164 |
]. |
|
1165 |
trapByteCode notNil ifTrue:[ |
|
1166 |
(aMethod byteCode == trapByteCode) ifTrue:[^ true] |
|
1167 |
] |
|
1168 |
]. |
|
1169 |
^ false |
|
68 | 1170 |
! |
1171 |
||
621 | 1172 |
checkConventionsFor:className instVarNames:instVarNameString classVarNames:classVarNameString |
1173 |
"Check for some 'considered bad-style' things, like lower case names. |
|
1174 |
NOTICE: |
|
1175 |
I dont like the confirmers below - we need a notifying: argument, to give |
|
1176 |
the outer codeview a chance to highlight the error. |
|
1177 |
(but thats how its defined in the book - maybe I will change it anyway). |
|
308 | 1178 |
" |
621 | 1179 |
|
1180 |
"let user confirm, if the classname is no good" |
|
1181 |
className first isUppercase ifFalse:[ |
|
1182 |
(self confirm:'classename ''' , className , ''' should start with an uppercase letter |
|
1183 |
(by convention only) |
|
308 | 1184 |
|
621 | 1185 |
install anyway ?' withCRs) |
1186 |
ifFalse:[ |
|
1187 |
^ false |
|
308 | 1188 |
] |
621 | 1189 |
]. |
1190 |
||
1191 |
"let user confirm, if any instvarname is no good" |
|
1192 |
(instVarNameString asCollectionOfWords |
|
1193 |
findFirst:[:word | word first isUppercase]) ~~ 0 ifTrue:[ |
|
1194 |
(self confirm:'instance variable names should start with a lowercase letter |
|
1195 |
(by convention only) |
|
1196 |
||
1197 |
install anyway ?' withCRs) |
|
1198 |
ifFalse:[ |
|
1199 |
^ false |
|
308 | 1200 |
] |
1201 |
]. |
|
621 | 1202 |
|
1203 |
"let user confirm, if any classvarname is no good" |
|
1204 |
(classVarNameString asCollectionOfWords |
|
1205 |
findFirst:[:word | word first isLowercase]) ~~ 0 ifTrue:[ |
|
1206 |
(self confirm:'class variable names should start with an uppercase letter |
|
1207 |
(by convention only) |
|
308 | 1208 |
|
621 | 1209 |
install anyway ?' withCRs) |
1210 |
ifFalse:[ |
|
1211 |
^ false |
|
1212 |
]. |
|
1213 |
]. |
|
308 | 1214 |
|
621 | 1215 |
^ true |
1 | 1216 |
! |
1217 |
||
1218 |
copyInvalidatedMethodsFrom:oldClass for:newClass |
|
159 | 1219 |
"copy all methods from oldClass to newClass and change their code |
1220 |
to a trap method reporting an error. |
|
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1221 |
This is done when a class has changed its layout or inheritance, |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1222 |
before recompilation is attempted. |
159 | 1223 |
This allows us to keep the source while trapping uncompilable (due to |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1224 |
now undefined instvars) methods. Later compilation of these methods will show |
159 | 1225 |
an error on the transcript and lead to the debugger once called." |
1 | 1226 |
|
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1227 |
|trap trapCode trapByteCode oldMethod newMethod oldMethodArray |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1228 |
newSelectorArray newMethodArray |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1229 |
nMethods "{ Class: SmallInteger }"| |
1 | 1230 |
|
328 | 1231 |
trap := Metaclass compiledMethodAt:#invalidCodeObject. |
1 | 1232 |
trapCode := trap code. |
1233 |
trapByteCode := trap byteCode. |
|
1234 |
||
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1235 |
newMethodArray := oldClass methodArray copy. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1236 |
newSelectorArray := oldClass selectorArray copy. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1237 |
newClass selectors:newSelectorArray methods:newMethodArray. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1238 |
|
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1239 |
nMethods := newMethodArray size. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1240 |
1 to:nMethods do:[:i | |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1241 |
oldMethod := newMethodArray at:i. |
251 | 1242 |
oldMethod isWrapped ifTrue:[ |
1243 |
oldMethod := oldMethod originalMethod |
|
1244 |
]. |
|
1245 |
newMethod := oldMethod copy. |
|
159 | 1246 |
newMethod code:trapCode. |
1247 |
newMethod literals:nil. |
|
1248 |
newMethod byteCode:trapByteCode. |
|
1249 |
newMethodArray at:i put:newMethod |
|
2 | 1250 |
] |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1251 |
|
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1252 |
"Modified: 27.1.1996 / 17:57:48 / cg" |
2 | 1253 |
! |
1254 |
||
1255 |
copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:setOfNames |
|
1256 |
"copy all methods from oldClass to newClass. Those methods accessing |
|
1257 |
a variable in setOfNames will be copied as invalid method, leading to |
|
159 | 1258 |
a trap when its executed. This is used when a class has changed its |
1259 |
layout for all methods which are affected by the change." |
|
1260 |
||
1261 |
self copyInvalidatedMethodsFrom:oldClass |
|
1262 |
for:newClass |
|
1263 |
accessingAny:setOfNames |
|
1264 |
orSuper:false |
|
1265 |
! |
|
1266 |
||
1267 |
copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:setOfNames orSuper:superBoolean |
|
1268 |
"copy all methods from oldClass to newClass. |
|
1269 |
Those methods accessing a variable in setOfNames will be copied as invalid method, |
|
1270 |
leading to a trap when its executed. If superBoolean is true, this is also done |
|
1271 |
for methods accessing super. This is used when a class has changed its |
|
1272 |
layout for all methods which are affected by the change." |
|
2 | 1273 |
|
251 | 1274 |
|trap trapCode trapByteCode p source mustInvalidate |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1275 |
oldMethod newMethod oldMethodArray newSelectorArray newMethodArray |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1276 |
nMethods "{ Class: SmallInteger }" |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1277 |
nNames usedVars| |
2 | 1278 |
|
328 | 1279 |
trap := Metaclass compiledMethodAt:#invalidCodeObject. |
2 | 1280 |
trapCode := trap code. |
1281 |
trapByteCode := trap byteCode. |
|
1282 |
||
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1283 |
newMethodArray := oldClass methodArray copy. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1284 |
newSelectorArray := oldClass selectorArray copy. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1285 |
|
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1286 |
newClass selectors:newSelectorArray methods:newMethodArray. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1287 |
|
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1288 |
nNames := setOfNames size. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1289 |
|
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1290 |
nMethods := newMethodArray size. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1291 |
1 to:nMethods do:[:i | |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1292 |
oldMethod := newMethodArray at:i. |
251 | 1293 |
oldMethod isWrapped ifTrue:[ |
1294 |
oldMethod := oldMethod originalMethod |
|
1295 |
]. |
|
202 | 1296 |
|
1297 |
"before parsing (which may take some time), |
|
1298 |
do a string search if its only one variable, |
|
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1299 |
we are looking for. |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1300 |
Could look for more than one variable by string compare, but then |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1301 |
parsing it right away may be faster ..." |
202 | 1302 |
|
251 | 1303 |
source := oldMethod source. |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1304 |
((nNames == 1) and:[superBoolean not]) ifTrue:[ |
251 | 1305 |
mustInvalidate := (source findString:(setOfNames first)) ~~ 0. |
202 | 1306 |
] ifFalse:[ |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1307 |
((nNames == 0) and:[superBoolean]) ifTrue:[ |
251 | 1308 |
mustInvalidate := (source findString:'super') ~~ 0. |
1309 |
] ifFalse:[ |
|
1310 |
mustInvalidate := true |
|
1311 |
]. |
|
202 | 1312 |
]. |
1313 |
||
1314 |
mustInvalidate ifTrue:[ |
|
251 | 1315 |
"we have to parse it ..." |
1316 |
p := Parser parseMethod:source in:newClass. |
|
202 | 1317 |
(p isNil |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1318 |
or:[((usedVars := p usedVars) notNil and:[usedVars includesAny:setOfNames]) |
202 | 1319 |
or:[superBoolean and:[p usesSuper]]]) ifFalse:[ |
1320 |
mustInvalidate := false |
|
1321 |
] |
|
1322 |
]. |
|
1323 |
||
1324 |
mustInvalidate ifTrue:[ |
|
159 | 1325 |
newMethod := oldMethod copy. |
1326 |
newMethod code:trapCode. |
|
1327 |
newMethod literals:nil. |
|
1328 |
newMethod byteCode:trapByteCode |
|
1329 |
] ifFalse:[ |
|
1330 |
newMethod := oldMethod. |
|
1331 |
]. |
|
1332 |
newMethodArray at:i put:newMethod |
|
1 | 1333 |
] |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1334 |
|
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1335 |
"Modified: 27.1.1996 / 17:56:44 / cg" |
1 | 1336 |
! |
1337 |
||
621 | 1338 |
copyMethodsFrom:oldClass for:newClass |
1339 |
"copy all methods from oldClass to newClass. |
|
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1340 |
This is used for class-methods when a class has changed, but its metaclass is |
621 | 1341 |
unaffected (i.e. classVars/inheritance have not changed) so there is no need |
1342 |
to recompile the class methods." |
|
195 | 1343 |
|
621 | 1344 |
newClass selectors:(oldClass selectorArray copy) |
1345 |
methods:(oldClass methodArray copy) |
|
1346 |
! |
|
1347 |
||
1348 |
differentInstanceVariableOffsetsIn:class1 and:class2 |
|
1349 |
"return a set of instance variable names which have different |
|
1350 |
positions in class1 and class2. |
|
1351 |
Also, variables which are only present in one class are returned. |
|
1352 |
This is used to find methods which need recompilation after a |
|
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1353 |
change in the instance variable layout." |
621 | 1354 |
|
1355 |
|offsets1 offsets2 changeSet| |
|
195 | 1356 |
|
621 | 1357 |
changeSet := Set new. |
1358 |
||
1359 |
" |
|
1360 |
collect the instvar-indices in the old and new class |
|
1361 |
" |
|
1362 |
offsets1 := class1 instanceVariableOffsets. |
|
1363 |
offsets2 := class2 instanceVariableOffsets. |
|
195 | 1364 |
|
621 | 1365 |
" |
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1366 |
compute the changeset as a set of instance variables, |
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1367 |
which have a different position |
621 | 1368 |
" |
1369 |
offsets1 keysAndValuesDo:[:varName :varIndex | |
|
1370 |
(offsets2 includesKey:varName) ifFalse:[ |
|
1371 |
changeSet add:varName |
|
1372 |
] ifTrue:[ |
|
1373 |
(varIndex ~~ (offsets2 at:varName)) ifTrue:[ |
|
1374 |
changeSet add:varName |
|
1375 |
] |
|
195 | 1376 |
] |
1377 |
]. |
|
621 | 1378 |
offsets2 keysAndValuesDo:[:varName :varIndex | |
1379 |
(offsets1 includesKey:varName) ifFalse:[ |
|
1380 |
changeSet add:varName |
|
1381 |
] ifTrue:[ |
|
1382 |
(varIndex ~~ (offsets1 at:varName)) ifTrue:[ |
|
1383 |
changeSet add:varName |
|
1384 |
] |
|
1385 |
] |
|
1386 |
]. |
|
1387 |
^ changeSet |
|
195 | 1388 |
|
621 | 1389 |
" |
1390 |
View class |
|
1391 |
differentInstanceVariableOffsetsIn:View |
|
1392 |
and:StandardSystemView |
|
1393 |
View class |
|
1394 |
differentInstanceVariableOffsetsIn:Object |
|
1395 |
and:Point |
|
1396 |
" |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1397 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1398 |
|
621 | 1399 |
invalidCodeObject |
1400 |
"When recompiling classes after a definition-change, all |
|
1401 |
uncompilable methods will be bound to this method here, |
|
1402 |
so that evaluating such an uncompilable method will trigger an error. |
|
1403 |
Can also happen when Compiler/runtime system is broken." |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1404 |
|
621 | 1405 |
self error:'invalid method - this method failed to compile when the class was changed' |
1 | 1406 |
! ! |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1407 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1408 |
!Metaclass methodsFor:'queries'! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1409 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1410 |
isMeta |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1411 |
"return true, if the receiver is some kind of metaclass; |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1412 |
true is returned here. Redefines isMeta in Object" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1413 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1414 |
^ true |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1415 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1416 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1417 |
soleInstance |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1418 |
"return my sole class." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1419 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1420 |
^ myClass |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
1421 |
! ! |
621 | 1422 |
|
639 | 1423 |
!Metaclass class methodsFor:'documentation'! |
1424 |
||
1425 |
version |
|
912
a009f25a6800
be careful with self-chaning selector/methodArrays (done in VM's lookup)
Claus Gittinger <cg@exept.de>
parents:
904
diff
changeset
|
1426 |
^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.46 1996-01-27 17:12:38 cg Exp $' |
639 | 1427 |
! ! |