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