author | Claus Gittinger <cg@exept.de> |
Thu, 27 Jun 2019 15:21:18 +0200 | |
changeset 24377 | 2fbcb2fa6c43 |
parent 22394 | 1f5a6e985b37 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
167 | 3 |
All Rights Reserved |
1 | 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 |
" |
|
5747 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
19706 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
1 | 16 |
Object subclass:#ClassCategoryReader |
784 | 17 |
instanceVariableNames:'myClass myCategory privacy ignore primSpec' |
11765
02f807d21b0b
Eliminate the KeepSource class variable
Stefan Vogel <sv@exept.de>
parents:
10396
diff
changeset
|
18 |
classVariableNames:'SourceMode SkipUnchangedMethods' |
784 | 19 |
poolDictionaries:'' |
20 |
category:'Kernel-Support' |
|
1 | 21 |
! |
22 |
||
2065 | 23 |
!ClassCategoryReader class methodsFor:'documentation'! |
88 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
167 | 28 |
All Rights Reserved |
1 | 29 |
|
88 | 30 |
This software is furnished under a license and may be used |
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
a helper class for fileIn - keeps track of class and category to filein for. |
|
42 |
Instances of this are created by the #methodsFor: methods in Class, to |
|
43 |
read the next chunk(s) from a stream. |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
44 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
45 |
ClassCategoryReaders allow different ways of keeping the sourceCode of its |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
46 |
loaded code. This is controlled by the SourceMode class variable which may be: |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
47 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
48 |
#discard - forget the source code; no browsing/recompilation is possible |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
49 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
50 |
#keep - keep the source code as a string. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
51 |
any saved image will later be fully independent of any |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
52 |
source files. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
53 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
54 |
#reference - keep a reference to the loaded files basename |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
55 |
In order to be browsable, the original sourcefile should be |
22394 | 56 |
found along the sourcePath |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
57 |
(i.e. typically a link in the source directory should be present) |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
58 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
59 |
#absReference - keep a reference to the loaded files absolute pathname |
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
60 |
but only if the file ends with .st. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
61 |
(this is ok in multiUser configurations, where all sourcefiles are mounted |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
62 |
on a common path; typically automounted systems) |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
63 |
|
22394 | 64 |
#forceAbsReference |
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
65 |
- like above, but also do it for files not ending with .st. |
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
66 |
Must be used with care - NEVER ever reference sources from the changes |
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
67 |
file, because the changesBrowser does not adjust methods sources |
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
68 |
when it compresses or removes changes. |
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
69 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
70 |
#sourceReference - append source to the `st.src' file, |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
71 |
and keep a reference to that file. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
72 |
if the image is later moved to another location, |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
73 |
this file should be moved along with it. |
1295 | 74 |
|
75 |
[author:] |
|
76 |
Claus Gittinger |
|
77 |
||
78 |
[see also:] |
|
79 |
Class PositionableStream |
|
88 | 80 |
" |
81 |
! ! |
|
1 | 82 |
|
2065 | 83 |
!ClassCategoryReader class methodsFor:'initialization'! |
425 | 84 |
|
85 |
initialize |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
86 |
SourceMode := #keep. |
2404
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
87 |
SkipUnchangedMethods := true. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
88 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
89 |
" |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
90 |
ClassCategoryReader initialize |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
91 |
" |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
92 |
|
2404
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
93 |
"Modified: 14.2.1997 / 18:26:52 / cg" |
425 | 94 |
! ! |
95 |
||
2065 | 96 |
!ClassCategoryReader class methodsFor:'instance creation'! |
1 | 97 |
|
6240
53b43e2188fa
added #class: instance creation
Claus Gittinger <cg@exept.de>
parents:
6222
diff
changeset
|
98 |
class:aClass |
53b43e2188fa
added #class: instance creation
Claus Gittinger <cg@exept.de>
parents:
6222
diff
changeset
|
99 |
"return a new ClassCategoryReader to operate on aClass" |
53b43e2188fa
added #class: instance creation
Claus Gittinger <cg@exept.de>
parents:
6222
diff
changeset
|
100 |
|
53b43e2188fa
added #class: instance creation
Claus Gittinger <cg@exept.de>
parents:
6222
diff
changeset
|
101 |
^ self new class:aClass |
53b43e2188fa
added #class: instance creation
Claus Gittinger <cg@exept.de>
parents:
6222
diff
changeset
|
102 |
! |
53b43e2188fa
added #class: instance creation
Claus Gittinger <cg@exept.de>
parents:
6222
diff
changeset
|
103 |
|
1 | 104 |
class:aClass category:aCategory |
105 |
"return a new ClassCategoryReader to read methods for aClass with |
|
106 |
methodCategory aCategory" |
|
107 |
||
108 |
^ self new class:aClass category:aCategory |
|
167 | 109 |
! |
110 |
||
216 | 111 |
class:aClass primitiveSpec:which |
112 |
"return a ClassCategoryReader to read a primitiveSpec chunk" |
|
113 |
||
114 |
^ self new class:aClass primitiveSpec:which |
|
1 | 115 |
! ! |
116 |
||
2065 | 117 |
!ClassCategoryReader class methodsFor:'defaults'! |
1 | 118 |
|
699 | 119 |
keepSource |
11765
02f807d21b0b
Eliminate the KeepSource class variable
Stefan Vogel <sv@exept.de>
parents:
10396
diff
changeset
|
120 |
^ SourceMode == #keep |
1 | 121 |
|
699 | 122 |
"Created: 9.9.1995 / 15:22:27 / claus" |
216 | 123 |
! |
124 |
||
699 | 125 |
keepSource:aBoolean |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
126 |
SourceMode := (aBoolean ifTrue:[#keep] ifFalse:[#reference]) |
68 | 127 |
|
699 | 128 |
"Created: 9.9.1995 / 15:22:26 / claus" |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
129 |
"Modified: 9.2.1996 / 17:23:04 / cg" |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
130 |
! |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
131 |
|
2404
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
132 |
skipUnchangedMethods |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
133 |
"return true, if the default for unchanged methods is to skip them. |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
134 |
The default is true." |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
135 |
|
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
136 |
^ SkipUnchangedMethods |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
137 |
|
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
138 |
"Created: 14.2.1997 / 18:27:49 / cg" |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
139 |
"Modified: 14.2.1997 / 18:28:13 / cg" |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
140 |
! |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
141 |
|
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
142 |
skipUnchangedMethods:aBoolean |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
143 |
"return true, if the default for unchanged methods is to skip them. |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
144 |
The default is true. Can be temporarily changed to false, if |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
145 |
a forced fileIn is required." |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
146 |
|
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
147 |
SkipUnchangedMethods := aBoolean |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
148 |
|
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
149 |
"Created: 14.2.1997 / 18:27:43 / cg" |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
150 |
"Modified: 14.2.1997 / 18:28:42 / cg" |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
151 |
! |
77c6111ce6ba
added access to skipIfSame default.
Claus Gittinger <cg@exept.de>
parents:
2065
diff
changeset
|
152 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
153 |
sourceMode |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
154 |
"return the sourceMode, which controls how sources are to be handled. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
155 |
Read #documentation for more info" |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
156 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
157 |
^ SourceMode |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
158 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
159 |
"Created: 9.2.1996 / 17:22:58 / cg" |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
160 |
! |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
161 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
162 |
sourceMode:aSymbol |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
163 |
"set the sourceMode, which controls how sources are to be handled. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
164 |
Read #documentation for more info" |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
165 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
166 |
SourceMode := aSymbol |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
167 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
168 |
"Created: 9.2.1996 / 17:23:00 / cg" |
1 | 169 |
! ! |
170 |
||
171 |
!ClassCategoryReader methodsFor:'fileIn'! |
|
172 |
||
699 | 173 |
fileInFrom:aStream |
174 |
"read method-chunks from the input stream, aStream; compile them |
|
175 |
and add the methods to the class defined by the class-instance var" |
|
176 |
||
3453 | 177 |
^ self |
178 |
fileInFrom:aStream |
|
179 |
notifying:nil |
|
180 |
passChunk:false |
|
181 |
single:false |
|
182 |
silent:nil |
|
183 |
||
184 |
"Modified: / 17.5.1998 / 19:58:33 / cg" |
|
699 | 185 |
! |
186 |
||
328 | 187 |
fileInFrom:aStream notifying:requestor passChunk:passChunk |
1 | 188 |
"read method-chunks from the input stream, aStream; compile them |
189 |
and add the methods to the class defined by the class-instance var; |
|
2065 | 190 |
errors and notifications are passed to requestor. |
191 |
If passChunk is true, chunks are given to the requestor, |
|
192 |
via a #source: message, allowing it to open a view showing any |
|
22394 | 193 |
erroneous source code." |
1 | 194 |
|
1644 | 195 |
^ self |
22394 | 196 |
fileInFrom:aStream |
197 |
notifying:requestor |
|
198 |
passChunk:passChunk |
|
1644 | 199 |
single:false |
3453 | 200 |
silent:nil |
1644 | 201 |
|
22394 | 202 |
"Modified: / 17-05-1998 / 19:58:15 / cg" |
203 |
"Modified (comment): / 18-12-2017 / 10:10:21 / mawalch" |
|
1644 | 204 |
! |
205 |
||
206 |
fileInFrom:aStream notifying:requestor passChunk:passChunk single:oneChunkOnly |
|
207 |
"read method-chunks from the input stream, aStream; compile them |
|
208 |
and add the methods to the class defined by the class-instance var; |
|
2065 | 209 |
errors and notifications are passed to requestor. |
210 |
If passChunk is true, chunks are given to the requestor, |
|
211 |
via a #source: message, allowing it to open a view showing any |
|
20145 | 212 |
erroneous source code. |
2065 | 213 |
If oneChunkOnly is true, the fileIn is finished after the first chunk." |
1644 | 214 |
|
3453 | 215 |
^ self |
216 |
fileInFrom:aStream |
|
217 |
notifying:requestor |
|
218 |
passChunk:passChunk |
|
219 |
single:oneChunkOnly |
|
220 |
silent:nil |
|
221 |
||
222 |
"Modified: / 17.5.1998 / 19:58:05 / cg" |
|
223 |
! |
|
1 | 224 |
|
3453 | 225 |
fileInFrom:aStream notifying:requestor passChunk:passChunk single:oneChunkOnly silent:beSilent |
226 |
"read method-chunks from the input stream, aStream; compile them |
|
227 |
and add the methods to the class defined by the class-instance var; |
|
228 |
errors and notifications are passed to requestor. |
|
229 |
If passChunk is true, chunks are given to the requestor, |
|
230 |
via a #source: message, allowing it to open a view showing any |
|
20145 | 231 |
erroneous source code. |
3453 | 232 |
If oneChunkOnly is true, the fileIn is finished after the first chunk. |
21420 | 233 |
The beSilent argument controls output to the transcript, if it's true or |
234 |
false. If it's nil, output is controlled by the Smalltalk>>silenLoading setting." |
|
3453 | 235 |
|
236 |
|aString done method compiler canMakeSourceRef sourceFile pos nm src s silent| |
|
237 |
||
13535 | 238 |
(silent := Object infoPrinting not) ifFalse:[ |
239 |
silent := beSilent ? Smalltalk silentLoading |
|
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
240 |
]. |
13535 | 241 |
|
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
242 |
silent ifFalse:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
243 |
myClass isNil ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
244 |
nm := '** UndefinedClass **' |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
245 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
246 |
nm := myClass name |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
247 |
]. |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
248 |
Transcript show:' '; show:nm; show:' -> '; show:myCategory. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
249 |
ignore ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
250 |
Transcript show:' (** ignored **)'. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
251 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
252 |
privacy notNil ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
253 |
Transcript show:' (** '; show:privacy; show:' **)' |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
254 |
] |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
255 |
]. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
256 |
Transcript cr. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
257 |
]. |
868
fc7ab02e0537
only keep sourceRef in methods if the sourceFIle is a '.st' file
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
258 |
|
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
259 |
canMakeSourceRef := false. |
328 | 260 |
|
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
261 |
"/ |
3519
6f4ccc0c6eff
handle squeaks commentStamp: special
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
262 |
"/ SourceMode controls if |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
263 |
"/ the sourceString should be kept or |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
264 |
"/ a reference to the fileStream should be placed into the |
3519
6f4ccc0c6eff
handle squeaks commentStamp: special
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
265 |
"/ method instead. |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
266 |
"/ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
267 |
((SourceMode ~~ #keep) |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
268 |
and:[SourceMode ~~ #discard]) ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
269 |
aStream isFileStream ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
270 |
sourceFile := aStream pathName. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
271 |
"/ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
272 |
"/ only do it, if the sourceFiles name |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
273 |
"/ ends with '.st' |
3028 | 274 |
"/ this prevents methods from referencing the changes file. |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
275 |
"/ |
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
276 |
((SourceMode == #forceAbsReference) |
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
277 |
or:[sourceFile asFilename hasSuffix:'st']) ifTrue:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
278 |
canMakeSourceRef := true. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
279 |
|
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
280 |
(SourceMode ~~ #absReference |
3904 | 281 |
and:[SourceMode ~~ #forceAbsReference]) ifTrue:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
282 |
SourceMode == #sourceReference ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
283 |
sourceFile := 'st.src'. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
284 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
285 |
sourceFile := aStream pathName asFilename baseName |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
286 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
287 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
288 |
] |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
289 |
] |
425 | 290 |
]. |
291 |
||
1 | 292 |
done := false. |
293 |
[done] whileFalse:[ |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
294 |
done := aStream atEnd. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
295 |
done ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
296 |
canMakeSourceRef ifTrue:[ |
15611 | 297 |
pos := aStream position + 1 |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
298 |
]. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
299 |
aString := aStream nextChunk. |
6307 | 300 |
aStream skipSeparators. |
3028 | 301 |
done := aString size == 0. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
302 |
done ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
303 |
primSpec notNil ifTrue:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
304 |
ignore ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
305 |
myClass perform:primSpec with:aString. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
306 |
" |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
307 |
ignore rest |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
308 |
" |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
309 |
ignore := true |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
310 |
] |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
311 |
] ifFalse:[ |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
312 |
passChunk ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
313 |
requestor source:aString |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
314 |
]. |
328 | 315 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
316 |
compiler := myClass compilerClass. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
317 |
|
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
318 |
"/ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
319 |
"/ kludge - for now; |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
320 |
"/ have to make ST/X's compiler protocol be compatible to ST-80's |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
321 |
"/ for other compilers to work ... (TGEN for example) |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
322 |
"/ |
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
323 |
(compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:silent:) |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
324 |
ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
325 |
"/ ST/X's compiler |
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
326 |
method := compiler |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
327 |
compile:aString |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
328 |
forClass:myClass |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
329 |
inCategory:myCategory |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
330 |
notifying:requestor |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
331 |
install:true |
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
332 |
skipIfSame:SkipUnchangedMethods |
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
333 |
silent:silent. |
350 | 334 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
335 |
(method notNil and:[method ~~ #Error]) ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
336 |
canMakeSourceRef ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
337 |
(src := method getSource) = aString ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
338 |
"/ it was not corrected ... |
350 | 339 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
340 |
SourceMode == #sourceReference ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
341 |
s := sourceFile asFilename appendingWriteStream. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
342 |
s setToEnd. |
15611 | 343 |
pos := s position + 1. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
344 |
s nextChunkPut:src. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
345 |
s close. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
346 |
]. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
347 |
method sourceFilename:sourceFile position:pos |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
348 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
349 |
] ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
350 |
SourceMode == #discard ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
351 |
method sourceFilename:nil position:nil |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
352 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
353 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
354 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
355 |
] ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
356 |
"/ some generated (TGEN) compiler |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
357 |
method := compiler new |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
358 |
compile:aString |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
359 |
in:myClass |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
360 |
notifying:requestor |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
361 |
ifFail:nil |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
362 |
]. |
328 | 363 |
|
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
364 |
ignore ifTrue:[ |
3217
568eaf667294
Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents:
3089
diff
changeset
|
365 |
method setPrivacy:#ignore |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
366 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
367 |
privacy notNil ifTrue:[ |
3217
568eaf667294
Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents:
3089
diff
changeset
|
368 |
method setPrivacy:privacy |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
369 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
370 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
371 |
] |
1644 | 372 |
]. |
373 |
oneChunkOnly ifTrue:[done := true]. |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
374 |
] |
1 | 375 |
] |
425 | 376 |
|
13535 | 377 |
"Modified: / 09-09-1995 / 15:29:08 / claus" |
378 |
"Modified: / 23-01-1998 / 15:25:01 / stefan" |
|
379 |
"Created: / 17-05-1998 / 19:56:32 / cg" |
|
380 |
"Modified: / 31-07-2011 / 09:30:07 / cg" |
|
21420 | 381 |
"Modified (comment): / 13-02-2017 / 19:58:07 / cg" |
3453 | 382 |
! |
383 |
||
384 |
fileInFrom:aStream silent:beSilent |
|
385 |
"read method-chunks from the input stream, aStream; compile them |
|
386 |
and add the methods to the class defined by the class-instance var. |
|
387 |
The beSilent argument controls if a message is to be sent to the Transcript." |
|
388 |
||
389 |
^ self |
|
390 |
fileInFrom:aStream |
|
391 |
notifying:nil |
|
392 |
passChunk:false |
|
393 |
single:false |
|
3454 | 394 |
silent:beSilent |
3453 | 395 |
|
396 |
"Created: / 17.5.1998 / 19:59:08 / cg" |
|
3454 | 397 |
"Modified: / 17.5.1998 / 19:59:57 / cg" |
699 | 398 |
! ! |
399 |
||
400 |
!ClassCategoryReader methodsFor:'private'! |
|
401 |
||
402 |
class:aClass category:aCategory |
|
403 |
"set the instance variables" |
|
404 |
||
405 |
myClass := aClass. |
|
5170 | 406 |
"/ ensure that the class is loaded. |
407 |
myClass autoload. |
|
699 | 408 |
myCategory := aCategory. |
409 |
ignore := false |
|
1 | 410 |
! |
411 |
||
699 | 412 |
class:aClass primitiveSpec:which |
413 |
"set the instance variables" |
|
414 |
||
415 |
myClass := aClass. |
|
5170 | 416 |
"/ ensure that the class is loaded. |
417 |
myClass autoload. |
|
699 | 418 |
primSpec := which. |
419 |
ignore := false |
|
420 |
! ! |
|
421 |
||
422 |
!ClassCategoryReader methodsFor:'special'! |
|
423 |
||
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
424 |
ignoredProtocol |
699 | 425 |
ignore := true |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
426 |
|
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
427 |
"Created: 10.2.1996 / 12:54:15 / cg" |
699 | 428 |
! |
1 | 429 |
|
699 | 430 |
privateProtocol |
431 |
privacy := #private |
|
432 |
! |
|
433 |
||
434 |
protectedProtocol |
|
435 |
privacy := #protected |
|
1 | 436 |
! ! |
699 | 437 |
|
2065 | 438 |
!ClassCategoryReader class methodsFor:'documentation'! |
699 | 439 |
|
440 |
version |
|
19706 | 441 |
^ '$Header$' |
442 |
! |
|
443 |
||
444 |
version_CVS |
|
445 |
^ '$Header$' |
|
699 | 446 |
! ! |
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
6307
diff
changeset
|
447 |
|
15611 | 448 |
|
699 | 449 |
ClassCategoryReader initialize! |