author | Claus Gittinger <cg@exept.de> |
Wed, 05 Sep 2001 18:45:04 +0200 | |
changeset 1482 | 13fe76a0986b |
parent 1469 | b726d8a4b801 |
child 1484 | 089067851973 |
permissions | -rw-r--r-- |
1423 | 1 |
"{ Package: 'stx:libtool2' }" |
1416 | 2 |
|
3 |
Object subclass:#SnapShotImageMemory |
|
1417 | 4 |
instanceVariableNames:'image stream msb ptrSize intSize intTag spaceInfos symbolEntries |
1416 | 5 |
globalEntries addrToObjectMapping' |
6 |
classVariableNames:'' |
|
7 |
poolDictionaries:'' |
|
8 |
category:'System-Support' |
|
9 |
! |
|
10 |
||
1417 | 11 |
Object subclass:#ImageHeader |
12 |
instanceVariableNames:'memory classRef bits byteSize' |
|
13 |
classVariableNames:'' |
|
14 |
poolDictionaries:'' |
|
15 |
privateIn:SnapShotImageMemory |
|
16 |
! |
|
17 |
||
18 |
SnapShotImageMemory::ImageHeader variableSubclass:#ImageObject |
|
1419 | 19 |
instanceVariableNames:'cachedContents' |
1416 | 20 |
classVariableNames:'' |
21 |
poolDictionaries:'' |
|
22 |
privateIn:SnapShotImageMemory |
|
23 |
! |
|
24 |
||
1448 | 25 |
SnapShotImageMemory::ImageHeader variableByteSubclass:#ImageByteObject |
26 |
instanceVariableNames:'' |
|
27 |
classVariableNames:'' |
|
28 |
poolDictionaries:'' |
|
29 |
privateIn:SnapShotImageMemory |
|
30 |
! |
|
31 |
||
1482 | 32 |
SnapShotImageMemory::ImageObject variableSubclass:#ImageMethodObject |
33 |
instanceVariableNames:'cachedPackage' |
|
34 |
classVariableNames:'' |
|
35 |
poolDictionaries:'' |
|
36 |
privateIn:SnapShotImageMemory |
|
37 |
! |
|
38 |
||
1416 | 39 |
SnapShotImageMemory::ImageObject variableSubclass:#ImageClassObject |
1482 | 40 |
instanceVariableNames:'cachedCategory cachedFlags cachedName' |
1416 | 41 |
classVariableNames:'' |
42 |
poolDictionaries:'' |
|
43 |
privateIn:SnapShotImageMemory |
|
44 |
! |
|
45 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
46 |
Object subclass:#SpaceInfo |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
47 |
instanceVariableNames:'start end size flags imageBase' |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
48 |
classVariableNames:'' |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
49 |
poolDictionaries:'' |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
50 |
privateIn:SnapShotImageMemory |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
51 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
52 |
|
1448 | 53 |
!SnapShotImageMemory class methodsFor:'documentation'! |
54 |
||
55 |
documentation |
|
56 |
" |
|
57 |
I represent the memory as contained in a snapshot image. |
|
58 |
||
59 |
I am not used directly; instead, via the SystemBrowsers entry: |
|
60 |
SystemBrowser openOnSnapShotImage:'/export/home/cg/work/stx/projects/smalltalk/st.img' |
|
61 |
||
62 |
[author:] |
|
63 |
Claus Gittinger |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
1416 | 67 |
|
68 |
!SnapShotImageMemory class methodsFor:'instance creation'! |
|
69 |
||
70 |
for:aFilename |
|
71 |
^ self new for:aFilename |
|
72 |
! ! |
|
73 |
||
74 |
!SnapShotImageMemory class methodsFor:'private'! |
|
75 |
||
76 |
isNilOOP:anOOP |
|
77 |
^ anOOP == 0 |
|
78 |
! |
|
79 |
||
80 |
isPointerOOP:anOOP |
|
81 |
^ (anOOP bitTest:1) not |
|
82 |
! |
|
83 |
||
84 |
isSmallIntegerOOP:anOOP |
|
85 |
^ anOOP bitTest:1 |
|
86 |
! ! |
|
87 |
||
88 |
!SnapShotImageMemory methodsFor:'accessing'! |
|
89 |
||
90 |
globalEntries |
|
91 |
"return the value of the instance variable 'globalEntries' (automatically generated)" |
|
92 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
93 |
^ globalEntries |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
94 |
! |
1416 | 95 |
|
96 |
globalEntries:something |
|
97 |
"set the value of the instance variable 'globalEntries' (automatically generated)" |
|
98 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
99 |
globalEntries := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
100 |
! |
1417 | 101 |
|
102 |
image |
|
103 |
||
104 |
^ image |
|
105 |
! |
|
106 |
||
107 |
image:something |
|
108 |
||
109 |
image := something. |
|
110 |
! |
|
111 |
||
112 |
ptrSize |
|
113 |
"return the value of the instance variable 'ptrSize' (automatically generated)" |
|
114 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
115 |
^ ptrSize |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
116 |
! |
1417 | 117 |
|
118 |
ptrSize:something |
|
119 |
"set the value of the instance variable 'ptrSize' (automatically generated)" |
|
120 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
121 |
ptrSize := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
122 |
! ! |
1416 | 123 |
|
124 |
!SnapShotImageMemory methodsFor:'object access'! |
|
125 |
||
1417 | 126 |
fetchByteAt:addr |
127 |
|byte imgAddr| |
|
128 |
||
129 |
imgAddr := self imageAddressOf:addr. |
|
130 |
stream position:imgAddr. |
|
131 |
byte := stream next. |
|
132 |
^ byte |
|
133 |
! |
|
134 |
||
1416 | 135 |
fetchClassObjectAt:baseAddr |
1417 | 136 |
|addr classPtr size bits o classRef nInsts| |
137 |
||
138 |
(baseAddr bitAnd:3) ~~ 0 ifTrue:[self halt]. |
|
1416 | 139 |
|
140 |
o := addrToObjectMapping at:baseAddr ifAbsent:nil. |
|
141 |
o notNil ifTrue:[^ o]. |
|
142 |
||
143 |
addr := baseAddr. |
|
144 |
classPtr := self fetchPointerAt:addr. |
|
145 |
addr := addr + ptrSize. |
|
146 |
size := self fetchUnboxedIntegerAt:addr. |
|
147 |
addr := addr + ptrSize. |
|
148 |
bits := self fetchUnboxedIntegerAt:addr. |
|
149 |
addr := addr + ptrSize. |
|
150 |
||
1417 | 151 |
nInsts := (size - (intSize *3)) // intSize. |
152 |
o := ImageClassObject new:nInsts. |
|
153 |
addrToObjectMapping at:baseAddr put:o. |
|
154 |
||
155 |
(self class isPointerOOP:classPtr) ifFalse:[ |
|
156 |
self halt |
|
157 |
]. |
|
158 |
||
159 |
classRef := self fetchClassObjectAt:classPtr. |
|
160 |
||
161 |
o classRef:classRef. |
|
162 |
size > 8000 ifTrue:[self halt]. |
|
163 |
o byteSize:size. |
|
1416 | 164 |
o bits:bits. |
165 |
||
1417 | 166 |
1 to:nInsts do:[:idx | |
1416 | 167 |
o at:idx put:(self fetchUnboxedIntegerAt:addr). |
1417 | 168 |
"/ o at:idx put:(self fetchObjectAt:(self fetchUnboxedIntegerAt:addr)). |
169 |
addr := addr + ptrSize. |
|
1416 | 170 |
]. |
1417 | 171 |
o memory:self. |
1416 | 172 |
^ o |
173 |
! |
|
174 |
||
175 |
fetchObjectAt:baseAddr |
|
1482 | 176 |
|addr classPtr classRef size bits o nBytes nInsts flags indexTypeFlags imgAddr |
177 |
| |
|
1417 | 178 |
|
179 |
baseAddr == 0 ifTrue:[^ nil]. |
|
180 |
(baseAddr bitAnd:1) == 1 ifTrue:[(baseAddr bitTest:16r80000000) ifTrue:[ |
|
181 |
^ (baseAddr - 16r100000000) bitShift32:-1 |
|
182 |
] ifFalse:[ |
|
183 |
^ baseAddr bitShift32:-1 |
|
184 |
] |
|
185 |
]. |
|
186 |
(baseAddr bitAnd:3) ~~ 0 ifTrue:[self halt]. |
|
1416 | 187 |
|
188 |
o := addrToObjectMapping at:baseAddr ifAbsent:nil. |
|
189 |
o notNil ifTrue:[^ o]. |
|
190 |
||
191 |
addr := baseAddr. |
|
192 |
classPtr := self fetchPointerAt:addr. |
|
193 |
addr := addr + ptrSize. |
|
194 |
size := self fetchUnboxedIntegerAt:addr. |
|
195 |
addr := addr + ptrSize. |
|
196 |
bits := self fetchUnboxedIntegerAt:addr. |
|
197 |
addr := addr + ptrSize. |
|
198 |
||
199 |
(self class isPointerOOP:classPtr) ifFalse:[ |
|
200 |
self halt |
|
201 |
]. |
|
202 |
||
203 |
classRef := self fetchClassObjectAt:classPtr. |
|
1417 | 204 |
|
1482 | 205 |
flags := classRef flags. |
206 |
indexTypeFlags := flags bitAnd:Behavior maskIndexType. |
|
207 |
(indexTypeFlags = Behavior flagBytes) ifTrue:[ |
|
1417 | 208 |
nBytes := (size - (intSize * 3)). |
209 |
o := ImageByteObject new:nBytes. |
|
210 |
o classRef:classRef. |
|
211 |
size > 8000 ifTrue:[self halt]. |
|
212 |
o byteSize:size. |
|
213 |
o bits:bits. |
|
1416 | 214 |
|
1417 | 215 |
imgAddr := self imageAddressOf:addr. |
216 |
stream position:imgAddr. |
|
1416 | 217 |
|
1417 | 218 |
1 to:nBytes do:[:idx | |
219 |
o at:idx put:(stream next). |
|
220 |
addr := addr + 1. |
|
221 |
]. |
|
222 |
||
223 |
"/Transcript show:'#'. |
|
224 |
"/Transcript show:((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:o startingAt:1) asString. |
|
225 |
"/Transcript cr. |
|
1416 | 226 |
|
1417 | 227 |
] ifFalse:[ |
1482 | 228 |
(indexTypeFlags = Behavior flagNotIndexed) ifFalse:[ |
229 |
(indexTypeFlags ~= Behavior flagPointers) ifTrue:[ |
|
230 |
(indexTypeFlags ~= Behavior flagWeakPointers) ifTrue:[ |
|
1417 | 231 |
self halt |
232 |
] |
|
233 |
]. |
|
234 |
]. |
|
1416 | 235 |
|
1417 | 236 |
nInsts := (size - (intSize * 3)) // intSize. |
1482 | 237 |
(flags bitTest:Behavior flagBehavior) |
1417 | 238 |
"/ classRef isImageBehavior |
239 |
ifTrue:[ |
|
240 |
o := ImageClassObject new:nInsts. |
|
241 |
] ifFalse:[ |
|
1482 | 242 |
(flags bitTest:Behavior flagMethod) ifTrue:[ |
243 |
o := ImageMethodObject new:nInsts. |
|
244 |
] ifFalse:[ |
|
245 |
o := ImageObject new:nInsts. |
|
246 |
] |
|
1417 | 247 |
]. |
248 |
o classRef:classRef. |
|
249 |
size > 8000 ifTrue:[self halt]. |
|
250 |
o byteSize:size. |
|
251 |
o bits:bits. |
|
252 |
addrToObjectMapping at:baseAddr put:o. |
|
1416 | 253 |
|
1417 | 254 |
1 to:nInsts do:[:idx | |
255 |
o at:idx put:(self fetchUnboxedIntegerAt:addr). |
|
256 |
"/ o at:idx put:(self fetchObjectAt:(self fetchUnboxedIntegerAt:addr)). |
|
257 |
addr := addr + ptrSize. |
|
258 |
] |
|
259 |
]. |
|
260 |
o memory:self. |
|
261 |
^ o |
|
1416 | 262 |
! |
263 |
||
264 |
fetchPointerAt:addr |
|
265 |
^ self fetchUnboxedIntegerAt:addr |
|
266 |
! |
|
267 |
||
268 |
fetchUnboxedIntegerAt:addr |
|
1417 | 269 |
|ptr imgAddr| |
270 |
||
271 |
(addr bitAnd:3) ~~ 0 ifTrue:[self halt]. |
|
272 |
||
273 |
imgAddr := self imageAddressOf:addr. |
|
274 |
stream position:imgAddr. |
|
275 |
ptr := stream nextUnsignedLongMSB:msb. |
|
276 |
^ ptr |
|
277 |
! |
|
278 |
||
279 |
imageAddressOf:addr |
|
1416 | 280 |
spaceInfos do:[:eachSpace | |
1417 | 281 |
|byte imgAddr| |
1416 | 282 |
|
283 |
addr >= eachSpace start ifTrue:[ |
|
284 |
addr <= eachSpace end ifTrue:[ |
|
285 |
imgAddr := eachSpace imageBase + (addr - eachSpace start). |
|
1417 | 286 |
^ imgAddr |
1416 | 287 |
] |
288 |
]. |
|
289 |
]. |
|
1417 | 290 |
self halt:'image address error'. |
1416 | 291 |
! ! |
292 |
||
293 |
!SnapShotImageMemory methodsFor:'private'! |
|
294 |
||
295 |
allClassesDo:aBlock |
|
296 |
self allGlobalKeysDo:[:eachKey | |
|
297 |
|val| |
|
298 |
||
299 |
val := self at:eachKey. |
|
300 |
val isBehavior ifTrue:[ |
|
301 |
aBlock value:val |
|
1417 | 302 |
] ifFalse:[ |
303 |
self halt. |
|
304 |
]. |
|
1416 | 305 |
]. |
306 |
! |
|
307 |
||
308 |
allGlobalKeysDo:aBlock |
|
1417 | 309 |
globalEntries isNil ifTrue:[ |
1416 | 310 |
self readHeader. |
311 |
self readGlobals. |
|
312 |
]. |
|
313 |
! |
|
314 |
||
1419 | 315 |
fetchByteArrayFor:aByteArrayRef |
316 |
|nBytes| |
|
317 |
||
318 |
(aByteArrayRef isImageBytes) ifFalse:[self halt]. |
|
319 |
||
320 |
nBytes := aByteArrayRef byteSize - (intSize * 3). |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
321 |
^ ((ByteArray new:nBytes) replaceFrom:1 to:nBytes-1 with:aByteArrayRef startingAt:1). |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
322 |
! |
1419 | 323 |
|
1417 | 324 |
fetchStringFor:aStringRef |
325 |
|nBytes| |
|
326 |
||
327 |
(aStringRef isImageBytes) ifFalse:[self halt]. |
|
328 |
||
329 |
nBytes := aStringRef byteSize - (intSize * 3). |
|
330 |
^ ((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:aStringRef startingAt:1) asString. |
|
331 |
! |
|
332 |
||
1416 | 333 |
for:aFilename |
334 |
stream := aFilename asFilename readStream binary. |
|
335 |
addrToObjectMapping := IdentityDictionary new. |
|
1417 | 336 |
|
337 |
addrToObjectMapping at:(ObjectMemory addressOf:false) put:false. |
|
338 |
addrToObjectMapping at:(ObjectMemory addressOf:true) put:true. |
|
339 |
! |
|
340 |
||
341 |
printStringOfClass:aClassRef |
|
342 |
|nameSlot| |
|
343 |
||
344 |
(aClassRef isImageBehavior) ifFalse:[self halt]. |
|
345 |
((aClassRef byteSize // intSize) - 3) < Class instSize ifTrue:[self halt.]. |
|
346 |
||
347 |
nameSlot := aClassRef at:7. |
|
348 |
nameSlot isInteger ifTrue:[ |
|
349 |
nameSlot := self fetchObjectAt:nameSlot |
|
350 |
]. |
|
351 |
nameSlot isImageSymbol ifFalse:[self halt]. |
|
352 |
^ 'Class: ' , (self printStringOfSymbol:nameSlot) |
|
353 |
! |
|
354 |
||
355 |
printStringOfObject:anObjectRef |
|
356 |
|s nBytes| |
|
357 |
||
358 |
anObjectRef isNil ifTrue:[^ 'nil']. |
|
359 |
(anObjectRef isInteger) ifTrue:[^ anObjectRef printString]. |
|
360 |
(anObjectRef == true ) ifTrue:[^ anObjectRef printString]. |
|
361 |
(anObjectRef == false) ifTrue:[^ anObjectRef printString]. |
|
362 |
||
363 |
(anObjectRef isImageSymbol) ifTrue:[^ self printStringOfSymbol:anObjectRef]. |
|
364 |
(anObjectRef isImageBehavior) ifTrue:[^ self printStringOfClass:anObjectRef]. |
|
365 |
||
366 |
^ 'obj(' , anObjectRef printString , ')' |
|
367 |
! |
|
368 |
||
369 |
printStringOfString:aStringRef |
|
370 |
|nBytes| |
|
371 |
||
372 |
(aStringRef isString) ifFalse:[self halt]. |
|
373 |
^ self fetchStringFor:aStringRef. |
|
374 |
! |
|
375 |
||
376 |
printStringOfSymbol:aSymbolRef |
|
377 |
|nBytes| |
|
378 |
||
379 |
(aSymbolRef isImageSymbol) ifFalse:[self halt]. |
|
1420 | 380 |
^ self fetchStringFor:aSymbolRef. |
1417 | 381 |
"/ nBytes := aSymbolRef size - (intSize * 3). |
382 |
"/ ^ ((ByteArray new:nBytes-1) replaceFrom:1 to:nBytes-1 with:aSymbolRef startingAt:1) asString. |
|
1416 | 383 |
! |
384 |
||
385 |
readGlobalEntries |
|
1417 | 386 |
|refPointer theSymbolPtr theSymbolRef theValuePtr theValueRef pos| |
1416 | 387 |
|
388 |
globalEntries := OrderedCollection new. |
|
389 |
[ |
|
390 |
refPointer := stream nextUnsignedLongMSB:msb. |
|
1417 | 391 |
theSymbolPtr := stream nextUnsignedLongMSB:msb. |
392 |
theValuePtr := stream nextUnsignedLongMSB:msb. |
|
393 |
theSymbolPtr ~~ 0 |
|
1416 | 394 |
] whileTrue:[ |
1417 | 395 |
globalEntries add:(theSymbolPtr -> theValuePtr). |
1416 | 396 |
]. |
1417 | 397 |
globalEntries := globalEntries asArray. |
398 |
||
399 |
"/ globalEntries inspect. |
|
400 |
pos := stream position. |
|
401 |
globalEntries do:[:item | |
|
402 |
theSymbolPtr := item key. |
|
403 |
theValuePtr := item value. |
|
404 |
theSymbolRef := self fetchObjectAt:theSymbolPtr. |
|
405 |
||
406 |
"/ Transcript show:(self printStringOfSymbol:theSymbolRef). |
|
407 |
"/ Transcript show:'->'. |
|
408 |
||
409 |
theValueRef := self fetchObjectAt:theValuePtr. |
|
410 |
"/ Transcript show:(self printStringOfObject:theValueRef). |
|
411 |
"/ Transcript cr. |
|
412 |
||
413 |
item key:theSymbolRef. |
|
414 |
item value:theValueRef. |
|
415 |
]. |
|
416 |
stream position:pos. |
|
1416 | 417 |
! |
418 |
||
419 |
readHeader |
|
420 |
" |
|
421 |
(self for:'stmeas.img') readHeader |
|
422 |
" |
|
423 |
||
424 |
|order magic version timeStamp snapID last_util_addr hiText_addr flags |
|
425 |
lowData hiData charSlots charTableSlots fixMemStart fixMemEnd |
|
426 |
symMemStart symMemEnd vmDataAddr sharedMethodCode sharedBlockCode |
|
427 |
nContexts contextSpace nRegistered symbolsSeqNr nSpaces |
|
1417 | 428 |
classNameSize spaceSize| |
1416 | 429 |
|
430 |
stream next:256. "/ skip execCmd |
|
431 |
||
432 |
msb := false. |
|
433 |
order := stream nextUnsignedLongMSB:msb. |
|
434 |
order = 16r076543210 ifTrue:[ |
|
435 |
] ifFalse:[ |
|
1423 | 436 |
order = 16r10325476 ifTrue:[ |
1416 | 437 |
msb := true. |
438 |
] ifFalse:[ |
|
439 |
self error:'unhandled byteorder' |
|
440 |
]. |
|
441 |
]. |
|
442 |
magic := (stream next:8) asString. |
|
443 |
magic ~= 'ST/X-IMG' ifTrue:[ |
|
444 |
self error:'not an st/x image' |
|
445 |
]. |
|
446 |
version := stream nextUnsignedLongMSB:msb. |
|
447 |
timeStamp := stream nextUnsignedLongMSB:msb. |
|
448 |
ptrSize := stream nextByte. |
|
449 |
ptrSize ~~ 4 ifTrue:[ |
|
450 |
self error:'unhandled ptr format' |
|
451 |
]. |
|
452 |
stream next:7. "/ filler |
|
453 |
intSize := stream nextUnsignedLongMSB:msb. |
|
454 |
intSize == 9 ifTrue:[ |
|
455 |
intSize := 4. |
|
456 |
intTag := 1. |
|
457 |
] ifFalse:[ |
|
458 |
self error:'unhandled int format' |
|
459 |
]. |
|
460 |
||
461 |
snapID := stream nextUnsignedLongMSB:msb. |
|
462 |
last_util_addr := stream next:intSize. |
|
463 |
hiText_addr := stream next:intSize. |
|
464 |
flags := stream next:intSize. |
|
465 |
stream next:8. "/ info, debug & filler |
|
466 |
||
467 |
lowData := stream nextUnsignedLongMSB:msb. |
|
468 |
hiData := stream nextUnsignedLongMSB:msb. |
|
469 |
||
470 |
charSlots := stream nextUnsignedLongMSB:msb. |
|
471 |
charTableSlots := stream nextUnsignedLongMSB:msb. |
|
472 |
||
473 |
version >= 8 ifTrue:[ |
|
474 |
fixMemStart := stream nextUnsignedLongMSB:msb. |
|
475 |
fixMemEnd := stream nextUnsignedLongMSB:msb. |
|
476 |
symMemStart := stream nextUnsignedLongMSB:msb. |
|
477 |
symMemEnd := stream nextUnsignedLongMSB:msb. |
|
478 |
vmDataAddr := stream nextUnsignedLongMSB:msb. |
|
479 |
]. |
|
480 |
stream next:(128 * intSize). "/ skip sharedMethodCode ptrs |
|
481 |
stream next:(128 * intSize). "/ skip sharedBlockCode ptrs |
|
482 |
||
483 |
nContexts := stream nextUnsignedLongMSB:msb. |
|
484 |
contextSpace := stream nextUnsignedLongMSB:msb. |
|
485 |
nRegistered := stream nextUnsignedLongMSB:msb. |
|
486 |
||
487 |
version >= 8 ifTrue:[ |
|
488 |
version >= 9 ifTrue:[ |
|
489 |
symbolsSeqNr := stream nextUnsignedLongMSB:msb. |
|
490 |
stream next:(intSize * 31). |
|
491 |
] ifFalse:[ |
|
492 |
stream next:(intSize * 32). |
|
493 |
] |
|
494 |
]. |
|
495 |
||
496 |
nSpaces := stream nextUnsignedLongMSB:msb. |
|
497 |
spaceInfos := (1 to:nSpaces) collect:[:idx | SpaceInfo new]. |
|
498 |
||
499 |
1 to:nSpaces do:[:i | |
|
500 |
(spaceInfos at:i) flags:(stream nextUnsignedLongMSB:msb). |
|
501 |
]. |
|
502 |
nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb]. |
|
503 |
||
504 |
1 to:nSpaces do:[:i | |
|
505 |
(spaceInfos at:i) start:(stream nextUnsignedLongMSB:msb). |
|
506 |
]. |
|
507 |
nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb]. |
|
508 |
||
509 |
1 to:nSpaces do:[:i | |
|
510 |
(spaceInfos at:i) size:(stream nextUnsignedLongMSB:msb). |
|
511 |
]. |
|
512 |
nSpaces+1 to:32 do:[:i | stream nextUnsignedLongMSB:msb]. |
|
513 |
||
514 |
version >= 8 ifTrue:[ |
|
1417 | 515 |
stream position:(stream class zeroPosition). |
516 |
stream skip:4096. |
|
1416 | 517 |
]. |
518 |
||
519 |
1 to:nSpaces do:[:i | |
|
520 |
(spaceInfos at:i) end:((spaceInfos at:i) start + (spaceInfos at:i) size - 1). |
|
521 |
]. |
|
522 |
1 to:nSpaces do:[:i | |
|
523 |
(spaceInfos at:i) imageBase:(stream position). |
|
1417 | 524 |
spaceSize := (spaceInfos at:i) size. |
525 |
stream skip:spaceSize. |
|
1416 | 526 |
]. |
527 |
||
528 |
"/ registration |
|
529 |
||
530 |
self readRegistrationEntries. |
|
1417 | 531 |
Transcript showCR:'reading symbols...'. |
1416 | 532 |
self readSymbolEntries. |
1417 | 533 |
self readUGlobalEntries. |
534 |
Transcript showCR:'reading globals...'. |
|
1416 | 535 |
self readGlobalEntries. |
536 |
||
537 |
||
538 |
"/struct basicImageHeader { |
|
539 |
"/ char h_execCmd[256]; |
|
540 |
"/ |
|
541 |
"/ int h_orderWord; |
|
542 |
"/ char h_magic[8]; |
|
543 |
"/ int h_version; |
|
544 |
"/ int h_timeStamp; |
|
545 |
"/ char h_ptrSize; |
|
546 |
"/ char h_filler1[7]; |
|
547 |
"/ int h_intSize; |
|
548 |
"/ int h_snapID; |
|
549 |
"/ INT h_last_util_addr; |
|
550 |
"/ INT h_hiText_addr; |
|
551 |
"/ INT h_flags; |
|
552 |
"/ char h_infoPrinting; |
|
553 |
"/ char h_debugPrinting; |
|
554 |
"/ char h_filler2[6]; |
|
555 |
"/ |
|
556 |
"/ /* |
|
557 |
"/ * these are to verify compatibility of the image with |
|
558 |
"/ * myself ... |
|
559 |
"/ * this is now obsolete. |
|
560 |
"/ */ |
|
561 |
"/ INT h_lowData, h_hiData; |
|
562 |
"/ |
|
563 |
"/ /* |
|
564 |
"/ * base address of character- and characterTable slots |
|
565 |
"/ */ |
|
566 |
"/ INT h_charSlots; |
|
567 |
"/ INT h_charTableSlots; |
|
568 |
"/ |
|
569 |
"/#if HEADER_VERSION >= 8 |
|
570 |
"/ /* |
|
571 |
"/ * the fixBase (VMDATA address) |
|
572 |
"/ */ |
|
573 |
"/ INT h_fixMemStart; |
|
574 |
"/ INT h_fixMemEnd; |
|
575 |
"/ INT h_symMemStart; |
|
576 |
"/ INT h_symMemEnd; |
|
577 |
"/ |
|
578 |
"/ INT h_vmDataAddr; |
|
579 |
"/#endif |
|
580 |
"/ |
|
581 |
"/ INT h_sharedMethodCode[128]; |
|
582 |
"/ INT h_sharedBlockCode[128]; |
|
583 |
"/ |
|
584 |
"/ /* |
|
585 |
"/ * space needed to restore contexts |
|
586 |
"/ */ |
|
587 |
"/ INT h_nContexts; |
|
588 |
"/ INT h_contextSpace; |
|
589 |
"/ |
|
590 |
"/ /* |
|
591 |
"/ * number of class registration info records |
|
592 |
"/ */ |
|
593 |
"/ INT h_nRegistered; |
|
594 |
"/ |
|
595 |
"/#if HEADER_VERSION >= 8 |
|
596 |
"/ /* |
|
597 |
"/ * reserved slots, for future versions |
|
598 |
"/ * (can add additional info, without affecting position of following stuff) |
|
599 |
"/ * If you add slots, you MUST DECREMENT the fillcount. |
|
600 |
"/ */ |
|
601 |
"/# if HEADER_VERSION >= 9 |
|
602 |
"/ INT h_symbolsSeqNr; |
|
603 |
"/ INT h_reserved[31]; |
|
604 |
"/# else |
|
605 |
"/ INT h_reserved[32]; |
|
606 |
"/# endif |
|
607 |
"/#endif |
|
608 |
"/ |
|
609 |
"/ /* |
|
610 |
"/ * number of spaces, base and size of each |
|
611 |
"/ */ |
|
612 |
"/ INT h_nSpaces; |
|
613 |
"/ INT h_spaceFlags[MAXSPACES]; |
|
614 |
"/ INT h_spaceBase[MAXSPACES]; |
|
615 |
"/ INT h_spaceSize[MAXSPACES]; |
|
616 |
"/ |
|
617 |
"/ /* |
|
618 |
"/ * here come nSpaces object spaces |
|
619 |
"/ */ |
|
620 |
"/ |
|
621 |
"/ /* |
|
622 |
"/ * here comes registration info |
|
623 |
"/ */ |
|
624 |
"/ |
|
625 |
"/ /* |
|
626 |
"/ * here come nSymbols symbolEntries |
|
627 |
"/ * followed by a zero/zero entry |
|
628 |
"/ */ |
|
629 |
"/ |
|
630 |
"/ /* |
|
631 |
"/ * here come nGlobal globalEntries |
|
632 |
"/ * followed by a zero/zero entry |
|
633 |
"/ */ |
|
634 |
"/ |
|
635 |
"/ /* |
|
636 |
"/ * here come nUnnamedGlobal globalEntries |
|
637 |
"/ * followed by a zero/zero entry |
|
638 |
"/ */ |
|
639 |
"/ |
|
640 |
"/ /* |
|
641 |
"/ * here come stack contexts |
|
642 |
"/ */ |
|
643 |
"/}; |
|
644 |
! |
|
645 |
||
646 |
readRegistrationEntries |
|
647 |
|classNameSize| |
|
648 |
||
649 |
[ |
|
650 |
classNameSize := stream nextUnsignedLongMSB:msb. |
|
651 |
classNameSize ~~ 0 |
|
652 |
] whileTrue:[ |
|
653 |
|className flags moduleTimestamp signature nMethods nBlocks oldLitRefs nLitRefs |
|
654 |
oldConstTable nConsts| |
|
655 |
||
656 |
className := (stream next:classNameSize) asString. |
|
657 |
stream next. "/ 0-byte |
|
658 |
flags := stream nextUnsignedLongMSB:msb. |
|
659 |
moduleTimestamp := stream nextUnsignedLongMSB:msb. |
|
660 |
signature := stream nextUnsignedLongMSB:msb. |
|
661 |
nMethods := stream nextUnsignedLongMSB:msb. |
|
662 |
nMethods timesRepeat:[ stream nextUnsignedLongMSB:msb ]. |
|
663 |
nBlocks := stream nextUnsignedLongMSB:msb. |
|
664 |
nBlocks timesRepeat:[ stream nextUnsignedLongMSB:msb ]. |
|
665 |
oldLitRefs := stream nextUnsignedLongMSB:msb. |
|
666 |
nLitRefs := stream nextUnsignedLongMSB:msb. |
|
667 |
nLitRefs timesRepeat:[ stream nextUnsignedLongMSB:msb ]. |
|
668 |
stream nextUnsignedLongMSB:msb. "/ 0-litRef |
|
669 |
oldConstTable := stream nextUnsignedLongMSB:msb. |
|
670 |
nConsts := stream nextUnsignedLongMSB:msb. |
|
671 |
nConsts timesRepeat:[ stream nextUnsignedLongMSB:msb ]. |
|
672 |
||
1420 | 673 |
"/ Transcript showCR:className. |
1416 | 674 |
]. |
675 |
! |
|
676 |
||
677 |
readSymbolEntries |
|
1417 | 678 |
|refPointer theSymbolPtr theSymbolRef pos| |
1416 | 679 |
|
680 |
symbolEntries := OrderedCollection new. |
|
681 |
||
682 |
[ |
|
683 |
refPointer := stream nextUnsignedLongMSB:msb. |
|
1417 | 684 |
theSymbolPtr := stream nextUnsignedLongMSB:msb. |
685 |
theSymbolPtr ~~ 0 |
|
1416 | 686 |
] whileTrue:[ |
1417 | 687 |
symbolEntries add:theSymbolPtr. |
1416 | 688 |
]. |
1417 | 689 |
symbolEntries := symbolEntries asArray. |
690 |
||
691 |
pos := stream position. |
|
692 |
symbolEntries := symbolEntries collect:[:theSymbolPtr | |
|
693 |
theSymbolRef := self fetchObjectAt:theSymbolPtr. |
|
694 |
theSymbolRef isImageSymbol ifFalse:[ |
|
695 |
self halt |
|
696 |
]. |
|
697 |
]. |
|
698 |
stream position:pos |
|
1416 | 699 |
! |
700 |
||
701 |
readUGlobalEntries |
|
702 |
|refPointer theValue| |
|
703 |
||
704 |
[ |
|
705 |
refPointer := stream nextUnsignedLongMSB:msb. |
|
706 |
theValue := stream nextUnsignedLongMSB:msb. |
|
707 |
refPointer ~~ 0 |
|
708 |
] whileTrue |
|
709 |
! ! |
|
710 |
||
1417 | 711 |
!SnapShotImageMemory::ImageHeader methodsFor:'accessing'! |
712 |
||
713 |
bits |
|
714 |
"return the value of the instance variable 'bits' (automatically generated)" |
|
715 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
716 |
^ bits |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
717 |
! |
1417 | 718 |
|
719 |
bits:something |
|
720 |
"set the value of the instance variable 'bits' (automatically generated)" |
|
721 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
722 |
bits := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
723 |
! |
1417 | 724 |
|
725 |
byteSize |
|
726 |
"return the value of the instance variable 'size' (automatically generated)" |
|
727 |
||
728 |
^ byteSize |
|
729 |
! |
|
730 |
||
731 |
byteSize:something |
|
732 |
"set the value of the instance variable 'size' (automatically generated)" |
|
733 |
||
734 |
something > 8000 ifTrue:[self halt]. |
|
735 |
byteSize := something. |
|
736 |
! |
|
737 |
||
738 |
classRef |
|
739 |
"return the value of the instance variable 'classRef' (automatically generated)" |
|
740 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
741 |
^ classRef |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
742 |
! |
1417 | 743 |
|
744 |
classRef:something |
|
745 |
"set the value of the instance variable 'classRef' (automatically generated)" |
|
746 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
747 |
classRef := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
748 |
! |
1417 | 749 |
|
750 |
memory |
|
751 |
"return the value of the instance variable 'memory' (automatically generated)" |
|
752 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
753 |
^ memory |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
754 |
! |
1417 | 755 |
|
756 |
memory:something |
|
757 |
"set the value of the instance variable 'memory' (automatically generated)" |
|
758 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
759 |
memory := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
760 |
! ! |
1417 | 761 |
|
762 |
!SnapShotImageMemory::ImageHeader methodsFor:'queries'! |
|
763 |
||
764 |
category |
|
765 |
|categoryPtr categoryRef category| |
|
766 |
||
767 |
self isMethodOrLazyMethod ifTrue:[ |
|
768 |
categoryPtr := self at:6. |
|
769 |
categoryRef := memory fetchObjectAt:categoryPtr. |
|
770 |
category := memory fetchStringFor:categoryRef. |
|
771 |
^ category |
|
772 |
]. |
|
773 |
self halt. |
|
774 |
! |
|
775 |
||
1419 | 776 |
isBehavior |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
777 |
^ self isImageBehavior |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
778 |
! |
1419 | 779 |
|
1417 | 780 |
isImageBehavior |
781 |
|flags| |
|
782 |
||
783 |
flags := classRef flags. |
|
784 |
^ flags bitTest:Behavior flagBehavior |
|
785 |
! |
|
786 |
||
787 |
isImageBytes |
|
788 |
|flags| |
|
789 |
||
790 |
flags := classRef flags bitAnd:Behavior maskIndexType. |
|
791 |
^ flags = Behavior flagBytes |
|
792 |
! |
|
793 |
||
794 |
isImageMethod |
|
795 |
|flags| |
|
796 |
||
797 |
flags := classRef flags. |
|
798 |
^ flags bitTest:Behavior flagMethod |
|
799 |
! |
|
800 |
||
801 |
isImageSymbol |
|
802 |
|flags| |
|
803 |
||
804 |
flags := classRef flags. |
|
805 |
^ flags bitTest:Behavior flagSymbol |
|
806 |
! |
|
807 |
||
1420 | 808 |
isJavaMethod |
809 |
|nm| |
|
810 |
||
811 |
nm := classRef name. |
|
812 |
^ (nm = 'JavaMethod' |
|
813 |
or:[ nm = 'JavaMethodWithException' |
|
814 |
or:[ nm = 'JavaMethodWithHandler' |
|
815 |
or:[ nm = 'JavaNativeMethod' ]]]) |
|
816 |
! |
|
817 |
||
1419 | 818 |
isLazyMethod |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
819 |
^ classRef name = 'LazyMethod' |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
820 |
! |
1419 | 821 |
|
1417 | 822 |
isMeta |
823 |
^ false |
|
824 |
! |
|
825 |
||
826 |
isMethod |
|
1420 | 827 |
|cls| |
828 |
||
829 |
cls := classRef. |
|
830 |
[cls notNil] whileTrue:[ |
|
831 |
cls name = 'Method' ifTrue:[^ true]. |
|
832 |
cls := cls superclass |
|
833 |
]. |
|
834 |
^ false. |
|
1417 | 835 |
! |
836 |
||
837 |
isMethodDictionary |
|
838 |
^ classRef name = 'MethodDictionary' |
|
839 |
! |
|
840 |
||
841 |
isMethodOrLazyMethod |
|
842 |
classRef name = 'LazyMethod' ifTrue:[^ true]. |
|
1420 | 843 |
^ self isMethod |
1417 | 844 |
! |
845 |
||
846 |
isString |
|
847 |
^ classRef name = 'String' |
|
848 |
! ! |
|
849 |
||
1419 | 850 |
!SnapShotImageMemory::ImageObject methodsFor:'method protocol'! |
851 |
||
852 |
byteCode |
|
853 |
|byteCodeSlotOffset byteCodePtr byteCodeRef byteCode| |
|
854 |
||
855 |
self isMethod ifTrue:[ |
|
856 |
byteCodeSlotOffset := Method instVarOffsetOf:'byteCode'. |
|
857 |
]. |
|
858 |
byteCodeSlotOffset notNil ifTrue:[ |
|
859 |
byteCodePtr := self at:byteCodeSlotOffset. |
|
860 |
byteCodeRef := memory fetchObjectAt:byteCodePtr. |
|
861 |
byteCodeRef isNil ifTrue:[^ nil]. |
|
862 |
||
863 |
byteCode := memory fetchByteArrayFor:byteCodeRef. |
|
864 |
^ byteCode |
|
865 |
]. |
|
866 |
||
867 |
self halt. |
|
868 |
! |
|
869 |
||
870 |
comment |
|
871 |
|src comment comments parser| |
|
872 |
||
873 |
self isMethod ifTrue:[ |
|
874 |
src := self source. |
|
875 |
src isNil ifTrue:[^ nil]. |
|
876 |
||
877 |
parser := Parser for:src in:nil. |
|
878 |
parser ignoreErrors; ignoreWarnings; saveComments:true. |
|
879 |
parser parseMethodSpec. |
|
880 |
comments := parser comments. |
|
881 |
comments size ~~ 0 ifTrue:[ |
|
882 |
comment := comments first string. |
|
883 |
(comment withoutSpaces endsWith:'}') ifTrue:[ |
|
884 |
"if first comment is a pragma, take next comment" |
|
885 |
comment := comments at:2 ifAbsent:nil. |
|
886 |
comment notNil ifTrue:[ |
|
887 |
comment := comment string. |
|
888 |
]. |
|
889 |
]. |
|
1417 | 890 |
]. |
1419 | 891 |
^ comment. |
1417 | 892 |
]. |
1419 | 893 |
self isLazyMethod ifTrue:[ |
894 |
^ '' |
|
895 |
]. |
|
896 |
||
897 |
self halt. |
|
1417 | 898 |
! |
1416 | 899 |
|
1419 | 900 |
containingClass |
901 |
self isMethodOrLazyMethod ifTrue:[ |
|
902 |
^ self mclass |
|
1417 | 903 |
]. |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
904 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
905 |
! |
1419 | 906 |
|
1469 | 907 |
flags |
908 |
|flagsSlotOffset flagsPtr flags| |
|
909 |
||
910 |
self isMethod ifTrue:[ |
|
911 |
flagsSlotOffset := Method instVarOffsetOf:'flags'. |
|
912 |
]. |
|
913 |
flagsSlotOffset notNil ifTrue:[ |
|
914 |
flagsPtr := self at:flagsSlotOffset. |
|
915 |
flags := memory fetchObjectAt:flagsPtr. |
|
916 |
^ flags |
|
917 |
]. |
|
918 |
||
919 |
self halt. |
|
920 |
! |
|
921 |
||
1419 | 922 |
hasCode |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
923 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
924 |
! |
1419 | 925 |
|
926 |
isBreakpointed |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
927 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
928 |
! |
1419 | 929 |
|
930 |
isCounting |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
931 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
932 |
! |
1419 | 933 |
|
934 |
isCountingMemoryUsage |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
935 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
936 |
! |
1419 | 937 |
|
938 |
isDynamic |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
939 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
940 |
! |
1419 | 941 |
|
942 |
isExecutable |
|
943 |
self isMethod ifTrue:[ |
|
944 |
^ false |
|
945 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
946 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
947 |
! |
1419 | 948 |
|
949 |
isIgnored |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
950 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
951 |
! |
1419 | 952 |
|
1482 | 953 |
isObsolete |
954 |
^ false |
|
955 |
! |
|
956 |
||
1419 | 957 |
isPrivate |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
958 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
959 |
! |
1419 | 960 |
|
961 |
isProtected |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
962 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
963 |
! |
1419 | 964 |
|
965 |
isPublic |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
966 |
^ true |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
967 |
! |
1419 | 968 |
|
969 |
isTimed |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
970 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
971 |
! |
1419 | 972 |
|
973 |
isTraced |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
974 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
975 |
! |
1416 | 976 |
|
1417 | 977 |
isWrapped |
978 |
^ false |
|
1416 | 979 |
! |
980 |
||
1419 | 981 |
mclass |
982 |
|mclassSlotOffset mclassPtr mclass| |
|
983 |
||
984 |
self isMethod ifTrue:[ |
|
985 |
mclassSlotOffset := Method instVarOffsetOf:'mclass'. |
|
1420 | 986 |
] ifFalse:[ |
987 |
self isJavaMethod ifTrue:[ |
|
988 |
mclassSlotOffset := JavaMethod instVarOffsetOf:'javaClass'. |
|
989 |
] |
|
990 |
]. |
|
991 |
||
992 |
mclassSlotOffset notNil ifTrue:[ |
|
1419 | 993 |
mclassPtr := self at:mclassSlotOffset. |
994 |
mclassPtr ~~ 0 ifTrue:[ |
|
1420 | 995 |
mclassPtr isInteger ifTrue:[ |
996 |
mclass := memory fetchObjectAt:mclassPtr. |
|
997 |
self at:mclassSlotOffset put:mclass. |
|
998 |
] ifFalse:[ |
|
999 |
mclass := mclassPtr. |
|
1000 |
]. |
|
1419 | 1001 |
mclass isImageBehavior ifFalse:[ |
1002 |
self halt |
|
1003 |
]. |
|
1004 |
^ mclass |
|
1005 |
]. |
|
1006 |
||
1007 |
"/ search my class ... |
|
1008 |
memory image allClassesDo:[:eachClass | |
|
1009 |
eachClass theNonMetaclass methodDictionary keysAndValuesDo:[:sel :mthdRef | |
|
1010 |
mthdRef == self ifTrue:[ |
|
1011 |
self at:mclassSlotOffset put:eachClass theNonMetaclass. |
|
1012 |
^ eachClass theNonMetaclass |
|
1013 |
]. |
|
1014 |
]. |
|
1015 |
eachClass theMetaclass methodDictionary keysAndValuesDo:[:sel :mthdRef | |
|
1016 |
mthdRef == self ifTrue:[ |
|
1017 |
self at:mclassSlotOffset put:eachClass theMetaclass. |
|
1018 |
^ eachClass theMetaclass |
|
1019 |
]. |
|
1020 |
] |
|
1417 | 1021 |
]. |
1419 | 1022 |
self halt. |
1420 | 1023 |
^ nil. |
1417 | 1024 |
]. |
1420 | 1025 |
^ nil. |
1419 | 1026 |
self halt. |
1417 | 1027 |
! |
1028 |
||
1419 | 1029 |
numArgs |
1469 | 1030 |
|flags| |
1031 |
||
1032 |
flags := self flags. |
|
1033 |
^ (flags bitAnd:(Method numArgsMaskInFlags)) bitShift:(Method numArgsShiftInFlags negated) |
|
1419 | 1034 |
! |
1035 |
||
1036 |
package |
|
1037 |
|packageSlotOffset packagePtr packageRef package| |
|
1038 |
||
1039 |
self isImageBehavior ifTrue:[ |
|
1040 |
self isMeta ifTrue:[ |
|
1041 |
^ self theNonMetaclass package |
|
1042 |
]. |
|
1043 |
packageSlotOffset := Class instVarOffsetOf:'package'. |
|
1420 | 1044 |
] ifFalse:[ |
1045 |
self isMethod ifTrue:[ |
|
1046 |
packageSlotOffset := Method instVarOffsetOf:'package'. |
|
1047 |
] ifFalse:[ |
|
1048 |
self isLazyMethod ifTrue:[ |
|
1049 |
packageSlotOffset := Method instVarOffsetOf:'package'. |
|
1050 |
]. |
|
1051 |
]. |
|
1419 | 1052 |
]. |
1053 |
packageSlotOffset notNil ifTrue:[ |
|
1054 |
packagePtr := self at:packageSlotOffset. |
|
1055 |
packageRef := memory fetchObjectAt:packagePtr. |
|
1056 |
packageRef isNil ifTrue:[^ nil]. |
|
1057 |
||
1058 |
packageRef isImageSymbol ifFalse:[ |
|
1420 | 1059 |
packageRef isImageBytes ifFalse:[ |
1060 |
self halt. |
|
1061 |
]. |
|
1062 |
"/ mhmh - can be a string sometimes ... |
|
1419 | 1063 |
]. |
1064 |
package := memory fetchStringFor:packageRef. |
|
1065 |
^ package asSymbol |
|
1066 |
]. |
|
1067 |
self isMeta ifTrue:[ |
|
1068 |
self halt |
|
1069 |
]. |
|
1070 |
||
1420 | 1071 |
^ nil |
1419 | 1072 |
! |
1073 |
||
1074 |
previousVersion |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1075 |
^ nil |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1076 |
! |
1419 | 1077 |
|
1417 | 1078 |
printStringForBrowserWithSelector:selector |
1079 |
^ selector |
|
1080 |
! |
|
1081 |
||
1419 | 1082 |
privacy |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1083 |
^ #public |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1084 |
! |
1419 | 1085 |
|
1417 | 1086 |
resources |
1087 |
^ nil |
|
1088 |
! |
|
1089 |
||
1090 |
source |
|
1482 | 1091 |
self halt:'unimplemented'. |
1416 | 1092 |
! |
1093 |
||
1419 | 1094 |
sourceFilename |
1095 |
"return the sourcefilename if source is extern; nil otherwise" |
|
1096 |
||
1097 |
self isMethodOrLazyMethod ifTrue:[ |
|
1098 |
self sourcePosition notNil ifTrue:[^ self source]. |
|
1099 |
^ nil |
|
1100 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1101 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1102 |
! |
1419 | 1103 |
|
1104 |
sourceLineNumber |
|
1105 |
self isMethodOrLazyMethod ifTrue:[ |
|
1106 |
^ 1 |
|
1107 |
]. |
|
1108 |
self halt. |
|
1109 |
! |
|
1110 |
||
1111 |
sourcePosition |
|
1112 |
|sourcePosition| |
|
1113 |
||
1114 |
self isMethodOrLazyMethod ifTrue:[ |
|
1115 |
sourcePosition := self sourcePositionValue. |
|
1116 |
sourcePosition isNil ifTrue:[^ sourcePosition]. |
|
1117 |
^ sourcePosition abs |
|
1118 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1119 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1120 |
! |
1419 | 1121 |
|
1122 |
sourcePositionValue |
|
1123 |
|sourcePosition sourcePositionPtr| |
|
1124 |
||
1125 |
self isMethodOrLazyMethod ifTrue:[ |
|
1126 |
sourcePositionPtr := self at:(Method instVarOffsetOf:'sourcePosition'). |
|
1127 |
sourcePosition := memory fetchObjectAt:sourcePositionPtr. |
|
1128 |
^ sourcePosition |
|
1129 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1130 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1131 |
! |
1419 | 1132 |
|
1417 | 1133 |
sourceStream |
1134 |
|sourcePosition source aStream fileName junk who |
|
1135 |
myClass mgr className sep dir mod package| |
|
1136 |
||
1137 |
self isMethod ifTrue:[ |
|
1138 |
sourcePosition := self at:(Method instVarOffsetOf:'sourcePosition'). |
|
1139 |
source := self at:(Method instVarOffsetOf:'source'). |
|
1140 |
source := memory fetchObjectAt:source. |
|
1141 |
source isString ifTrue:[ |
|
1142 |
source := memory printStringOfString:source. |
|
1143 |
]. |
|
1144 |
sourcePosition notNil ifTrue:[ |
|
1145 |
sourcePosition := memory fetchObjectAt:sourcePosition. |
|
1146 |
]. |
|
1147 |
||
1148 |
source isNil ifTrue:[^ nil]. |
|
1149 |
sourcePosition isNil ifTrue:[^ source readStream]. |
|
1150 |
||
1151 |
sourcePosition < 0 ifTrue:[ |
|
1152 |
aStream := source asFilename readStream. |
|
1153 |
aStream notNil ifTrue:[ |
|
1154 |
^ aStream |
|
1155 |
]. |
|
1156 |
||
1157 |
fileName := Smalltalk getSourceFileName:source. |
|
1158 |
fileName notNil ifTrue:[ |
|
1159 |
aStream := fileName asFilename readStream. |
|
1160 |
aStream notNil ifTrue:[ |
|
1161 |
^ aStream |
|
1162 |
]. |
|
1163 |
]. |
|
1164 |
]. |
|
1165 |
||
1166 |
"/ |
|
1167 |
"/ if there is no SourceManager, look in local standard places first |
|
1168 |
"/ |
|
1169 |
(mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[ |
|
1170 |
aStream := self localSourceStream. |
|
1171 |
aStream notNil ifTrue:[ |
|
1172 |
^ aStream |
|
1173 |
]. |
|
1174 |
]. |
|
1175 |
||
1176 |
"/ |
|
1177 |
"/ nope - ask my class for the source (this also invokes the SCMgr) |
|
1178 |
"/ |
|
1179 |
myClass := self mclass. |
|
1416 | 1180 |
|
1417 | 1181 |
package := self package. |
1182 |
(package notNil and:[package ~= myClass package]) ifTrue:[ |
|
1183 |
mgr notNil ifTrue:[ |
|
1184 |
"/ try to get the source using my package information ... |
|
1185 |
sep := package indexOfAny:'/\:'. |
|
1186 |
sep ~~ 0 ifTrue:[ |
|
1187 |
mod := package copyTo:sep - 1. |
|
1188 |
dir := package copyFrom:sep + 1. |
|
1189 |
aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true. |
|
1190 |
aStream notNil ifTrue:[ |
|
1191 |
^ aStream |
|
1192 |
]. |
|
1193 |
]. |
|
1194 |
]. |
|
1195 |
]. |
|
1196 |
||
1197 |
aStream := myClass sourceStreamFor:source. |
|
1198 |
aStream notNil ifTrue:[ |
|
1199 |
^ aStream |
|
1200 |
]. |
|
1201 |
||
1202 |
"/ |
|
1203 |
"/ nope - look in standard places |
|
1204 |
"/ (if there is a source-code manager - otherwise, we already did that) |
|
1205 |
"/ |
|
1206 |
mgr notNil ifTrue:[ |
|
1207 |
aStream := self localSourceStream. |
|
1208 |
aStream notNil ifTrue:[ |
|
1209 |
^ aStream |
|
1210 |
]. |
|
1211 |
]. |
|
1212 |
||
1213 |
"/ |
|
1214 |
"/ final chance: try current directory |
|
1215 |
"/ |
|
1216 |
aStream isNil ifTrue:[ |
|
1217 |
aStream := source asFilename readStream. |
|
1218 |
aStream notNil ifTrue:[ |
|
1219 |
^ aStream |
|
1220 |
]. |
|
1221 |
]. |
|
1222 |
||
1223 |
(who isNil and:[source notNil]) ifTrue:[ |
|
1224 |
"/ |
|
1225 |
"/ mhmh - seems to be a method which used to be in some |
|
1226 |
"/ class, but has been overwritten by another or removed. |
|
1227 |
"/ (i.e. it has no containing class anyMore) |
|
1228 |
"/ try to guess the class from the sourceFileName. |
|
1229 |
"/ and retry. |
|
1230 |
"/ |
|
1231 |
className := Smalltalk classNameForFile:source. |
|
1232 |
className knownAsSymbol ifTrue:[ |
|
1233 |
myClass := Smalltalk at:className asSymbol ifAbsent:nil. |
|
1234 |
myClass notNil ifTrue:[ |
|
1235 |
aStream := myClass sourceStreamFor:source. |
|
1236 |
aStream notNil ifTrue:[ |
|
1237 |
^ aStream |
|
1238 |
]. |
|
1239 |
] |
|
1240 |
] |
|
1241 |
]. |
|
1242 |
||
1243 |
^ nil |
|
1244 |
]. |
|
1416 | 1245 |
self halt. |
1246 |
! ! |
|
1247 |
||
1419 | 1248 |
!SnapShotImageMemory::ImageObject methodsFor:'methodDictionary protocol'! |
1249 |
||
1250 |
at:aSelector ifAbsent:exceptionValue |
|
1251 |
self isMethodDictionary ifTrue:[ |
|
1252 |
cachedContents isNil ifTrue:[ |
|
1253 |
self cacheMethodDictionary. |
|
1254 |
]. |
|
1255 |
^ cachedContents at:aSelector ifAbsent:exceptionValue |
|
1256 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1257 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1258 |
! |
1419 | 1259 |
|
1260 |
cacheMethodDictionary |
|
1261 |
|symPtr symRef mthdPtr mthdRef s| |
|
1262 |
||
1263 |
cachedContents isNil ifTrue:[ |
|
1264 |
cachedContents := IdentityDictionary new. |
|
1265 |
||
1266 |
1 to:self size by:2 do:[:idx | |
|
1267 |
symPtr := self at:idx. |
|
1268 |
symRef := memory fetchObjectAt:symPtr. |
|
1269 |
symRef isImageSymbol ifFalse:[self halt]. |
|
1270 |
s := memory fetchStringFor:symRef. |
|
1271 |
mthdPtr := self at:idx + 1. |
|
1272 |
mthdRef := memory fetchObjectAt:mthdPtr. |
|
1273 |
cachedContents at:s asSymbol put:mthdRef. |
|
1274 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1275 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1276 |
! |
1419 | 1277 |
|
1278 |
do:aBlock |
|
1279 |
self isMethodDictionary ifTrue:[ |
|
1280 |
cachedContents isNil ifTrue:[ |
|
1281 |
self cacheMethodDictionary. |
|
1282 |
]. |
|
1283 |
cachedContents do:aBlock. |
|
1284 |
^ self. |
|
1285 |
]. |
|
1286 |
self halt. |
|
1287 |
! |
|
1288 |
||
1289 |
includesKey:aSelector |
|
1290 |
self isMethodDictionary ifTrue:[ |
|
1291 |
cachedContents isNil ifTrue:[ |
|
1292 |
self cacheMethodDictionary. |
|
1293 |
]. |
|
1294 |
^ cachedContents includesKey:aSelector |
|
1295 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1296 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1297 |
! |
1419 | 1298 |
|
1299 |
keyAtValue:aMethod ifAbsent:exceptionValue |
|
1300 |
self isMethodDictionary ifTrue:[ |
|
1301 |
cachedContents isNil ifTrue:[ |
|
1302 |
self cacheMethodDictionary. |
|
1303 |
]. |
|
1304 |
^ cachedContents keyAtValue:aMethod ifAbsent:exceptionValue |
|
1305 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1306 |
self halt. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1307 |
! |
1419 | 1308 |
|
1309 |
keysAndValuesDo:aBlock |
|
1310 |
self isMethodDictionary ifTrue:[ |
|
1311 |
cachedContents isNil ifTrue:[ |
|
1312 |
self cacheMethodDictionary. |
|
1313 |
]. |
|
1314 |
||
1315 |
cachedContents keysAndValuesDo:[:sel :mthdRef | |
|
1316 |
aBlock value:sel value:mthdRef. |
|
1317 |
]. |
|
1318 |
^ self |
|
1319 |
]. |
|
1320 |
self halt. |
|
1321 |
! ! |
|
1322 |
||
1448 | 1323 |
!SnapShotImageMemory::ImageByteObject methodsFor:'queries'! |
1324 |
||
1325 |
size |
|
1326 |
^ byteSize |
|
1327 |
! ! |
|
1328 |
||
1482 | 1329 |
!SnapShotImageMemory::ImageMethodObject methodsFor:'method protocol'! |
1330 |
||
1331 |
package |
|
1332 |
|packageSlotOffset packagePtr packageRef package| |
|
1333 |
||
1334 |
cachedPackage isNil ifTrue:[ |
|
1335 |
packageSlotOffset := Method instVarOffsetOf:'package'. |
|
1336 |
||
1337 |
packagePtr := self at:packageSlotOffset. |
|
1338 |
packageRef := memory fetchObjectAt:packagePtr. |
|
1339 |
packageRef isNil ifTrue:[^ nil]. |
|
1340 |
||
1341 |
packageRef isImageSymbol ifFalse:[ |
|
1342 |
packageRef isImageBytes ifFalse:[ |
|
1343 |
self halt. |
|
1344 |
]. |
|
1345 |
"/ mhmh - can be a string sometimes ... |
|
1346 |
]. |
|
1347 |
package := memory fetchStringFor:packageRef. |
|
1348 |
cachedPackage := package asSymbol |
|
1349 |
]. |
|
1350 |
^ cachedPackage |
|
1351 |
! |
|
1352 |
||
1353 |
source |
|
1354 |
|sourcePosition sourcePositionPtr sourcePtr sourceRef source aStream junk| |
|
1355 |
||
1356 |
sourcePositionPtr := self at:(Method instVarOffsetOf:'sourcePosition'). |
|
1357 |
sourcePtr := self at:(Method instVarOffsetOf:'source'). |
|
1358 |
sourceRef := memory fetchObjectAt:sourcePtr. |
|
1359 |
sourceRef isString ifFalse:[ |
|
1360 |
self halt. |
|
1361 |
]. |
|
1362 |
source := memory printStringOfString:sourceRef. |
|
1363 |
sourcePosition := memory fetchObjectAt:sourcePositionPtr. |
|
1364 |
sourcePosition isNil ifTrue:[ |
|
1365 |
^ source |
|
1366 |
]. |
|
1367 |
||
1368 |
aStream := self sourceStream. |
|
1369 |
aStream notNil ifTrue:[ |
|
1370 |
Stream positionErrorSignal handle:[:ex | |
|
1371 |
^ nil |
|
1372 |
] do:[ |
|
1373 |
aStream position:sourcePosition abs. |
|
1374 |
]. |
|
1375 |
junk := aStream nextChunk. |
|
1376 |
||
1377 |
aStream close. |
|
1378 |
^ junk |
|
1379 |
]. |
|
1380 |
self halt. |
|
1381 |
! ! |
|
1382 |
||
1383 |
!SnapShotImageMemory::ImageMethodObject methodsFor:'queries'! |
|
1384 |
||
1385 |
isMethod |
|
1386 |
^ true |
|
1387 |
! ! |
|
1388 |
||
1416 | 1389 |
!SnapShotImageMemory::ImageClassObject methodsFor:'accessing - slots'! |
1390 |
||
1417 | 1391 |
category |
1482 | 1392 |
|categoryRef| |
1393 |
||
1394 |
cachedCategory isNil ifTrue:[ |
|
1395 |
categoryRef := self categorySlot. |
|
1396 |
categoryRef isInteger ifTrue:[ |
|
1397 |
categoryRef := memory fetchObjectAt:categoryRef. |
|
1398 |
]. |
|
1399 |
categoryRef notNil ifTrue:[ |
|
1400 |
cachedCategory := memory fetchStringFor:categoryRef. |
|
1401 |
]. |
|
1417 | 1402 |
]. |
1482 | 1403 |
^ cachedCategory |
1417 | 1404 |
! |
1405 |
||
1416 | 1406 |
categorySlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1407 |
^ self at:(Class instVarOffsetOf:'category') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1408 |
! |
1419 | 1409 |
|
1410 |
classFilename |
|
1411 |
|classFilenameRef classFilename| |
|
1412 |
||
1413 |
classFilenameRef := self classFilenameSlot. |
|
1414 |
classFilenameRef isInteger ifTrue:[ |
|
1415 |
classFilenameRef := memory fetchObjectAt:classFilenameRef. |
|
1416 |
]. |
|
1417 |
classFilenameRef notNil ifTrue:[ |
|
1418 |
classFilename := memory fetchStringFor:classFilenameRef. |
|
1419 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1420 |
^ classFilename |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1421 |
! |
1416 | 1422 |
|
1423 |
classFilenameSlot |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1424 |
^ self at:(Class instVarOffsetOf:'classFilename') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1425 |
! |
1416 | 1426 |
|
1417 | 1427 |
classVarNames |
1428 |
|classVarNamesRef classVarNames s| |
|
1429 |
||
1430 |
classVarNamesRef := self classVarsSlot. |
|
1431 |
classVarNamesRef isInteger ifTrue:[ |
|
1432 |
classVarNamesRef := memory fetchObjectAt:classVarNamesRef. |
|
1433 |
]. |
|
1434 |
classVarNamesRef notNil ifTrue:[ |
|
1435 |
classVarNamesRef isImageBytes ifTrue:[ |
|
1436 |
"/ a string |
|
1437 |
classVarNames := memory fetchStringFor:classVarNamesRef. |
|
1438 |
classVarNames := classVarNames asCollectionOfWords. |
|
1439 |
] ifFalse:[ |
|
1440 |
classVarNames := Array new:(classVarNamesRef size). |
|
1441 |
1 to:classVarNames size do:[:idx | |
|
1442 |
s := classVarNamesRef at:idx. |
|
1443 |
s := memory fetchObjectAt:s. |
|
1444 |
s isImageBytes ifFalse:[self halt]. |
|
1445 |
s := memory fetchStringFor:s. |
|
1446 |
classVarNames at:idx put:s. |
|
1447 |
]. |
|
1448 |
]. |
|
1449 |
]. |
|
1482 | 1450 |
^ classVarNames ? #() |
1417 | 1451 |
! |
1452 |
||
1419 | 1453 |
classVariableString |
1454 |
|classVarsPtr classVarsRef classVars| |
|
1455 |
||
1456 |
(classVarsPtr := self classVarsSlot) == 0 ifTrue:[^ '']. |
|
1457 |
classVarsRef := memory fetchObjectAt:classVarsPtr. |
|
1458 |
classVarsRef isImageBytes ifTrue:[ |
|
1459 |
"/ a string |
|
1460 |
classVars := memory fetchStringFor:classVarsRef. |
|
1461 |
^ classVars |
|
1462 |
]. |
|
1463 |
^ self classVarNames asStringWith:(Character space) |
|
1464 |
! |
|
1465 |
||
1416 | 1466 |
classVarsSlot |
1467 |
^ self at:9 |
|
1468 |
! |
|
1469 |
||
1417 | 1470 |
comment |
1471 |
|commentRef comment| |
|
1472 |
||
1473 |
commentRef := self commentSlot. |
|
1474 |
commentRef isInteger ifTrue:[ |
|
1475 |
commentRef := memory fetchObjectAt:commentRef. |
|
1476 |
]. |
|
1477 |
commentRef notNil ifTrue:[ |
|
1478 |
comment := memory fetchStringFor:commentRef. |
|
1479 |
]. |
|
1480 |
^ comment |
|
1481 |
! |
|
1482 |
||
1416 | 1483 |
commentSlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1484 |
^ self at:(Class instVarOffsetOf:'comment') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1485 |
! |
1416 | 1486 |
|
1417 | 1487 |
flags |
1423 | 1488 |
|flags amount| |
1416 | 1489 |
|
1482 | 1490 |
cachedFlags isNil ifTrue:[ |
1491 |
flags := self flagsSlot. |
|
1492 |
||
1493 |
(SnapShotImageMemory isSmallIntegerOOP:flags) ifFalse:[ |
|
1494 |
self halt |
|
1495 |
]. |
|
1496 |
amount := -1. |
|
1497 |
cachedFlags := flags bitShift:amount. |
|
1416 | 1498 |
]. |
1482 | 1499 |
^ cachedFlags |
1416 | 1500 |
! |
1501 |
||
1417 | 1502 |
flagsSlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1503 |
^ self at:(Class instVarOffsetOf:'flags') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1504 |
! |
1419 | 1505 |
|
1506 |
instSize |
|
1507 |
|instSizeRef| |
|
1508 |
||
1509 |
instSizeRef := self instSizeSlot. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1510 |
^ memory fetchObjectAt:instSizeRef. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1511 |
! |
1417 | 1512 |
|
1416 | 1513 |
instSizeSlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1514 |
^ self at:(Class instVarOffsetOf:'instSize') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1515 |
! |
1416 | 1516 |
|
1417 | 1517 |
instVarNames |
1518 |
|instVarNamesRef instVarNames s| |
|
1519 |
||
1520 |
instVarNamesRef := self instVarsSlot. |
|
1521 |
instVarNamesRef isInteger ifTrue:[ |
|
1522 |
instVarNamesRef := memory fetchObjectAt:instVarNamesRef. |
|
1523 |
]. |
|
1524 |
instVarNamesRef notNil ifTrue:[ |
|
1525 |
instVarNamesRef isImageBytes ifTrue:[ |
|
1526 |
"/ a string |
|
1527 |
instVarNames := memory fetchStringFor:instVarNamesRef. |
|
1528 |
instVarNames := instVarNames asCollectionOfWords. |
|
1529 |
] ifFalse:[ |
|
1530 |
instVarNames := Array new:(instVarNamesRef size). |
|
1531 |
1 to:instVarNames size do:[:idx | |
|
1532 |
s := instVarNamesRef at:idx. |
|
1533 |
s := memory fetchObjectAt:s. |
|
1534 |
s isImageBytes ifFalse:[self halt]. |
|
1535 |
s := memory fetchStringFor:s. |
|
1536 |
instVarNames at:idx put:s. |
|
1537 |
]. |
|
1538 |
]. |
|
1539 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1540 |
^ instVarNames ? #() |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1541 |
! |
1417 | 1542 |
|
1416 | 1543 |
instVarsSlot |
1544 |
^ self at:6 |
|
1545 |
! |
|
1546 |
||
1417 | 1547 |
methodDictionary |
1548 |
|methodDictionaryRef methodDictionary| |
|
1549 |
||
1550 |
methodDictionaryRef := self methodDictionarySlot. |
|
1551 |
methodDictionaryRef isInteger ifTrue:[ |
|
1552 |
methodDictionaryRef == 0 ifTrue:[^ nil]. |
|
1553 |
methodDictionary := memory fetchObjectAt:methodDictionaryRef. |
|
1554 |
]. |
|
1555 |
^ methodDictionary |
|
1556 |
! |
|
1557 |
||
1416 | 1558 |
methodDictionarySlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1559 |
^ self at:(Class instVarOffsetOf:'methodDictionary') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1560 |
! |
1416 | 1561 |
|
1417 | 1562 |
name |
1482 | 1563 |
|nameRef| |
1564 |
||
1565 |
cachedName isNil ifTrue:[ |
|
1566 |
self isMeta ifTrue:[ |
|
1567 |
cachedName := self theNonMetaclass name , ' class' |
|
1568 |
] ifFalse:[ |
|
1569 |
nameRef := self nameSlot. |
|
1570 |
nameRef isInteger ifTrue:[ |
|
1571 |
nameRef := memory fetchObjectAt:nameRef. |
|
1572 |
]. |
|
1573 |
nameRef notNil ifTrue:[ |
|
1574 |
cachedName := memory fetchStringFor:nameRef. |
|
1575 |
cachedName := cachedName asSymbol |
|
1576 |
]. |
|
1577 |
]. |
|
1419 | 1578 |
]. |
1482 | 1579 |
^ cachedName |
1417 | 1580 |
! |
1581 |
||
1416 | 1582 |
nameSlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1583 |
^ self at:(Class instVarOffsetOf:'name') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1584 |
! |
1416 | 1585 |
|
1586 |
packageSlot |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1587 |
^ self at:(Class instVarOffsetOf:'package') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1588 |
! |
1419 | 1589 |
|
1590 |
primitiveSpec |
|
1591 |
|primitiveSpecRef primitiveSpec| |
|
1592 |
||
1593 |
primitiveSpecRef := self primitiveSpecSlot. |
|
1594 |
primitiveSpecRef isInteger ifTrue:[ |
|
1595 |
primitiveSpecRef := memory fetchObjectAt:primitiveSpecRef. |
|
1596 |
]. |
|
1597 |
primitiveSpecRef notNil ifTrue:[ |
|
1598 |
primitiveSpec := memory fetchStringFor:primitiveSpecRef. |
|
1599 |
]. |
|
1600 |
^ primitiveSpec |
|
1416 | 1601 |
! |
1602 |
||
1419 | 1603 |
primitiveSpecSlot |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1604 |
^ self at:(Class instVarOffsetOf:'primitiveSpec') |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1605 |
! |
1419 | 1606 |
|
1607 |
revision |
|
1608 |
|revisionRef revision| |
|
1609 |
||
1610 |
revisionRef := self revisionSlot. |
|
1611 |
revisionRef isInteger ifTrue:[ |
|
1612 |
revisionRef := memory fetchObjectAt:revisionRef. |
|
1613 |
]. |
|
1614 |
revisionRef notNil ifTrue:[ |
|
1615 |
revision := memory fetchStringFor:revisionRef. |
|
1616 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1617 |
^ revision |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1618 |
! |
1419 | 1619 |
|
1416 | 1620 |
revisionSlot |
1621 |
^ self at:14 |
|
1622 |
! |
|
1623 |
||
1417 | 1624 |
superclass |
1625 |
|superClassRef superClass| |
|
1626 |
||
1627 |
superClassRef := self superclassSlot. |
|
1628 |
superClassRef isInteger ifTrue:[ |
|
1629 |
superClass := memory fetchObjectAt:superClassRef. |
|
1630 |
]. |
|
1631 |
^ superClass |
|
1632 |
! |
|
1633 |
||
1634 |
superclassSlot |
|
1416 | 1635 |
^ self at:1 |
1636 |
! ! |
|
1637 |
||
1417 | 1638 |
!SnapShotImageMemory::ImageClassObject methodsFor:'class protocol'! |
1639 |
||
1419 | 1640 |
addAllClassVarNamesTo:aCollection |
1641 |
"helper - add the name-strings of the class variables and of the class-vars |
|
1642 |
of all superclasses to the argument, aCollection. Return aCollection" |
|
1643 |
||
1644 |
|classvars superclass| |
|
1645 |
||
1646 |
(superclass := self superclass) notNil ifTrue:[ |
|
1647 |
superclass addAllClassVarNamesTo:aCollection |
|
1648 |
]. |
|
1649 |
(classvars := self classVariableString) notNil ifTrue:[ |
|
1650 |
aCollection addAll:(classvars asCollectionOfWords). |
|
1651 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1652 |
^ aCollection |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1653 |
! |
1419 | 1654 |
|
1655 |
addAllInstVarNamesTo:aCollection |
|
1656 |
|superInsts instvars superclass| |
|
1657 |
||
1658 |
(superclass := self superclass) notNil ifTrue:[ |
|
1659 |
self superclass addAllInstVarNamesTo:aCollection |
|
1660 |
]. |
|
1661 |
aCollection addAll:self instVarNames. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1662 |
^ aCollection |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1663 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1664 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1665 |
addChangeRecordForClassFileOut:aClass |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1666 |
! |
1419 | 1667 |
|
1668 |
allClassVarNames |
|
1669 |
"return a collection of all the class variable name-strings |
|
1670 |
this includes all superclass-class variables" |
|
1671 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1672 |
^ self addAllClassVarNamesTo:(OrderedCollection new) |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1673 |
! |
1419 | 1674 |
|
1675 |
allInstVarNames |
|
1676 |
self superclass isNil ifTrue:[^ self instVarNames]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1677 |
^ self addAllInstVarNamesTo:(OrderedCollection new) |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1678 |
! |
1419 | 1679 |
|
1680 |
allSubclassesDo:aBlock |
|
1681 |
"evaluate aBlock for all of my subclasses. |
|
1682 |
There is no specific order, in which the entries are enumerated. |
|
1683 |
Warning: |
|
1684 |
This will only enumerate globally known classes - for anonymous |
|
1685 |
behaviors, you have to walk over all instances of Behavior." |
|
1686 |
||
1687 |
self isMeta ifTrue:[ |
|
1688 |
"/ metaclasses are not found via Smalltalk allClassesDo: |
|
1689 |
"/ here, walk over classes and enumerate corresponding metas. |
|
1690 |
self soleInstance allSubclassesDo:[:aSubClass | |
|
1482 | 1691 |
aBlock value:(aSubClass theMetaclass) |
1419 | 1692 |
]. |
1693 |
] ifFalse:[ |
|
1694 |
Smalltalk allClassesDo:[:aClass | |
|
1695 |
(aClass isSubclassOf:self) ifTrue:[ |
|
1696 |
aBlock value:aClass |
|
1697 |
] |
|
1698 |
] |
|
1699 |
] |
|
1700 |
||
1701 |
" |
|
1702 |
Collection allSubclassesDo:[:c | Transcript showCR:(c name)] |
|
1703 |
Collection class allSubclassesDo:[:c | Transcript showCR:(c name)] |
|
1704 |
" |
|
1705 |
||
1706 |
"Modified: / 25.10.1997 / 21:17:13 / cg" |
|
1707 |
! |
|
1708 |
||
1709 |
allSuperclasses |
|
1710 |
"return a collection of the receivers accumulated superclasses" |
|
1711 |
||
1712 |
|aCollection theSuperClass| |
|
1713 |
||
1714 |
theSuperClass := self superclass. |
|
1715 |
theSuperClass isNil ifTrue:[ |
|
1716 |
^ #() |
|
1717 |
]. |
|
1718 |
aCollection := OrderedCollection new. |
|
1719 |
[theSuperClass notNil] whileTrue:[ |
|
1720 |
aCollection add:theSuperClass. |
|
1721 |
theSuperClass := theSuperClass superclass |
|
1722 |
]. |
|
1723 |
^ aCollection |
|
1724 |
||
1725 |
" |
|
1726 |
String allSuperclasses |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1727 |
" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1728 |
! |
1419 | 1729 |
|
1730 |
allSuperclassesDo:aBlock |
|
1731 |
"evaluate aBlock for all of my superclasses" |
|
1732 |
||
1733 |
|theClass| |
|
1734 |
||
1735 |
theClass := self superclass. |
|
1736 |
[theClass notNil] whileTrue:[ |
|
1737 |
aBlock value:theClass. |
|
1738 |
theClass := theClass superclass |
|
1739 |
] |
|
1740 |
||
1741 |
" |
|
1742 |
String allSuperclassesDo:[:c | Transcript showCR:(c name)] |
|
1743 |
" |
|
1744 |
! |
|
1745 |
||
1746 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace |
|
1747 |
"append an expression on aStream, which defines myself." |
|
1748 |
||
1749 |
self |
|
1750 |
basicFileOutDefinitionOn:aStream |
|
1751 |
withNameSpace:forceNameSpace |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1752 |
withPackage:true |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1753 |
! |
1419 | 1754 |
|
1417 | 1755 |
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace withPackage:showPackage |
1756 |
"append an expression on aStream, which defines myself." |
|
1757 |
||
1758 |
|s owner ns nsName fullName superName cls topOwner |
|
1759 |
syntaxHilighting superclass category| |
|
1760 |
||
1761 |
UserPreferences isNil ifTrue:[ |
|
1762 |
syntaxHilighting := false |
|
1763 |
] ifFalse:[ |
|
1764 |
syntaxHilighting := UserPreferences current syntaxColoring. |
|
1765 |
]. |
|
1766 |
||
1767 |
owner := self owningClass. |
|
1768 |
||
1769 |
owner isNil ifTrue:[ |
|
1770 |
ns := self nameSpace. |
|
1771 |
] ifFalse:[ |
|
1772 |
ns := self topOwningClass nameSpace |
|
1773 |
]. |
|
1774 |
fullName := Class fileOutNameSpaceQuerySignal query == true. |
|
1775 |
||
1776 |
(showPackage and:[owner isNil]) ifTrue:[ |
|
1777 |
aStream nextPutAll:'"{ Package: '''. |
|
1778 |
aStream nextPutAll:self package asString. |
|
1779 |
aStream nextPutAll:''' }"'; cr; cr. |
|
1780 |
]. |
|
1781 |
||
1782 |
((owner isNil and:[fullName not]) |
|
1783 |
or:[owner notNil and:[forceNameSpace and:[fullName not]]]) ifTrue:[ |
|
1784 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
1785 |
nsName := ns name. |
|
1786 |
(nsName includes:$:) ifTrue:[ |
|
1787 |
nsName := '''' , nsName , '''' |
|
1788 |
]. |
|
1789 |
"/ aStream nextPutLine:'"{ NameSpace: ' , nsName , ' }"'; cr. |
|
1790 |
aStream nextPutAll:'"{ NameSpace: '. |
|
1791 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1792 |
aStream nextPutAll:nsName. |
|
1793 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1794 |
aStream nextPutAll:' }"'; cr; cr. |
|
1795 |
] |
|
1796 |
]. |
|
1797 |
||
1419 | 1798 |
superclass := self superclass. |
1799 |
category := self category. |
|
1800 |
||
1417 | 1801 |
"take care of nil-superclass" |
1802 |
superclass isNil ifTrue:[ |
|
1803 |
s := 'nil' |
|
1804 |
] ifFalse:[ |
|
1805 |
fullName ifTrue:[ |
|
1806 |
superclass == owner ifTrue:[ |
|
1807 |
s := superclass nameWithoutNameSpacePrefix |
|
1808 |
] ifFalse:[ |
|
1809 |
s := superclass name |
|
1810 |
] |
|
1811 |
] ifFalse:[ |
|
1812 |
(ns == superclass nameSpace |
|
1813 |
and:[superclass owningClass isNil]) ifTrue:[ |
|
1814 |
"/ superclass is in the same namespace; |
|
1815 |
"/ still prepend namespace prefix, to avoid |
|
1816 |
"/ confusing stc, which needs that information ... |
|
1817 |
s := superclass nameWithoutPrefix |
|
1818 |
] ifFalse:[ |
|
1819 |
"/ a very special (rare) situation: |
|
1820 |
"/ my superclass resides in another nameSpace, |
|
1821 |
"/ but there is something else named like this |
|
1822 |
"/ to be found in my nameSpace (or a private class) |
|
1823 |
||
1824 |
superName := superclass nameWithoutNameSpacePrefix asSymbol. |
|
1825 |
cls := self privateClassesAt:superName. |
|
1826 |
cls isNil ifTrue:[ |
|
1827 |
(topOwner := self topOwningClass) isNil ifTrue:[ |
|
1828 |
ns := self nameSpace. |
|
1829 |
ns notNil ifTrue:[ |
|
1830 |
cls := ns privateClassesAt:superName |
|
1831 |
] ifFalse:[ |
|
1832 |
"/ self error:'unexpected nil namespace' |
|
1833 |
] |
|
1834 |
] ifFalse:[ |
|
1835 |
cls := topOwner nameSpace at:superName. |
|
1836 |
] |
|
1837 |
]. |
|
1838 |
(cls notNil and:[cls ~~ superclass]) ifTrue:[ |
|
1839 |
s := superclass nameSpace name , '::' , superName |
|
1840 |
] ifFalse:[ |
|
1841 |
"/ no class with that name found in my namespace ... |
|
1842 |
"/ if the superclass resides in Smalltalk, |
|
1843 |
"/ suppress prefix; otherwise, use full prefix. |
|
1844 |
(superclass nameSpace notNil |
|
1845 |
and:[superclass nameSpace ~~ Smalltalk]) ifTrue:[ |
|
1846 |
(owner notNil |
|
1847 |
and:[owner nameSpace == superclass owningClass nameSpace]) |
|
1848 |
ifTrue:[ |
|
1849 |
s := superclass nameWithoutNameSpacePrefix |
|
1850 |
] ifFalse:[ |
|
1851 |
s := superclass name |
|
1852 |
] |
|
1853 |
] ifFalse:[ |
|
1854 |
s := superName |
|
1855 |
] |
|
1856 |
] |
|
1857 |
] |
|
1858 |
] |
|
1859 |
]. |
|
1860 |
||
1861 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1862 |
aStream nextPutAll:s. "/ superclass |
|
1863 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1864 |
aStream space. |
|
1865 |
self basicFileOutInstvarTypeKeywordOn:aStream. |
|
1866 |
||
1867 |
(fullName and:[owner isNil]) ifTrue:[ |
|
1868 |
aStream nextPutAll:'#'''. |
|
1869 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1870 |
aStream nextPutAll:(self name). |
|
1871 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1872 |
aStream nextPutAll:''''. |
|
1873 |
] ifFalse:[ |
|
1874 |
aStream nextPut:$#. |
|
1875 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1876 |
aStream nextPutAll:(self nameWithoutPrefix). |
|
1877 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1878 |
]. |
|
1879 |
||
1880 |
aStream crtab. |
|
1881 |
aStream nextPutAll:'instanceVariableNames:'''. |
|
1882 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1883 |
self printInstVarNamesOn:aStream indent:16. |
|
1884 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1885 |
aStream nextPutAll:''''. |
|
1886 |
||
1887 |
aStream crtab. |
|
1888 |
aStream nextPutAll:'classVariableNames:'''. |
|
1889 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1890 |
self printClassVarNamesOn:aStream indent:16. |
|
1891 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1892 |
aStream nextPutAll:''''. |
|
1893 |
||
1894 |
aStream crtab. |
|
1895 |
aStream nextPutAll:'poolDictionaries:'''''. |
|
1896 |
||
1897 |
aStream crtab. |
|
1898 |
owner isNil ifTrue:[ |
|
1899 |
"/ a public class |
|
1900 |
aStream nextPutAll:'category:'. |
|
1901 |
category isNil ifTrue:[ |
|
1902 |
s := '''''' |
|
1903 |
] ifFalse:[ |
|
1904 |
s := category asString storeString |
|
1905 |
]. |
|
1906 |
aStream nextPutAll:s. |
|
1907 |
] ifFalse:[ |
|
1908 |
"/ a private class |
|
1909 |
aStream nextPutAll:'privateIn:'. |
|
1910 |
syntaxHilighting ifTrue:[aStream bold]. |
|
1911 |
"/ fullName ifTrue:[ |
|
1912 |
"/ s := owner name. |
|
1913 |
"/ ] ifFalse:[ |
|
1914 |
"/ s := owner nameWithoutNameSpacePrefix. |
|
1915 |
"/ ]. |
|
1916 |
s := owner nameWithoutNameSpacePrefix. |
|
1917 |
aStream nextPutAll:s. |
|
1918 |
syntaxHilighting ifTrue:[aStream normal]. |
|
1919 |
]. |
|
1920 |
aStream cr |
|
1921 |
||
1922 |
"Created: / 4.1.1997 / 20:38:16 / cg" |
|
1923 |
"Modified: / 8.8.1997 / 10:59:50 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1924 |
"Modified: / 18.3.1999 / 18:15:46 / stefan" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1925 |
! |
1417 | 1926 |
|
1927 |
basicFileOutInstvarTypeKeywordOn:aStream |
|
1928 |
"a helper for fileOutDefinition" |
|
1929 |
||
1930 |
|isVar s superclass| |
|
1931 |
||
1932 |
superclass := self superclass. |
|
1933 |
superclass isNil ifTrue:[ |
|
1934 |
isVar := self isVariable |
|
1935 |
] ifFalse:[ |
|
1936 |
"I cant remember what this is for ?" |
|
1937 |
isVar := (self isVariable and:[superclass isVariable not]) |
|
1938 |
]. |
|
1939 |
||
1940 |
aStream nextPutAll:(self firstDefinitionSelectorPart). |
|
1941 |
||
1942 |
"Created: 11.10.1996 / 18:57:29 / cg" |
|
1943 |
! |
|
1944 |
||
1419 | 1945 |
binaryRevision |
1946 |
"return the revision-ID from which the class was stc-compiled; |
|
1947 |
nil if its an autoloaded or filedIn class. |
|
1948 |
If a classes binary is up-to-date w.r.t. the source repository, |
|
1949 |
the returned string is the same as the one returned by #revision." |
|
1950 |
||
1951 |
|owner info c revision| |
|
1952 |
||
1953 |
revision := self revision. |
|
1954 |
||
1955 |
(owner := self owningClass) notNil ifTrue:[^ owner binaryRevision]. |
|
1956 |
revision notNil ifTrue:[ |
|
1957 |
c := revision first. |
|
1958 |
c == $$ ifTrue:[ |
|
1959 |
info := Class revisionInfoFromString:revision. |
|
1960 |
info isNil ifTrue:[^ '0']. |
|
1961 |
^ info at:#revision ifAbsent:'0'. |
|
1962 |
]. |
|
1963 |
c isDigit ifFalse:[ |
|
1964 |
^ '0' |
|
1965 |
]. |
|
1966 |
]. |
|
1967 |
||
1968 |
^ revision |
|
1969 |
||
1970 |
" |
|
1971 |
Object binaryRevision |
|
1972 |
Object class binaryRevision |
|
1973 |
" |
|
1974 |
||
1975 |
" |
|
1976 |
to find all classes which are not up-to-date: |
|
1977 |
||
1978 |
|classes| |
|
1979 |
||
1980 |
classes := Smalltalk allClasses |
|
1981 |
select:[:cls | cls binaryRevision notNil and:[cls binaryRevision ~= cls revision]]. |
|
1982 |
SystemBrowser browseClasses:classes title:'classes which are not up-to-date' |
|
1983 |
" |
|
1984 |
||
1985 |
"Created: 7.12.1995 / 10:58:47 / cg" |
|
1986 |
"Modified: 1.4.1997 / 23:33:01 / stefan" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1987 |
"Modified: 9.9.1997 / 12:05:41 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
1988 |
! |
1419 | 1989 |
|
1417 | 1990 |
compiledMethodAt:aSelector |
1991 |
||
1992 |
^ self compiledMethodAt:aSelector ifAbsent:nil |
|
1993 |
! |
|
1994 |
||
1995 |
compiledMethodAt:aSelector ifAbsent:exceptionValue |
|
1996 |
|dict| |
|
1997 |
||
1998 |
dict := self methodDictionary. |
|
1999 |
dict isNil ifTrue:[ |
|
2000 |
('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR. |
|
2001 |
^ exceptionValue value |
|
2002 |
]. |
|
2003 |
||
2004 |
^ dict at:aSelector ifAbsent:exceptionValue |
|
2005 |
! |
|
2006 |
||
2007 |
evaluatorClass |
|
2008 |
^ Object evaluatorClass |
|
2009 |
! |
|
2010 |
||
1419 | 2011 |
fileOut |
2012 |
|baseName dirName nm fileName| |
|
2013 |
||
2014 |
baseName := (Smalltalk fileNameForClass:self name). |
|
2015 |
nm := baseName asFilename withSuffix:'st'. |
|
2016 |
||
2017 |
" |
|
2018 |
this test allows a smalltalk to be built without Projects/ChangeSets |
|
2019 |
" |
|
2020 |
Project notNil ifTrue:[ |
|
2021 |
dirName := Project currentProjectDirectory |
|
2022 |
] ifFalse:[ |
|
2023 |
dirName := Filename currentDirectory |
|
2024 |
]. |
|
2025 |
fileName := (dirName asFilename construct:nm). |
|
2026 |
fileName makeLegalFilename. |
|
2027 |
||
2028 |
self fileOutAs:fileName name. |
|
2029 |
||
2030 |
"/ " |
|
2031 |
"/ add a change record; that way, administration is much easier, |
|
2032 |
"/ since we can see in that changeBrowser, which changes have |
|
2033 |
"/ already found their way into a sourceFile and which must be |
|
2034 |
"/ applied again |
|
2035 |
"/ " |
|
2036 |
"/ self addChangeRecordForClassFileOut:self |
|
2037 |
||
2038 |
"Modified: / 7.6.1996 / 09:14:43 / stefan" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2039 |
"Modified: / 27.8.1998 / 02:02:57 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2040 |
! |
1419 | 2041 |
|
2042 |
fileOutAllDefinitionsOn:aStream |
|
2043 |
"append expressions on aStream, which defines myself and all of my private classes." |
|
2044 |
||
2045 |
self fileOutDefinitionOn:aStream. |
|
2046 |
aStream nextPutChunkSeparator. |
|
2047 |
aStream cr; cr. |
|
2048 |
||
2049 |
"/ |
|
2050 |
"/ optional classInstanceVariables |
|
2051 |
"/ |
|
2052 |
self classRef instanceVariableString isBlank ifFalse:[ |
|
2053 |
self fileOutClassInstVarDefinitionOn:aStream. |
|
2054 |
aStream nextPutChunkSeparator. |
|
2055 |
aStream cr; cr |
|
2056 |
]. |
|
2057 |
||
2058 |
"/ here, the full nameSpace prefixes are output, |
|
2059 |
"/ to avoid confusing stc |
|
2060 |
"/ (which otherwise could not find the correct superclass) |
|
2061 |
"/ |
|
2062 |
Class fileOutNameSpaceQuerySignal answer:true do:[ |
|
2063 |
self privateClassesSorted do:[:aClass | |
|
2064 |
aClass fileOutAllDefinitionsOn:aStream |
|
2065 |
] |
|
2066 |
]. |
|
2067 |
||
2068 |
"Created: 15.10.1996 / 11:15:19 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2069 |
"Modified: 22.3.1997 / 16:11:56 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2070 |
! |
1419 | 2071 |
|
2072 |
fileOutAs:fileNameString |
|
2073 |
"create a file consisting of all methods in myself in |
|
2074 |
sourceForm, from which the class can be reconstructed (by filing in). |
|
2075 |
The given fileName should be a full path, including suffix. |
|
2076 |
Care is taken, to not clobber any existing file in |
|
2077 |
case of errors (for example: disk full). |
|
2078 |
Also, since the classes methods need a valid sourcefile, the current |
|
2079 |
sourceFile may not be rewritten." |
|
2080 |
||
2081 |
|aStream fileName newFileName savFilename needRename |
|
2082 |
mySourceFileName sameFile s mySourceFileID anySourceRef| |
|
2083 |
||
2084 |
self isLoaded ifFalse:[ |
|
2085 |
^ Class fileOutErrorSignal |
|
2086 |
raiseRequestWith:self |
|
2087 |
errorString:'will not fileOut unloaded classes' |
|
2088 |
]. |
|
2089 |
||
2090 |
fileName := fileNameString asFilename. |
|
2091 |
||
2092 |
" |
|
2093 |
if file exists, copy the existing to a .sav-file, |
|
2094 |
create the new file as XXX.new-file, |
|
2095 |
and, if that worked rename afterwards ... |
|
2096 |
" |
|
2097 |
(fileName exists) ifTrue:[ |
|
2098 |
sameFile := false. |
|
2099 |
||
2100 |
"/ check carefully - maybe, my source does not really come from that |
|
2101 |
"/ file (i.e. all of my methods have their source as string) |
|
2102 |
||
2103 |
anySourceRef := false. |
|
2104 |
self methodDictionary do:[:m| |
|
2105 |
m sourcePosition notNil ifTrue:[ |
|
2106 |
anySourceRef := true |
|
2107 |
] |
|
2108 |
]. |
|
2109 |
self classRef methodDictionary do:[:m| |
|
2110 |
m sourcePosition notNil ifTrue:[ |
|
2111 |
anySourceRef := true |
|
2112 |
] |
|
2113 |
]. |
|
2114 |
||
2115 |
anySourceRef ifTrue:[ |
|
2116 |
s := self sourceStream. |
|
2117 |
s notNil ifTrue:[ |
|
2118 |
mySourceFileID := s pathName asFilename info id. |
|
2119 |
sameFile := (fileName info id) == mySourceFileID. |
|
2120 |
s close. |
|
2121 |
] ifFalse:[ |
|
2122 |
self classFilename notNil ifTrue:[ |
|
2123 |
" |
|
2124 |
check for overwriting my current source file |
|
2125 |
this is not allowed, since it would clobber my methods source |
|
2126 |
file ... you have to save it to some other place. |
|
2127 |
This happens if you ask for a fileOut into the source-directory |
|
2128 |
(from which my methods get their source) |
|
2129 |
" |
|
2130 |
mySourceFileName := Smalltalk getSourceFileName:self classFilename. |
|
2131 |
sameFile := (fileNameString = mySourceFileName). |
|
2132 |
sameFile ifFalse:[ |
|
2133 |
mySourceFileName notNil ifTrue:[ |
|
2134 |
sameFile := (fileName info id) == (mySourceFileName asFilename info id) |
|
2135 |
] |
|
2136 |
]. |
|
2137 |
] |
|
2138 |
]. |
|
2139 |
]. |
|
2140 |
||
2141 |
sameFile ifTrue:[ |
|
2142 |
^ Class fileOutErrorSignal |
|
2143 |
raiseRequestWith:fileNameString |
|
2144 |
errorString:('may not overwrite sourcefile:', fileNameString) |
|
2145 |
]. |
|
2146 |
||
2147 |
savFilename := Filename newTemporary. |
|
2148 |
fileName copyTo:savFilename. |
|
2149 |
newFileName := fileName withSuffix:'new'. |
|
2150 |
needRename := true |
|
2151 |
] ifFalse:[ |
|
2152 |
"/ another possible trap: if my sourceFileName is |
|
2153 |
"/ the same as the written one AND the new files directory |
|
2154 |
"/ is along the sourcePath, we also need a temporary file |
|
2155 |
"/ first, to avoid accessing the newly written file. |
|
2156 |
||
2157 |
anySourceRef := false. |
|
2158 |
self methodDictionary do:[:m| |
|
2159 |
|mSrc| |
|
2160 |
||
2161 |
(mSrc := m sourceFilename) notNil ifTrue:[ |
|
2162 |
mSrc asFilename baseName = fileName baseName ifTrue:[ |
|
2163 |
anySourceRef := true |
|
2164 |
] |
|
2165 |
] |
|
2166 |
]. |
|
2167 |
self classRef methodDictionary do:[:m| |
|
2168 |
|mSrc| |
|
2169 |
||
2170 |
(mSrc := m sourceFilename) notNil ifTrue:[ |
|
2171 |
mSrc asFilename baseName = fileName baseName ifTrue:[ |
|
2172 |
anySourceRef := true |
|
2173 |
] |
|
2174 |
] |
|
2175 |
]. |
|
2176 |
anySourceRef ifTrue:[ |
|
2177 |
newFileName := fileName withSuffix:'new'. |
|
2178 |
needRename := true |
|
2179 |
] ifFalse:[ |
|
2180 |
newFileName := fileName. |
|
2181 |
needRename := false |
|
2182 |
] |
|
2183 |
]. |
|
2184 |
||
2185 |
aStream := newFileName writeStream. |
|
2186 |
aStream isNil ifTrue:[ |
|
2187 |
savFilename notNil ifTrue:[ |
|
2188 |
savFilename delete |
|
2189 |
]. |
|
2190 |
^ Class fileOutErrorSignal |
|
2191 |
raiseRequestWith:newFileName |
|
2192 |
errorString:('cannot create file:', newFileName name) |
|
2193 |
]. |
|
2194 |
self fileOutOn:aStream. |
|
2195 |
aStream close. |
|
2196 |
||
2197 |
" |
|
2198 |
finally, replace the old-file |
|
2199 |
be careful, if the old one is a symbolic link; in this case, |
|
2200 |
we have to do a copy ... |
|
2201 |
" |
|
2202 |
needRename ifTrue:[ |
|
2203 |
newFileName copyTo:fileName. |
|
2204 |
newFileName delete |
|
2205 |
]. |
|
2206 |
savFilename notNil ifTrue:[ |
|
2207 |
savFilename delete |
|
2208 |
]. |
|
2209 |
||
2210 |
" |
|
2211 |
add a change record; that way, administration is much easier, |
|
2212 |
since we can see in that changeBrowser, which changes have |
|
2213 |
already found their way into a sourceFile and which must be |
|
2214 |
applied again |
|
2215 |
" |
|
2216 |
self addChangeRecordForClassFileOut:self |
|
2217 |
||
2218 |
"Modified: / 7.6.1996 / 09:14:43 / stefan" |
|
2219 |
"Created: / 16.4.1997 / 20:44:05 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2220 |
"Modified: / 12.8.1998 / 11:14:56 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2221 |
! |
1419 | 2222 |
|
2223 |
fileOutCategory:aCategory |
|
2224 |
"create a file 'class-category.st' consisting of all methods in aCategory. |
|
2225 |
If the current project is not nil, create the file in the projects |
|
2226 |
directory." |
|
2227 |
||
2228 |
|aStream fileName| |
|
2229 |
||
2230 |
fileName := (self name , '-' , aCategory , '.st') asFilename. |
|
2231 |
fileName makeLegalFilename. |
|
2232 |
||
2233 |
"/ |
|
2234 |
"/ this test allows a smalltalk to be built without Projects/ChangeSets |
|
2235 |
"/ |
|
2236 |
Project notNil ifTrue:[ |
|
2237 |
fileName := Project currentProjectDirectory asFilename construct:(fileName name). |
|
2238 |
]. |
|
2239 |
||
2240 |
"/ |
|
2241 |
"/ if the file exists, save original in a .sav file |
|
2242 |
"/ |
|
2243 |
fileName exists ifTrue:[ |
|
2244 |
fileName copyTo:(fileName withSuffix:'sav') |
|
2245 |
]. |
|
2246 |
aStream := FileStream newFileNamed:fileName. |
|
2247 |
aStream isNil ifTrue:[ |
|
2248 |
^ Class fileOutErrorSignal |
|
2249 |
raiseRequestWith:fileName |
|
2250 |
errorString:('cannot create file:', fileName pathName) |
|
2251 |
]. |
|
2252 |
||
2253 |
self fileOutCategory:aCategory on:aStream. |
|
2254 |
aStream close |
|
2255 |
||
2256 |
"Modified: / 1.4.1997 / 16:00:24 / stefan" |
|
2257 |
"Created: / 1.4.1997 / 16:04:18 / stefan" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2258 |
"Modified: / 28.10.1997 / 14:40:28 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2259 |
! |
1419 | 2260 |
|
2261 |
fileOutCategory:aCategory except:skippedMethods only:savedMethods methodFilter:methodFilter on:aStream |
|
2262 |
|dict source sortedSelectors first privacy interestingMethods cat| |
|
2263 |
||
2264 |
dict := self methodDictionary. |
|
2265 |
dict notNil ifTrue:[ |
|
2266 |
interestingMethods := OrderedCollection new. |
|
2267 |
dict do:[:aMethod | |
|
2268 |
|wanted| |
|
2269 |
||
2270 |
(methodFilter isNil |
|
2271 |
or:[methodFilter value:aMethod]) ifTrue:[ |
|
2272 |
(aCategory = aMethod category) ifTrue:[ |
|
2273 |
skippedMethods notNil ifTrue:[ |
|
2274 |
wanted := (skippedMethods includesIdentical:aMethod) not |
|
2275 |
] ifFalse:[ |
|
2276 |
savedMethods notNil ifTrue:[ |
|
2277 |
wanted := (savedMethods includesIdentical:aMethod). |
|
2278 |
] ifFalse:[ |
|
2279 |
wanted := true |
|
2280 |
] |
|
2281 |
]. |
|
2282 |
wanted ifTrue:[interestingMethods add:aMethod]. |
|
2283 |
] |
|
2284 |
] |
|
2285 |
]. |
|
2286 |
interestingMethods notEmpty ifTrue:[ |
|
2287 |
first := true. |
|
2288 |
privacy := nil. |
|
2289 |
||
2290 |
"/ |
|
2291 |
"/ sort by selector |
|
2292 |
"/ |
|
2293 |
sortedSelectors := interestingMethods collect:[:m | self selectorAtMethod:m]. |
|
2294 |
sortedSelectors sortWith:interestingMethods. |
|
2295 |
||
2296 |
interestingMethods do:[:aMethod | |
|
2297 |
first ifFalse:[ |
|
2298 |
privacy ~~ aMethod privacy ifTrue:[ |
|
2299 |
first := true. |
|
2300 |
aStream space. |
|
2301 |
aStream nextPutChunkSeparator. |
|
2302 |
]. |
|
2303 |
aStream cr; cr |
|
2304 |
]. |
|
2305 |
||
2306 |
privacy := aMethod privacy. |
|
2307 |
||
2308 |
first ifTrue:[ |
|
2309 |
aStream nextPutChunkSeparator. |
|
2310 |
self printClassNameOn:aStream. |
|
2311 |
privacy ~~ #public ifTrue:[ |
|
2312 |
aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
|
2313 |
] ifFalse:[ |
|
2314 |
aStream nextPutAll:' methodsFor:'. |
|
2315 |
]. |
|
2316 |
cat := aCategory. |
|
2317 |
cat isNil ifTrue:[ cat := '' ]. |
|
2318 |
aStream nextPutAll:aCategory asString storeString. |
|
2319 |
aStream nextPutChunkSeparator; cr; cr. |
|
2320 |
first := false. |
|
2321 |
]. |
|
2322 |
source := aMethod source. |
|
2323 |
source isNil ifTrue:[ |
|
2324 |
Class fileOutErrorSignal |
|
2325 |
raiseRequestWith:self |
|
2326 |
errorString:'no source for method: ', (aMethod displayString) |
|
2327 |
] ifFalse:[ |
|
2328 |
aStream nextChunkPut:source. |
|
2329 |
]. |
|
2330 |
]. |
|
2331 |
aStream space. |
|
2332 |
aStream nextPutChunkSeparator. |
|
2333 |
aStream cr |
|
2334 |
] |
|
2335 |
] |
|
2336 |
||
2337 |
"Modified: 28.8.1995 / 14:30:41 / claus" |
|
2338 |
"Modified: 12.6.1996 / 11:37:33 / stefan" |
|
2339 |
"Modified: 15.11.1996 / 11:32:21 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2340 |
"Created: 1.4.1997 / 16:04:33 / stefan" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2341 |
! |
1419 | 2342 |
|
2343 |
fileOutCategory:aCategory methodFilter:methodFilter on:aStream |
|
2344 |
"file out all methods belonging to aCategory, aString onto aStream" |
|
2345 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2346 |
self fileOutCategory:aCategory except:nil only:nil methodFilter:methodFilter on:aStream |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2347 |
! |
1419 | 2348 |
|
2349 |
fileOutCategory:aCategory on:aStream |
|
2350 |
Class fileOutNameSpaceQuerySignal answer:true do:[ |
|
2351 |
self fileOutCategory:aCategory except:nil only:nil methodFilter:nil on:aStream |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2352 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2353 |
! |
1419 | 2354 |
|
2355 |
fileOutClassInstVarDefinitionOn:aStream withNameSpace:withNameSpace |
|
2356 |
"append an expression to define my classInstanceVariables on aStream" |
|
2357 |
||
2358 |
|anySuperClassInstVar| |
|
2359 |
||
2360 |
self isLoaded ifFalse:[ |
|
2361 |
^ self basicFileOutDefinitionOn:aStream withNameSpace:withNameSpace |
|
2362 |
]. |
|
2363 |
||
2364 |
withNameSpace ifTrue:[ |
|
2365 |
self name printOn:aStream. |
|
2366 |
] ifFalse:[ |
|
2367 |
self printClassNameOn:aStream. |
|
2368 |
]. |
|
2369 |
aStream nextPutAll:' class instanceVariableNames:'''. |
|
1482 | 2370 |
self theMetaclass printInstVarNamesOn:aStream indent:8. |
1419 | 2371 |
aStream nextPutAll:''''. |
2372 |
||
2373 |
"mhmh - good idea; saw this in SmallDraw sourcecode ..." |
|
2374 |
||
2375 |
anySuperClassInstVar := false. |
|
2376 |
self allSuperclassesDo:[:aSuperClass | |
|
1482 | 2377 |
aSuperClass theMetaclass instVarNames do:[:ignored | anySuperClassInstVar := true]. |
1419 | 2378 |
]. |
2379 |
||
2380 |
aStream cr; cr; nextPut:(Character doubleQuote); cr; space. |
|
2381 |
anySuperClassInstVar ifFalse:[ |
|
2382 |
aStream |
|
2383 |
nextPutLine:'No other class instance variables are inherited by this class.'. |
|
2384 |
] ifTrue:[ |
|
2385 |
aStream |
|
2386 |
nextPutLine:'The following class instance variables are inherited by this class:'. |
|
2387 |
aStream cr. |
|
2388 |
self allSuperclassesDo:[:aSuperClass | |
|
2389 |
aStream tab; nextPutAll:aSuperClass name; nextPutAll:' - '. |
|
1482 | 2390 |
aStream nextPutLine:(aSuperClass theMetaclass instanceVariableString). |
1419 | 2391 |
]. |
2392 |
||
2393 |
]. |
|
2394 |
aStream nextPut:(Character doubleQuote); cr. |
|
2395 |
||
2396 |
"Created: / 10.12.1995 / 16:31:25 / cg" |
|
2397 |
"Modified: / 1.4.1997 / 16:00:33 / stefan" |
|
2398 |
"Modified: / 3.2.2000 / 23:05:28 / cg" |
|
2399 |
! |
|
2400 |
||
2401 |
fileOutDefinitionOn:aStream |
|
2402 |
"append an expression on aStream, which defines myself." |
|
2403 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2404 |
^ self basicFileOutDefinitionOn:aStream withNameSpace:false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2405 |
! |
1419 | 2406 |
|
2407 |
fileOutMethod:aMethod |
|
2408 |
|aStream fileName selector| |
|
2409 |
||
2410 |
selector := self selectorAtMethod:aMethod. |
|
2411 |
selector notNil ifTrue:[ |
|
2412 |
fileName := (self name , '-' , selector, '.st') asFilename. |
|
2413 |
fileName makeLegalFilename. |
|
2414 |
||
2415 |
" |
|
2416 |
this test allows a smalltalk to be built without Projects/ChangeSets |
|
2417 |
" |
|
2418 |
Project notNil ifTrue:[ |
|
2419 |
fileName := Project currentProjectDirectory asFilename construct:fileName name. |
|
2420 |
]. |
|
2421 |
||
2422 |
" |
|
2423 |
if file exists, save original in a .sav file |
|
2424 |
" |
|
2425 |
fileName exists ifTrue:[ |
|
2426 |
fileName copyTo:(fileName withSuffix: 'sav') |
|
2427 |
]. |
|
2428 |
||
2429 |
fileName := fileName name. |
|
2430 |
||
2431 |
aStream := FileStream newFileNamed:fileName. |
|
2432 |
aStream isNil ifTrue:[ |
|
2433 |
^ Class fileOutErrorSignal |
|
2434 |
raiseRequestWith:fileName |
|
2435 |
errorString:('cannot create file:', fileName) |
|
2436 |
]. |
|
2437 |
self fileOutMethod:aMethod on:aStream. |
|
2438 |
aStream close |
|
2439 |
] |
|
2440 |
||
2441 |
"Modified: / 1.4.1997 / 16:00:57 / stefan" |
|
2442 |
"Created: / 2.4.1997 / 00:24:28 / stefan" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2443 |
"Modified: / 28.10.1997 / 14:40:34 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2444 |
! |
1419 | 2445 |
|
2446 |
fileOutMethod:aMethod on:aStream |
|
2447 |
|dict cat source privacy| |
|
2448 |
||
2449 |
dict := self methodDictionary. |
|
2450 |
dict notNil ifTrue:[ |
|
2451 |
aStream nextPutChunkSeparator. |
|
2452 |
self name printOn:aStream. |
|
2453 |
"/ self printClassNameOn:aStream. |
|
2454 |
||
2455 |
(privacy := aMethod privacy) ~~ #public ifTrue:[ |
|
2456 |
aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
|
2457 |
] ifFalse:[ |
|
2458 |
aStream nextPutAll:' methodsFor:'. |
|
2459 |
]. |
|
2460 |
cat := aMethod category. |
|
2461 |
cat isNil ifTrue:[ |
|
2462 |
cat := '' |
|
2463 |
]. |
|
2464 |
aStream nextPutAll:cat asString storeString. |
|
2465 |
aStream nextPutChunkSeparator; cr; cr. |
|
2466 |
source := aMethod source. |
|
2467 |
source isNil ifTrue:[ |
|
2468 |
Class fileOutErrorSignal |
|
2469 |
raiseRequestWith:self |
|
2470 |
errorString:('no source for method: ' , |
|
2471 |
self name , '>>' , |
|
2472 |
(self selectorAtMethod:aMethod)) |
|
2473 |
] ifFalse:[ |
|
2474 |
aStream nextChunkPut:source. |
|
2475 |
]. |
|
2476 |
aStream space. |
|
2477 |
aStream nextPutChunkSeparator. |
|
2478 |
aStream cr |
|
2479 |
] |
|
2480 |
||
2481 |
"Modified: 27.8.1995 / 01:23:19 / claus" |
|
2482 |
"Modified: 12.6.1996 / 11:44:41 / stefan" |
|
2483 |
"Modified: 15.11.1996 / 11:32:43 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2484 |
"Created: 2.4.1997 / 00:24:33 / stefan" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2485 |
! |
1419 | 2486 |
|
2487 |
fileOutOn:aStream |
|
2488 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2489 |
^ self fileOutOn:aStream withTimeStamp:true |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2490 |
! |
1419 | 2491 |
|
2492 |
fileOutOn:aStream withTimeStamp:stampIt |
|
2493 |
"file out my definition and all methods onto aStream. |
|
2494 |
If stampIt is true, a timeStamp comment is prepended." |
|
2495 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2496 |
self fileOutOn:aStream withTimeStamp:stampIt withInitialize:true |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2497 |
! |
1419 | 2498 |
|
2499 |
fileOutOn:aStream withTimeStamp:stampIt withInitialize:initIt |
|
2500 |
"file out my definition and all methods onto aStream. |
|
2501 |
If stampIt is true, a timeStamp comment is prepended. |
|
2502 |
If initIt is true, and the class implements a class-initialize method, |
|
2503 |
append a corresponding doIt expression for initialization." |
|
2504 |
||
2505 |
self |
|
2506 |
fileOutOn:aStream |
|
2507 |
withTimeStamp:stampIt |
|
2508 |
withInitialize:initIt |
|
2509 |
withDefinition:true |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2510 |
methodFilter:nil |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2511 |
! |
1419 | 2512 |
|
2513 |
fileOutOn:aStream withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter |
|
2514 |
"file out my definition and all methods onto aStream. |
|
2515 |
If stampIt is true, a timeStamp comment is prepended. |
|
2516 |
If initIt is true, and the class implements a class-initialize method, |
|
2517 |
append a corresponding doIt expression for initialization. |
|
2518 |
The order by which the fileOut is done is used to put the version string at the end. |
|
2519 |
Thus, if the version string is expanded (by CVS), the characterPositions of methods should not move" |
|
2520 |
||
2521 |
|collectionOfCategories copyrightMethod copyrightText comment versionMethod skippedMethods |
|
2522 |
meta| |
|
2523 |
||
2524 |
self isLoaded ifFalse:[ |
|
2525 |
^ Class fileOutErrorSignal |
|
2526 |
raiseRequestWith:self |
|
2527 |
errorString:'will not fileOut unloaded classes' |
|
2528 |
]. |
|
2529 |
||
2530 |
meta := self classRef. |
|
2531 |
||
2532 |
" |
|
2533 |
if there is a copyright method, add a copyright comment |
|
2534 |
at the beginning, taking the string from the copyright method. |
|
2535 |
We cannot do this unconditionally - that would lead to my copyrights |
|
2536 |
being put on your code ;-). |
|
2537 |
On the other hand: I want every file created by myself to have the |
|
2538 |
copyright string at the beginning be preserved .... even if the |
|
2539 |
code was edited in the browser and filedOut. |
|
2540 |
" |
|
2541 |
(copyrightMethod := meta compiledMethodAt:#copyright) notNil ifTrue:[ |
|
2542 |
" |
|
2543 |
get the copyright methods source, |
|
2544 |
and insert at beginning. |
|
2545 |
" |
|
2546 |
copyrightText := copyrightMethod source. |
|
2547 |
copyrightText isNil ifTrue:[ |
|
2548 |
" |
|
2549 |
no source available - trigger an error |
|
2550 |
" |
|
2551 |
Class fileOutErrorSignal |
|
2552 |
raiseRequestWith:'no source for class ' , self name , ' available. Cannot fileOut'. |
|
2553 |
^ self |
|
2554 |
]. |
|
2555 |
" |
|
2556 |
strip off the selector-line |
|
2557 |
" |
|
2558 |
copyrightText := copyrightText asCollectionOfLines asStringCollection. |
|
2559 |
copyrightText := copyrightText copyFrom:2 to:(copyrightText size). |
|
2560 |
"/ copyrightText do:[:line | aStream nextPutAll:line. aStream cr.]. |
|
2561 |
copyrightText := copyrightText asString. |
|
2562 |
aStream nextPutAllAsChunk:copyrightText. |
|
2563 |
]. |
|
2564 |
||
2565 |
stampIt ifTrue:[ |
|
2566 |
"/ |
|
2567 |
"/ first, a timestamp |
|
2568 |
"/ |
|
2569 |
aStream nextPutAll:(Smalltalk timeStamp). |
|
2570 |
aStream nextPutChunkSeparator. |
|
2571 |
aStream cr; cr. |
|
2572 |
]. |
|
2573 |
||
2574 |
withDefinition ifTrue:[ |
|
2575 |
"/ |
|
2576 |
"/ then the definition |
|
2577 |
"/ |
|
2578 |
self fileOutAllDefinitionsOn:aStream. |
|
2579 |
"/ |
|
2580 |
"/ a comment - if any |
|
2581 |
"/ |
|
2582 |
(comment := self comment) notNil ifTrue:[ |
|
2583 |
self fileOutCommentOn:aStream. |
|
2584 |
aStream cr. |
|
2585 |
]. |
|
2586 |
"/ |
|
2587 |
"/ primitive definitions - if any |
|
2588 |
"/ |
|
2589 |
self fileOutPrimitiveSpecsOn:aStream. |
|
2590 |
]. |
|
2591 |
||
2592 |
"/ |
|
2593 |
"/ methods from all categories in metaclass (i.e. class methods) |
|
2594 |
"/ EXCEPT: the version method is placed at the very end, to |
|
2595 |
"/ avoid sourcePosition-shifts when checked out later. |
|
2596 |
"/ (RCS expands this string, so its size is not constant) |
|
2597 |
"/ |
|
2598 |
collectionOfCategories := meta categories asSortedCollection. |
|
2599 |
collectionOfCategories notNil ifTrue:[ |
|
2600 |
"/ |
|
2601 |
"/ documentation first (if any), but not the version method |
|
2602 |
"/ |
|
2603 |
(collectionOfCategories includes:'documentation') ifTrue:[ |
|
2604 |
versionMethod := meta compiledMethodAt:#version. |
|
2605 |
versionMethod notNil ifTrue:[ |
|
2606 |
skippedMethods := Array with:versionMethod |
|
2607 |
]. |
|
2608 |
meta fileOutCategory:'documentation' except:skippedMethods only:nil methodFilter:methodFilter on:aStream. |
|
2609 |
aStream cr. |
|
2610 |
]. |
|
2611 |
||
2612 |
"/ |
|
2613 |
"/ initialization next (if any) |
|
2614 |
"/ |
|
2615 |
(collectionOfCategories includes:'initialization') ifTrue:[ |
|
2616 |
meta fileOutCategory:'initialization' methodFilter:methodFilter on:aStream. |
|
2617 |
aStream cr. |
|
2618 |
]. |
|
2619 |
||
2620 |
"/ |
|
2621 |
"/ instance creation next (if any) |
|
2622 |
"/ |
|
2623 |
(collectionOfCategories includes:'instance creation') ifTrue:[ |
|
2624 |
meta fileOutCategory:'instance creation' methodFilter:methodFilter on:aStream. |
|
2625 |
aStream cr. |
|
2626 |
]. |
|
2627 |
collectionOfCategories do:[:aCategory | |
|
2628 |
((aCategory ~= 'documentation') |
|
2629 |
and:[(aCategory ~= 'initialization') |
|
2630 |
and:[aCategory ~= 'instance creation']]) ifTrue:[ |
|
2631 |
meta fileOutCategory:aCategory methodFilter:methodFilter on:aStream. |
|
2632 |
aStream cr |
|
2633 |
] |
|
2634 |
] |
|
2635 |
]. |
|
2636 |
||
2637 |
"/ |
|
2638 |
"/ methods from all categories in myself |
|
2639 |
"/ |
|
2640 |
collectionOfCategories := self categories asSortedCollection. |
|
2641 |
collectionOfCategories notNil ifTrue:[ |
|
2642 |
collectionOfCategories do:[:aCategory | |
|
2643 |
self fileOutCategory:aCategory methodFilter:methodFilter on:aStream. |
|
2644 |
aStream cr |
|
2645 |
] |
|
2646 |
]. |
|
2647 |
||
2648 |
"/ |
|
2649 |
"/ any private classes' methods |
|
2650 |
"/ |
|
2651 |
self privateClassesSorted do:[:aClass | |
|
2652 |
aClass fileOutAllMethodsOn:aStream methodFilter:methodFilter |
|
2653 |
]. |
|
2654 |
||
2655 |
||
2656 |
"/ |
|
2657 |
"/ finally, the previously skipped version method |
|
2658 |
"/ |
|
2659 |
versionMethod notNil ifTrue:[ |
|
2660 |
meta fileOutCategory:'documentation' except:nil only:skippedMethods methodFilter:methodFilter on:aStream. |
|
2661 |
]. |
|
2662 |
||
2663 |
initIt ifTrue:[ |
|
2664 |
"/ |
|
2665 |
"/ optionally an initialize message |
|
2666 |
"/ |
|
2667 |
(meta implements:#initialize) ifTrue:[ |
|
2668 |
self printClassNameOn:aStream. aStream nextPutAll:' initialize'. |
|
2669 |
aStream nextPutChunkSeparator. |
|
2670 |
aStream cr |
|
2671 |
] |
|
2672 |
] |
|
2673 |
||
2674 |
"Created: / 15.11.1995 / 12:53:06 / cg" |
|
2675 |
"Modified: / 1.4.1997 / 16:01:05 / stefan" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2676 |
"Modified: / 13.3.1998 / 12:23:59 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2677 |
! |
1419 | 2678 |
|
2679 |
fileOutPrimitiveDefinitionsOn:aStream |
|
2680 |
"append primitive defs (if any) to aStream." |
|
2681 |
||
2682 |
|s| |
|
2683 |
||
2684 |
" |
|
2685 |
primitive definitions - if any |
|
2686 |
" |
|
2687 |
(s := self primitiveDefinitionsString) notNil ifTrue:[ |
|
2688 |
aStream nextPutChunkSeparator. |
|
2689 |
self printClassNameOn:aStream. |
|
2690 |
aStream nextPutAll:' primitiveDefinitions'; |
|
2691 |
nextPutChunkSeparator; |
|
2692 |
cr. |
|
2693 |
aStream nextPutAll:s. |
|
2694 |
aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr |
|
2695 |
]. |
|
2696 |
(s := self primitiveVariablesString) notNil ifTrue:[ |
|
2697 |
aStream nextPutChunkSeparator. |
|
2698 |
self printClassNameOn:aStream. |
|
2699 |
aStream nextPutAll:' primitiveVariables'; |
|
2700 |
nextPutChunkSeparator; |
|
2701 |
cr. |
|
2702 |
aStream nextPutAll:s. |
|
2703 |
aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr |
|
2704 |
]. |
|
2705 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2706 |
"Modified: 8.1.1997 / 17:45:40 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2707 |
! |
1419 | 2708 |
|
2709 |
fileOutPrimitiveSpecsOn:aStream |
|
2710 |
"append primitive defs (if any) to aStream." |
|
2711 |
||
2712 |
|s| |
|
2713 |
||
2714 |
" |
|
2715 |
primitive definitions - if any |
|
2716 |
" |
|
2717 |
self fileOutPrimitiveDefinitionsOn:aStream. |
|
2718 |
" |
|
2719 |
primitive functions - if any |
|
2720 |
" |
|
2721 |
(s := self primitiveFunctionsString) notNil ifTrue:[ |
|
2722 |
aStream nextPutChunkSeparator. |
|
2723 |
self printClassNameOn:aStream. |
|
2724 |
aStream nextPutAll:' primitiveFunctions'; |
|
2725 |
nextPutChunkSeparator; |
|
2726 |
cr. |
|
2727 |
aStream nextPutAll:s. |
|
2728 |
aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr |
|
2729 |
]. |
|
2730 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2731 |
"Modified: 8.1.1997 / 17:45:51 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2732 |
! |
1419 | 2733 |
|
1417 | 2734 |
firstDefinitionSelectorPart |
2735 |
"return the first part of the selector with which I was (can be) defined in my superclass" |
|
2736 |
||
2737 |
self isVariable ifFalse:[ |
|
2738 |
^ #'subclass:' |
|
2739 |
]. |
|
2740 |
self isBytes ifTrue:[ |
|
2741 |
^ #'variableByteSubclass:' |
|
2742 |
]. |
|
2743 |
self isLongs ifTrue:[ |
|
2744 |
^ #'variableLongSubclass:' |
|
2745 |
]. |
|
2746 |
self isFloats ifTrue:[ |
|
2747 |
^ #'variableFloatSubclass:' |
|
2748 |
]. |
|
2749 |
self isDoubles ifTrue:[ |
|
2750 |
^ #'variableDoubleSubclass:' |
|
2751 |
]. |
|
2752 |
self isWords ifTrue:[ |
|
2753 |
^ #'variableWordSubclass:' |
|
2754 |
]. |
|
2755 |
self isSignedWords ifTrue:[ |
|
2756 |
^ #'variableSignedWordSubclass:' |
|
2757 |
]. |
|
2758 |
self isSignedLongs ifTrue:[ |
|
2759 |
^ #'variableSignedLongSubclass:' |
|
2760 |
]. |
|
2761 |
self isSignedLongLongs ifTrue:[ |
|
2762 |
^ #'variableSignedLongLongSubclass:' |
|
2763 |
]. |
|
2764 |
self isLongLongs ifTrue:[ |
|
2765 |
^ #'variableLongLongSubclass:' |
|
2766 |
]. |
|
2767 |
^ #'variableSubclass:' |
|
2768 |
! |
|
2769 |
||
1419 | 2770 |
getPrimitiveSpecsAt:index |
2771 |
"{ Pragma: +optSpace }" |
|
2772 |
||
2773 |
"return a primitiveSpecification component as string or nil" |
|
2774 |
||
2775 |
|owner pos stream string primitiveSpec classFilename| |
|
2776 |
||
2777 |
(owner := self owningClass) notNil ifTrue:[^ owner getPrimitiveSpecsAt:index]. |
|
2778 |
||
2779 |
primitiveSpec := self primitiveSpec. |
|
2780 |
||
2781 |
primitiveSpec isNil ifTrue:[^ nil]. |
|
2782 |
pos := primitiveSpec at:index. |
|
2783 |
pos isNil ifTrue:[^ nil]. |
|
2784 |
||
2785 |
"the primitiveSpec is either a string, or an integer specifying the |
|
2786 |
position within the classes sourcefile ... |
|
2787 |
" |
|
2788 |
pos isNumber ifTrue:[ |
|
2789 |
classFilename := self classFilename. |
|
2790 |
classFilename notNil ifTrue:[ |
|
2791 |
stream := self sourceStream. |
|
2792 |
stream notNil ifTrue:[ |
|
2793 |
stream position:pos+1. |
|
2794 |
string := stream nextChunk. |
|
2795 |
stream close. |
|
2796 |
^ string |
|
2797 |
] |
|
2798 |
]. |
|
2799 |
^ nil |
|
2800 |
]. |
|
2801 |
^ pos |
|
2802 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2803 |
"Modified: 15.1.1997 / 15:29:30 / stefan" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2804 |
! |
1419 | 2805 |
|
2806 |
hasMethods |
|
2807 |
"return true, if there are any (local) methods in this class" |
|
2808 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2809 |
^ (self methodDictionary size ~~ 0) |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2810 |
! |
1419 | 2811 |
|
2812 |
implements:aSelector |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2813 |
^ self includesSelector:aSelector |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2814 |
! |
1419 | 2815 |
|
2816 |
includesSelector:aSelector |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2817 |
^ self methodDictionary includesKey:aSelector |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2818 |
! |
1419 | 2819 |
|
2820 |
instanceVariableString |
|
2821 |
"return a string of the instance variable names" |
|
2822 |
||
2823 |
|instvars| |
|
2824 |
||
2825 |
instvars := self instVarNames. |
|
2826 |
instvars isNil ifTrue:[^ '']. |
|
2827 |
instvars isString ifTrue:[ |
|
2828 |
^ instvars |
|
2829 |
]. |
|
2830 |
||
2831 |
^ instvars asStringWith:(Character space) |
|
2832 |
||
2833 |
" |
|
2834 |
Point instanceVariableString |
|
2835 |
" |
|
2836 |
||
2837 |
"Modified: 22.8.1997 / 14:59:14 / cg" |
|
2838 |
! |
|
2839 |
||
1482 | 2840 |
isObsolete |
2841 |
"return true, if the receiver is obsolete |
|
2842 |
(i.e. has been replaced by a different class or was removed, |
|
2843 |
but is still referenced by instanced)" |
|
2844 |
||
2845 |
|cat| |
|
2846 |
||
2847 |
cat := self category. |
|
2848 |
||
2849 |
^ cat = 'obsolete' |
|
2850 |
or:[cat = 'removed' |
|
2851 |
or:[cat = '* removed *' |
|
2852 |
or:[cat = '* obsolete *']]] |
|
1419 | 2853 |
! |
2854 |
||
2855 |
isSubclassOf:aClass |
|
2856 |
"return true, if I am a subclass of the argument, aClass" |
|
2857 |
||
2858 |
|theClass| |
|
2859 |
||
2860 |
theClass := self superclass. |
|
2861 |
[theClass notNil] whileTrue:[ |
|
2862 |
(theClass == aClass) ifTrue:[^ true]. |
|
2863 |
theClass := theClass superclass. |
|
2864 |
]. |
|
2865 |
^ false |
|
2866 |
! |
|
2867 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2868 |
localSourceStreamFor:sourceFile |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2869 |
"return an open stream on a local sourcefile, nil if that is not available" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2870 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2871 |
|fileName info module dir fn package packageDir zar entry| |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2872 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2873 |
"/ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2874 |
"/ old: look in 'source/<filename>' |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2875 |
"/ this is still kept in order to find user-private |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2876 |
"/ classes in her currentDirectory. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2877 |
"/ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2878 |
fileName := Smalltalk getSourceFileName:sourceFile. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2879 |
fileName notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2880 |
^ fileName asFilename readStream. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2881 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2882 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2883 |
(package := self package) notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2884 |
"/ newest sceme ... |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2885 |
packageDir := package copyReplaceAll:$: with:$/. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2886 |
packageDir := Smalltalk getPackageFileName:packageDir. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2887 |
packageDir notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2888 |
"/ present there ? |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2889 |
packageDir := packageDir asFilename. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2890 |
(fn := packageDir construct:sourceFile) exists ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2891 |
^ fn readStream. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2892 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2893 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2894 |
"/ a source subdirectory ? |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2895 |
fn := (packageDir construct:'source') construct:sourceFile. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2896 |
fn exists ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2897 |
^ fn readStream. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2898 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2899 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2900 |
"/ a zip-file ? |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2901 |
fn := (packageDir construct:'source.zip'). |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2902 |
fn exists ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2903 |
zar := ZipArchive oldFileNamed:fn. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2904 |
zar notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2905 |
entry := zar extract:sourceFile. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2906 |
entry notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2907 |
^ entry asString readStream |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2908 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2909 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2910 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2911 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2912 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2913 |
"/ will vanish ... |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2914 |
(package includes:$:) ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2915 |
package := package asString copyReplaceAll:$: with:$/ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2916 |
] ifFalse:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2917 |
package := 'stx/' , package |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2918 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2919 |
fileName := Smalltalk getSourceFileName:(package , '/' , sourceFile). |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2920 |
fileName notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2921 |
^ fileName asFilename readStream. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2922 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2923 |
(package startsWith:'stx/') ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2924 |
fileName := Smalltalk getSourceFileName:((package copyFrom:5) , '/' , sourceFile). |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2925 |
fileName notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2926 |
^ fileName asFilename readStream. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2927 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2928 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2929 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2930 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2931 |
"/ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2932 |
"/ new: look in 'source/<module>/<package>/<filename> |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2933 |
"/ this makes the symbolic links to (or copy of) the source files |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2934 |
"/ obsolete. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2935 |
info := self packageSourceCodeInfo. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2936 |
info notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2937 |
module := info at:#module ifAbsent:nil. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2938 |
module notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2939 |
dir := info at:#directory ifAbsent:nil. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2940 |
dir notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2941 |
fn := (module asFilename construct:dir) construct:sourceFile. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2942 |
fileName := Smalltalk getSourceFileName:(fn name). |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2943 |
fileName notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2944 |
^ fileName asFilename readStream. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2945 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2946 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2947 |
"/ brand new: look for source/<module>/package.zip |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2948 |
"/ containing an entry for <filename> |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2949 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2950 |
fn := (module asFilename construct:dir) withSuffix:'zip'. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2951 |
fileName := Smalltalk getSourceFileName:(fn name). |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2952 |
fileName notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2953 |
zar := ZipArchive oldFileNamed:fileName. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2954 |
zar notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2955 |
entry := zar extract:sourceFile. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2956 |
entry notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2957 |
^ entry asString readStream |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2958 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2959 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2960 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2961 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2962 |
"/ and also in source/source.zip ... |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2963 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2964 |
fileName := Smalltalk getSourceFileName:'source.zip'. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2965 |
fileName notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2966 |
zar := ZipArchive oldFileNamed:fileName. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2967 |
zar notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2968 |
entry := zar extract:sourceFile. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2969 |
entry notNil ifTrue:[ |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2970 |
^ entry asString readStream |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2971 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2972 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2973 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2974 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2975 |
] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2976 |
]. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2977 |
^ nil |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2978 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2979 |
"Modified: / 18.7.1998 / 22:53:19 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2980 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
2981 |
|
1482 | 2982 |
lookupMethodFor:aSelector |
2983 |
"return the method, which would be executed if aSelector was sent to |
|
2984 |
an instance of the receiver. I.e. the selector arrays of the receiver |
|
2985 |
and all of its superclasses are searched for aSelector. |
|
2986 |
Return the method, or nil if instances do not understand aSelector. |
|
2987 |
EXPERIMENTAL: take care of multiple superclasses." |
|
2988 |
||
2989 |
|m cls| |
|
2990 |
||
2991 |
cls := self. |
|
2992 |
[cls notNil] whileTrue:[ |
|
2993 |
m := cls compiledMethodAt:aSelector. |
|
2994 |
m notNil ifTrue:[^ m]. |
|
2995 |
cls := cls superclass |
|
2996 |
]. |
|
2997 |
^ nil |
|
2998 |
! |
|
2999 |
||
1417 | 3000 |
nameWithoutNameSpacePrefix |
3001 |
|nm owner| |
|
3002 |
||
3003 |
nm := self nameWithoutPrefix. |
|
3004 |
(owner := self owningClass) isNil ifTrue:[ |
|
3005 |
^ nm |
|
3006 |
]. |
|
3007 |
||
3008 |
^ (owner nameWithoutNameSpacePrefix , '::' , nm) |
|
3009 |
! |
|
3010 |
||
3011 |
nameWithoutPrefix |
|
3012 |
|nm idx| |
|
3013 |
||
3014 |
nm := self name. |
|
3015 |
idx := nm lastIndexOf:$:. |
|
3016 |
idx == 0 ifTrue:[ |
|
3017 |
^ nm |
|
3018 |
]. |
|
3019 |
^ nm copyFrom:idx+1. |
|
3020 |
! |
|
3021 |
||
1419 | 3022 |
packageSourceCodeInfo |
3023 |
"{ Pragma: +optSpace }" |
|
3024 |
||
3025 |
"return the sourceCodeInfo, which defines the module and the subdirectory |
|
3026 |
in which the receiver class was built. |
|
3027 |
This info is extracted from the package id (which is added to stc-compiled classes). |
|
3028 |
This method is to be obsoleted soon, since the same info is now found |
|
3029 |
in the versionString. |
|
3030 |
||
3031 |
The info returned consists of a dictionary |
|
3032 |
filled with (at least) values at: #module, #directory and #library. |
|
3033 |
If no such info is present in the class, nil is returned. |
|
3034 |
(this happens with autoloaded and filed-in classes) |
|
3035 |
Auotloaded classes set their package from the revisionInfo, if present. |
|
3036 |
||
3037 |
By convention, this info is encoded in the classes package |
|
3038 |
string (which is given as argument to stc) as the last word in parenthesis. |
|
3039 |
The info consists of 1 to 3 subcomponents, separated by colons. |
|
3040 |
The first defines the classes module (i.e. some application identifier), |
|
3041 |
the second defines the subdirectory within that module, the third |
|
3042 |
defines the name of the class library. |
|
3043 |
If left blank, the module info defaults to 'stx', |
|
3044 |
the directory info defaults to library name. |
|
3045 |
The library name may not be left blank. |
|
3046 |
(this is done for backward compatibility,) |
|
3047 |
||
3048 |
For example: |
|
3049 |
'....(libbasic)' -> module: stx directory: libbasic library: libbasic |
|
3050 |
'....(stx:libbasic)' -> module: stx directory: libbasic library: libbasic |
|
3051 |
'....(stx:foo:libbfoo)' -> module: stx directory: foo library: libfoo |
|
3052 |
'....(aeg:libIECInterface)' -> module: aeg directory: libIECInterface library:libIECInterface |
|
3053 |
'....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase |
|
3054 |
||
3055 |
The way how the sourceCodeManager uses this to find the source location |
|
3056 |
depends on the scheme used. For CVS, the module is taken as the -d arg, |
|
3057 |
while the directory is prepended to the file name. |
|
3058 |
Other schemes may do things differently - these are not yet specified. |
|
3059 |
||
3060 |
Caveat: |
|
3061 |
Encoding this info in the package string seems somewhat kludgy. |
|
3062 |
" |
|
3063 |
||
3064 |
|owner sourceInfo packageString idx1 idx2 |
|
3065 |
moduleString directoryString libraryString components component1 component2 dirComponents mgr |
|
3066 |
package| |
|
3067 |
||
3068 |
(owner := self owningClass) notNil ifTrue:[^ owner packageSourceCodeInfo]. |
|
3069 |
||
3070 |
package := self package. |
|
3071 |
package isNil ifTrue:[^ nil]. |
|
3072 |
||
3073 |
packageString := package asString. |
|
3074 |
idx1 := packageString lastIndexOf:$(. |
|
3075 |
idx1 ~~ 0 ifTrue:[ |
|
3076 |
idx2 := packageString indexOf:$) startingAt:idx1+1. |
|
3077 |
idx2 ~~ 0 ifTrue:[ |
|
3078 |
sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1 |
|
3079 |
] |
|
3080 |
] ifFalse:[ |
|
3081 |
sourceInfo := packageString |
|
3082 |
]. |
|
3083 |
||
3084 |
sourceInfo isNil ifTrue:[^ nil]. |
|
3085 |
components := sourceInfo asCollectionOfSubstringsSeparatedBy:$:. |
|
3086 |
components size == 0 ifTrue:[ |
|
3087 |
"/ moduleString := 'stx'. |
|
3088 |
"/ directoryString := libraryString := ''. |
|
3089 |
^ nil |
|
3090 |
]. |
|
3091 |
||
3092 |
component1 := components at:1. |
|
3093 |
components size == 1 ifTrue:[ |
|
3094 |
"/ a single name given - the module becomes 'stx' or |
|
3095 |
"/ the very first directory component (if such a module exists). |
|
3096 |
"/ If the component includes slashes, its the directory |
|
3097 |
"/ otherwise the library. |
|
3098 |
"/ |
|
3099 |
dirComponents := Filename concreteClass components:component1. |
|
3100 |
(dirComponents size > 1 |
|
3101 |
and:[(mgr := self sourceCodeManager) notNil |
|
3102 |
and:[mgr checkForExistingModule:dirComponents first]]) ifTrue:[ |
|
3103 |
moduleString := dirComponents first. |
|
3104 |
directoryString := libraryString := (Filename fromComponents:(dirComponents copyFrom:2)) asString. |
|
3105 |
] ifFalse:[ |
|
3106 |
"/ non-existing; assume directory under the stx package. |
|
3107 |
moduleString := 'stx'. |
|
3108 |
(component1 startsWith:'stx/') ifTrue:[ |
|
3109 |
component1 := component1 copyFrom:5 |
|
3110 |
]. |
|
3111 |
directoryString := libraryString := component1. |
|
3112 |
]. |
|
3113 |
||
3114 |
(libraryString includes:$/) ifTrue:[ |
|
3115 |
libraryString := libraryString asFilename baseName |
|
3116 |
] |
|
3117 |
] ifFalse:[ |
|
3118 |
component2 := components at:2. |
|
3119 |
components size == 2 ifTrue:[ |
|
3120 |
"/ two components - assume its the module and the directory; |
|
3121 |
"/ the library is assumed to be named after the directory |
|
3122 |
"/ except, if slashes are in the name; then the libraryname |
|
3123 |
"/ is the last component. |
|
3124 |
"/ |
|
3125 |
moduleString := component1. |
|
3126 |
directoryString := libraryString := component2. |
|
3127 |
(libraryString includes:$/) ifTrue:[ |
|
3128 |
libraryString := libraryString asFilename baseName |
|
3129 |
] |
|
3130 |
] ifFalse:[ |
|
3131 |
"/ all components given |
|
3132 |
moduleString := component1. |
|
3133 |
directoryString := component2. |
|
3134 |
libraryString := components at:3. |
|
3135 |
] |
|
3136 |
]. |
|
3137 |
||
3138 |
libraryString isEmpty ifTrue:[ |
|
3139 |
directoryString notEmpty ifTrue:[ |
|
3140 |
libraryString := directoryString asFilename baseName |
|
3141 |
]. |
|
3142 |
libraryString isEmpty ifTrue:[ |
|
3143 |
"/ lets extract the library from the liblist file ... |
|
3144 |
libraryString := Smalltalk libraryFileNameOfClass:self. |
|
3145 |
libraryString isNil ifTrue:[^ nil]. |
|
3146 |
] |
|
3147 |
]. |
|
3148 |
||
3149 |
moduleString isEmpty ifTrue:[ |
|
3150 |
moduleString := 'stx'. |
|
3151 |
]. |
|
3152 |
directoryString isEmpty ifTrue:[ |
|
3153 |
directoryString := libraryString. |
|
3154 |
]. |
|
3155 |
||
3156 |
^ IdentityDictionary |
|
3157 |
with:(#module->moduleString) |
|
3158 |
with:(#directory->directoryString) |
|
3159 |
with:(#library->libraryString) |
|
3160 |
||
3161 |
" |
|
3162 |
Object packageSourceCodeInfo |
|
3163 |
View packageSourceCodeInfo |
|
3164 |
Model packageSourceCodeInfo |
|
3165 |
BinaryObjectStorage packageSourceCodeInfo |
|
3166 |
MemoryMonitor packageSourceCodeInfo |
|
3167 |
ClockView packageSourceCodeInfo |
|
3168 |
" |
|
3169 |
||
3170 |
"Created: 4.11.1995 / 20:36:53 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3171 |
"Modified: 19.9.1997 / 10:42:25 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3172 |
! |
1419 | 3173 |
|
3174 |
primitiveDefinitionsString |
|
3175 |
"{ Pragma: +optSpace }" |
|
3176 |
||
3177 |
"return the primitiveDefinition string or nil" |
|
3178 |
||
3179 |
^ self getPrimitiveSpecsAt:1 |
|
3180 |
||
3181 |
" |
|
3182 |
Object primitiveDefinitionsString |
|
3183 |
String primitiveDefinitionsString |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3184 |
" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3185 |
! |
1419 | 3186 |
|
3187 |
primitiveFunctionsString |
|
3188 |
"{ Pragma: +optSpace }" |
|
3189 |
||
3190 |
"return the primitiveFunctions string or nil" |
|
3191 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3192 |
^ self getPrimitiveSpecsAt:3 |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3193 |
! |
1419 | 3194 |
|
3195 |
primitiveVariablesString |
|
3196 |
"{ Pragma: +optSpace }" |
|
3197 |
||
3198 |
"return the primitiveVariables string or nil" |
|
3199 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3200 |
^ self getPrimitiveSpecsAt:2 |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3201 |
! |
1419 | 3202 |
|
3203 |
printClassNameOn:aStream |
|
3204 |
|nm| |
|
3205 |
||
3206 |
Class fileOutNameSpaceQuerySignal query == false ifTrue:[ |
|
3207 |
nm := self nameWithoutNameSpacePrefix |
|
3208 |
] ifFalse:[ |
|
3209 |
nm := self name. |
|
3210 |
]. |
|
3211 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3212 |
aStream nextPutAll:nm. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3213 |
! |
1419 | 3214 |
|
1417 | 3215 |
printClassVarNamesOn:aStream indent:indent |
3216 |
"print the class variable names indented and breaking at line end" |
|
3217 |
||
3218 |
self printNameArray:(self classVarNames) on:aStream indent:indent |
|
3219 |
! |
|
3220 |
||
3221 |
printHierarchyAnswerIndentOn:aStream |
|
3222 |
"print my class hierarchy on aStream - return indent |
|
3223 |
recursively calls itself to print superclass and use returned indent |
|
3224 |
for my description - used in the browser" |
|
3225 |
||
3226 |
|indent nm superclass| |
|
3227 |
||
3228 |
superclass := self superclass. |
|
3229 |
indent := 0. |
|
3230 |
(superclass notNil) ifTrue:[ |
|
3231 |
indent := (superclass printHierarchyAnswerIndentOn:aStream) + 2 |
|
3232 |
]. |
|
3233 |
aStream spaces:indent. |
|
3234 |
nm := self printNameInHierarchy. |
|
3235 |
aStream nextPutAll:nm; nextPutAll:' ('. |
|
3236 |
self printInstVarNamesOn:aStream indent:(indent + nm size + 2). |
|
3237 |
aStream nextPutLine:')'. |
|
3238 |
^ indent |
|
3239 |
! |
|
3240 |
||
3241 |
printHierarchyOn:aStream |
|
3242 |
self printHierarchyAnswerIndentOn:aStream |
|
3243 |
! |
|
3244 |
||
3245 |
printInstVarNamesOn:aStream indent:indent |
|
3246 |
"print the instance variable names indented and breaking at line end" |
|
3247 |
||
3248 |
self printNameArray:(self instVarNames) on:aStream indent:indent |
|
3249 |
||
3250 |
"Created: 22.3.1997 / 14:12:00 / cg" |
|
3251 |
! |
|
3252 |
||
3253 |
printNameArray:anArray on:aStream indent:indent |
|
3254 |
"print an array of strings separated by spaces; when the stream |
|
3255 |
defines a lineLength, break when this limit is reached; indent |
|
3256 |
every line; used to printOut instance variable names" |
|
3257 |
||
3258 |
|thisName nextName arraySize lenMax pos mustBreak line spaces| |
|
3259 |
||
3260 |
arraySize := anArray size. |
|
3261 |
arraySize ~~ 0 ifTrue:[ |
|
3262 |
pos := indent. |
|
3263 |
lenMax := aStream lineLength. |
|
3264 |
thisName := anArray at:1. |
|
3265 |
line := ''. |
|
3266 |
1 to:arraySize do:[:index | |
|
3267 |
line := line , thisName. |
|
3268 |
pos := pos + thisName size. |
|
3269 |
(index == arraySize) ifFalse:[ |
|
3270 |
nextName := anArray at:(index + 1). |
|
3271 |
mustBreak := false. |
|
3272 |
(lenMax > 0) ifTrue:[ |
|
3273 |
((pos + nextName size) > lenMax) ifTrue:[ |
|
3274 |
mustBreak := true |
|
3275 |
] |
|
3276 |
]. |
|
3277 |
mustBreak ifTrue:[ |
|
3278 |
aStream nextPutLine:line withTabs. |
|
3279 |
spaces isNil ifTrue:[ |
|
3280 |
spaces := String new:indent |
|
3281 |
]. |
|
3282 |
line := spaces. |
|
3283 |
pos := indent |
|
3284 |
] ifFalse:[ |
|
3285 |
line := line , ' '. |
|
3286 |
pos := pos + 1 |
|
3287 |
]. |
|
3288 |
thisName := nextName |
|
3289 |
] |
|
3290 |
]. |
|
3291 |
aStream nextPutAll:line withTabs |
|
3292 |
] |
|
3293 |
||
3294 |
"Modified: 9.11.1996 / 00:12:06 / cg" |
|
3295 |
"Created: 22.3.1997 / 14:12:12 / cg" |
|
3296 |
! |
|
3297 |
||
3298 |
printNameInHierarchy |
|
3299 |
^ self name |
|
3300 |
! |
|
3301 |
||
1419 | 3302 |
privateClasses |
3303 |
"{ Pragma: +optSpace }" |
|
3304 |
||
3305 |
"return a collection of my private classes (if any). |
|
3306 |
The classes are in any order." |
|
3307 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3308 |
^ self privateClassesOrAll:false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3309 |
! |
1419 | 3310 |
|
1417 | 3311 |
privateClassesAt:aClassNameStringOrSymbol |
3312 |
|nmSym| |
|
3313 |
||
3314 |
nmSym := (self name , '::' , aClassNameStringOrSymbol) asSymbolIfInterned. |
|
3315 |
nmSym isNil ifTrue:[ |
|
3316 |
"/ no such symbol - there cannot be a corresponding private class |
|
3317 |
^ nil |
|
3318 |
]. |
|
3319 |
||
3320 |
^ memory at:nmSym. |
|
3321 |
! |
|
3322 |
||
1419 | 3323 |
privateClassesOrAll:allOfThem |
3324 |
"{ Pragma: +optSpace }" |
|
3325 |
||
3326 |
"return a collection of my direct private classes (if any) |
|
3327 |
or direct plus indirect private classes (if allOfThem). |
|
3328 |
An empty collection if there are none. |
|
3329 |
The classes are in any order." |
|
3330 |
||
3331 |
|classes myName myNamePrefix myNamePrefixLen| |
|
3332 |
||
3333 |
myName := self name. |
|
3334 |
myNamePrefix := myName , '::'. |
|
3335 |
myNamePrefixLen := myNamePrefix size. |
|
3336 |
||
3337 |
Smalltalk keysDo:[:nm | |
|
3338 |
|cls| |
|
3339 |
||
3340 |
(nm startsWith:myNamePrefix) ifTrue:[ |
|
3341 |
(allOfThem |
|
3342 |
or:[(nm indexOf:$: startingAt:myNamePrefixLen + 1) == 0]) ifTrue:[ |
|
3343 |
cls := Smalltalk at:nm. |
|
3344 |
||
3345 |
(cls isBehavior and:[cls isMeta not]) ifTrue:[ |
|
3346 |
classes isNil ifTrue:[ |
|
3347 |
classes := IdentitySet new:10. |
|
3348 |
]. |
|
3349 |
classes add:cls. |
|
3350 |
] |
|
3351 |
] |
|
3352 |
] |
|
3353 |
]. |
|
3354 |
||
3355 |
^ classes ? #() |
|
3356 |
||
3357 |
" |
|
3358 |
UILayoutTool privateClassesOrAll:true |
|
3359 |
UILayoutTool privateClassesOrAll:false |
|
3360 |
" |
|
3361 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3362 |
"Modified: / 29.5.1998 / 23:23:18 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3363 |
! |
1419 | 3364 |
|
3365 |
privateClassesSorted |
|
3366 |
"{ Pragma: +optSpace }" |
|
3367 |
||
3368 |
"return a collection of my private classes (if any). |
|
3369 |
The classes are sorted by inheritance." |
|
3370 |
||
3371 |
|classes| |
|
3372 |
||
3373 |
classes := self privateClasses. |
|
3374 |
(classes size > 0) ifTrue:[ |
|
3375 |
classes := classes asOrderedCollection topologicalSort:[:a :b | b isSubclassOf:a]. |
|
3376 |
]. |
|
3377 |
^ classes. |
|
3378 |
||
3379 |
" |
|
3380 |
Object privateClassesSorted |
|
3381 |
" |
|
3382 |
||
3383 |
"Created: 22.3.1997 / 16:10:42 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3384 |
"Modified: 22.3.1997 / 16:11:20 / cg" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3385 |
! |
1419 | 3386 |
|
3387 |
revisionInfo |
|
3388 |
"return a dictionary filled with revision info. |
|
3389 |
This extracts the relevant info from the revisionString. |
|
3390 |
The revisionInfo contains all or a subset of: |
|
3391 |
#binaryRevision - the revision upon which the binary of this class is based |
|
3392 |
#revision - the revision upon which the class is based logically |
|
3393 |
(different, if a changed class was checked in, but not yet recompiled) |
|
3394 |
#user - the user who checked in the logical revision |
|
3395 |
#date - the date when the logical revision was checked in |
|
3396 |
#time - the time when the logical revision was checked in |
|
3397 |
#fileName - the classes source file name |
|
3398 |
#repositoryPath - the classes source container |
|
3399 |
" |
|
3400 |
||
3401 |
|vsnString info mgr| |
|
3402 |
||
3403 |
vsnString := self revisionString. |
|
3404 |
vsnString notNil ifTrue:[ |
|
3405 |
mgr := self sourceCodeManager. |
|
3406 |
mgr notNil ifTrue:[ |
|
3407 |
info := mgr revisionInfoFromString:vsnString |
|
3408 |
] ifFalse:[ |
|
3409 |
info := Class revisionInfoFromString:vsnString. |
|
3410 |
]. |
|
3411 |
info notNil ifTrue:[ |
|
3412 |
info at:#binaryRevision put:self binaryRevision. |
|
3413 |
] |
|
3414 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3415 |
^ info |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3416 |
! |
1419 | 3417 |
|
3418 |
revisionString |
|
3419 |
"{ Pragma: +optSpace }" |
|
3420 |
||
3421 |
"return my revision string; that one is extracted from the |
|
3422 |
classes #version method. Either this is a method returning that string, |
|
3423 |
or its a comment-only method and the comment defines the version. |
|
3424 |
If the source is not accessable or no such method exists, |
|
3425 |
nil is returned." |
|
3426 |
||
3427 |
|owner cls meta m src val| |
|
3428 |
||
3429 |
(owner := self owningClass) notNil ifTrue:[^ owner revisionString]. |
|
3430 |
||
3431 |
thisContext isRecursive ifTrue:[^ nil ]. |
|
3432 |
||
3433 |
self isMeta ifTrue:[ |
|
3434 |
meta := self. cls := self soleInstance |
|
3435 |
] ifFalse:[ |
|
3436 |
cls := self. meta := self classRef |
|
3437 |
]. |
|
3438 |
||
3439 |
m := meta compiledMethodAt:#version. |
|
3440 |
m isNil ifTrue:[ |
|
3441 |
m := cls compiledMethodAt:#version. |
|
3442 |
m isNil ifTrue:[^ nil]. |
|
3443 |
]. |
|
3444 |
||
3445 |
m isExecutable ifTrue:[ |
|
3446 |
"/ |
|
3447 |
"/ if its a method returning the string, |
|
3448 |
"/ thats the returned value |
|
3449 |
"/ |
|
3450 |
val := cls version. |
|
3451 |
val isString ifTrue:[^ val]. |
|
3452 |
]. |
|
3453 |
||
3454 |
"/ |
|
3455 |
"/ if its a method consisting of a comment only |
|
3456 |
"/ extract it - this may lead to a recursive call |
|
3457 |
"/ to myself (thats what the #isRecursive is for) |
|
3458 |
"/ in case we need to access the source code manager |
|
3459 |
"/ for the source ... |
|
3460 |
"/ |
|
3461 |
src := m source. |
|
3462 |
src isNil ifTrue:[^ nil]. |
|
3463 |
^ Class revisionStringFromSource:src |
|
3464 |
||
3465 |
" |
|
3466 |
Smalltalk allClassesDo:[:cls | |
|
3467 |
Transcript showCR:cls revisionString |
|
3468 |
]. |
|
3469 |
||
3470 |
Number revisionString |
|
3471 |
FileDirectory revisionString |
|
3472 |
Metaclass revisionString |
|
3473 |
" |
|
3474 |
||
3475 |
"Created: 29.10.1995 / 19:28:03 / cg" |
|
3476 |
"Modified: 23.10.1996 / 18:23:56 / cg" |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3477 |
"Modified: 1.4.1997 / 23:37:25 / stefan" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3478 |
! |
1419 | 3479 |
|
3480 |
selectorAtMethod:aMethod |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3481 |
^ self selectorAtMethod:aMethod ifAbsent:[nil] |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3482 |
! |
1419 | 3483 |
|
3484 |
selectorAtMethod:aMethod ifAbsent:failBlock |
|
3485 |
|md| |
|
3486 |
||
3487 |
md := self methodDictionary. |
|
3488 |
md isNil ifTrue:[ |
|
3489 |
'OOPS - nil methodDictionary' errorPrintCR. |
|
3490 |
^ nil |
|
3491 |
]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3492 |
^ md keyAtValue:aMethod ifAbsent:failBlock. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3493 |
! |
1419 | 3494 |
|
3495 |
soleInstance |
|
3496 |
self isMeta ifFalse:[self halt]. |
|
3497 |
^ self theNonMetaclass. |
|
3498 |
! |
|
3499 |
||
1417 | 3500 |
sourceCodeManager |
3501 |
^ SourceCodeManager |
|
3502 |
! |
|
3503 |
||
1419 | 3504 |
sourceStreamFor:source |
3505 |
"return an open stream on a sourcefile, nil if that is not available" |
|
3506 |
||
3507 |
|owner fileName aStream mgr validated guessedFileName sep mod dir classFilename package name| |
|
3508 |
||
3509 |
self isMeta ifTrue:[ |
|
3510 |
^ self theNonMetaclass sourceStreamFor:source |
|
3511 |
]. |
|
3512 |
||
3513 |
(owner := self owningClass) notNil ifTrue:[^ owner sourceStreamFor:source]. |
|
3514 |
validated := false. |
|
3515 |
||
3516 |
classFilename := self classFilename. |
|
3517 |
package := self package. |
|
3518 |
name := self name. |
|
3519 |
||
3520 |
"/ |
|
3521 |
"/ if there is no SourceCodeManager, |
|
3522 |
"/ or TryLocalSourceFirst is true, |
|
3523 |
"/ look in standard places first |
|
3524 |
"/ |
|
3525 |
((mgr := self sourceCodeManager) isNil |
|
3526 |
or:[Class tryLocalSourceFirst == true]) ifTrue:[ |
|
3527 |
aStream := self localSourceStreamFor:source. |
|
3528 |
]. |
|
3529 |
||
3530 |
aStream isNil ifTrue:[ |
|
3531 |
"/ mhmh - still no source file. |
|
3532 |
"/ If there is a SourceCodeManager, ask it to aquire the |
|
3533 |
"/ the source for my class, and return an open stream on it. |
|
3534 |
"/ if that one does not know about the source, look in |
|
3535 |
"/ standard places |
|
3536 |
||
3537 |
mgr notNil ifTrue:[ |
|
3538 |
self classFilename ~= source ifTrue:[ |
|
3539 |
sep := self package indexOfAny:'/\:'. |
|
3540 |
sep ~~ 0 ifTrue:[ |
|
3541 |
mod := package copyTo:sep - 1. |
|
3542 |
dir := package copyFrom:sep + 1. |
|
3543 |
aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true. |
|
3544 |
]. |
|
3545 |
]. |
|
3546 |
aStream isNil ifTrue:[ |
|
3547 |
classFilename isNil ifTrue:[ |
|
3548 |
classFilename := guessedFileName := (Smalltalk fileNameForClass:self) , '.st'. |
|
3549 |
]. |
|
3550 |
source asFilename baseName = classFilename asFilename baseName ifTrue:[ |
|
3551 |
aStream := mgr getSourceStreamFor:self. |
|
3552 |
] |
|
3553 |
]. |
|
3554 |
aStream notNil ifTrue:[ |
|
3555 |
(self validateSourceStream:aStream) ifFalse:[ |
|
3556 |
('Class [info]: repositories source for `' |
|
3557 |
, (self isMeta ifTrue:[self soleInstance name] |
|
3558 |
ifFalse:[name]) |
|
3559 |
, ''' is invalid.') infoPrintCR. |
|
3560 |
aStream close. |
|
3561 |
aStream := nil |
|
3562 |
] ifTrue:[ |
|
3563 |
validated := true. |
|
3564 |
]. |
|
3565 |
]. |
|
3566 |
] |
|
3567 |
]. |
|
3568 |
||
3569 |
aStream isNil ifTrue:[ |
|
3570 |
"/ |
|
3571 |
"/ hard case - there is no source file for this class |
|
3572 |
"/ (in the source-dir-path). |
|
3573 |
"/ |
|
3574 |
||
3575 |
"/ |
|
3576 |
"/ look if my binary is from a dynamically loaded module, |
|
3577 |
"/ and, if so, look in the modules directory for the |
|
3578 |
"/ source file. |
|
3579 |
"/ |
|
3580 |
ObjectFileLoader notNil ifTrue:[ |
|
3581 |
ObjectFileLoader loadedObjectHandlesDo:[:h | |
|
3582 |
|f classes| |
|
3583 |
||
3584 |
aStream isNil ifTrue:[ |
|
3585 |
(classes := h classes) size > 0 ifTrue:[ |
|
3586 |
(classes includes:self) ifTrue:[ |
|
3587 |
f := h pathName. |
|
3588 |
f := f asFilename directory. |
|
3589 |
f := f construct:source. |
|
3590 |
f exists ifTrue:[ |
|
3591 |
aStream := f readStream. |
|
3592 |
]. |
|
3593 |
]. |
|
3594 |
]. |
|
3595 |
] |
|
3596 |
]. |
|
3597 |
]. |
|
3598 |
]. |
|
3599 |
||
3600 |
"/ |
|
3601 |
"/ try along sourcePath |
|
3602 |
"/ |
|
3603 |
aStream isNil ifTrue:[ |
|
3604 |
aStream := self localSourceStreamFor:source. |
|
3605 |
]. |
|
3606 |
||
3607 |
"/ |
|
3608 |
"/ final chance: try current directory |
|
3609 |
"/ |
|
3610 |
aStream isNil ifTrue:[ |
|
3611 |
aStream := source asFilename readStream. |
|
3612 |
]. |
|
3613 |
||
3614 |
(aStream notNil and:[validated not]) ifTrue:[ |
|
3615 |
(self validateSourceStream:aStream) ifFalse:[ |
|
3616 |
(Smalltalk releaseIdentification = 'ST/X_free_demo_vsn') ifTrue:[ |
|
3617 |
"/ ('Class [info]: source for ''' , self name , ''' is not available in the demo version.') infoPrintCR |
|
3618 |
] ifFalse:[ |
|
3619 |
('Class [warning]: source for ''' , self name , ''' is invalid or stripped. Take care.') errorPrintCR |
|
3620 |
] |
|
3621 |
]. |
|
3622 |
]. |
|
3623 |
(aStream notNil and:[aStream isFileStream]) ifTrue:[ |
|
3624 |
guessedFileName notNil ifTrue:[ |
|
3625 |
classFilename := aStream pathName asFilename baseName. |
|
3626 |
] |
|
3627 |
]. |
|
3628 |
^ aStream |
|
3629 |
||
3630 |
" |
|
3631 |
Object sourceStream |
|
3632 |
Clock sourceStream |
|
3633 |
Autoload sourceStream |
|
3634 |
" |
|
3635 |
||
3636 |
"Created: / 10.11.1995 / 21:05:13 / cg" |
|
3637 |
"Modified: / 22.4.1998 / 19:20:50 / ca" |
|
3638 |
"Modified: / 23.4.1998 / 15:53:54 / cg" |
|
3639 |
! |
|
3640 |
||
3641 |
subclasses |
|
3642 |
"return a collection of the direct subclasses of the receiver" |
|
3643 |
||
3644 |
|newColl| |
|
3645 |
||
3646 |
"/ "/ use cached information (avoid class hierarchy search) |
|
3647 |
"/ "/ if possible |
|
3648 |
"/ |
|
3649 |
"/ SubclassInfo notNil ifTrue:[ |
|
3650 |
"/ newColl := SubclassInfo at:self ifAbsent:nil. |
|
3651 |
"/ newColl notNil ifTrue:[^ newColl asOrderedCollection] |
|
3652 |
"/ ]. |
|
3653 |
||
3654 |
newColl := OrderedCollection new. |
|
3655 |
self subclassesDo:[:aClass | |
|
3656 |
newColl add:aClass |
|
3657 |
]. |
|
3658 |
"/ SubclassInfo notNil ifTrue:[ |
|
3659 |
"/ SubclassInfo at:self put:newColl. |
|
3660 |
"/ ]. |
|
3661 |
^ newColl |
|
3662 |
! |
|
3663 |
||
3664 |
subclassesDo:aBlock |
|
3665 |
"evaluate the argument, aBlock for all immediate subclasses. |
|
3666 |
This will only enumerate globally known classes - for anonymous |
|
3667 |
behaviors, you have to walk over all instances of Behavior." |
|
3668 |
||
3669 |
|coll| |
|
3670 |
||
3671 |
self isMeta ifTrue:[ |
|
3672 |
self halt. |
|
3673 |
"/ metaclasses are not found via Smalltalk allClassesDo: |
|
3674 |
"/ here, walk over classes and enumerate corresponding metas. |
|
3675 |
self soleInstance subclassesDo:[:aSubClass | |
|
1482 | 3676 |
aBlock value:(aSubClass theMetaclass) |
1419 | 3677 |
]. |
3678 |
^ self |
|
3679 |
]. |
|
3680 |
||
3681 |
"/ use cached information (avoid class hierarchy search) |
|
3682 |
"/ if possible |
|
3683 |
||
3684 |
"/ SubclassInfo isNil ifTrue:[ |
|
3685 |
"/ Behavior subclassInfo |
|
3686 |
"/ ]. |
|
3687 |
"/ SubclassInfo notNil ifTrue:[ |
|
3688 |
"/ coll := SubclassInfo at:self ifAbsent:nil. |
|
3689 |
"/ coll notNil ifTrue:[ |
|
3690 |
"/ coll do:aBlock. |
|
3691 |
"/ ]. |
|
3692 |
"/ ^ self |
|
3693 |
"/ ]. |
|
3694 |
||
3695 |
Smalltalk allClassesDo:[:aClass | |
|
3696 |
(aClass superclass == self) ifTrue:[ |
|
3697 |
aBlock value:aClass |
|
3698 |
] |
|
3699 |
] |
|
3700 |
||
3701 |
" |
|
3702 |
Collection subclassesDo:[:c | Transcript showCR:(c name)] |
|
3703 |
" |
|
3704 |
||
3705 |
"Modified: 22.1.1997 / 18:44:01 / cg" |
|
3706 |
! |
|
3707 |
||
1417 | 3708 |
syntaxHighlighterClass |
3709 |
^ Object syntaxHighlighterClass |
|
3710 |
! |
|
3711 |
||
1419 | 3712 |
theMetaclass |
3713 |
self isMeta ifTrue:[^ self]. |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3714 |
^ self classRef. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3715 |
! |
1419 | 3716 |
|
3717 |
theNonMetaclass |
|
3718 |
|instSlotOffs clsPtr| |
|
3719 |
||
3720 |
self isMeta ifFalse:[^ self]. |
|
3721 |
instSlotOffs := Metaclass instVarOffsetOf:'myClass'. |
|
3722 |
clsPtr := self at:instSlotOffs. |
|
3723 |
^ memory fetchObjectAt:clsPtr. |
|
3724 |
! |
|
3725 |
||
3726 |
validateSourceStream:aStream |
|
3727 |
"check if aStream really contains my source. |
|
3728 |
This is done by checking the version methods return value |
|
3729 |
against the version string as contained in the version method" |
|
3730 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3731 |
^ true |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3732 |
! |
1419 | 3733 |
|
1482 | 3734 |
whichClassDefinesClassVar:aVariableName |
3735 |
"return the class which defines the class variable |
|
3736 |
named aVariableName. This method should not be used for |
|
3737 |
repeated searches (i.e. in the compiler/parser), since it creates |
|
3738 |
many throw away intermediate objects." |
|
3739 |
||
3740 |
|cls| |
|
3741 |
||
3742 |
cls := self. |
|
3743 |
[cls notNil] whileTrue:[ |
|
3744 |
(cls classVarNames includes:aVariableName) ifTrue:[ ^ cls]. |
|
3745 |
cls := cls superclass |
|
3746 |
]. |
|
3747 |
^ nil |
|
3748 |
! |
|
3749 |
||
3750 |
whichClassIncludesSelector:aSelector |
|
3751 |
"return the class in the inheritance chain, which implements the method |
|
3752 |
for aSelector; return nil if none." |
|
3753 |
||
3754 |
|cls| |
|
3755 |
||
3756 |
cls := self. |
|
3757 |
[cls notNil] whileTrue:[ |
|
3758 |
(cls includesSelector:aSelector) ifTrue:[^ cls]. |
|
3759 |
cls := cls superclass |
|
3760 |
]. |
|
3761 |
^ nil |
|
3762 |
! |
|
3763 |
||
1419 | 3764 |
withAllSuperclasses |
3765 |
"return a collection containing the receiver and all |
|
3766 |
of the receivers accumulated superclasses" |
|
3767 |
||
3768 |
|aCollection theSuperClass| |
|
3769 |
||
3770 |
aCollection := OrderedCollection with:self. |
|
3771 |
theSuperClass := self superclass. |
|
3772 |
[theSuperClass notNil] whileTrue:[ |
|
3773 |
aCollection add:theSuperClass. |
|
3774 |
theSuperClass := theSuperClass superclass |
|
3775 |
]. |
|
3776 |
^ aCollection |
|
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3777 |
! |
1419 | 3778 |
|
1417 | 3779 |
withAllSuperclassesDo:aBlock |
3780 |
|sc| |
|
3781 |
||
3782 |
aBlock value:self. |
|
3783 |
sc := self superclass. |
|
3784 |
sc notNil ifTrue:[ |
|
3785 |
sc withAllSuperclassesDo:aBlock. |
|
3786 |
] |
|
3787 |
! ! |
|
3788 |
||
3789 |
!SnapShotImageMemory::ImageClassObject methodsFor:'queries'! |
|
3790 |
||
3791 |
categories |
|
3792 |
|newList| |
|
3793 |
||
3794 |
newList := Set new. |
|
3795 |
self methodDictionary do:[:aMethod | |
|
3796 |
|cat| |
|
3797 |
||
3798 |
cat := aMethod category. |
|
3799 |
cat isNil ifTrue:[ |
|
3800 |
cat := '* no category *' |
|
3801 |
]. |
|
3802 |
newList add:cat |
|
3803 |
]. |
|
3804 |
^ newList |
|
3805 |
! |
|
3806 |
||
3807 |
isBytes |
|
3808 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagBytes. |
|
3809 |
! |
|
3810 |
||
3811 |
isDoubles |
|
3812 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagDoubles. |
|
3813 |
! |
|
3814 |
||
3815 |
isFloats |
|
3816 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagFloats. |
|
3817 |
! |
|
3818 |
||
1482 | 3819 |
isImageBehavior |
3820 |
^ true |
|
3821 |
! |
|
3822 |
||
1417 | 3823 |
isLoaded |
1420 | 3824 |
|superclass| |
3825 |
||
3826 |
superclass := self superclass. |
|
3827 |
superclass isNil ifTrue:[^ true]. |
|
1417 | 3828 |
^ self superclass name ~= 'Autoload' |
3829 |
! |
|
3830 |
||
3831 |
isLongLongs |
|
3832 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagLongLongs. |
|
3833 |
! |
|
3834 |
||
3835 |
isLongs |
|
3836 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagLongs. |
|
3837 |
! |
|
3838 |
||
3839 |
isMeta |
|
1419 | 3840 |
^ self size == (Metaclass instSize). |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3841 |
"/ ^ classRef classRef name = 'Metaclass' |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3842 |
! |
1417 | 3843 |
|
3844 |
isPrivate |
|
3845 |
^ classRef isPrivateMeta |
|
3846 |
! |
|
3847 |
||
3848 |
isPrivateMeta |
|
3849 |
^ classRef name = 'PrivateMetaclass' |
|
3850 |
! |
|
3851 |
||
3852 |
isSignedLongLongs |
|
3853 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedLongLongs. |
|
3854 |
! |
|
3855 |
||
3856 |
isSignedLongs |
|
3857 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedLongs. |
|
3858 |
! |
|
3859 |
||
3860 |
isSignedWords |
|
3861 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagSignedWords. |
|
3862 |
! |
|
3863 |
||
3864 |
isVariable |
|
3865 |
^ (self flags bitAnd:Behavior maskIndexType) ~= 0. |
|
3866 |
! |
|
3867 |
||
1422 | 3868 |
isVisualStartable |
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3869 |
^ false |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3870 |
! |
1422 | 3871 |
|
1417 | 3872 |
isWords |
3873 |
^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagWords. |
|
3874 |
! |
|
3875 |
||
3876 |
nameSpace |
|
3877 |
|env name idx nsName| |
|
3878 |
||
3879 |
"/ (env := self environment) notNil ifTrue:[^ env]. |
|
1419 | 3880 |
env := Smalltalk. "/ default |
1417 | 3881 |
name := self name. |
3882 |
idx := name lastIndexOf:$:. |
|
3883 |
idx ~~ 0 ifTrue:[ |
|
3884 |
(name at:idx-1) == $: ifTrue:[ |
|
3885 |
nsName := name copyTo:(idx - 2). |
|
3886 |
env := Smalltalk at:nsName asSymbol. |
|
3887 |
] |
|
3888 |
]. |
|
3889 |
^ env |
|
3890 |
! |
|
3891 |
||
3892 |
owningClass |
|
3893 |
|ownerPtr owner| |
|
3894 |
||
3895 |
classRef isPrivateMeta ifFalse:[^ nil]. |
|
3896 |
ownerPtr := classRef at:8. |
|
3897 |
owner := memory fetchClassObjectAt:ownerPtr. |
|
3898 |
^ owner |
|
3899 |
! |
|
3900 |
||
3901 |
supportsMethodCategories |
|
3902 |
^ true |
|
3903 |
! |
|
3904 |
||
3905 |
topOwningClass |
|
3906 |
|owner| |
|
3907 |
||
3908 |
classRef isPrivateMeta ifTrue:[ |
|
3909 |
owner := self owningClass. |
|
3910 |
[owner classRef isPrivateMeta] whileTrue:[ |
|
3911 |
owner := owner owningClass |
|
3912 |
]. |
|
3913 |
^ owner |
|
3914 |
] ifFalse:[ |
|
3915 |
^ nil |
|
3916 |
]. |
|
3917 |
^ self halt. |
|
3918 |
! |
|
3919 |
||
3920 |
wasAutoloaded |
|
3921 |
^ false |
|
3922 |
! ! |
|
3923 |
||
1440
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3924 |
!SnapShotImageMemory::SpaceInfo methodsFor:'accessing'! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3925 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3926 |
end |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3927 |
"return the value of the instance variable 'end' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3928 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3929 |
^ end |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3930 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3931 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3932 |
end:something |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3933 |
"set the value of the instance variable 'end' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3934 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3935 |
end := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3936 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3937 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3938 |
flags |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3939 |
"return the value of the instance variable 'flags' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3940 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3941 |
^ flags |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3942 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3943 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3944 |
flags:something |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3945 |
"set the value of the instance variable 'flags' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3946 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3947 |
flags := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3948 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3949 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3950 |
imageBase |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3951 |
"return the value of the instance variable 'imageBase' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3952 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3953 |
^ imageBase |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3954 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3955 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3956 |
imageBase:something |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3957 |
"set the value of the instance variable 'imageBase' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3958 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3959 |
imageBase := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3960 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3961 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3962 |
size |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3963 |
"return the value of the instance variable 'size' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3964 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3965 |
^ size |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3966 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3967 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3968 |
size:something |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3969 |
"set the value of the instance variable 'size' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3970 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3971 |
size := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3972 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3973 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3974 |
start |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3975 |
"return the value of the instance variable 'start' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3976 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3977 |
^ start |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3978 |
! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3979 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3980 |
start:something |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3981 |
"set the value of the instance variable 'start' (automatically generated)" |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3982 |
|
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3983 |
start := something. |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3984 |
! ! |
f3eda2f72399
local source string was missing (if cvs access is not avaialable)
Claus Gittinger <cg@exept.de>
parents:
1423
diff
changeset
|
3985 |
|
1416 | 3986 |
!SnapShotImageMemory class methodsFor:'documentation'! |
3987 |
||
3988 |
version |
|
3989 |
^ '$Header$' |
|
3990 |
! ! |