author | Jan Vrany <jan.vrany@labware.com> |
Wed, 22 Mar 2023 13:57:18 +0000 | |
branch | jv |
changeset 25445 | 1623217d2268 |
parent 20150 | 3a825b090d4e |
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 |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
56 |
found along the sourcePath |
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 |
|
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
64 |
#forceAbsReference |
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 |
|
193 |
arronous source code." |
|
1 | 194 |
|
1644 | 195 |
^ self |
196 |
fileInFrom:aStream |
|
197 |
notifying:requestor |
|
198 |
passChunk:passChunk |
|
199 |
single:false |
|
3453 | 200 |
silent:nil |
1644 | 201 |
|
3453 | 202 |
"Modified: / 17.5.1998 / 19:58:15 / cg" |
1644 | 203 |
! |
204 |
||
205 |
fileInFrom:aStream notifying:requestor passChunk:passChunk single:oneChunkOnly |
|
206 |
"read method-chunks from the input stream, aStream; compile them |
|
207 |
and add the methods to the class defined by the class-instance var; |
|
2065 | 208 |
errors and notifications are passed to requestor. |
209 |
If passChunk is true, chunks are given to the requestor, |
|
210 |
via a #source: message, allowing it to open a view showing any |
|
20145 | 211 |
erroneous source code. |
2065 | 212 |
If oneChunkOnly is true, the fileIn is finished after the first chunk." |
1644 | 213 |
|
3453 | 214 |
^ self |
215 |
fileInFrom:aStream |
|
216 |
notifying:requestor |
|
217 |
passChunk:passChunk |
|
218 |
single:oneChunkOnly |
|
219 |
silent:nil |
|
220 |
||
221 |
"Modified: / 17.5.1998 / 19:58:05 / cg" |
|
222 |
! |
|
1 | 223 |
|
3453 | 224 |
fileInFrom:aStream notifying:requestor passChunk:passChunk single:oneChunkOnly silent:beSilent |
225 |
"read method-chunks from the input stream, aStream; compile them |
|
226 |
and add the methods to the class defined by the class-instance var; |
|
227 |
errors and notifications are passed to requestor. |
|
228 |
If passChunk is true, chunks are given to the requestor, |
|
229 |
via a #source: message, allowing it to open a view showing any |
|
20145 | 230 |
erroneous source code. |
3453 | 231 |
If oneChunkOnly is true, the fileIn is finished after the first chunk. |
232 |
The beSilent argument controls output to the transcript, if its true or |
|
233 |
false. If its nil, output is controlled by the Smalltalk>>silenLoading setting." |
|
234 |
||
235 |
|aString done method compiler canMakeSourceRef sourceFile pos nm src s silent| |
|
236 |
||
13535 | 237 |
(silent := Object infoPrinting not) ifFalse:[ |
238 |
silent := beSilent ? Smalltalk silentLoading |
|
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
239 |
]. |
13535 | 240 |
|
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
241 |
silent ifFalse:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
242 |
myClass isNil ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
243 |
nm := '** UndefinedClass **' |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
244 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
245 |
nm := myClass name |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
246 |
]. |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
247 |
Transcript show:' '; show:nm; show:' -> '; show:myCategory. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
248 |
ignore ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
249 |
Transcript show:' (** ignored **)'. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
250 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
251 |
privacy notNil ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
252 |
Transcript show:' (** '; show:privacy; show:' **)' |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
253 |
] |
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 |
Transcript cr. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
256 |
]. |
868
fc7ab02e0537
only keep sourceRef in methods if the sourceFIle is a '.st' file
Claus Gittinger <cg@exept.de>
parents:
784
diff
changeset
|
257 |
|
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
258 |
canMakeSourceRef := false. |
328 | 259 |
|
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
260 |
"/ |
3519
6f4ccc0c6eff
handle squeaks commentStamp: special
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
261 |
"/ SourceMode controls if |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
262 |
"/ the sourceString should be kept or |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
263 |
"/ 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
|
264 |
"/ method instead. |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
265 |
"/ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
266 |
((SourceMode ~~ #keep) |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
267 |
and:[SourceMode ~~ #discard]) ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
268 |
aStream isFileStream ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
269 |
sourceFile := aStream pathName. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
270 |
"/ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
271 |
"/ only do it, if the sourceFiles name |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
272 |
"/ ends with '.st' |
3028 | 273 |
"/ this prevents methods from referencing the changes file. |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
274 |
"/ |
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
275 |
((SourceMode == #forceAbsReference) |
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
276 |
or:[sourceFile asFilename hasSuffix:'st']) ifTrue:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
277 |
canMakeSourceRef := true. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
278 |
|
3860
6ec12b7b2073
added #forceAbsReference sourceMode.
Claus Gittinger <cg@exept.de>
parents:
3519
diff
changeset
|
279 |
(SourceMode ~~ #absReference |
3904 | 280 |
and:[SourceMode ~~ #forceAbsReference]) ifTrue:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
281 |
SourceMode == #sourceReference ifTrue:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
282 |
sourceFile := 'st.src'. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
283 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
284 |
sourceFile := aStream pathName asFilename baseName |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
285 |
] |
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 |
] |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
288 |
] |
425 | 289 |
]. |
290 |
||
1 | 291 |
done := false. |
292 |
[done] whileFalse:[ |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
293 |
done := aStream atEnd. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
294 |
done ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
295 |
canMakeSourceRef ifTrue:[ |
15611 | 296 |
pos := aStream position + 1 |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
297 |
]. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
298 |
aString := aStream nextChunk. |
6307 | 299 |
aStream skipSeparators. |
3028 | 300 |
done := aString size == 0. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
301 |
done ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
302 |
primSpec notNil ifTrue:[ |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
303 |
ignore ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
304 |
myClass perform:primSpec with:aString. |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
305 |
" |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
306 |
ignore rest |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
307 |
" |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
308 |
ignore := true |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
309 |
] |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
310 |
] ifFalse:[ |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
311 |
passChunk ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
312 |
requestor source:aString |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
313 |
]. |
328 | 314 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
315 |
compiler := myClass compilerClass. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
316 |
|
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 |
"/ kludge - for now; |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
319 |
"/ 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
|
320 |
"/ for other compilers to work ... (TGEN for example) |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
321 |
"/ |
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
322 |
(compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:silent:) |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
323 |
ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
324 |
"/ ST/X's compiler |
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
325 |
method := compiler |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
326 |
compile:aString |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
327 |
forClass:myClass |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
328 |
inCategory:myCategory |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
329 |
notifying:requestor |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
330 |
install:true |
10396
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
331 |
skipIfSame:SkipUnchangedMethods |
ba4896c55165
Pass silent flag to compiler on fileIn
Stefan Vogel <sv@exept.de>
parents:
7054
diff
changeset
|
332 |
silent:silent. |
350 | 333 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
334 |
(method notNil and:[method ~~ #Error]) ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
335 |
canMakeSourceRef ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
336 |
(src := method getSource) = aString ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
337 |
"/ it was not corrected ... |
350 | 338 |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
339 |
SourceMode == #sourceReference ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
340 |
s := sourceFile asFilename appendingWriteStream. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
341 |
s setToEnd. |
15611 | 342 |
pos := s position + 1. |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
343 |
s nextChunkPut:src. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
344 |
s close. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
345 |
]. |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
346 |
method sourceFilename:sourceFile position:pos |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
347 |
] |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
348 |
] ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
349 |
SourceMode == #discard ifTrue:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
350 |
method sourceFilename:nil position:nil |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
351 |
] |
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 |
] ifFalse:[ |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
355 |
"/ some generated (TGEN) compiler |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
356 |
method := compiler new |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
357 |
compile:aString |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
358 |
in:myClass |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
359 |
notifying:requestor |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
360 |
ifFail:nil |
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
361 |
]. |
328 | 362 |
|
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
363 |
ignore ifTrue:[ |
3217
568eaf667294
Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents:
3089
diff
changeset
|
364 |
method setPrivacy:#ignore |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
365 |
] ifFalse:[ |
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
366 |
privacy notNil ifTrue:[ |
3217
568eaf667294
Use #setPrivacy: instead of #setPrivate #setProtected and #setIgnored
Stefan Vogel <sv@exept.de>
parents:
3089
diff
changeset
|
367 |
method setPrivacy:privacy |
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
368 |
] |
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 |
] |
1644 | 371 |
]. |
372 |
oneChunkOnly ifTrue:[done := true]. |
|
955
6b5487deebfa
more & better sourceHandling options
Claus Gittinger <cg@exept.de>
parents:
882
diff
changeset
|
373 |
] |
1 | 374 |
] |
425 | 375 |
|
13535 | 376 |
"Modified: / 09-09-1995 / 15:29:08 / claus" |
377 |
"Modified: / 23-01-1998 / 15:25:01 / stefan" |
|
378 |
"Created: / 17-05-1998 / 19:56:32 / cg" |
|
379 |
"Modified: / 31-07-2011 / 09:30:07 / cg" |
|
3453 | 380 |
! |
381 |
||
382 |
fileInFrom:aStream silent:beSilent |
|
383 |
"read method-chunks from the input stream, aStream; compile them |
|
384 |
and add the methods to the class defined by the class-instance var. |
|
385 |
The beSilent argument controls if a message is to be sent to the Transcript." |
|
386 |
||
387 |
^ self |
|
388 |
fileInFrom:aStream |
|
389 |
notifying:nil |
|
390 |
passChunk:false |
|
391 |
single:false |
|
3454 | 392 |
silent:beSilent |
3453 | 393 |
|
394 |
"Created: / 17.5.1998 / 19:59:08 / cg" |
|
3454 | 395 |
"Modified: / 17.5.1998 / 19:59:57 / cg" |
699 | 396 |
! ! |
397 |
||
398 |
!ClassCategoryReader methodsFor:'private'! |
|
399 |
||
400 |
class:aClass category:aCategory |
|
401 |
"set the instance variables" |
|
402 |
||
403 |
myClass := aClass. |
|
5170 | 404 |
"/ ensure that the class is loaded. |
405 |
myClass autoload. |
|
699 | 406 |
myCategory := aCategory. |
407 |
ignore := false |
|
1 | 408 |
! |
409 |
||
699 | 410 |
class:aClass primitiveSpec:which |
411 |
"set the instance variables" |
|
412 |
||
413 |
myClass := aClass. |
|
5170 | 414 |
"/ ensure that the class is loaded. |
415 |
myClass autoload. |
|
699 | 416 |
primSpec := which. |
417 |
ignore := false |
|
418 |
! ! |
|
419 |
||
420 |
!ClassCategoryReader methodsFor:'special'! |
|
421 |
||
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
422 |
ignoredProtocol |
699 | 423 |
ignore := true |
959
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
424 |
|
dbf9d63b4a6c
correctly handling ignoredMethods
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
425 |
"Created: 10.2.1996 / 12:54:15 / cg" |
699 | 426 |
! |
1 | 427 |
|
699 | 428 |
privateProtocol |
429 |
privacy := #private |
|
430 |
! |
|
431 |
||
432 |
protectedProtocol |
|
433 |
privacy := #protected |
|
1 | 434 |
! ! |
699 | 435 |
|
2065 | 436 |
!ClassCategoryReader class methodsFor:'documentation'! |
699 | 437 |
|
438 |
version |
|
19706 | 439 |
^ '$Header$' |
440 |
! |
|
441 |
||
442 |
version_CVS |
|
443 |
^ '$Header$' |
|
699 | 444 |
! ! |
7054
685d359f9847
code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents:
6307
diff
changeset
|
445 |
|
15611 | 446 |
|
699 | 447 |
ClassCategoryReader initialize! |