author | Claus Gittinger <cg@exept.de> |
Fri, 02 Oct 2009 17:00:29 +0200 | |
changeset 12109 | 1e360b1a1062 |
parent 12053 | bab73507144f |
child 12182 | 8e65115f9c92 |
permissions | -rw-r--r-- |
11962 | 1 |
"{ Package: 'stx:libbasic' }" |
2 |
||
3 |
Object subclass:#AbstractSourceFileWriter |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Kernel-Classes' |
|
8 |
! |
|
9 |
||
12041 | 10 |
Query subclass:#MethodSourceRewriteQuery |
11 |
instanceVariableNames:'method source' |
|
12 |
classVariableNames:'' |
|
13 |
poolDictionaries:'' |
|
14 |
privateIn:AbstractSourceFileWriter |
|
15 |
! |
|
16 |
||
17 |
||
18 |
!AbstractSourceFileWriter class methodsFor:'signal constants'! |
|
11962 | 19 |
|
12041 | 20 |
methodSourceRewriteQuery |
21 |
"hook to allow for just-in-time rewriting of a method's sourceCode while filing out |
|
22 |
used when saving version_XXX methods in a non-XXX sourceCodeManager |
|
23 |
(i.e. to rewrite all non-CVS version methods while saving into a CVS repository) |
|
24 |
this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a |
|
25 |
CVS repository without loosing the original string with the next checkout, because it also gets |
|
26 |
expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN. |
|
27 |
||
28 |
see SmalltalkChunkFileSourceWriter fileOutMethod:on:" |
|
29 |
||
30 |
^ MethodSourceRewriteQuery |
|
11962 | 31 |
! ! |
32 |
||
33 |
!AbstractSourceFileWriter methodsFor:'fileout'! |
|
34 |
||
35 |
fileOut:aClass on:outStreamArg |
|
36 |
||
37 |
self |
|
38 |
fileOut:aClass on:outStreamArg |
|
39 |
withTimeStamp:true withInitialize:true |
|
40 |
withDefinition:true |
|
41 |
methodFilter:nil encoder:nil |
|
42 |
||
43 |
"Created: / 15-08-2009 / 13:11:31 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
44 |
! ! |
|
45 |
||
46 |
!AbstractSourceFileWriter methodsFor:'source writing'! |
|
47 |
||
48 |
fileOut: class on:stream withTimeStamp: stampIt withInitialize: initIt withDefinition: withDefinition methodFilter:methodFilter encoder:encoderOrNil |
|
49 |
"raise an error: must be redefined in concrete subclass(es)" |
|
50 |
||
51 |
^ self subclassResponsibility |
|
52 |
||
53 |
"Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
54 |
! ! |
|
55 |
||
56 |
!AbstractSourceFileWriter methodsFor:'source writing - comments'! |
|
57 |
||
58 |
fileOutComment: aStringOrStringCollection on: aStream |
|
12109
1e360b1a1062
comment/format in: #fileOutComment:on:
Claus Gittinger <cg@exept.de>
parents:
12053
diff
changeset
|
59 |
"Writes a comment to a stream using proper syntax" |
11962 | 60 |
|
61 |
self fileOutCommentStartOn: aStream. |
|
62 |
aStringOrStringCollection isStringCollection |
|
63 |
ifTrue: |
|
64 |
[aStringOrStringCollection |
|
65 |
do:[:line|self fileOutCommentLine: line on: aStream] |
|
66 |
separatedBy: [aStream cr]] |
|
67 |
ifFalse: |
|
68 |
[(aStringOrStringCollection includes: Character cr) |
|
69 |
ifTrue:"/hmm...multiline comment as string |
|
70 |
[aStringOrStringCollection asStringCollection |
|
71 |
do:[:line|self fileOutCommentLine: line on: aStream] |
|
72 |
separatedBy: [aStream cr]] |
|
73 |
ifFalse: |
|
74 |
[self fileOutCommentLine: aStringOrStringCollection on: aStream]]. |
|
75 |
self fileOutCommentEndOn: aStream. |
|
76 |
||
77 |
"Created: / 21-08-2009 / 09:36:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
78 |
! |
|
79 |
||
80 |
fileOutCommentEndOn: aStream |
|
81 |
" |
|
82 |
Writes a comment end mark on aStream. |
|
83 |
" |
|
84 |
||
85 |
^self subclassResponsibility |
|
86 |
||
87 |
"Created: / 21-08-2009 / 09:40:42 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
88 |
! |
|
89 |
||
90 |
fileOutCommentLine: aString on: aStream |
|
91 |
||
92 |
" |
|
93 |
Writes a single line of comment on a comment to a stream. |
|
94 |
Should not put an cr to the stream!! |
|
95 |
" |
|
96 |
||
97 |
^self subclassResponsibility |
|
98 |
||
99 |
"Created: / 21-08-2009 / 09:42:23 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
100 |
! |
|
101 |
||
102 |
fileOutCommentStartOn: aStream |
|
103 |
" |
|
104 |
Writes a comment start mark on aStream. |
|
105 |
" |
|
106 |
||
107 |
^self subclassResponsibility |
|
108 |
||
109 |
"Created: / 21-08-2009 / 09:40:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
110 |
! ! |
|
111 |
||
12041 | 112 |
!AbstractSourceFileWriter::MethodSourceRewriteQuery class methodsFor:'documentation'! |
113 |
||
114 |
documentation |
|
115 |
" |
|
116 |
hook to allow for just-in-time rewriting of a method's sourceCode while filing out |
|
117 |
used when saving version_XXX methods in a non-XXX sourceCodeManager |
|
118 |
(i.e. to rewrite all non-CVS version methods while saving into a CVS repository) |
|
119 |
this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a |
|
120 |
CVS repository without loosing the original string with the next checkout, because it also gets |
|
121 |
expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN. |
|
122 |
||
123 |
see SmalltalkChunkFileSourceWriter fileOutMethod:on: |
|
124 |
" |
|
125 |
! ! |
|
126 |
||
127 |
!AbstractSourceFileWriter::MethodSourceRewriteQuery methodsFor:'accessing'! |
|
128 |
||
129 |
method |
|
130 |
^ method |
|
131 |
! |
|
132 |
||
133 |
method:methodArg source:sourceArg |
|
134 |
method := methodArg. |
|
135 |
source := sourceArg. |
|
136 |
! |
|
137 |
||
138 |
source |
|
139 |
^ source |
|
140 |
! ! |
|
141 |
||
11962 | 142 |
!AbstractSourceFileWriter class methodsFor:'documentation'! |
143 |
||
144 |
version |
|
12109
1e360b1a1062
comment/format in: #fileOutComment:on:
Claus Gittinger <cg@exept.de>
parents:
12053
diff
changeset
|
145 |
^ '$Header: /cvs/stx/stx/libbasic/AbstractSourceFileWriter.st,v 1.5 2009-10-02 15:00:29 cg Exp $' |
12041 | 146 |
! |
147 |
||
148 |
version_CVS |
|
12109
1e360b1a1062
comment/format in: #fileOutComment:on:
Claus Gittinger <cg@exept.de>
parents:
12053
diff
changeset
|
149 |
^ '$Header: /cvs/stx/stx/libbasic/AbstractSourceFileWriter.st,v 1.5 2009-10-02 15:00:29 cg Exp $' |
12041 | 150 |
! |
151 |
||
152 |
version_SVN |
|
12053 | 153 |
^'Id: AbstractSourceFileWriter.st 10468 2009-08-22 08:34:50Z vranyj1 ' |
11962 | 154 |
! ! |