AbstractSourceFileWriter.st
author Claus Gittinger <cg@exept.de>
Tue, 02 Apr 2019 10:50:28 +0200
branchjv
changeset 24091 691c182c3105
parent 23546 0bb5e8a11f90
permissions -rw-r--r--
#BUGFIX by cg class: CharacterArray changed: #, #asDenseUnicodeString (grafted from ba4c42171801ea3a46aea31504a621256655feae)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13406
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     1
"
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
23107
40173e082cbc Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18919
diff changeset
     3
 COPYRIGHT (c) 2009-2010 Jan Vrany
13406
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     4
              All Rights Reserved
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     5
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     6
 This software is furnished under a license and may be used
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     7
 only in accordance with the terms of that license and with the
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     8
 inclusion of the above copyright notice.   This software may not
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
     9
 be provided or otherwise made available to, or used by, any
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    10
 other person.  No title to or ownership of the software is
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    11
 hereby transferred.
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    12
"
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
    13
"{ Package: 'stx:libbasic' }"
3303e65f30cd initial checkin
fm
parents:
diff changeset
    14
17334
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
    15
"{ NameSpace: Smalltalk }"
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
    16
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
    17
Object subclass:#AbstractSourceFileWriter
16879
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
    18
	instanceVariableNames:'generatingSourceForOriginal'
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
    19
	classVariableNames:''
3303e65f30cd initial checkin
fm
parents:
diff changeset
    20
	poolDictionaries:''
15419
a1da7568bcfe class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 14407
diff changeset
    21
	category:'Kernel-Classes-Support'
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
    22
!
3303e65f30cd initial checkin
fm
parents:
diff changeset
    23
23546
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    24
Query subclass:#ClassSourceRewriteQuery
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    25
	instanceVariableNames:'source klass'
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    26
	classVariableNames:''
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    27
	poolDictionaries:''
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    28
	privateIn:AbstractSourceFileWriter
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    29
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    30
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    31
Query subclass:#MethodSourceRewriteQuery
23546
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    32
	instanceVariableNames:'source method'
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    33
	classVariableNames:''
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    34
	poolDictionaries:''
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    35
	privateIn:AbstractSourceFileWriter
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    36
!
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    37
13406
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    38
!AbstractSourceFileWriter class methodsFor:'documentation'!
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    39
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    40
copyright
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    41
"
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    42
 COPYRIGHT (c) 2006 by eXept Software AG
23107
40173e082cbc Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18919
diff changeset
    43
 COPYRIGHT (c) 2009-2010 Jan Vrany
13406
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    44
              All Rights Reserved
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    45
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    46
 This software is furnished under a license and may be used
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    47
 only in accordance with the terms of that license and with the
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    48
 inclusion of the above copyright notice.   This software may not
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    49
 be provided or otherwise made available to, or used by, any
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    50
 other person.  No title to or ownership of the software is
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    51
 hereby transferred.
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    52
"
14407
a58be3849b65 comment
Claus Gittinger <cg@exept.de>
parents: 13406
diff changeset
    53
!
a58be3849b65 comment
Claus Gittinger <cg@exept.de>
parents: 13406
diff changeset
    54
a58be3849b65 comment
Claus Gittinger <cg@exept.de>
parents: 13406
diff changeset
    55
documentation
a58be3849b65 comment
Claus Gittinger <cg@exept.de>
parents: 13406
diff changeset
    56
"
a58be3849b65 comment
Claus Gittinger <cg@exept.de>
parents: 13406
diff changeset
    57
    Abstract common superclass for source file writers
a58be3849b65 comment
Claus Gittinger <cg@exept.de>
parents: 13406
diff changeset
    58
"
13406
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
    59
! !
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    60
18913
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
    61
!AbstractSourceFileWriter class methodsFor:'queries'!
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
    62
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
    63
isAbstract
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
    64
    ^ self == AbstractSourceFileWriter
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
    65
! !
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
    66
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    67
!AbstractSourceFileWriter class methodsFor:'signal constants'!
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
    68
