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