author | Stefan Vogel <sv@exept.de> |
Thu, 16 Apr 2020 16:57:05 +0200 | |
changeset 25362 | f1606835f9fb |
parent 24833 | 94226f673308 |
permissions | -rw-r--r-- |
24375 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1 | 3 |
" |
5 | 4 |
COPYRIGHT (c) 1988 by Claus Gittinger |
159 | 5 |
All Rights Reserved |
1 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
5341
e7465ebd9126
change notification for new classes
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
14 |
"{ Package: 'stx:libbasic' }" |
e7465ebd9126
change notification for new classes
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
15 |
|
17277 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
18 |
ClassDescription subclass:#Metaclass |
1047 | 19 |
instanceVariableNames:'myClass' |
2822
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
20 |
classVariableNames:'ConfirmationQuerySignal' |
1047 | 21 |
poolDictionaries:'' |
22 |
category:'Kernel-Classes' |
|
1 | 23 |
! |
24 |
||
1742 | 25 |
!Metaclass class methodsFor:'documentation'! |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
26 |
|
88 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
159 | 30 |
All Rights Reserved |
1 | 31 |
|
88 | 32 |
This software is furnished under a license and may be used |
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
621 | 39 |
! |
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
every classes class is a subclass of Metaclass. |
|
44 |
(i.e. every class is the sole instance of its Metaclass) |
|
12094 | 45 |
Metaclass provides support for creating new (sub)classes and/or |
621 | 46 |
changing the definition of an already existing class. |
1292 | 47 |
|
48 |
[author:] |
|
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
49 |
Claus Gittinger |
1669 | 50 |
|
51 |
[see also:] |
|
52 |
Behavior ClassDescription Class |
|
621 | 53 |
" |
88 | 54 |
! ! |
1 | 55 |
|
2822
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
56 |
!Metaclass class methodsFor:'Signal constants'! |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
57 |
|
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
58 |
confirmationQuerySignal |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
59 |
"return the query signal which is raised to ask if user |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
60 |
confirmation dialogs should be opened. |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
61 |
If unhandled, they are." |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
62 |
|
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
63 |
^ ConfirmationQuerySignal |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
64 |
|
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
65 |
"Created: 31.7.1997 / 21:55:39 / cg" |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
66 |
! ! |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
67 |
|
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
68 |
!Metaclass class methodsFor:'class initialization'! |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
69 |
|
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
70 |
initialize |
12254 | 71 |
ConfirmationQuerySignal isNil ifTrue:[ |
72 |
ConfirmationQuerySignal := Query newSignal defaultAnswer:true. |
|
73 |
]. |
|
2822
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
74 |
|
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
75 |
"Modified: 31.7.1997 / 21:54:44 / cg" |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
76 |
! ! |
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
77 |
|
1742 | 78 |
!Metaclass class methodsFor:'creating metaclasses'! |
356 | 79 |
|
80 |
new |
|
81 |
"creating a new metaclass - have to set the new classes |
|
82 |
flags correctly to have it behave like a metaclass ... |
|
83 |
Not for normal applications - creating new metaclasses is a very |
|
84 |
tricky thing; should be left to the gurus ;-)" |
|
85 |
||
86 |
|newMetaclass| |
|
87 |
||
88 |
newMetaclass := super new. |
|
89 |
newMetaclass instSize:(Class instSize). |
|
90 |
newMetaclass setSuperclass:Class. |
|
91 |
||
92 |
^ newMetaclass |
|
93 |
||
94 |
" |
|
95 |
Metaclass new <- new metaclass |
|
96 |
Metaclass new new <- new class |
|
97 |
Metaclass new new new <- new instance |
|
98 |
" |
|
99 |
! ! |
|
100 |
||
24063 | 101 |
!Metaclass class methodsFor:'method templates'! |
102 |
||
103 |
classTemplateFor:aSuperClass in:categoryString asNamespace:asNameSpace private:isPrivate |
|
104 |
"returning nil here, will let the browser generate a template. |
|
105 |
However, special metaclasses (other languages) |
|
106 |
may redefine this" |
|
107 |
||
108 |
^ nil |
|
109 |
||
110 |
"Created: / 12-04-2019 / 05:18:51 / Claus Gittinger" |
|
111 |
! ! |
|
112 |
||
1742 | 113 |
!Metaclass class methodsFor:'queries'! |
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
114 |
|
7617 | 115 |
asPrivate |
12094 | 116 |
^ PrivateMetaclass |
7617 | 117 |
! |
118 |
||
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
119 |
isBuiltInClass |
1266 | 120 |
"return true if this class is known by the run-time-system. |
121 |
Here, true is returned for myself, false for subclasses." |
|
122 |
||
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
123 |
^ self == Metaclass class or:[self == Metaclass] |
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
124 |
|
1266 | 125 |
"Modified: 23.4.1996 / 15:59:44 / cg" |
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
126 |
! ! |
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
127 |
|
7261 | 128 |
!Metaclass methodsFor:'Compatibility-ST80'! |
3012 | 129 |
|
130 |
comment:aString |
|
131 |
"ignored - sometimes found in ST-80 fileOut files. |
|
132 |
Comments are supposed to be defined via class messages." |
|
133 |
||
134 |
"Created: 9.10.1997 / 18:14:34 / cg" |
|
3079 | 135 |
! |
136 |
||
137 |
sourceCodeTemplate |
|
138 |
"ST80 compatibility - return a definition message for myself. |
|
139 |
Same as #definition" |
|
140 |
||
141 |
^ self soleInstance definition |
|
142 |
||
143 |
"Created: / 1.11.1997 / 13:16:45 / cg" |
|
3012 | 144 |
! ! |
145 |
||
23298 | 146 |
!Metaclass methodsFor:'Compatibility-Squeak'! |
147 |
||
148 |
instanceVariableString:aString |
|
149 |
"for compatibility" |
|
150 |
||
151 |
self instanceVariableNames:aString |
|
152 |
||
153 |
"Created: / 26-08-2018 / 16:29:13 / Claus Gittinger" |
|
154 |
! ! |
|
21407 | 155 |
|
5578 | 156 |
!Metaclass methodsFor:'autoload check'! |
157 |
||
158 |
isLoaded |
|
12094 | 159 |
"return true, if the class has been loaded; |
5578 | 160 |
redefined in Autoload; see comment there" |
161 |
||
14647 | 162 |
^ myClass isNil or:[ myClass isLoaded ] |
5578 | 163 |
|
164 |
||
165 |
! ! |
|
166 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
167 |
!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
|
168 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
169 |
instanceVariableNames:aString |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
170 |
"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
|
171 |
this actually creates a new metaclass and class, leaving the original |
16769 | 172 |
class hanging around as obsolete classes. |
173 |
This may also be true for all subclasses, if class instance variables are added/removed in a superclass. |
|
174 |
Existing instances (i.e. insts of the class) are migrated to become instances of the new class(es). |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
175 |
|
16769 | 176 |
However, if the old class is referenced somewhere (in a collection), |
177 |
that reference will still point to the old, now obsolete class. |
|
178 |
Time will show, if that is a problem and will be fixed." |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
179 |
|
6021 | 180 |
|builder| |
181 |
||
7518
298576c9de5a
care for no real change in instanceVariableString.
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
182 |
self instanceVariableString asStringCollection = aString asStringCollection ifTrue:[^ self]. |
298576c9de5a
care for no real change in instanceVariableString.
Claus Gittinger <cg@exept.de>
parents:
7435
diff
changeset
|
183 |
|
6021 | 184 |
builder := ClassBuilder new. |
185 |
builder oldMetaclass:self instanceVariableNames:aString. |
|
16769 | 186 |
builder rebuildForChangedClassInstanceVariables. |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
187 |
! ! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
188 |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
189 |
!Metaclass methodsFor:'compiler interface'! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
190 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
191 |
browserClass |
12094 | 192 |
"return the browser to use for this class - |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
193 |
this can be redefined in special classes, to get different browsers" |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
194 |
|
22244 | 195 |
^ SystemBrowser default. |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
196 |
|
22244 | 197 |
"Created: / 03-05-1996 / 12:36:40 / cg" |
198 |
"Modified: / 01-09-2017 / 14:21:14 / cg" |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
199 |
! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
200 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
201 |
compilerClass |
12094 | 202 |
"return the compiler to use for this class - |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
203 |
this can be redefined in special classes, to compile classes with |
17678 | 204 |
JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
205 |
|
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
206 |
^ self programmingLanguage compilerClass. |
12102 | 207 |
|
208 |
" |
|
209 |
Array compilerClass |
|
210 |
" |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
211 |
! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
212 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
213 |
evaluatorClass |
12094 | 214 |
"return the compiler to use for expression evaluation for this class - |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
215 |
this can be redefined in special classes, to evaluate expressions with |
17678 | 216 |
JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
217 |
|
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
218 |
^ self programmingLanguage evaluatorClass. |
12102 | 219 |
|
220 |
" |
|
221 |
Array evaluatorClass |
|
222 |
" |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
223 |
! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
224 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
225 |
formatterClass |
12094 | 226 |
"return the parser to use for formatting (prettyPrinting) this class - |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
227 |
this can be redefined in special classes, to format classes with |
17678 | 228 |
JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
229 |
|
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
230 |
^ self programmingLanguage formatterClass. |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
231 |
|
12102 | 232 |
" |
233 |
Array formatterClass |
|
234 |
" |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
235 |
! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
236 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
237 |
parserClass |
12094 | 238 |
"return the parser to use for parsing this class - |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
239 |
this can be redefined in special classes, to parse classes with |
17678 | 240 |
JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
241 |
|
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
242 |
^ self programmingLanguage parserClass. |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
243 |
|
12102 | 244 |
" |
245 |
Array parserClass |
|
246 |
" |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
247 |
! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
248 |
|
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
249 |
programmingLanguage |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
250 |
"return the programming language in which this class is written" |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
251 |
|
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
252 |
^ SmalltalkLanguage instance |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
253 |
|
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
254 |
"Created: / 15-08-2009 / 09:06:25 / Jan Vrany <vranyj1@fel.cvut.cz>" |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
255 |
"Modified: / 16-08-2009 / 10:37:08 / Jan Vrany <vranyj1@fel.cvut.cz>" |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
256 |
! |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
257 |
|
7617 | 258 |
realSubclassDefinerClass |
17678 | 259 |
"Answer an evaluator class appropriate for evaluating definitions of new |
260 |
subclasses of this class." |
|
261 |
||
262 |
"cg: @jan - what is the difference to the subclassDefinerClass?" |
|
7617 | 263 |
^ self evaluatorClass |
264 |
! |
|
265 |
||
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
266 |
subclassDefinerClass |
12094 | 267 |
"Answer an evaluator class appropriate for evaluating definitions of new |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
268 |
subclasses of this class." |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
269 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
270 |
^ self evaluatorClass |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
271 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
272 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
273 |
! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
274 |
|
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
275 |
syntaxHighlighterClass |
12094 | 276 |
"return the class to use for syntaxHighlighting (prettyPrinting) this class - |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
277 |
this can be redefined in special classes, to highlight classes with |
17678 | 278 |
JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
279 |
|
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
280 |
^ self programmingLanguage syntaxHighlighterClass. |
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
281 |
|
12102 | 282 |
" |
283 |
Array syntaxHighlighterClass |
|
284 |
" |
|
5994
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
285 |
! ! |
554530710162
allow metaclass to specify compiler, parser, evaluator etc.
Claus Gittinger <cg@exept.de>
parents:
5891
diff
changeset
|
286 |
|
24176 | 287 |
!Metaclass methodsFor:'copying-private'! |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
288 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
289 |
postCopy |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
290 |
"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
|
291 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
292 |
myClass := nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
293 |
! ! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
294 |
|
1 | 295 |
!Metaclass methodsFor:'creating classes'! |
296 |
||
10475 | 297 |
name:newName inEnvironment:aNameSpaceOrOwningClass |
12094 | 298 |
subclassOf:aClass |
299 |
instanceVariableNames:stringOfInstVarNames |
|
300 |
variable:variableBoolean |
|
301 |
words:wordsBoolean |
|
302 |
pointers:pointersBoolean |
|
303 |
classVariableNames:stringOfClassVarNames |
|
304 |
poolDictionaries:stringOfPoolNames |
|
305 |
category:categoryString |
|
306 |
comment:commentString |
|
307 |
changed:changed |
|
6824
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
308 |
|
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
309 |
^ self |
12094 | 310 |
name:newName |
311 |
inEnvironment:aNameSpaceOrOwningClass |
|
312 |
subclassOf:aClass |
|
313 |
instanceVariableNames:stringOfInstVarNames |
|
314 |
variable:variableBoolean |
|
315 |
words:wordsBoolean |
|
316 |
pointers:pointersBoolean |
|
317 |
classVariableNames:stringOfClassVarNames |
|
318 |
poolDictionaries:stringOfPoolNames |
|
319 |
category:categoryString |
|
320 |
comment:commentString |
|
321 |
changed:changed |
|
322 |
classInstanceVariableNames:nil |
|
6824
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
323 |
|
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
324 |
"Modified: 16.6.1997 / 11:53:58 / cg" |
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
325 |
! |
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
326 |
|
10475 | 327 |
name:newName inEnvironment:aNameSpaceOrOwningClass |
19115 | 328 |
subclassOf:aClass |
329 |
instanceVariableNames:stringOfInstVarNames |
|
330 |
variable:variableBoolean |
|
331 |
words:wordsBoolean |
|
332 |
pointers:pointersBoolean |
|
333 |
classVariableNames:stringOfClassVarNames |
|
334 |
poolDictionaries:stringOfPoolNames |
|
335 |
category:categoryString |
|
336 |
comment:commentString |
|
337 |
changed:changed |
|
338 |
classInstanceVariableNames:stringOfClassInstVarNamesOrNil |
|
1439 | 339 |
|
340 |
"this is the main workhorse for installing new classes - special care |
|
341 |
has to be taken, when changing an existing classes definition. In this |
|
22371 | 342 |
case, some or all of the methods and subclass-methods have to be |
1439 | 343 |
recompiled. |
19115 | 344 |
Also, the old class(es) are still kept (but not accessible as a global), |
12094 | 345 |
to allow existing instances some life. |
1439 | 346 |
This might change in the future. |
347 |
" |
|
21407 | 348 |
|builder newClass| |
6021 | 349 |
|
6516
68fdff63c92b
allow for classBuilder to be provided by subclasses
Claus Gittinger <cg@exept.de>
parents:
6082
diff
changeset
|
350 |
builder := self newClassBuilder. |
12094 | 351 |
builder name:newName |
19115 | 352 |
inEnvironment:aNameSpaceOrOwningClass |
353 |
subclassOf:aClass |
|
354 |
instanceVariableNames:stringOfInstVarNames |
|
355 |
variable:variableBoolean |
|
356 |
words:wordsBoolean |
|
357 |
pointers:pointersBoolean |
|
358 |
classVariableNames:stringOfClassVarNames |
|
359 |
poolDictionaries:stringOfPoolNames |
|
360 |
category:categoryString |
|
361 |
comment:commentString |
|
362 |
changed:changed |
|
363 |
classInstanceVariableNames:stringOfClassInstVarNamesOrNil. |
|
21407 | 364 |
newClass := builder buildClass. |
365 |
||
22138 | 366 |
newClass notNil ifTrue:[ |
367 |
"/ if the class was autoloaded, and it refers to any autoloaded shared pool, |
|
368 |
"/ reference the pool now. So it will be present, when methods are compiled |
|
369 |
"/ (avoids costy recompiles which may happen, if the sharedPool is loaded |
|
370 |
"/ after the methods have been compiled assuming that those names are globals) |
|
371 |
(newClass sharedPools ? #()) do:[:each | each autoload]. |
|
372 |
]. |
|
21407 | 373 |
^ newClass |
374 |
||
22138 | 375 |
"Modified: / 28-07-2017 / 13:40:22 / cg" |
22371 | 376 |
"Modified (comment): / 21-11-2017 / 13:03:39 / cg" |
6021 | 377 |
! |
378 |
||
379 |
new |
|
380 |
"create & return a new metaclass (a classes class). |
|
381 |
Since metaclasses only have one instance (the class), |
|
382 |
complain if there is already one. |
|
383 |
You get a new class by sending #new to the returned metaclass |
|
384 |
(confusing - isn't it ?)" |
|
385 |
||
386 |
|newClass| |
|
387 |
||
388 |
myClass notNil ifTrue:[ |
|
12094 | 389 |
self error:'Each metaclass may only have one instance'. |
6021 | 390 |
]. |
391 |
newClass := self basicNew. |
|
12094 | 392 |
newClass |
393 |
setSuperclass:Object |
|
394 |
methodDictionary:(MethodDictionary new) |
|
395 |
instSize:0 |
|
396 |
flags:(Behavior flagBehavior). |
|
6021 | 397 |
myClass := newClass. |
398 |
^ newClass |
|
399 |
||
400 |
"Modified: 1.4.1997 / 15:44:50 / stefan" |
|
6516
68fdff63c92b
allow for classBuilder to be provided by subclasses
Claus Gittinger <cg@exept.de>
parents:
6082
diff
changeset
|
401 |
! |
68fdff63c92b
allow for classBuilder to be provided by subclasses
Claus Gittinger <cg@exept.de>
parents:
6082
diff
changeset
|
402 |
|
68fdff63c92b
allow for classBuilder to be provided by subclasses
Claus Gittinger <cg@exept.de>
parents:
6082
diff
changeset
|
403 |
newClassBuilder |
7617 | 404 |
^ ClassBuilder new metaclass:self class. |
1 | 405 |
! ! |
406 |
||
5562 | 407 |
!Metaclass methodsFor:'enumerating'! |
408 |
||
6078
13d651d69246
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6021
diff
changeset
|
409 |
instAndClassSelectorsAndMethodsDo:aTwoArgBlock |
13d651d69246
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6021
diff
changeset
|
410 |
myClass instAndClassSelectorsAndMethodsDo:aTwoArgBlock |
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
411 |
! |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
412 |
|
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
413 |
subclassesDo:aBlock |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
414 |
"evaluate the argument, aBlock for all immediate subclasses. |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
415 |
This will only enumerate globally known classes - for anonymous |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
416 |
behaviors, you have to walk over all instances of Behavior." |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
417 |
|
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
418 |
"metaclasses are not found via Smalltalk allClassesDo: |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
419 |
here, walk over classes and enumerate corresponding metas" |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
420 |
|
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
421 |
self soleInstance subclassesDo:[:aSubClass | |
12094 | 422 |
aBlock value:aSubClass class |
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
423 |
]. |
5562 | 424 |
! ! |
425 |
||
3640
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
426 |
!Metaclass methodsFor:'fileOut'! |
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
427 |
|
12094 | 428 |
basicFileOutDefinitionOf:aClass on:aStream withNameSpace:forceNameSpace withPackage:showPackage |
7617 | 429 |
"append an expression on aStream, which defines myself." |
430 |
||
8716 | 431 |
|syntaxHilighting| |
7617 | 432 |
|
433 |
UserPreferences isNil ifTrue:[ |
|
12094 | 434 |
syntaxHilighting := false |
7617 | 435 |
] ifFalse:[ |
12094 | 436 |
syntaxHilighting := UserPreferences current syntaxColoring. |
7617 | 437 |
]. |
8716 | 438 |
self |
12094 | 439 |
basicFileOutDefinitionOf:aClass |
440 |
on:aStream |
|
441 |
withNameSpace:forceNameSpace |
|
442 |
withPackage:showPackage |
|
443 |
syntaxHilighting:syntaxHilighting |
|
8716 | 444 |
! |
445 |
||
446 |
basicFileOutDefinitionOf:aClass on:aStream withNameSpace:forceNameSpace withPackage:showPackage syntaxHilighting:syntaxHilighting |
|
447 |
"append an expression on aStream, which defines myself." |
|
448 |
||
17277 | 449 |
|s owner namespace nsName fullName forceNoNameSpace superNameWithoutNameSpacePrefix cls topOwner |
9689
6213791d1760
do not store NoProject-classes (leave them unspecified in the source)
Claus Gittinger <cg@exept.de>
parents:
9197
diff
changeset
|
450 |
superclass superclassNamespace nm useStoreString boldOn boldOff pkg| |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
451 |
|
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
452 |
syntaxHilighting ifTrue:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
453 |
boldOn := [aStream bold]. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
454 |
boldOff := [aStream normal]. |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
455 |
]. |
7617 | 456 |
|
457 |
fullName := FileOutNameSpaceQuerySignal query == true. |
|
458 |
owner := aClass owningClass. |
|
17277 | 459 |
namespace := aClass topNameSpace. |
7617 | 460 |
|
461 |
(showPackage and:[owner isNil]) ifTrue:[ |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
462 |
pkg := aClass getPackage. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
463 |
(pkg notNil and:[pkg ~= PackageId noProjectID]) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
464 |
aStream nextPutAll:'"{ Package: '''. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
465 |
aStream nextPutAll:aClass package asString. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
466 |
aStream nextPutAll:''' }"'; cr; cr. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
467 |
] |
7617 | 468 |
]. |
469 |
||
16232
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
470 |
|
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
471 |
"/ No, always use namespace pragma, otherwise when reading back |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
472 |
"/ from stream, we need somehow to tell what's namespace and what's |
23266 | 473 |
"/ a private class in another class. So namespaces are **always** denoted by |
16232
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
474 |
"/ namespace pragma. |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
475 |
|
7617 | 476 |
"/ the backward compatible namespace directive is only used |
477 |
"/ for non-private classes. |
|
478 |
"/ Private classes cannot be filed into another smalltalk anyway, |
|
479 |
"/ and there is no need to complicate global lookup in stc... |
|
16232
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
480 |
"/ |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
481 |
"/ owner notNil ifTrue:[ |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
482 |
"/ forceNoNameSpace := ForceNoNameSpaceQuerySignal query == true. |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
483 |
"/ forceNoNameSpace ifFalse:[ |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
484 |
"/ fullName := true. |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
485 |
"/ ] |
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
486 |
"/ ]. |
7617 | 487 |
|
488 |
fullName ifFalse:[ |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
489 |
(owner isNil or:[forceNameSpace]) ifTrue:[ |
17277 | 490 |
(namespace notNil and:[namespace ~~ Smalltalk]) ifTrue:[ |
491 |
nsName := namespace name. |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
492 |
(nsName includes:$:) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
493 |
nsName := '''' , nsName , '''' |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
494 |
]. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
495 |
aStream nextPutAll:'"{ NameSpace: '. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
496 |
boldOn value. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
497 |
aStream nextPutAll:nsName. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
498 |
boldOff value. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
499 |
aStream nextPutAll:' }"'; cr; cr. |
17277 | 500 |
] ifFalse:[ |
501 |
"/ always write a namespace directive - even for smalltalk classes. |
|
502 |
"/ reason: the fileout might go into a big file containing multiple classes |
|
503 |
"/ in different namespaces (otherwise, the smalltalk class would later be filed into |
|
504 |
"/ the previous class's namespace) |
|
23266 | 505 |
(Smalltalk at:aClass name) == aClass ifTrue:[ |
506 |
aStream nextPutAll:'"{ NameSpace: Smalltalk }"'; cr; cr. |
|
507 |
] ifFalse:[ |
|
508 |
aStream nextPutAll:'"{ NameSpace: nil }"'; cr; cr. |
|
509 |
]. |
|
17277 | 510 |
]. |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
511 |
]. |
7617 | 512 |
]. |
513 |
||
514 |
"take care of nil-superclass" |
|
515 |
superclass := aClass superclass. |
|
516 |
superclass isNil ifTrue:[ |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
517 |
s := 'nil' |
7617 | 518 |
] ifFalse:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
519 |
superclassNamespace := superclass nameSpace. |
9197 | 520 |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
521 |
"/ be careful: if the superclasses ns is Smalltalk, |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
522 |
"/ AND this is the definition of a private class, |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
523 |
"/ AND a private class with the same name as my superclas |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
524 |
"/ exists in my owning class, |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
525 |
"/ THEN we MUST add the smalltalk-prefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
526 |
"/ (otherwise, we get the private class as superclass when accepting the |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
527 |
"/ next time) |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
528 |
(owner notNil |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
529 |
and:[ superclassNamespace == Smalltalk |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
530 |
and:[ (owner privateClassesAt:superclass name) notNil ]]) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
531 |
s := superclass nameWithNameSpacePrefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
532 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
533 |
fullName ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
534 |
s := superclass name. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
535 |
] ifFalse:[ |
17277 | 536 |
(namespace == superclassNamespace |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
537 |
and:[superclass owningClass isNil]) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
538 |
"/ superclass is in the same namespace and not private; |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
539 |
"/ still prepend namespace prefix for private classes, |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
540 |
"/ to avoid confusing stc, which needs that information. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
541 |
"/ LATE note (AUG2002) - no longer; stc was fixed. |
7617 | 542 |
"/ owner notNil ifTrue:[ |
543 |
"/ s := superclass name |
|
544 |
"/ ] ifFalse:[ |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
545 |
s := superclass nameWithoutPrefix |
7617 | 546 |
"/ ] |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
547 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
548 |
"/ a very special (rare) situation: |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
549 |
"/ my superclass resides in another nameSpace, |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
550 |
"/ but there is something else named like this |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
551 |
"/ to be found in my nameSpace (or a private class) |
7617 | 552 |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
553 |
superNameWithoutNameSpacePrefix := superclass nameWithoutNameSpacePrefix asSymbol. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
554 |
cls := aClass privateClassesAt:superNameWithoutNameSpacePrefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
555 |
cls isNil ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
556 |
(topOwner := aClass topOwningClass) isNil ifTrue:[ |
17277 | 557 |
namespace := aClass nameSpace. |
558 |
namespace notNil ifTrue:[ |
|
559 |
cls := namespace privateClassesAt:superNameWithoutNameSpacePrefix |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
560 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
561 |
"/ aClass error:'unexpected nil namespace' |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
562 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
563 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
564 |
cls := topOwner nameSpace at:superNameWithoutNameSpacePrefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
565 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
566 |
]. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
567 |
(cls notNil and:[cls ~~ superclass]) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
568 |
s := superclassNamespace name , '::' , superNameWithoutNameSpacePrefix |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
569 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
570 |
"/ no class with that name found in my namespace ... |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
571 |
"/ if the superclass resides in Smalltalk, |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
572 |
"/ suppress prefix; otherwise, use full prefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
573 |
(superclassNamespace notNil |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
574 |
and:[superclassNamespace ~~ Smalltalk]) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
575 |
(owner notNil |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
576 |
and:[(topOwner := owner topOwningClass) notNil |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
577 |
and:[superclass topOwningClass notNil |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
578 |
and:[topOwner nameSpace == superclass topOwningClass "owningClass" nameSpace] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
579 |
]]) ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
580 |
s := superNameWithoutNameSpacePrefix |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
581 |
] ifFalse:[ |
17277 | 582 |
namespace == superclass topNameSpace ifTrue:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
583 |
s := superNameWithoutNameSpacePrefix |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
584 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
585 |
s := superclass name |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
586 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
587 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
588 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
589 |
s := superNameWithoutNameSpacePrefix |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
590 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
591 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
592 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
593 |
] |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
594 |
] |
7617 | 595 |
]. |
596 |
||
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
597 |
boldOn value. |
7617 | 598 |
aStream nextPutAll:s. "/ superclass |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
599 |
boldOff value. |
7617 | 600 |
aStream space. |
601 |
aClass basicFileOutInstvarTypeKeywordOn:aStream. |
|
602 |
||
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
603 |
useStoreString := false. |
7617 | 604 |
(fullName and:[owner isNil]) ifTrue:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
605 |
nm := aClass name. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
606 |
useStoreString := true. |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
607 |
] ifFalse:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
608 |
nm := aClass nameWithoutPrefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
609 |
nm isValidSmalltalkIdentifier ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
610 |
useStoreString := true. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
611 |
]. |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
612 |
]. |
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
613 |
aStream nextPut:$#. |
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
614 |
useStoreString ifTrue:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
615 |
aStream nextPutAll:''''. |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
616 |
]. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
617 |
boldOn value. |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
618 |
aStream nextPutAll:nm. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
619 |
boldOff value. |
8765
97227ad9480c
care for non-valid classnames (spaces in name)
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
620 |
useStoreString ifTrue:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
621 |
aStream nextPutAll:''''. |
7617 | 622 |
]. |
623 |
||
12094 | 624 |
aStream crtab. |
7617 | 625 |
aStream nextPutAll:'instanceVariableNames:'''. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
626 |
boldOn value. |
7617 | 627 |
aClass printInstVarNamesOn:aStream indent:16. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
628 |
boldOff value. |
7617 | 629 |
aStream nextPutAll:''''. |
630 |
||
631 |
aStream crtab. |
|
632 |
aStream nextPutAll:'classVariableNames:'''. |
|
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
633 |
boldOn value. |
7617 | 634 |
aClass printClassVarNamesOn:aStream indent:16. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
635 |
boldOff value. |
7617 | 636 |
aStream nextPutAll:''''. |
637 |
||
638 |
aStream crtab. |
|
8551 | 639 |
aStream nextPutAll:'poolDictionaries:'''. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
640 |
boldOn value. |
8551 | 641 |
aClass printSharedPoolNamesOn:aStream indent:16. |
9175
2d009bbc418b
care for definition of a class, where the superclass
Claus Gittinger <cg@exept.de>
parents:
8765
diff
changeset
|
642 |
boldOff value. |
8551 | 643 |
aStream nextPutAll:''''. |
7617 | 644 |
|
645 |
aStream crtab. |
|
646 |
owner isNil ifTrue:[ |
|
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
647 |
"/ a public class |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
648 |
aStream nextPutAll:'category:'. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
649 |
aClass category isNil ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
650 |
s := '''''' |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
651 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
652 |
s := aClass category asString storeString |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
653 |
]. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
654 |
aStream nextPutAll:s. |
7617 | 655 |
] ifFalse:[ |
12217
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
656 |
"/ a private class |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
657 |
aStream nextPutAll:'privateIn:'. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
658 |
boldOn value. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
659 |
fullName ifTrue:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
660 |
s := owner name. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
661 |
] ifFalse:[ |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
662 |
s := owner nameWithoutNameSpacePrefix. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
663 |
]. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
664 |
aStream nextPutAll:s. |
379dcf29b04a
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12149
diff
changeset
|
665 |
boldOff value. |
7617 | 666 |
]. |
667 |
aStream cr |
|
668 |
||
10739
9602cd5ad8a0
changed #basicFileOutDefinitionOf:on:withNameSpace:withPackage:syntaxHilighting:
Claus Gittinger <cg@exept.de>
parents:
10475
diff
changeset
|
669 |
"Created: / 04-01-1997 / 20:38:16 / cg" |
9602cd5ad8a0
changed #basicFileOutDefinitionOf:on:withNameSpace:withPackage:syntaxHilighting:
Claus Gittinger <cg@exept.de>
parents:
10475
diff
changeset
|
670 |
"Modified: / 18-03-1999 / 18:15:46 / stefan" |
10740 | 671 |
"Modified: / 08-10-2007 / 13:28:59 / cg" |
16232
c561a9ff8d9f
Always file out namespace using namespace pragma, even for private classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15956
diff
changeset
|
672 |
"Modified: / 06-03-2014 / 10:32:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23266 | 673 |
"Modified: / 08-08-2018 / 09:06:17 / Claus Gittinger" |
7617 | 674 |
! |
675 |
||
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
676 |
fileOutClassInstVarDefinitionOn:aStream withNameSpace:withNameSpace |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
677 |
"append an expression to define my classInstanceVariables on aStream" |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
678 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
679 |
|anySuperClassInstVar| |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
680 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
681 |
myClass isLoaded ifFalse:[ |
12094 | 682 |
^ myClass basicFileOutDefinitionOn:aStream withNameSpace:withNameSpace |
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
683 |
]. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
684 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
685 |
withNameSpace ifTrue:[ |
12094 | 686 |
myClass name printOn:aStream. |
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
687 |
] ifFalse:[ |
12094 | 688 |
myClass printClassNameOn:aStream. |
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
689 |
]. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
690 |
aStream nextPutAll:' class instanceVariableNames:'''. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
691 |
self printInstVarNamesOn:aStream indent:8. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
692 |
aStream nextPutAll:''''. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
693 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
694 |
"mhmh - good idea; saw this in SmallDraw sourcecode ..." |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
695 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
696 |
anySuperClassInstVar := false. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
697 |
myClass allSuperclassesDo:[:aSuperClass | |
12094 | 698 |
aSuperClass class instVarNames do:[:ignored | anySuperClassInstVar := true]. |
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
699 |
]. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
700 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
701 |
aStream cr; cr; nextPut:(Character doubleQuote); cr; space. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
702 |
anySuperClassInstVar ifFalse:[ |
12094 | 703 |
aStream |
704 |
nextPutLine:'No other class instance variables are inherited by this class.'. |
|
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
705 |
] ifTrue:[ |
12094 | 706 |
aStream |
707 |
nextPutLine:'The following class instance variables are inherited by this class:'. |
|
708 |
aStream cr. |
|
709 |
myClass allSuperclassesDo:[:aSuperClass | |
|
710 |
aStream tab; nextPutAll:aSuperClass name; nextPutAll:' - '. |
|
711 |
aStream nextPutLine:(aSuperClass class instanceVariableString). |
|
712 |
]. |
|
8277
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
713 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
714 |
]. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
715 |
aStream nextPut:(Character doubleQuote); cr. |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
716 |
|
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
717 |
"Created: / 10.12.1995 / 16:31:25 / cg" |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
718 |
"Modified: / 1.4.1997 / 16:00:33 / stefan" |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
719 |
"Modified: / 3.2.2000 / 23:05:28 / cg" |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
720 |
! |
357428ca03c5
classInstVar definition string (for non-ST metaclasses)
Claus Gittinger <cg@exept.de>
parents:
8228
diff
changeset
|
721 |
|
3640
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
722 |
fileOutDefinitionOn:aStream |
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
723 |
myClass fileOutClassInstVarDefinitionOn:aStream |
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
724 |
|
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
725 |
"Modified: / 21.6.1998 / 04:10:02 / cg" |
8228 | 726 |
! |
727 |
||
728 |
fileOutOn:outStreamArg withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter encoder:encoderOrNil |
|
729 |
"file out my definition and all methods onto aStream. |
|
730 |
If stampIt is true, a timeStamp comment is prepended. |
|
731 |
If initIt is true, and the class implements a class-initialize method, |
|
732 |
append a corresponding doIt expression for initialization. |
|
733 |
The order by which the fileOut is done is used to put the version string at the end. |
|
734 |
Thus, if the version string is expanded (by CVS), the characterPositions of methods should not move" |
|
735 |
||
12149
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
736 |
self programmingLanguage sourceFileWriterClass new |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
737 |
fileOut:myClass on:outStreamArg withTimeStamp:stampIt |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
738 |
withInitialize:initIt withDefinition:withDefinition |
797e3911c35d
added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12102
diff
changeset
|
739 |
methodFilter:methodFilter encoder:encoderOrNil |
3640
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
740 |
! ! |
523d80dfc3ac
added #fileOutDefinitionOn: (show c-instVars) for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
3629
diff
changeset
|
741 |
|
12029 | 742 |
!Metaclass methodsFor:'method templates'! |
743 |
||
744 |
versionMethodTemplateForSourceCodeManager:aSourceCodeManager |
|
745 |
^ aSourceCodeManager versionMethodTemplateForSmalltalk |
|
746 |
! ! |
|
747 |
||
12094 | 748 |
!Metaclass methodsFor:'misc ui support'! |
749 |
||
750 |
iconInBrowserSymbol |
|
751 |
"can be redefined for a private icon in the browser. |
|
752 |
The returned symbol must be a selector of the ToolbarIconLibrary." |
|
753 |
||
754 |
^ nil |
|
755 |
! ! |
|
756 |
||
1875 | 757 |
!Metaclass methodsFor:'private'! |
68 | 758 |
|
12094 | 759 |
setSoleInstance:aClass |
6021 | 760 |
myClass := aClass |
761 |
||
762 |
"Created: 12.12.1995 / 13:46:22 / cg" |
|
1 | 763 |
! ! |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
764 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
765 |
!Metaclass methodsFor:'queries'! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
766 |
|
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
767 |
category |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
768 |
"return my category" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
769 |
|
12094 | 770 |
myClass isNil ifTrue:[^ nil]. |
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
771 |
^ myClass category |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
772 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
773 |
"Created: 2.4.1997 / 00:46:11 / stefan" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
774 |
! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
775 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
776 |
comment |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
777 |
"return my comment" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
778 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
779 |
^ myClass comment |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
780 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
781 |
"Created: 2.4.1997 / 00:51:35 / stefan" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
782 |
! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
783 |
|
22418 | 784 |
environment |
785 |
"return the namespace I am contained in; ST-80 compatible name" |
|
786 |
||
787 |
myClass isNil ifTrue:[^ nil]. |
|
788 |
^ myClass environment |
|
789 |
||
790 |
"Created: / 12-01-2018 / 14:04:01 / stefan" |
|
791 |
! |
|
792 |
||
9712 | 793 |
getPackage |
794 |
"return my package-id" |
|
795 |
||
796 |
^ myClass getPackage |
|
797 |
||
798 |
"Created: 15.10.1996 / 19:44:51 / cg" |
|
799 |
! |
|
800 |
||
5574 | 801 |
hasExtensions |
802 |
"return true if I have extensions" |
|
803 |
||
804 |
^ myClass hasExtensions |
|
805 |
||
806 |
! |
|
807 |
||
5659 | 808 |
hasExtensionsFrom:aPackageID |
809 |
"return true if I have extensions from a package" |
|
810 |
||
811 |
^ myClass hasExtensionsFrom:aPackageID |
|
812 |
! |
|
813 |
||
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
814 |
isBuiltInClass |
1266 | 815 |
"return true if this class is known by the run-time-system. |
816 |
Here, true is returned for myself, false for subclasses." |
|
817 |
||
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
818 |
^ self == Metaclass class or:[self == Metaclass] |
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
819 |
|
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
820 |
"Created: 15.4.1996 / 17:17:34 / cg" |
1266 | 821 |
"Modified: 23.4.1996 / 15:59:37 / cg" |
1179
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
822 |
! |
3e0f32177af4
allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
823 |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
824 |
isMeta |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
825 |
"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
|
826 |
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
|
827 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
828 |
^ true |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
829 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
830 |
|
21607 | 831 |
logFacility |
24833 | 832 |
"the 'log facility'; |
833 |
this is used by the Logger both as a prefix to the log message, |
|
834 |
and maybe (later) used to filter and/or control per-facility log thresholds." |
|
835 |
||
21607 | 836 |
myClass notNil ifTrue:[^ myClass logFacility ]. |
837 |
^ '???' |
|
838 |
||
839 |
"Created: / 01-03-2017 / 10:36:50 / cg" |
|
840 |
! |
|
841 |
||
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
842 |
name |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
843 |
"return my name - that is the name of my sole class, with ' class' |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
844 |
appended." |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
845 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
846 |
|nm| |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
847 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
848 |
myClass isNil ifTrue:[ |
12094 | 849 |
^ #someMetaclass |
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
850 |
]. |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
851 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
852 |
(nm := myClass name) isNil ifTrue:[ |
12094 | 853 |
'Metaclass [warning]: no name in my class' errorPrintCR. |
854 |
^ #'unnamed class' |
|
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
855 |
]. |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
856 |
^ nm , ' class' |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
857 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
858 |
"Modified: 10.1.1997 / 17:55:08 / cg" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
859 |
"Modified: 1.4.1997 / 15:53:11 / stefan" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
860 |
! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
861 |
|
1920 | 862 |
nameSpace |
863 |
"return the nameSpace I am contained in. |
|
864 |
Due to the implementation of nameSpaces (as classVariables), |
|
865 |
a class can only be contained in one nameSpace (which is the desired)" |
|
866 |
||
867 |
"/ this information is in the class |
|
868 |
||
869 |
^ myClass nameSpace |
|
870 |
||
871 |
"Created: 7.11.1996 / 13:18:52 / cg" |
|
872 |
! |
|
873 |
||
1724 | 874 |
owningClass |
875 |
"return nil here - regular metaclasses are never private" |
|
876 |
||
877 |
^ nil |
|
878 |
||
879 |
"Created: 12.10.1996 / 20:12:16 / cg" |
|
880 |
! |
|
881 |
||
1757 | 882 |
package |
883 |
"return my package-id" |
|
884 |
||
885 |
^ myClass package |
|
886 |
||
887 |
"Created: 15.10.1996 / 19:44:51 / cg" |
|
888 |
! |
|
889 |
||
12094 | 890 |
soleInstance |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
891 |
"return my sole class." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
892 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
893 |
^ myClass |
2047 | 894 |
! |
895 |
||
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
896 |
subclasses |
12835 | 897 |
"ask my non-meta for subclasses" |
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
898 |
|
12835 | 899 |
^ myClass subclasses collect:[:theNonMetaClass | theNonMetaClass class]. |
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
900 |
|
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
901 |
" |
12835 | 902 |
Integer class subclasses |
7435
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
903 |
" |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
904 |
! |
c5afb1b0fd1b
Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents:
7261
diff
changeset
|
905 |
|
5217
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
906 |
theMetaclass |
9695 | 907 |
"return the metaClass of the class-meta pair. |
908 |
Here, return myself, because I am the metaclass. |
|
909 |
Also implemented in my class, which also returns me." |
|
5217
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
910 |
|
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
911 |
^ self |
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
912 |
|
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
913 |
"Created: / 30.1.2000 / 23:08:15 / cg" |
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
914 |
"Modified: / 31.1.2000 / 16:15:00 / cg" |
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
915 |
! |
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
916 |
|
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
917 |
theNonMetaclass |
9695 | 918 |
"return the nonMetaClass of the class-meta pair. |
919 |
Here, return my class object, because I am the metaclass. |
|
17592 | 920 |
Also implemented in my class, which returns itself. |
921 |
Sigh: ST/X naming; Squeak calls this theNonMetaClass" |
|
5217
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
922 |
|
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
923 |
^ self soleInstance |
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
924 |
|
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
925 |
"Created: / 30.1.2000 / 23:08:11 / cg" |
5218 | 926 |
"Modified: / 31.1.2000 / 16:17:02 / cg" |
5217
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
927 |
! |
3f9682e47725
added #theNonMetaclass & #theMetaclass,
Claus Gittinger <cg@exept.de>
parents:
5191
diff
changeset
|
928 |
|
2047 | 929 |
topOwningClass |
930 |
"return nil here - regular metaclasses are never private" |
|
931 |
||
932 |
^ nil |
|
933 |
||
934 |
"Created: 3.1.1997 / 19:18:06 / cg" |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
935 |
! ! |
621 | 936 |
|
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
937 |
!Metaclass methodsFor:'source management'! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
938 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
939 |
binaryRevision |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
940 |
^ myClass binaryRevision |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
941 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
942 |
" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
943 |
Object binaryRevision |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
944 |
Object class binaryRevision |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
945 |
" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
946 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
947 |
"Modified: 2.4.1997 / 01:17:04 / stefan" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
948 |
! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
949 |
|
13475
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
950 |
binaryRevisionString |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
951 |
^ myClass binaryRevisionString |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
952 |
|
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
953 |
" |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
954 |
Object binaryRevisionString |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
955 |
Object class binaryRevisionString |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
956 |
" |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
957 |
|
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
958 |
"Modified: / 02-04-1997 / 01:17:04 / stefan" |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
959 |
"Created: / 01-07-2011 / 10:55:39 / cg" |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
960 |
! |
76bd767cfcee
added: #binaryRevisionString
Claus Gittinger <cg@exept.de>
parents:
13407
diff
changeset
|
961 |
|
15956 | 962 |
sourceCodeManagerFromBinaryRevision |
963 |
||
964 |
^ myClass sourceCodeManagerFromBinaryRevision |
|
965 |
||
966 |
"Modified: / 01-04-1997 / 14:36:31 / stefan" |
|
967 |
"Created: / 06-10-2011 / 09:34:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
968 |
! |
|
969 |
||
8228 | 970 |
sourceFileSuffix |
24375 | 971 |
"Answers a default suffix for source files, i.e. |
972 |
'st' for Smalltalk, 'js' for JavaScript or 'rb' for Ruby', etc." |
|
973 |
||
974 |
^ self programmingLanguage sourceFileSuffix |
|
13407 | 975 |
|
976 |
"Modified: / 15-08-2009 / 22:46:44 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
977 |
"Modified: / 28-06-2011 / 13:44:36 / cg" |
|
24375 | 978 |
"Modified (comment): / 27-06-2019 / 12:33:51 / Claus Gittinger" |
8228 | 979 |
! |
980 |
||
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
981 |
sourceStream |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
982 |
"return the classes source stream" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
983 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
984 |
^ myClass sourceStream |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
985 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
986 |
"Modified: 1.4.1997 / 14:36:31 / stefan" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
987 |
! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
988 |
|
4780 | 989 |
sourceStreamFor:sourceFileName |
990 |
"return the sourceStream for a sourceFileName" |
|
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
991 |
|
4780 | 992 |
^ myClass sourceStreamFor:sourceFileName |
2666
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
993 |
|
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
994 |
"Modified: 1.4.1997 / 14:36:38 / stefan" |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
995 |
! ! |
7981b615b48a
Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents:
2584
diff
changeset
|
996 |
|
1742 | 997 |
!Metaclass class methodsFor:'documentation'! |
639 | 998 |
|
23298 | 999 |
version |
1000 |
^ '$Header$' |
|
1001 |
! |
|
1002 |
||
12102 | 1003 |
version_CVS |
18890 | 1004 |
^ '$Header$' |
639 | 1005 |
! ! |
6824
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6516
diff
changeset
|
1006 |
|
15956 | 1007 |
|
2822
64829ed8f8c6
allow for conventions-dialog to be suppressed (offer a querySignal)
Claus Gittinger <cg@exept.de>
parents:
2700
diff
changeset
|
1008 |
Metaclass initialize! |