23546
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    69
classSourceRewriteQuery
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    70
    "
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    71
    Hook to allow for just-in-time rewriting of a class definition while filing out.
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    72
    This can be used (is used) by source code exporters that need to rewrite class
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    73
    definitions on the fly. 
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    74
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    75
    See for example BeeProjectWriter.
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    76
    "
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    77
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    78
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    79
    ^ ClassSourceRewriteQuery
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    80
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    81
    "Created: / 24-10-2018 / 10:49:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    82
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
    83
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    84
methodSourceRewriteQuery
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    85
    "hook to allow for just-in-time rewriting of a method's sourceCode while filing out
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    86
    used when saving version_XXX methods in a non-XXX sourceCodeManager
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    87
    (i.e. to rewrite all non-CVS version methods while saving into a CVS repository)
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    88
    this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    89
    CVS repository without loosing the original string with the next checkout, because it also gets  
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    90
    expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN.
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    91
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    92
    see SmalltalkChunkFileSourceWriter fileOutMethod:on:"
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    93
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
    94
    ^ MethodSourceRewriteQuery
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
    95
! !
3303e65f30cd initial checkin
fm
parents:
diff changeset
    96
16879
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
    97
!AbstractSourceFileWriter methodsFor:'accessing'!
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
    98
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
    99
generatingSourceForOriginal:aBoolean
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   100
    "if false (the default), the source of the current (in image) code is generated.
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   101
     That means, that any extension method which shadows some other original method,
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   102
     that extension method's code is generated.
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   103
     if true, the code of the original method is generated.
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   104
     Use a true value, when generating code for a SCM checkin operation, as then we do not
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   105
     want the extension to shadow the original"
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   106
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   107
    generatingSourceForOriginal := aBoolean.
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   108
! !
2b94ea863dda Moved #generatingSourceForOriginal: from SmalltalkChunkFileSourceWriter to
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15419
diff changeset
   109
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   110
!AbstractSourceFileWriter methodsFor:'fileout'!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   111
3303e65f30cd initial checkin
fm
parents:
diff changeset
   112
fileOut:aClass on:outStreamArg 
3303e65f30cd initial checkin
fm
parents:
diff changeset
   113
3303e65f30cd initial checkin
fm
parents:
diff changeset
   114
    self 
3303e65f30cd initial checkin
fm
parents:
diff changeset
   115
        fileOut:aClass on:outStreamArg 
3303e65f30cd initial checkin
fm
parents:
diff changeset
   116
        withTimeStamp:true withInitialize:true 
3303e65f30cd initial checkin
fm
parents:
diff changeset
   117
        withDefinition:true 
3303e65f30cd initial checkin
fm
parents:
diff changeset
   118
        methodFilter:nil encoder:nil
3303e65f30cd initial checkin
fm
parents:
diff changeset
   119
3303e65f30cd initial checkin
fm
parents:
diff changeset
   120
    "Created: / 15-08-2009 / 13:11:31 / Jan Vrany <vranyj1@fel.cvut.cz>"
3303e65f30cd initial checkin
fm
parents:
diff changeset
   121
! !
3303e65f30cd initial checkin
fm
parents:
diff changeset
   122
3303e65f30cd initial checkin
fm
parents:
diff changeset
   123
!AbstractSourceFileWriter methodsFor:'source writing'!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   124
16881
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   125
fileOut: class on:stream withTimeStamp: stampIt withInitialize: initIt withDefinition: withDefinition methodFilter:methodFilter
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   126
17334
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   127
    ^ self 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   128
        fileOut: class 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   129
        on:stream 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   130
        withTimeStamp: stampIt 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   131
        withInitialize: initIt 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   132
        withDefinition: withDefinition 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   133
        methodFilter:methodFilter 
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   134
        encoder:nil
16881
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   135
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   136
    "Created: / 04-10-2014 / 12:10:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   137
!
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   138
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   139
fileOut: class on:stream withTimeStamp: stampIt withInitialize: initIt withDefinition: withDefinition methodFilter:methodFilter encoder:encoderOrNil
3303e65f30cd initial checkin
fm
parents:
diff changeset
   140
    "raise an error: must be redefined in concrete subclass(es)"
3303e65f30cd initial checkin
fm
parents:
diff changeset
   141
3303e65f30cd initial checkin
fm
parents:
diff changeset
   142
    ^ self subclassResponsibility
3303e65f30cd initial checkin
fm
parents:
diff changeset
   143
3303e65f30cd initial checkin
fm
parents:
diff changeset
   144
    "Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
13406
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   145
!
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   146
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   147
fileOutMethods: methods on:stream
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   148
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   149
    "Files out a bunch of methods. This is used to file-out extension methods"    
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   150
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   151
    self subclassResponsibility
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   152
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   153
    "Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   154
    "Created: / 30-12-2009 / 18:34:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   155
