SnapShotImage.st
changeset 1417 28d6026fe30c
parent 1415 77abca16cfa3
child 1418 7466259d8bb5
equal deleted inserted replaced
1416:eec0911414fe 1417:28d6026fe30c
       
     1 'From Smalltalk/X, Version:4.1.1 on 24-Okt-2000 at 12:50:49'                    !
       
     2 
     1 "{ Package: 'cg:private' }"
     3 "{ Package: 'cg:private' }"
     2 
     4 
     3 Object subclass:#SnapShotImage
     5 Object subclass:#SnapShotImage
     4 	instanceVariableNames:'memory globals'
     6 	instanceVariableNames:'memory globals'
     5 	classVariableNames:''
     7 	classVariableNames:''
    15 ! !
    17 ! !
    16 
    18 
    17 !SnapShotImage methodsFor:'private'!
    19 !SnapShotImage methodsFor:'private'!
    18 
    20 
    19 fetchGlobals
    21 fetchGlobals
       
    22     globals := IdentityDictionary new.
    20     memory globalEntries do:[:eachEntry |
    23     memory globalEntries do:[:eachEntry |
    21         |pNameSym pVal nameSym value|
    24         |nameSymRef valRef nameSym value|
    22 
    25 
    23         pNameSym := eachEntry key.
    26         nameSymRef := eachEntry key.
    24         pVal := eachEntry value.
    27         valRef := eachEntry value.
       
    28         nameSymRef isImageSymbol ifFalse:[self halt].
    25 
    29 
    26         nameSym := memory fetchObjectAt:pNameSym.
    30         nameSym := (memory printStringOfSymbol:nameSymRef) asSymbol.
    27         value := memory fetchObjectAt:pVal.
    31         globals at:nameSym put:valRef
    28         self halt.
       
    29     ].
    32     ].
    30 !
    33 !
    31 
    34 
    32 for:aFilename
    35 for:aFilename
    33     memory := SnapShotImageMemory for:aFilename.
    36     memory := SnapShotImageMemory for:aFilename.
    35 ! !
    38 ! !
    36 
    39 
    37 !SnapShotImage methodsFor:'smalltalk protocol'!
    40 !SnapShotImage methodsFor:'smalltalk protocol'!
    38 
    41 
    39 allClassesDo:aBlock
    42 allClassesDo:aBlock
    40     self keysAndValuesDo:[:key :val |
    43     self keysAndValuesDo:[:key :valRef |
    41         val isBehavior ifTrue:[
    44         valRef isInteger ifFalse:[
    42             aBlock value:val
    45             valRef ~~ true ifTrue:[
       
    46                 valRef ~~ false ifTrue:[
       
    47                     valRef notNil ifTrue:[
       
    48                         valRef isImageBehavior ifTrue:[
       
    49                             aBlock value:valRef
       
    50                         ]
       
    51                     ]
       
    52                 ]
       
    53             ]
    43         ]
    54         ]
    44     ].
    55     ].
       
    56 !
       
    57 
       
    58 at:aKey
       
    59     globals isNil ifTrue:[
       
    60         self fetchGlobals
       
    61     ].
       
    62     ^ globals at:aKey
    45 !
    63 !
    46 
    64 
    47 keysAndValuesDo:aTwoArgBlock
    65 keysAndValuesDo:aTwoArgBlock
    48     globals isNil ifTrue:[
    66     globals isNil ifTrue:[
    49         self fetchGlobals
    67         self fetchGlobals