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