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