!
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   156
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   157
fileOutPackageDefinition:packageId on:stream 
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   158
    "Files out a package definition on the stream, so all subsequent
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   159
     code entities will be placed in that package"
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   160
    
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   161
    self subclassResponsibility
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   162
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   163
    "Modified: / 16-08-2009 / 09:59:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
ab78d458b472 changed: #version_CVS
vrany
parents: 12182
diff changeset
   164
    "Created: / 30-12-2009 / 18:34:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   165
! !
3303e65f30cd initial checkin
fm
parents:
diff changeset
   166
3303e65f30cd initial checkin
fm
parents:
diff changeset
   167
!AbstractSourceFileWriter methodsFor:'source writing - comments'!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   168
3303e65f30cd initial checkin
fm
parents:
diff changeset
   169
fileOutComment: aStringOrStringCollection on: aStream
12109
1e360b1a1062 comment/format in: #fileOutComment:on:
Claus Gittinger <cg@exept.de>
parents: 12053
diff changeset
   170
    "Writes a comment to a stream using proper syntax"
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   171
3303e65f30cd initial checkin
fm
parents:
diff changeset
   172
    self fileOutCommentStartOn: aStream.
3303e65f30cd initial checkin
fm
parents:
diff changeset
   173
    aStringOrStringCollection isStringCollection
17334
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   174
        ifTrue:[
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   175
            aStringOrStringCollection 
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   176
                do:[:line|self fileOutCommentLine: line on: aStream]
3303e65f30cd initial checkin
fm
parents:
diff changeset
   177
                separatedBy: [aStream cr]]
17334
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   178
        ifFalse:[
5c901455163b class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 16881
diff changeset
   179
            (aStringOrStringCollection includes: Character cr)
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   180
                ifTrue:"/hmm...multiline comment as string
3303e65f30cd initial checkin
fm
parents:
diff changeset
   181
                    [aStringOrStringCollection asStringCollection
3303e65f30cd initial checkin
fm
parents:
diff changeset
   182
                        do:[:line|self fileOutCommentLine: line on: aStream]
3303e65f30cd initial checkin
fm
parents:
diff changeset
   183
                        separatedBy: [aStream cr]]
3303e65f30cd initial checkin
fm
parents:
diff changeset
   184
                ifFalse:
3303e65f30cd initial checkin
fm
parents:
diff changeset
   185
                    [self fileOutCommentLine: aStringOrStringCollection on: aStream]].
3303e65f30cd initial checkin
fm
parents:
diff changeset
   186
    self fileOutCommentEndOn: aStream.
3303e65f30cd initial checkin
fm
parents:
diff changeset
   187
3303e65f30cd initial checkin
fm
parents:
diff changeset
   188
    "Created: / 21-08-2009 / 09:36:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
3303e65f30cd initial checkin
fm
parents:
diff changeset
   189
!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   190
3303e65f30cd initial checkin
fm
parents:
diff changeset
   191
fileOutCommentEndOn: aStream
3303e65f30cd initial checkin
fm
parents:
diff changeset
   192
    "
3303e65f30cd initial checkin
fm
parents:
diff changeset
   193
        Writes a comment end mark on aStream.
3303e65f30cd initial checkin
fm
parents:
diff changeset
   194
    "
3303e65f30cd initial checkin
fm
parents:
diff changeset
   195
3303e65f30cd initial checkin
fm
parents:
diff changeset
   196
    ^self subclassResponsibility
3303e65f30cd initial checkin
fm
parents:
diff changeset
   197
3303e65f30cd initial checkin
fm
parents:
diff changeset
   198
    "Created: / 21-08-2009 / 09:40:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
3303e65f30cd initial checkin
fm
parents:
diff changeset
   199
!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   200
3303e65f30cd initial checkin
fm
parents:
diff changeset
   201
fileOutCommentLine: aString on: aStream
3303e65f30cd initial checkin
fm
parents:
diff changeset
   202
3303e65f30cd initial checkin
fm
parents:
diff changeset
   203
    "
3303e65f30cd initial checkin
fm
parents:
diff changeset
   204
        Writes a single line of comment on a comment to a stream.
3303e65f30cd initial checkin
fm
parents:
diff changeset
   205
        Should not put an cr to the stream!!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   206
    "
3303e65f30cd initial checkin
fm
parents:
diff changeset
   207
3303e65f30cd initial checkin
fm
parents:
diff changeset
   208
    ^self subclassResponsibility
