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