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