author | Claus Gittinger <cg@exept.de> |
Mon, 24 Jun 2013 00:22:16 +0200 | |
changeset 15419 | a1da7568bcfe |
parent 14407 | a58be3849b65 |
child 16879 | 2b94ea863dda |
child 18068 | 3e841ddcb18a |
permissions | -rw-r--r-- |
13406 | 1 |
" |
2 |
COPYRIGHT (c) 2006 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 |
" |
|
11962 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
14 |
Object subclass:#AbstractSourceFileWriter |
|
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
15419
a1da7568bcfe
class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
14407
diff
changeset
|
18 |
category:'Kernel-Classes-Support' |
11962 | 19 |
! |
20 |
||
12041 | 21 |
Query subclass:#MethodSourceRewriteQuery |
22 |
instanceVariableNames:'method source' |
|
23 |
classVariableNames:'' |
|
24 |
poolDictionaries:'' |
|
25 |
privateIn:AbstractSourceFileWriter |
|
26 |
! |
|
27 |
||
13406 | 28 |
!AbstractSourceFileWriter class methodsFor:'documentation'! |
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
14407 | 42 |
! |
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
Abstract common superclass for source file writers |
|
47 |
" |
|
13406 | 48 |
! ! |
12041 | 49 |
|
50 |
!AbstractSourceFileWriter class methodsFor:'signal constants'! |
|
11962 | 51 |
|
12041 | 52 |
methodSourceRewriteQuery |
53 |
"hook to allow for just-in-time rewriting of a method's sourceCode while filing out |
|
54 |
used when saving version_XXX methods in a non-XXX sourceCodeManager |
|
55 |
(i.e. to rewrite all non-CVS version methods while saving into a CVS repository) |
|
56 |
this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a |
|
57 |
CVS repository without loosing the original string with the next checkout, because it also gets |
|
58 |
expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN. |
|
59 |
||
60 |
see SmalltalkChunkFileSourceWriter fileOutMethod:on:" |
|
61 |
||
62 |
^ MethodSourceRewriteQuery |
|
11962 | 63 |
! ! |
64 |
||
65 |
!AbstractSourceFileWriter methodsFor:'fileout'! |
|
66 |
||
67 |
fileOut:aClass on:outStreamArg |
|
68 |
||
69 |
self |
|
70 |
fileOut:aClass on:outStreamArg |
|
71 |
withTimeStamp:true withInitialize:true |
|
72 |
withDefinition:true |
|
73 |
methodFilter:nil encoder:nil |
|
74 |
||
75 |
"Created: / 15-08-2009 / 13:11:31 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
76 |
! ! |
|
77 |
||
78 |
!AbstractSourceFileWriter methodsFor:'source writing'! |
|
79 |
||
80 |
fileOut: class on:stream withTimeStamp: stampIt withInitialize: initIt withDefinition: withDefinition methodFilter:methodFilter encoder:encoderOrNil |
|
81 |
"raise an error: must be redefined in concrete subclass(es)" |
|
82 |
||
83 |
^ self subclassResponsibility |
|
84 |
||
85 |
"Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
13406 | 86 |
! |
87 |
||
88 |
fileOutMethods: methods on:stream |
|
89 |
||
90 |
"Files out a bunch of methods. This is used to file-out extension methods" |
|
91 |
||
92 |
self subclassResponsibility |
|
93 |
||
94 |
"Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
95 |
"Created: / 30-12-2009 / 18:34:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
96 |
! |
|
97 |
||
98 |
fileOutPackageDefinition:packageId on:stream |
|
99 |
"Files out a package definition on the stream, so all subsequent |
|
100 |
code entities will be placed in that package" |
|
101 |
||
102 |
self subclassResponsibility |
|
103 |
||
104 |
"Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
105 |
"Created: / 30-12-2009 / 18:34:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11962 | 106 |
! ! |
107 |
||
108 |
!AbstractSourceFileWriter methodsFor:'source writing - comments'! |
|
109 |
||
110 |
fileOutComment: aStringOrStringCollection on: aStream |
|
12109
1e360b1a1062
comment/format in: #fileOutComment:on:
Claus Gittinger <cg@exept.de>
parents:
12053
diff
changeset
|
111 |
"Writes a comment to a stream using proper syntax" |
11962 | 112 |
|
113 |
self fileOutCommentStartOn: aStream. |
|
114 |
aStringOrStringCollection isStringCollection |
|
115 |
ifTrue: |
|
116 |
[aStringOrStringCollection |
|
117 |
do:[:line|self fileOutCommentLine: line on: aStream] |
|
118 |
separatedBy: [aStream cr]] |
|
119 |
ifFalse: |
|
120 |
[(aStringOrStringCollection includes: Character cr) |
|
121 |
ifTrue:"/hmm...multiline comment as string |
|
122 |
[aStringOrStringCollection asStringCollection |
|
123 |
do:[:line|self fileOutCommentLine: line on: aStream] |
|
124 |
separatedBy: [aStream cr]] |
|
125 |
ifFalse: |
|
126 |
[self fileOutCommentLine: aStringOrStringCollection on: aStream]]. |
|
127 |
self fileOutCommentEndOn: aStream. |
|
128 |
||
129 |
"Created: / 21-08-2009 / 09:36:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
130 |
! |
|
131 |
||
132 |
fileOutCommentEndOn: aStream |
|
133 |
" |
|
134 |
Writes a comment end mark on aStream. |
|
135 |
" |
|
136 |
||
137 |
^self subclassResponsibility |
|
138 |
||
139 |
"Created: / 21-08-2009 / 09:40:42 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
140 |
! |
|
141 |
||
142 |
fileOutCommentLine: aString on: aStream |
|
143 |
||
144 |
" |
|
145 |
Writes a single line of comment on a comment to a stream. |
|
146 |
Should not put an cr to the stream!! |
|
147 |
" |
|
148 |
||
149 |
^self subclassResponsibility |
|
150 |
||
151 |
"Created: / 21-08-2009 / 09:42:23 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
152 |
! |
|
153 |
||
154 |
fileOutCommentStartOn: aStream |
|
155 |
" |
|
156 |
Writes a comment start mark on aStream. |
|
157 |
" |
|
158 |
||
159 |
^self subclassResponsibility |
|
160 |
||
161 |
"Created: / 21-08-2009 / 09:40:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
162 |
! ! |
|
163 |
||
12041 | 164 |
!AbstractSourceFileWriter::MethodSourceRewriteQuery class methodsFor:'documentation'! |
165 |
||
166 |
documentation |
|
167 |
" |
|
168 |
hook to allow for just-in-time rewriting of a method's sourceCode while filing out |
|
169 |
used when saving version_XXX methods in a non-XXX sourceCodeManager |
|
170 |
(i.e. to rewrite all non-CVS version methods while saving into a CVS repository) |
|
171 |
this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a |
|
172 |
CVS repository without loosing the original string with the next checkout, because it also gets |
|
173 |
expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN. |
|
174 |
||
175 |
see SmalltalkChunkFileSourceWriter fileOutMethod:on: |
|
176 |
" |
|
177 |
! ! |
|
178 |
||
179 |
!AbstractSourceFileWriter::MethodSourceRewriteQuery methodsFor:'accessing'! |
|
180 |
||
181 |
method |
|
182 |
^ method |
|
183 |
! |
|
184 |
||
185 |
method:methodArg source:sourceArg |
|
186 |
method := methodArg. |
|
187 |
source := sourceArg. |
|
188 |
! |
|
189 |
||
190 |
source |
|
191 |
^ source |
|
192 |
! ! |
|
193 |
||
11962 | 194 |
!AbstractSourceFileWriter class methodsFor:'documentation'! |
195 |
||
12041 | 196 |
version_CVS |
15419
a1da7568bcfe
class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
14407
diff
changeset
|
197 |
^ '$Header: /cvs/stx/stx/libbasic/AbstractSourceFileWriter.st,v 1.9 2013-06-23 22:22:16 cg Exp $' |
12041 | 198 |
! |
199 |
||
200 |
version_SVN |
|
15419
a1da7568bcfe
class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
14407
diff
changeset
|
201 |
^ '$ Id: AbstractSourceFileWriter.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
11962 | 202 |
! ! |
15419
a1da7568bcfe
class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
14407
diff
changeset
|
203 |