3303e65f30cd initial checkin
fm
parents:
diff changeset
   209
3303e65f30cd initial checkin
fm
parents:
diff changeset
   210
    "Created: / 21-08-2009 / 09:42:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
3303e65f30cd initial checkin
fm
parents:
diff changeset
   211
!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   212
3303e65f30cd initial checkin
fm
parents:
diff changeset
   213
fileOutCommentStartOn: aStream
3303e65f30cd initial checkin
fm
parents:
diff changeset
   214
    "
3303e65f30cd initial checkin
fm
parents:
diff changeset
   215
        Writes a comment start mark on aStream.
3303e65f30cd initial checkin
fm
parents:
diff changeset
   216
    "
3303e65f30cd initial checkin
fm
parents:
diff changeset
   217
3303e65f30cd initial checkin
fm
parents:
diff changeset
   218
    ^self subclassResponsibility
3303e65f30cd initial checkin
fm
parents:
diff changeset
   219
3303e65f30cd initial checkin
fm
parents:
diff changeset
   220
    "Created: / 21-08-2009 / 09:40:28 / Jan Vrany <vranyj1@fel.cvut.cz>"
3303e65f30cd initial checkin
fm
parents:
diff changeset
   221
! !
3303e65f30cd initial checkin
fm
parents:
diff changeset
   222
23546
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   223
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   224
!AbstractSourceFileWriter::ClassSourceRewriteQuery methodsFor:'accessing'!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   225
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   226
klass
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   227
    ^ klass
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   228
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   229
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   230
klass:aClass
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   231
    klass := aClass.
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   232
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   233
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   234
klass:aClass source: aString
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   235
    klass := aClass.
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   236
    source := aString.
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   237
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   238
    "Created: / 24-10-2018 / 11:10:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   239
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   240
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   241
source
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   242
    ^ source
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   243
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   244
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   245
source:aString
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   246
    source := aString.
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   247
! !
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   248
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   249
!AbstractSourceFileWriter::MethodSourceRewriteQuery class methodsFor:'documentation'!
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   250
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   251
documentation
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   252
"
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   253
    hook to allow for just-in-time rewriting of a method's sourceCode while filing out
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   254
    used when saving version_XXX methods in a non-XXX sourceCodeManager
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   255
    (i.e. to rewrite all non-CVS version methods while saving into a CVS repository)
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   256
    this is required because we cannot save an SVN version method (dollar-ID-...-dollar) into a
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   257
    CVS repository without loosing the original string with the next checkout, because it also gets  
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   258
    expanded by CVS. The same is true vice-versa for CVS-Ids, which get clobbered by SVN.
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   259
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   260
    see SmalltalkChunkFileSourceWriter fileOutMethod:on:
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   261
"
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   262
! !
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   263
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   264
!AbstractSourceFileWriter::MethodSourceRewriteQuery methodsFor:'accessing'!
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   265
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   266
method
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   267
    ^ method
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   268
!
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   269
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   270
method:methodArg source:sourceArg 
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   271
    method := methodArg.
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   272
    source := sourceArg.
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   273
!
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   274
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   275
source
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   276
    ^ source
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   277
! !
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   278
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   279
!AbstractSourceFileWriter class methodsFor:'documentation'!
3303e65f30cd initial checkin
fm
parents:
diff changeset
   280
16881
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   281
version
18913
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
   282
    ^ '$Header$'
16881
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   283
!
0971640d795b Oops, fixes to class fileout to handle non-ASCII code correctly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16879
diff changeset
   284
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   285
version_CVS
18913
7ed4b692fff2 added: #isAbstract
Claus Gittinger <cg@exept.de>
parents: 17334
diff changeset
   286
    ^ '$Header$'
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   287
!
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   288
23546
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   289
version_HG
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   290
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   291
    ^ '$Changeset: <not expanded> $'
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   292
!
0bb5e8a11f90 Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23107
diff changeset
   293
12041
afa57da40ad1 added: #methodSourceRewriteQuery
fm
parents: 12011
diff changeset
   294
version_SVN
15419
a1da7568bcfe class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 14407
diff changeset
   295
    ^ '$ Id: AbstractSourceFileWriter.st 10643 2011-06-08 21:53:07Z vranyj1  $'
11962
3303e65f30cd initial checkin
fm
parents:
diff changeset
   296
! !
15419
a1da7568bcfe class: AbstractSourceFileWriter
Claus Gittinger <cg@exept.de>
parents: 14407
diff changeset
   297