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
|
|
59 |
|
|
60 |
"
|
|
61 |
Writes a comment to a stream
|
|
62 |
using proper syntax
|
|
63 |
"
|
|
64 |
self fileOutCommentStartOn: aStream.
|
|
65 |
aStringOrStringCollection isStringCollection
|
|
66 |
ifTrue:
|
|
67 |
[aStringOrStringCollection
|
|
68 |
do:[:line|self fileOutCommentLine: line on: aStream]
|
|
69 |
separatedBy: [aStream cr]]
|
|
70 |
ifFalse:
|
|
71 |
[(aStringOrStringCollection includes: Character cr)
|
|
72 |
ifTrue:"/hmm...multiline comment as string
|
|
73 |
[aStringOrStringCollection asStringCollection
|
|
74 |
do:[:line|self fileOutCommentLine: line on: aStream]
|
|
75 |
separatedBy: [aStream cr]]
|
|
76 |
ifFalse:
|
|
77 |
[self fileOutCommentLine: aStringOrStringCollection on: aStream]].
|
|
78 |
self fileOutCommentEndOn: aStream.
|
|
79 |
|
|
80 |
"Created: / 21-08-2009 / 09:36:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
81 |
!
|
|
82 |
|
|
83 |
fileOutCommentEndOn: aStream
|
|
84 |
"
|
|
85 |
Writes a comment end mark on aStream.
|
|
86 |
"
|
|
87 |
|
|
88 |
^self subclassResponsibility
|
|
89 |
|
|
90 |
"Created: / 21-08-2009 / 09:40:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
91 |
!
|
|
92 |
|
|
93 |
fileOutCommentLine: aString on: aStream
|
|
94 |
|
|
95 |
"
|
|
96 |
Writes a single line of comment on a comment to a stream.
|
|
97 |
Should not put an cr to the stream!!
|
|
98 |
"
|
|
99 |
|
|
100 |
^self subclassResponsibility
|
|
101 |
|
|
102 |
"Created: / 21-08-2009 / 09:42:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
103 |
!
|
|
104 |
|
|
105 |
fileOutCommentStartOn: aStream
|
|
106 |
"
|
|
107 |
Writes a comment start mark on aStream.
|
|
108 |
"
|
|
109 |
|
|
110 |
^self subclassResponsibility
|
|
111 |
|
|
112 |
"Created: / 21-08-2009 / 09:40:28 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
113 |
! !
|
|
114 |
|
12041
|
115 |
!AbstractSourceFileWriter::MethodSourceRewriteQuery class methodsFor:'documentation'!
|
|
116 |
|
|
117 |
documentation
|
|
118 |
"
|
|
119 |
hook to allow for just-in-time rewriting of a method's sourceCode while filing out
|
|
120 |
used when saving version_XXX methods in a non-XXX sourceCodeManager
|
|
121 |
(i.e. to rewrite all non-CVS version methods while saving into a CVS repository)
|
|
122 |
this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a
|
|
123 |
CVS repository without loosing the original string with the next checkout, because it also gets
|
|
124 |
expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN.
|
|
125 |
|
|
126 |
see SmalltalkChunkFileSourceWriter fileOutMethod:on:
|
|
127 |
"
|
|
128 |
! !
|
|
129 |
|
|
130 |
!AbstractSourceFileWriter::MethodSourceRewriteQuery methodsFor:'accessing'!
|
|
131 |
|
|
132 |
method
|
|
133 |
^ method
|
|
134 |
!
|
|
135 |
|
|
136 |
method:methodArg source:sourceArg
|
|
137 |
method := methodArg.
|
|
138 |
source := sourceArg.
|
|
139 |
!
|
|
140 |
|
|
141 |
source
|
|
142 |
^ source
|
|
143 |
! !
|
|
144 |
|
11962
|
145 |
!AbstractSourceFileWriter class methodsFor:'documentation'!
|
|
146 |
|
|
147 |
version
|
12041
|
148 |
^ '$Header: /cvs/stx/stx/libbasic/AbstractSourceFileWriter.st,v 1.3 2009-09-29 16:16:28 fm Exp $'
|
|
149 |
!
|
|
150 |
|
|
151 |
version_CVS
|
|
152 |
^ '$Header: /cvs/stx/stx/libbasic/AbstractSourceFileWriter.st,v 1.3 2009-09-29 16:16:28 fm Exp $'
|
|
153 |
!
|
|
154 |
|
|
155 |
version_SVN
|
|
156 |
^'Id: AbstractSourceFileWriter.st,v 1.2 2009/09/23 12:23:23 fm Exp '
|
11962
|
157 |
! !
|