author | Merge Script |
Thu, 19 May 2016 07:07:52 +0200 | |
branch | jv |
changeset 19882 | 8a3f4071dfec |
parent 19691 | 5e613f6255d9 |
parent 19875 | 85383ff294d8 |
child 21026 | 81e280fc1b93 |
permissions | -rw-r--r-- |
8728 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
8227 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
17333
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
15 |
|
11963 | 16 |
AbstractSourceFileWriter subclass:#SmalltalkChunkFileSourceWriter |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
17 |
instanceVariableNames:'classBeingSaved methodsAlreadySaved' |
8227 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
15421
bfe697cc8b21
class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
15085
diff
changeset
|
20 |
category:'Kernel-Classes-Support' |
8227 | 21 |
! |
22 |
||
8728 | 23 |
!SmalltalkChunkFileSourceWriter class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
14409 | 37 |
! |
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
I know how to write smalltalk chunk file format |
|
42 |
" |
|
8728 | 43 |
! ! |
8227 | 44 |
|
14596
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
45 |
!SmalltalkChunkFileSourceWriter class methodsFor:'simple API'! |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
46 |
|
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
47 |
fileOut:aClass on:aStream |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
48 |
self fileOut:aClass on:aStream withTimeStamp:true |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
49 |
withInitialize:true withDefinition:true |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
50 |
methodFilter:nil encoder:nil |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
51 |
! |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
52 |
|
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
53 |
fileOut:aClass on:aStream withTimeStamp:withTimeStamp |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
54 |
withInitialize:initIt withDefinition:withDefinition |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
55 |
methodFilter:methodFilter encoder:encoderOrNil |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
56 |
|
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
57 |
self new |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
58 |
fileOut:aClass on:aStream withTimeStamp:withTimeStamp |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
59 |
withInitialize:initIt withDefinition:withDefinition |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
60 |
methodFilter:methodFilter encoder:encoderOrNil |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
61 |
! ! |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
62 |
|
14326 | 63 |
!SmalltalkChunkFileSourceWriter class methodsFor:'utilities - source code'! |
64 |
||
65 |
methodTemplate |
|
19672 | 66 |
<resource: #obsolete> |
14326 | 67 |
"return a method definition template string" |
68 |
||
69 |
|s| |
|
70 |
||
19672 | 71 |
self obsoleteMethodWarning:'use codeGenerator'. |
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
72 |
s := (TextStream ? WriteStream) on:''. |
14326 | 73 |
s nextPutAll: |
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
74 |
'message "selector and argument names" |
14326 | 75 |
"comment stating purpose of this message" |
76 |
||
77 |
|temporaries| |
|
78 |
||
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
79 |
"statement." |
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
80 |
"statement." |
14326 | 81 |
|
82 |
" |
|
83 |
optional: comment giving example use |
|
84 |
" |
|
85 |
'. |
|
86 |
s cr. |
|
87 |
s emphasis:(UserPreferences current commentEmphasisAndColor). |
|
88 |
s nextPutAll: |
|
89 |
'" |
|
90 |
change the above template into real code; |
|
91 |
remove this comment. |
|
92 |
Then `accept'' either via the menu |
|
93 |
or via the keyboard (usually CMD-A). |
|
94 |
||
95 |
You do not need this template; you can also |
|
96 |
select any existing methods code, change it, |
|
97 |
and finally `accept''. The method will then be |
|
98 |
installed under the selector as defined in the |
|
99 |
actual text - no matter which method is selected |
|
100 |
in the browser. |
|
101 |
||
102 |
Or clear this text, type in the method from scratch |
|
103 |
and install it with `accept''. |
|
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
104 |
|
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
105 |
If you don''t like this method template to appear, |
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
106 |
disable it either via the global or browser''s settings dialog, |
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
107 |
or by evaluating: |
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
108 |
UserPreferences current showMethodTemplate:false |
14326 | 109 |
" |
110 |
'. |
|
111 |
^ s contents |
|
112 |
! |
|
113 |
||
19672 | 114 |
methodTemplateForDocumentation |
115 |
<resource: #obsolete> |
|
116 |
"return a method definition template string" |
|
117 |
||
118 |
|s| |
|
119 |
||
120 |
self obsoleteMethodWarning:'use codeGenerator'. |
|
121 |
s := (TextStream ? WriteStream) on:''. |
|
122 |
s nextPutAll: |
|
123 |
'documentation |
|
124 |
'. |
|
125 |
s emphasis:(UserPreferences current commentEmphasisAndColor). |
|
126 |
s nextPutAll:( |
|
127 |
'" |
|
128 |
comment describing this class. |
|
129 |
you can disable the generation of this template by evaluating: |
|
130 |
UserPreferences current showMethodTemplate:false |
|
131 |
||
132 |
[instance variables:] |
|
133 |
describe instance variables |
|
134 |
[class variables:] |
|
135 |
describe class variables |
|
136 |
[see also:] |
|
137 |
||
138 |
[author:] |
|
139 |
%1 |
|
140 |
" |
|
141 |
' bindWith:(OperatingSystem getFullUserName)). |
|
142 |
^ s contents |
|
143 |
! |
|
144 |
||
14326 | 145 |
versionMethodTemplateForCVS |
19672 | 146 |
<resource: #obsolete> |
14326 | 147 |
"careful to avoid expansion by cvs here!!" |
148 |
||
19672 | 149 |
self obsoleteMethodWarning:'use methodTemplateForVersionMethodCVS'. |
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
150 |
^ ('version_CVS\ ^ ''$' , 'Header$''') withCRs |
14326 | 151 |
|
152 |
"Created: / 21-08-2012 / 11:52:27 / cg" |
|
153 |
! ! |
|
154 |
||
8227 | 155 |
!SmalltalkChunkFileSourceWriter methodsFor:'source writing'! |
156 |
||
16880
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
157 |
fileOut:aClass on:outStreamArg withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
158 |
|encoder any16Bit| |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
159 |
|
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
160 |
any16Bit := aClass withAllPrivateClasses contains:[:cls | |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
161 |
cls instAndClassMethods contains:[:m | |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
162 |
(methodFilter isNil or:[ (methodFilter value:m) ]) |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
163 |
and:[ |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
164 |
|src| |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
165 |
|
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
166 |
src := m source. |
18210
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
167 |
src notNil and:[src isWideString and:[ src contains: [:c | c codePoint > 16rFF ] ] ] |
16880
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
168 |
]]]. |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
169 |
|
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
170 |
any16Bit ifTrue:[ |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
171 |
encoder := CharacterEncoder encoderForUTF8. |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
172 |
]. |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
173 |
^ self |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
174 |
fileOut: aClass |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
175 |
on:outStreamArg |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
176 |
withTimeStamp:stampIt |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
177 |
withInitialize:initIt |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
178 |
withDefinition:withDefinition |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
179 |
methodFilter:methodFilter |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
180 |
encoder:encoder |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
181 |
|
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
182 |
"Created: / 04-10-2014 / 12:11:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18210
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
183 |
"Modified: / 13-04-2015 / 21:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
16880
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
184 |
! |
150ff012bd46
Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16878
diff
changeset
|
185 |
|
8227 | 186 |
fileOut:aClass on:outStreamArg withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter encoder:encoderOrNil |
187 |
"file out my definition and all methods onto aStream. |
|
188 |
If stampIt is true, a timeStamp comment is prepended. |
|
189 |
If initIt is true, and the class implements a class-initialize method, |
|
190 |
append a corresponding doIt expression for initialization. |
|
17153
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
191 |
The order by which the fileOut is done is used to put the version method at the end. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
192 |
Thus, if the version string is expanded (by CVS), the characterPositions of all other methods should not move. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
193 |
Notice that any extensions version method is NOT written when a project definition is saved; |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
194 |
it is ABSOLUTELY required, that it is saved to the extensions.st file only (because the expanded version string |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
195 |
would be the version string of the project definition file and NOT the version string of the extensions file). |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
196 |
todo: code duplication with JavaScriptSourceFileWriter - please refactor" |
8227 | 197 |
|
17153
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
198 |
|collectionOfCategories comment versionMethods extensionVersionMethods |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
199 |
nonMeta meta classesImplementingInitialize outStream |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
200 |
allMetaClassSelectors versionSelectors extensionVersionSelectors |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
201 |
allVersionMethods| |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
202 |
|
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
203 |
self todo:'code duplication with JavaScriptSourceFileWriter - please refactor'. |
8227 | 204 |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
205 |
classBeingSaved := nonMeta := aClass theNonMetaclass. |
8227 | 206 |
meta := nonMeta class. |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
207 |
methodsAlreadySaved := Set new. |
8227 | 208 |
|
209 |
nonMeta isLoaded ifFalse:[ |
|
210 |
^ ClassDescription fileOutErrorSignal |
|
211 |
raiseRequestWith:nonMeta |
|
212 |
errorString:' - will not fileOut unloaded class: ', nonMeta name |
|
213 |
]. |
|
214 |
||
215 |
encoderOrNil isNil ifTrue:[ |
|
216 |
outStream := outStreamArg. |
|
217 |
] ifFalse:[ |
|
218 |
outStream := EncodedStream stream:outStreamArg encoder:encoderOrNil. |
|
219 |
outStream nextPutAll:'"{ Encoding: ' , encoderOrNil nameOfEncoding , ' }"'; cr; cr. |
|
220 |
]. |
|
221 |
||
222 |
" |
|
223 |
if there is a copyright method, add a copyright comment |
|
224 |
at the beginning, taking the string from the copyright method. |
|
225 |
We cannot do this unconditionally - that would lead to my copyrights |
|
226 |
being put on your code ;-). |
|
227 |
On the other hand: I want every file created by myself to have the |
|
228 |
copyright string at the beginning be preserved .... even if the |
|
229 |
code was edited in the browser and filedOut. |
|
230 |
" |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
231 |
self generateHeaderWithCopyrightOn:outStream. |
8227 | 232 |
|
233 |
stampIt ifTrue:[ |
|
234 |
"/ |
|
235 |
"/ first, a timestamp |
|
236 |
"/ |
|
14596
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
237 |
self generateTimestampOn:outStream. |
8227 | 238 |
]. |
239 |
||
240 |
withDefinition ifTrue:[ |
|
241 |
"/ |
|
242 |
"/ then the definition(s) |
|
243 |
"/ |
|
244 |
self fileOutAllDefinitionsOf:nonMeta on:outStream. |
|
245 |
"/ |
|
246 |
"/ a comment - if any |
|
247 |
"/ |
|
248 |
(comment := nonMeta comment) notNil ifTrue:[ |
|
17335
1e44f87fe4d6
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17333
diff
changeset
|
249 |
self fileOutClassCommentOf:nonMeta on:outStream. |
8227 | 250 |
]. |
251 |
"/ |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
252 |
"/ ST/X primitive definitions - if any |
8227 | 253 |
"/ |
254 |
nonMeta fileOutPrimitiveSpecsOn:outStream. |
|
255 |
]. |
|
256 |
||
257 |
"/ |
|
258 |
"/ methods from all categories in metaclass (i.e. class methods) |
|
259 |
"/ EXCEPT: the version method is placed at the very end, to |
|
260 |
"/ avoid sourcePosition-shifts when checked out later. |
|
261 |
"/ (RCS expands this string, so its size is not constant) |
|
262 |
"/ |
|
263 |
collectionOfCategories := meta categories asSortedCollection. |
|
17153
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
264 |
|
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
265 |
allMetaClassSelectors := meta methodDictionary keys. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
266 |
versionSelectors := allMetaClassSelectors select:[:selector | AbstractSourceCodeManager isVersionMethodSelector:selector ]. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
267 |
versionMethods := versionSelectors collect:[:eachSelector | meta methodDictionary at:eachSelector]. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
268 |
extensionVersionSelectors := allMetaClassSelectors select:[:selector | AbstractSourceCodeManager isExtensionsVersionMethodSelector:selector ]. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
269 |
extensionVersionMethods := extensionVersionSelectors collect:[:eachSelector | meta methodDictionary at:eachSelector]. |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
270 |
allVersionMethods := Set new addAll:versionMethods; addAll:extensionVersionMethods; yourself. |
12045
ccb1c727370b
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
12043
diff
changeset
|
271 |
|
8227 | 272 |
collectionOfCategories notNil ifTrue:[ |
273 |
"/ |
|
274 |
"/ documentation first (if any), but not the version method |
|
275 |
"/ |
|
276 |
(collectionOfCategories includes:'documentation') ifTrue:[ |
|
12043 | 277 |
|
13754
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
278 |
"/ versionMethods do:[:versionMethod | |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
279 |
"/ |source| |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
280 |
"/ |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
281 |
"/ source := versionMethod source. |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
282 |
"/ (source isEmptyOrNil or:[(source startsWith:nonMeta nameOfOldVersionMethod) not]) ifTrue:[ |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
283 |
"/ "something bad happend to the classes code" |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
284 |
"/ |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
285 |
"/ Class fileOutErrorSignal |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
286 |
"/ raiseRequestWith:aClass |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
287 |
"/ errorString:' - bad source for version method (uncompiled class file?): ', (versionMethod displayString) |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
288 |
"/ ]. |
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
289 |
"/ ]. |
12043 | 290 |
|
17153
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
291 |
self fileOutCategory:'documentation' of:meta except:allVersionMethods only:nil methodFilter:methodFilter on:outStream. |
8227 | 292 |
]. |
293 |
||
294 |
"/ |
|
295 |
"/ initialization next (if any) |
|
296 |
"/ |
|
297 |
(collectionOfCategories includes:'initialization') ifTrue:[ |
|
298 |
self fileOutCategory:'initialization' of:meta methodFilter:methodFilter on:outStream. |
|
299 |
]. |
|
300 |
||
301 |
"/ |
|
302 |
"/ instance creation next (if any) |
|
303 |
"/ |
|
304 |
(collectionOfCategories includes:'instance creation') ifTrue:[ |
|
305 |
self fileOutCategory:'instance creation' of:meta methodFilter:methodFilter on:outStream. |
|
306 |
]. |
|
307 |
collectionOfCategories do:[:aCategory | |
|
308 |
((aCategory ~= 'documentation') |
|
309 |
and:[(aCategory ~= 'initialization') |
|
310 |
and:[aCategory ~= 'instance creation']]) ifTrue:[ |
|
311 |
self fileOutCategory:aCategory of:meta methodFilter:methodFilter on:outStream. |
|
312 |
] |
|
313 |
] |
|
314 |
]. |
|
315 |
||
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
316 |
"/ if there are any primitive definitions (vw-like ffi-primitives), |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
317 |
"/ file them out first in the order: defines, types. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
318 |
"/ Otherwise, we might have trouble when filing in later, because the types are needed |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
319 |
"/ for the primitive calls. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
320 |
nonMeta methodDictionary keysAndValuesDo:[:sel :m | |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
321 |
m isVisualWorksTypedef ifTrue:[ |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
322 |
self fileOutCategory:m category of:nonMeta except:nil only:(Array with:m) methodFilter:methodFilter on:outStream. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
323 |
]. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
324 |
]. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
325 |
|
8227 | 326 |
"/ |
327 |
"/ methods from all categories |
|
328 |
"/ |
|
329 |
collectionOfCategories := nonMeta categories asSortedCollection. |
|
330 |
collectionOfCategories notNil ifTrue:[ |
|
331 |
collectionOfCategories do:[:aCategory | |
|
332 |
self fileOutCategory:aCategory of:nonMeta methodFilter:methodFilter on:outStream. |
|
333 |
] |
|
334 |
]. |
|
335 |
||
336 |
"/ |
|
337 |
"/ any private classes' methods |
|
338 |
"/ |
|
17153
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
339 |
nonMeta privateClassesSorted do:[:eachPrivateClass | |
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
340 |
self fileOutAllMethodsOf:eachPrivateClass on:outStream methodFilter:methodFilter |
8227 | 341 |
]. |
342 |
||
343 |
||
344 |
"/ |
|
17153
91e8d99118e0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
16880
diff
changeset
|
345 |
"/ finally, the previously skipped version method (but not the extensionsVersion methods!!) |
8227 | 346 |
"/ |
12043 | 347 |
versionMethods notEmpty ifTrue: [ |
348 |
self fileOutCategory:'documentation' of:meta except:nil only:versionMethods methodFilter:methodFilter on:outStream. |
|
8227 | 349 |
]. |
350 |
||
351 |
initIt ifTrue:[ |
|
352 |
"/ |
|
353 |
"/ optionally an initialize message |
|
354 |
"/ |
|
355 |
classesImplementingInitialize := OrderedCollection new. |
|
356 |
||
357 |
(meta includesSelector:#initialize) ifTrue:[ |
|
358 |
classesImplementingInitialize add:nonMeta |
|
359 |
]. |
|
360 |
nonMeta privateClassesSorted do:[:aPrivateClass | |
|
361 |
(aPrivateClass theMetaclass includesSelector:#initialize) ifTrue:[ |
|
362 |
classesImplementingInitialize add:aPrivateClass |
|
363 |
] |
|
364 |
]. |
|
17333
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
365 |
classesImplementingInitialize notEmpty ifTrue:[ |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
366 |
outStream cr. |
8227 | 367 |
classesImplementingInitialize topologicalSort:[:a :b | b isSubclassOf:a]. |
368 |
classesImplementingInitialize do:[:eachClass | |
|
17333
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
369 |
self generateCallToInitializerFor:eachClass on:outStream |
8227 | 370 |
]. |
371 |
]. |
|
372 |
] |
|
373 |
||
10036
51489deaf8c5
care for non-comment in copyright method (JUN stuff)
Claus Gittinger <cg@exept.de>
parents:
8728
diff
changeset
|
374 |
"Created: / 15-11-1995 / 12:53:06 / cg" |
51489deaf8c5
care for non-comment in copyright method (JUN stuff)
Claus Gittinger <cg@exept.de>
parents:
8728
diff
changeset
|
375 |
"Modified: / 01-04-1997 / 16:01:05 / stefan" |
13754
0ce8b7b9e6ee
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
Claus Gittinger <cg@exept.de>
parents:
13462
diff
changeset
|
376 |
"Modified: / 29-09-2011 / 14:53:49 / cg" |
8227 | 377 |
! |
378 |
||
379 |
fileOutAllDefinitionsOf:aNonMetaClass on:aStream |
|
15953 | 380 |
self fileOutAllDefinitionsOf:aNonMetaClass on:aStream withNameSpace: true. |
381 |
||
382 |
"Created: / 15-10-1996 / 11:15:19 / cg" |
|
383 |
"Modified: / 22-03-1997 / 16:11:56 / cg" |
|
384 |
"Modified: / 04-02-2014 / 20:00:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
385 |
! |
|
386 |
||
387 |
fileOutAllDefinitionsOf:aNonMetaClass on:aStream withNameSpace: withNameSpacePragma |
|
8227 | 388 |
"append expressions on aStream, which defines myself and all of my private classes." |
389 |
||
15085
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
390 |
|s| |
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
391 |
|
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
392 |
s := CharacterWriteStream on:(String new:50). |
15953 | 393 |
self fileOutDefinitionOf:aNonMetaClass on:s withNameSpace: withNameSpacePragma. |
15085
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
394 |
aStream nextChunkPut:(s contents). |
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
395 |
|
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
396 |
"/ self fileOutDefinitionOf:aNonMetaClass on:aStream. |
328f314c2e19
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14985
diff
changeset
|
397 |
"/ aStream nextPutChunkSeparator. |
8227 | 398 |
aStream cr; cr. |
399 |
||
400 |
"/ |
|
401 |
"/ optional classInstanceVariables |
|
402 |
"/ |
|
403 |
aNonMetaClass class instanceVariableString isBlank ifFalse:[ |
|
17333
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
404 |
self fileOutClassInstVarDefinitionOf:aNonMetaClass on:aStream |
8227 | 405 |
]. |
406 |
||
407 |
"/ here, the full nameSpace prefixes are output, |
|
408 |
"/ to avoid confusing stc |
|
409 |
"/ (which otherwise could not find the correct superclass) |
|
410 |
"/ |
|
411 |
Class fileOutNameSpaceQuerySignal answer:false do:[ |
|
412 |
Class forceNoNameSpaceQuerySignal answer:true do:[ |
|
413 |
aNonMetaClass privateClassesSorted do:[:aClass | |
|
15953 | 414 |
self fileOutAllDefinitionsOf:aClass on:aStream withNameSpace: false |
8227 | 415 |
] |
416 |
] |
|
417 |
]. |
|
418 |
||
15953 | 419 |
"Created: / 04-02-2014 / 20:00:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8227 | 420 |
! |
421 |
||
422 |
fileOutAllMethodsOf:aClass on:aStream methodFilter:methodFilter |
|
423 |
|collectionOfCategories| |
|
424 |
||
425 |
collectionOfCategories := aClass class categories asSortedCollection. |
|
426 |
collectionOfCategories notNil ifTrue:[ |
|
427 |
collectionOfCategories do:[:aCategory | |
|
428 |
self fileOutCategory:aCategory of:aClass class methodFilter:methodFilter on:aStream. |
|
429 |
] |
|
430 |
]. |
|
431 |
collectionOfCategories := aClass categories asSortedCollection. |
|
432 |
collectionOfCategories notNil ifTrue:[ |
|
433 |
collectionOfCategories do:[:aCategory | |
|
434 |
self fileOutCategory:aCategory of:aClass methodFilter:methodFilter on:aStream. |
|
435 |
] |
|
436 |
]. |
|
437 |
||
438 |
aClass privateClassesSorted do:[:aClass | |
|
439 |
self fileOutAllMethodsOf:aClass on:aStream methodFilter:methodFilter |
|
440 |
]. |
|
441 |
||
442 |
"Created: 15.10.1996 / 11:13:00 / cg" |
|
443 |
"Modified: 22.3.1997 / 16:12:17 / cg" |
|
444 |
! |
|
445 |
||
446 |
fileOutCategory:aCategory of:aClass except:skippedMethods only:savedMethods methodFilter:methodFilter on:aStream |
|
447 |
"file out all methods belonging to aCategory, aString onto aStream. |
|
448 |
If skippedMethods is nonNil, those are not saved. |
|
449 |
If savedMethods is nonNil, only those are saved. |
|
450 |
If both are nil, all are saved. See version-method handling in |
|
451 |
fileOut for what this is needed." |
|
452 |
||
14983
a0b8519d7c50
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14596
diff
changeset
|
453 |
|sortedSelectors first prevPrivacy privacy interestingMethods cat prjDef| |
11701 | 454 |
|
455 |
interestingMethods := OrderedCollection new. |
|
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
456 |
aClass methodsDo:[:each | |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
457 |
| wanted method shadowed | |
8227 | 458 |
|
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
459 |
method := each. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
460 |
(methodsAlreadySaved includes:method) ifFalse:[ |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
461 |
(aCategory = method category) ifTrue:[ |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
462 |
wanted := methodFilter isNil or:[methodFilter value:method]. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
463 |
wanted ifFalse:[ |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
464 |
"/ care for methods which have been shadowed by an extension from another package!! |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
465 |
"/ The problem is that we cannot easily introspect the filter, so we cannot know |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
466 |
"/ if the filter is for package or not. In most (all?) cases it is as this method |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
467 |
"/ is mostly used by source code management, so if the filter filters method out, |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
468 |
"/ try afain for possibly shadowed method. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
469 |
methodFilter notNil ifTrue:[ |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
470 |
shadowed := method shadowedMethod. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
471 |
shadowed notNil ifTrue:[ |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
472 |
wanted := methodFilter value: shadowed. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
473 |
]. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
474 |
]. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
475 |
]. |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
476 |
wanted ifTrue:[ |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
477 |
skippedMethods notNil ifTrue:[ |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
478 |
wanted := (skippedMethods includesIdentical:method) not |
8227 | 479 |
] ifFalse:[ |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
480 |
wanted := savedMethods isNil or:[ savedMethods includesIdentical:method ]. |
11703
54e2c3acf7a7
skip non-symbol-selector methods when filing out
Claus Gittinger <cg@exept.de>
parents:
11701
diff
changeset
|
481 |
]. |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
482 |
wanted ifTrue:[ |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
483 |
(method selector isSymbol) ifTrue:[ |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
484 |
interestingMethods add:method |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
485 |
] ifFalse:[ |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
486 |
Transcript showCR:'skipping non-symbol method ', method selector printString. |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
487 |
]. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
488 |
]. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
489 |
] |
8227 | 490 |
] |
11701 | 491 |
] |
492 |
]. |
|
14983
a0b8519d7c50
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14596
diff
changeset
|
493 |
|
11701 | 494 |
interestingMethods notEmpty ifTrue:[ |
495 |
"/ |
|
496 |
"/ sort by selector |
|
497 |
"/ |
|
498 |
sortedSelectors := interestingMethods collect:[:m | aClass selectorAtMethod:m]. |
|
499 |
sortedSelectors sortWith:interestingMethods. |
|
8227 | 500 |
|
14985
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
501 |
generatingSourceForOriginal == true ifTrue:[ |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
502 |
"/ care for methods which have been shadowed by an extension from another package!! |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
503 |
(prjDef := aClass theNonMetaclass projectDefinitionClass) notNil ifTrue:[ |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
504 |
prjDef hasSavedOverwrittenMethods ifTrue:[ |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
505 |
interestingMethods := interestingMethods collect:[:m | |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
506 |
|originalOrNil| |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
507 |
|
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
508 |
(m package ~~ aClass package) ifTrue:[ |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
509 |
originalOrNil := prjDef savedOverwrittenMethodForClass:aClass selector:m selector. |
14985
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
510 |
originalOrNil notNil ifTrue:[ |
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
511 |
1. |
14985
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
512 |
self breakPoint:#cg |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
513 |
]. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
514 |
]. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
515 |
originalOrNil ? m |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
516 |
]. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
517 |
] |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
518 |
]. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
519 |
]. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
520 |
|
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
521 |
first := true. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
522 |
prevPrivacy := nil. |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
523 |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
524 |
interestingMethods do:[:eachMethod | |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
525 |
privacy := eachMethod privacy. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
526 |
|
11701 | 527 |
first ifFalse:[ |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
528 |
privacy ~~ prevPrivacy ifTrue:[ |
11701 | 529 |
first := true. |
530 |
aStream space. |
|
8227 | 531 |
aStream nextPutChunkSeparator. |
11701 | 532 |
]. |
533 |
aStream cr; cr |
|
534 |
]. |
|
535 |
||
536 |
first ifTrue:[ |
|
537 |
aStream nextPutChunkSeparator. |
|
538 |
aClass printClassNameOn:aStream. |
|
539 |
privacy ~~ #public ifTrue:[ |
|
540 |
aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
|
541 |
] ifFalse:[ |
|
542 |
aStream nextPutAll:' methodsFor:'. |
|
8227 | 543 |
]. |
11701 | 544 |
cat := aCategory. |
545 |
cat isNil ifTrue:[ cat := '' ]. |
|
546 |
aStream nextPutAll:aCategory asString storeString. |
|
547 |
aStream nextPutChunkSeparator; cr; cr. |
|
548 |
first := false. |
|
8227 | 549 |
]. |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
550 |
self fileOutMethod:eachMethod on:aStream. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
551 |
methodsAlreadySaved add:eachMethod. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
552 |
|
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
553 |
prevPrivacy := privacy. |
11701 | 554 |
]. |
555 |
aStream space. |
|
556 |
aStream nextPutChunkSeparator. |
|
557 |
aStream cr |
|
14596
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
558 |
]. |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
559 |
aStream cr |
8227 | 560 |
|
16878
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
561 |
"Modified: / 28-08-1995 / 14:30:41 / claus" |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
562 |
"Modified: / 12-06-1996 / 11:37:33 / stefan" |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
563 |
"Modified: / 15-11-1996 / 11:32:21 / cg" |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
564 |
"Created: / 01-04-1997 / 16:04:33 / stefan" |
19f06d12b7da
Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15953
diff
changeset
|
565 |
"Modified: / 03-10-2014 / 23:16:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8227 | 566 |
! |
567 |
||
568 |
fileOutCategory:aCategory of:aClass methodFilter:methodFilter on:aStream |
|
569 |
"file out all methods belonging to aCategory, aString onto aStream" |
|
570 |
||
571 |
self fileOutCategory:aCategory of:aClass except:nil only:nil methodFilter:methodFilter on:aStream |
|
572 |
||
573 |
"Created: 1.4.1997 / 16:04:44 / stefan" |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
574 |
! |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
575 |
|
17335
1e44f87fe4d6
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17333
diff
changeset
|
576 |
fileOutClassCommentOf:aNonMetaClass on:aStream |
1e44f87fe4d6
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17333
diff
changeset
|
577 |
aNonMetaClass fileOutCommentOn:aStream. |
1e44f87fe4d6
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17333
diff
changeset
|
578 |
! |
1e44f87fe4d6
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17333
diff
changeset
|
579 |
|
17333
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
580 |
fileOutClassInstVarDefinitionOf:aNonMetaClass on:aStream |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
581 |
aNonMetaClass fileOutClassInstVarDefinitionOn:aStream. |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
582 |
aStream nextPutChunkSeparator. |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
583 |
aStream cr; cr |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
584 |
! |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
585 |
|
12108 | 586 |
fileOutCommentEndOn:aStream |
587 |
"Writes a comment end mark on aStream." |
|
588 |
||
589 |
"/ intentionally left blank - make each line an EOL-comment instead |
|
590 |
! |
|
591 |
||
592 |
fileOutCommentLine:aString on:aStream |
|
593 |
"Writes a single line of comment on a comment to a stream." |
|
594 |
||
595 |
aStream |
|
596 |
nextPutAll:'"/ '; |
|
597 |
nextPutAll: aString |
|
598 |
! |
|
599 |
||
600 |
fileOutCommentStartOn:aStream |
|
601 |
"Writes a comment start mark on aStream." |
|
602 |
||
603 |
"/ intentionally left blank - make each line an EOL-comment instead |
|
604 |
! |
|
605 |
||
14596
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
606 |
fileOutDefinitionOf:aNonMetaClass on:aStream |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
607 |
aNonMetaClass fileOutDefinitionOn:aStream. |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
608 |
! |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
609 |
|
15953 | 610 |
fileOutDefinitionOf:aNonMetaClass on:aStream withNameSpace: withNameSpacePragma |
611 |
aNonMetaClass basicFileOutDefinitionOn:aStream withNameSpace: withNameSpacePragma |
|
612 |
||
613 |
"Created: / 04-02-2014 / 20:00:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
614 |
! |
|
615 |
||
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
616 |
fileOutMethod:aMethod on:aStream |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
617 |
"file a single method onto aStream." |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
618 |
|
12043 | 619 |
|source possiblyRewrittenSource rewriteQuery| |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
620 |
|
18210
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
621 |
source := aMethod source asSingleByteStringIfPossible. |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
622 |
source isNil ifTrue:[ |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
623 |
Class fileOutErrorSignal |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
624 |
raiseRequestWith:aMethod mclass |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
625 |
errorString:' - no source for method: ', (aMethod displayString) |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
626 |
] ifFalse:[ |
12043 | 627 |
"/ hook to allow for just-in-time rewriting of a method's sourceCode while filing out |
628 |
"/ used when saving version_XXX methods in a non-XXX sourceCodeManager |
|
629 |
"/ (i.e. to rewrite all non-CVS version methods while saving into a CVS repository) |
|
630 |
"/ this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a |
|
631 |
"/ CVS repository without loosing the original string with the next checkout, because it also gets |
|
632 |
"/ expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN. |
|
17401
2d776a4f4258
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17335
diff
changeset
|
633 |
"/ also used, when generating sourcecode for another Smalltalk system (VSE fileout) |
2d776a4f4258
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17335
diff
changeset
|
634 |
|
12043 | 635 |
rewriteQuery := AbstractSourceFileWriter methodSourceRewriteQuery new. |
636 |
rewriteQuery method:aMethod source:source. |
|
637 |
possiblyRewrittenSource := (rewriteQuery query) ? source. |
|
638 |
aStream nextChunkPut:possiblyRewrittenSource. |
|
639 |
"/possiblyRewrittenSource ~= source ifTrue: [ |
|
640 |
"/ Transcript showCR: possiblyRewrittenSource. |
|
641 |
"/]. |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
642 |
]. |
18210
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
643 |
|
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
644 |
"Modified: / 13-04-2015 / 21:37:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
645 |
! |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
646 |
|
13420 | 647 |
fileOutMethods: methods on: stream |
648 |
||
15953 | 649 |
methods do:[:method| |
650 |
|cat source privacy| |
|
13420 | 651 |
|
652 |
stream nextPutChunkSeparator. |
|
15953 | 653 |
"JV@2012-09-05: Support for filing out Java extension methods" |
654 |
method mclass theNonMetaclass isJavaClass ifTrue:[ |
|
655 |
| class classBinaryName comps | |
|
656 |
||
657 |
class := method mclass theNonMetaclass . |
|
658 |
"Sigh, make it compatible with old and new naming of Java classes |
|
659 |
||
660 |
old -> aJavaClass name == #'java/lang/Object' |
|
661 |
new -> aJavaClass name == JAVA::java::lang::Object |
|
662 |
aJavaClass binaryName == #'java/lang/Object' |
|
663 |
" |
|
664 |
classBinaryName := (class respondsTo: #binaryName) |
|
665 |
ifTrue:[ class binaryName ] |
|
666 |
ifFalse:[ class name ]. |
|
667 |
stream nextPutAll:'(Java classForName:'''. |
|
668 |
stream nextPutAll:(classBinaryName copyReplaceAll:$/ with: $.). |
|
669 |
stream nextPutAll:''')'. |
|
670 |
method mclass isMetaclass ifTrue:[ |
|
671 |
stream nextPutAll: ' class'. |
|
672 |
]. |
|
673 |
] ifFalse:[ |
|
674 |
method mclass name printOn:stream. |
|
675 |
]. |
|
13420 | 676 |
"/ self printClassNameOn:aStream. |
677 |
||
678 |
(privacy := method privacy) ~~ #public ifTrue:[ |
|
679 |
stream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
|
680 |
] ifFalse:[ |
|
681 |
stream nextPutAll:' methodsFor:'. |
|
682 |
]. |
|
683 |
||
684 |
cat := method category ? ''. |
|
685 |
stream nextPutAll:cat asString storeString. |
|
686 |
stream nextPutChunkSeparator; cr; cr. |
|
687 |
||
688 |
self fileOutMethod: method on: stream. |
|
689 |
||
690 |
stream space. |
|
691 |
stream nextPutChunkSeparator. |
|
692 |
stream cr] |
|
693 |
||
694 |
"Created: / 30-12-2009 / 18:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
15953 | 695 |
"Modified: / 09-10-2013 / 08:57:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13420 | 696 |
! |
697 |
||
698 |
fileOutPackageDefinition:pkg on:aStream |
|
699 |
(pkg notNil and:[ pkg ~= PackageId noProjectID ]) ifTrue:[ |
|
700 |
aStream nextPutAll:'"{ Package: '''. |
|
701 |
aStream nextPutAll:pkg asString. |
|
702 |
aStream |
|
703 |
nextPutAll:''' }"'; cr; cr; |
|
704 |
nextPut:$!!; cr; cr |
|
705 |
] |
|
706 |
! |
|
707 |
||
17333
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
708 |
generateCallToInitializerFor:aClass on:aStream |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
709 |
aClass printClassNameOn:aStream. aStream nextPutAll:' initialize'. |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
710 |
aStream nextPutChunkSeparator. |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
711 |
aStream cr. |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
712 |
! |
937efc261475
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17153
diff
changeset
|
713 |
|
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
714 |
generateHeaderWithCopyrightOn:outStream |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
715 |
|copyrightMethod copyrightText| |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
716 |
|
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
717 |
"if there is a copyright method, add a copyright comment |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
718 |
at the beginning, taking the string from the copyright method. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
719 |
We cannot do this unconditionally - that would lead to my copyrights |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
720 |
being put on your code ;-). |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
721 |
On the other hand: I want every file created by myself to have the |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
722 |
copyright string at the beginning be preserved .... even if the |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
723 |
code was edited in the browser and filedOut." |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
724 |
|
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
725 |
(copyrightMethod := classBeingSaved theMetaclass compiledMethodAt:#copyright) notNil ifTrue:[ |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
726 |
" |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
727 |
get the copyright method's comment-text, strip off empty and blank lines |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
728 |
and insert at beginning. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
729 |
" |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
730 |
copyrightText := copyrightMethod comment. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
731 |
copyrightText notEmptyOrNil ifTrue:[ |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
732 |
copyrightText := copyrightText asCollectionOfLines asStringCollection. |
19875 | 733 |
copyrightText := copyrightText withoutLeadingAndTrailingBlankLines. |
11853
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
734 |
copyrightText notEmpty ifTrue:[ |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
735 |
copyrightText addFirst:'"'. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
736 |
copyrightText addLast:'"'. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
737 |
copyrightText := copyrightText asString. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
738 |
outStream nextPutAllAsChunk:copyrightText. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
739 |
]. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
740 |
]. |
7c3265d8931e
save typedef methods before others to ensure that types
Claus Gittinger <cg@exept.de>
parents:
11703
diff
changeset
|
741 |
]. |
14596
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
742 |
! |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
743 |
|
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
744 |
generateTimestampOn:outStream |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
745 |
outStream nextPutAll:(Smalltalk timeStamp). |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
746 |
outStream nextPutChunkSeparator. |
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
747 |
outStream cr; cr. |
8227 | 748 |
! ! |
749 |
||
750 |
!SmalltalkChunkFileSourceWriter class methodsFor:'documentation'! |
|
751 |
||
14985
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
752 |
version |
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
753 |
^ '$Header$' |
14985
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
754 |
! |
2e24694bc6f4
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14983
diff
changeset
|
755 |
|
13420 | 756 |
version_CVS |
18554
ead4614d7aaa
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
17401
diff
changeset
|
757 |
^ '$Header$' |
12043 | 758 |
! |
759 |
||
18210
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
760 |
version_HG |
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
761 |
|
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
762 |
^ '$Changeset: <not expanded> $' |
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
763 |
! |
d1768187cb74
fileout: file out class in UTF8 only if necessary
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18120
diff
changeset
|
764 |
|
13420 | 765 |
version_SVN |
15421
bfe697cc8b21
class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
15085
diff
changeset
|
766 |
^ '$ Id: SmalltalkChunkFileSourceWriter.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
8227 | 767 |
! ! |
14596
45bb7ac30ab0
class: SmalltalkChunkFileSourceWriter
Claus Gittinger <cg@exept.de>
parents:
14409
diff
changeset
|
768 |