SnapShotImageMemory.st
changeset 1440 f3eda2f72399
parent 1423 5bb61f51152d
child 1448 42ec8770d09f
equal deleted inserted replaced
1439:540781421bbf 1440:f3eda2f72399
    13 	classVariableNames:''
    13 	classVariableNames:''
    14 	poolDictionaries:''
    14 	poolDictionaries:''
    15 	privateIn:SnapShotImageMemory
    15 	privateIn:SnapShotImageMemory
    16 !
    16 !
    17 
    17 
       
    18 SnapShotImageMemory::ImageHeader variableSubclass:#ImageObject
       
    19 	instanceVariableNames:'cachedContents'
       
    20 	classVariableNames:''
       
    21 	poolDictionaries:''
       
    22 	privateIn:SnapShotImageMemory
       
    23 !
       
    24 
       
    25 SnapShotImageMemory::ImageObject variableSubclass:#ImageClassObject
       
    26 	instanceVariableNames:''
       
    27 	classVariableNames:''
       
    28 	poolDictionaries:''
       
    29 	privateIn:SnapShotImageMemory
       
    30 !
       
    31 
    18 Object subclass:#SpaceInfo
    32 Object subclass:#SpaceInfo
    19 	instanceVariableNames:'start end size flags imageBase'
    33 	instanceVariableNames:'start end size flags imageBase'
    20 	classVariableNames:''
    34 	classVariableNames:''
    21 	poolDictionaries:''
    35 	poolDictionaries:''
    22 	privateIn:SnapShotImageMemory
    36 	privateIn:SnapShotImageMemory
    23 !
    37 !
    24 
    38 
    25 SnapShotImageMemory::ImageHeader variableSubclass:#ImageObject
       
    26 	instanceVariableNames:'cachedContents'
       
    27 	classVariableNames:''
       
    28 	poolDictionaries:''
       
    29 	privateIn:SnapShotImageMemory
       
    30 !
       
    31 
       
    32 SnapShotImageMemory::ImageObject variableSubclass:#ImageClassObject
       
    33 	instanceVariableNames:''
       
    34 	classVariableNames:''
       
    35 	poolDictionaries:''
       
    36 	privateIn:SnapShotImageMemory
       
    37 !
       
    38 
       
    39 SnapShotImageMemory::ImageHeader variableByteSubclass:#ImageByteObject
    39 SnapShotImageMemory::ImageHeader variableByteSubclass:#ImageByteObject
    40 	instanceVariableNames:''
    40 	instanceVariableNames:''
    41 	classVariableNames:''
    41 	classVariableNames:''
    42 	poolDictionaries:''
    42 	poolDictionaries:''
    43 	privateIn:SnapShotImageMemory
    43 	privateIn:SnapShotImageMemory
    67 !SnapShotImageMemory methodsFor:'accessing'!
    67 !SnapShotImageMemory methodsFor:'accessing'!
    68 
    68 
    69 globalEntries
    69 globalEntries
    70     "return the value of the instance variable 'globalEntries' (automatically generated)"
    70     "return the value of the instance variable 'globalEntries' (automatically generated)"
    71 
    71 
    72     ^ globalEntries!
    72     ^ globalEntries
       
    73 !
    73 
    74 
    74 globalEntries:something
    75 globalEntries:something
    75     "set the value of the instance variable 'globalEntries' (automatically generated)"
    76     "set the value of the instance variable 'globalEntries' (automatically generated)"
    76 
    77 
    77     globalEntries := something.!
    78     globalEntries := something.
       
    79 !
    78 
    80 
    79 image
    81 image
    80 
    82 
    81     ^ image
    83     ^ image
    82 !
    84 !
    87 !
    89 !
    88 
    90 
    89 ptrSize
    91 ptrSize
    90     "return the value of the instance variable 'ptrSize' (automatically generated)"
    92     "return the value of the instance variable 'ptrSize' (automatically generated)"
    91 
    93 
    92     ^ ptrSize!
    94     ^ ptrSize
       
    95 !
    93 
    96 
    94 ptrSize:something
    97 ptrSize:something
    95     "set the value of the instance variable 'ptrSize' (automatically generated)"
    98     "set the value of the instance variable 'ptrSize' (automatically generated)"
    96 
    99 
    97     ptrSize := something.! !
   100     ptrSize := something.
       
   101 ! !
    98 
   102 
    99 !SnapShotImageMemory methodsFor:'object access'!
   103 !SnapShotImageMemory methodsFor:'object access'!
   100 
   104 
   101 fetchByteAt:addr
   105 fetchByteAt:addr
   102     |byte imgAddr|
   106     |byte imgAddr|
   285     |nBytes|
   289     |nBytes|
   286 
   290 
   287     (aByteArrayRef isImageBytes) ifFalse:[self halt].
   291     (aByteArrayRef isImageBytes) ifFalse:[self halt].
   288 
   292 
   289     nBytes := aByteArrayRef byteSize - (intSize * 3).
   293     nBytes := aByteArrayRef byteSize - (intSize * 3).
   290     ^ ((ByteArray new:nBytes) replaceFrom:1 to:nBytes-1 with:aByteArrayRef startingAt:1).!
   294     ^ ((ByteArray new:nBytes) replaceFrom:1 to:nBytes-1 with:aByteArrayRef startingAt:1).
       
   295 !
   291 
   296 
   292 fetchStringFor:aStringRef
   297 fetchStringFor:aStringRef
   293     |nBytes|
   298     |nBytes|
   294 
   299 
   295     (aStringRef isImageBytes) ifFalse:[self halt].
   300     (aStringRef isImageBytes) ifFalse:[self halt].
   679 !SnapShotImageMemory::ImageHeader methodsFor:'accessing'!
   684 !SnapShotImageMemory::ImageHeader methodsFor:'accessing'!
   680 
   685 
   681 bits
   686 bits
   682     "return the value of the instance variable 'bits' (automatically generated)"
   687     "return the value of the instance variable 'bits' (automatically generated)"
   683 
   688 
   684     ^ bits!
   689     ^ bits
       
   690 !
   685 
   691 
   686 bits:something
   692 bits:something
   687     "set the value of the instance variable 'bits' (automatically generated)"
   693     "set the value of the instance variable 'bits' (automatically generated)"
   688 
   694 
   689     bits := something.!
   695     bits := something.
       
   696 !
   690 
   697 
   691 byteSize
   698 byteSize
   692     "return the value of the instance variable 'size' (automatically generated)"
   699     "return the value of the instance variable 'size' (automatically generated)"
   693 
   700 
   694     ^ byteSize
   701     ^ byteSize
   702 !
   709 !
   703 
   710 
   704 classRef
   711 classRef
   705     "return the value of the instance variable 'classRef' (automatically generated)"
   712     "return the value of the instance variable 'classRef' (automatically generated)"
   706 
   713 
   707     ^ classRef!
   714     ^ classRef
       
   715 !
   708 
   716 
   709 classRef:something
   717 classRef:something
   710     "set the value of the instance variable 'classRef' (automatically generated)"
   718     "set the value of the instance variable 'classRef' (automatically generated)"
   711 
   719 
   712     classRef := something.!
   720     classRef := something.
       
   721 !
   713 
   722 
   714 memory
   723 memory
   715     "return the value of the instance variable 'memory' (automatically generated)"
   724     "return the value of the instance variable 'memory' (automatically generated)"
   716 
   725 
   717     ^ memory!
   726     ^ memory
       
   727 !
   718 
   728 
   719 memory:something
   729 memory:something
   720     "set the value of the instance variable 'memory' (automatically generated)"
   730     "set the value of the instance variable 'memory' (automatically generated)"
   721 
   731 
   722     memory := something.! !
   732     memory := something.
       
   733 ! !
   723 
   734 
   724 !SnapShotImageMemory::ImageHeader methodsFor:'queries'!
   735 !SnapShotImageMemory::ImageHeader methodsFor:'queries'!
   725 
   736 
   726 category
   737 category
   727     |categoryPtr categoryRef category|
   738     |categoryPtr categoryRef category|
   734     ].
   745     ].
   735 self halt.
   746 self halt.
   736 !
   747 !
   737 
   748 
   738 isBehavior
   749 isBehavior
   739     ^ self isImageBehavior!
   750     ^ self isImageBehavior
       
   751 !
   740 
   752 
   741 isImageBehavior
   753 isImageBehavior
   742     |flags|
   754     |flags|
   743 
   755 
   744     flags := classRef flags.
   756     flags := classRef flags.
   775       or:[ nm = 'JavaMethodWithHandler' 
   787       or:[ nm = 'JavaMethodWithHandler' 
   776       or:[ nm = 'JavaNativeMethod' ]]])
   788       or:[ nm = 'JavaNativeMethod' ]]])
   777 !
   789 !
   778 
   790 
   779 isLazyMethod                               
   791 isLazyMethod                               
   780     ^ classRef name = 'LazyMethod'!
   792     ^ classRef name = 'LazyMethod'
       
   793 !
   781 
   794 
   782 isMeta
   795 isMeta
   783     ^ false
   796     ^ false
   784 !
   797 !
   785 
   798 
   804 !
   817 !
   805 
   818 
   806 isString                               
   819 isString                               
   807     ^ classRef name = 'String'
   820     ^ classRef name = 'String'
   808 ! !
   821 ! !
   809 
       
   810 !SnapShotImageMemory::SpaceInfo methodsFor:'accessing'!
       
   811 
       
   812 end
       
   813     "return the value of the instance variable 'end' (automatically generated)"
       
   814 
       
   815     ^ end!
       
   816 
       
   817 end:something
       
   818     "set the value of the instance variable 'end' (automatically generated)"
       
   819 
       
   820     end := something.!
       
   821 
       
   822 flags
       
   823     "return the value of the instance variable 'flags' (automatically generated)"
       
   824 
       
   825     ^ flags!
       
   826 
       
   827 flags:something
       
   828     "set the value of the instance variable 'flags' (automatically generated)"
       
   829 
       
   830     flags := something.!
       
   831 
       
   832 imageBase
       
   833     "return the value of the instance variable 'imageBase' (automatically generated)"
       
   834 
       
   835     ^ imageBase!
       
   836 
       
   837 imageBase:something
       
   838     "set the value of the instance variable 'imageBase' (automatically generated)"
       
   839 
       
   840     imageBase := something.!
       
   841 
       
   842 size
       
   843     "return the value of the instance variable 'size' (automatically generated)"
       
   844 
       
   845     ^ size!
       
   846 
       
   847 size:something
       
   848     "set the value of the instance variable 'size' (automatically generated)"
       
   849 
       
   850     size := something.!
       
   851 
       
   852 start
       
   853     "return the value of the instance variable 'start' (automatically generated)"
       
   854 
       
   855     ^ start!
       
   856 
       
   857 start:something
       
   858     "set the value of the instance variable 'start' (automatically generated)"
       
   859 
       
   860     start := something.! !
       
   861 
   822 
   862 !SnapShotImageMemory::ImageObject methodsFor:'method protocol'!
   823 !SnapShotImageMemory::ImageObject methodsFor:'method protocol'!
   863 
   824 
   864 byteCode
   825 byteCode
   865     |byteCodeSlotOffset byteCodePtr byteCodeRef byteCode|
   826     |byteCodeSlotOffset byteCodePtr byteCodeRef byteCode|
   911 
   872 
   912 containingClass
   873 containingClass
   913     self isMethodOrLazyMethod ifTrue:[
   874     self isMethodOrLazyMethod ifTrue:[
   914         ^ self mclass
   875         ^ self mclass
   915     ].
   876     ].
   916     self halt.!
   877     self halt.
       
   878 !
   917 
   879 
   918 hasCode
   880 hasCode
   919     ^ false!
   881     ^ false
       
   882 !
   920 
   883 
   921 isBreakpointed
   884 isBreakpointed
   922     ^ false!
   885     ^ false
       
   886 !
   923 
   887 
   924 isCounting
   888 isCounting
   925     ^ false!
   889     ^ false
       
   890 !
   926 
   891 
   927 isCountingMemoryUsage
   892 isCountingMemoryUsage
   928     ^ false!
   893     ^ false
       
   894 !
   929 
   895 
   930 isDynamic
   896 isDynamic
   931     ^ false!
   897     ^ false
       
   898 !
   932 
   899 
   933 isExecutable
   900 isExecutable
   934     self isMethod ifTrue:[
   901     self isMethod ifTrue:[
   935         ^ false
   902         ^ false
   936     ].
   903     ].
   937     self halt.!
   904     self halt.
       
   905 !
   938 
   906 
   939 isIgnored
   907 isIgnored
   940     ^ false!
   908     ^ false
       
   909 !
   941 
   910 
   942 isPrivate
   911 isPrivate
   943     ^ false!
   912     ^ false
       
   913 !
   944 
   914 
   945 isProtected
   915 isProtected
   946     ^ false!
   916     ^ false
       
   917 !
   947 
   918 
   948 isPublic
   919 isPublic
   949     ^ true!
   920     ^ true
       
   921 !
   950 
   922 
   951 isTimed
   923 isTimed
   952     ^ false!
   924     ^ false
       
   925 !
   953 
   926 
   954 isTraced
   927 isTraced
   955     ^ false!
   928     ^ false
       
   929 !
   956 
   930 
   957 isWrapped
   931 isWrapped
   958     ^ false
   932     ^ false
   959 !
   933 !
   960 
   934 
  1058 
  1032 
  1059     ^ nil
  1033     ^ nil
  1060 !
  1034 !
  1061 
  1035 
  1062 previousVersion
  1036 previousVersion
  1063     ^ nil!
  1037     ^ nil
       
  1038 !
  1064 
  1039 
  1065 printStringForBrowserWithSelector:selector
  1040 printStringForBrowserWithSelector:selector
  1066     ^ selector
  1041     ^ selector
  1067 !
  1042 !
  1068 
  1043 
  1069 privacy
  1044 privacy
  1070     ^ #public!
  1045     ^ #public
       
  1046 !
  1071 
  1047 
  1072 resources
  1048 resources
  1073     ^ nil
  1049     ^ nil
  1074 !
  1050 !
  1075 
  1051 
  1110 
  1086 
  1111     self isMethodOrLazyMethod ifTrue:[
  1087     self isMethodOrLazyMethod ifTrue:[
  1112         self sourcePosition notNil ifTrue:[^ self source].
  1088         self sourcePosition notNil ifTrue:[^ self source].
  1113         ^ nil
  1089         ^ nil
  1114     ].
  1090     ].
  1115     self halt.!
  1091     self halt.
       
  1092 !
  1116 
  1093 
  1117 sourceLineNumber
  1094 sourceLineNumber
  1118     self isMethodOrLazyMethod ifTrue:[
  1095     self isMethodOrLazyMethod ifTrue:[
  1119         ^ 1
  1096         ^ 1
  1120     ].
  1097     ].
  1127     self isMethodOrLazyMethod ifTrue:[
  1104     self isMethodOrLazyMethod ifTrue:[
  1128         sourcePosition := self sourcePositionValue.
  1105         sourcePosition := self sourcePositionValue.
  1129         sourcePosition isNil ifTrue:[^ sourcePosition].
  1106         sourcePosition isNil ifTrue:[^ sourcePosition].
  1130         ^ sourcePosition abs
  1107         ^ sourcePosition abs
  1131     ].
  1108     ].
  1132     self halt.!
  1109     self halt.
       
  1110 !
  1133 
  1111 
  1134 sourcePositionValue
  1112 sourcePositionValue
  1135     |sourcePosition sourcePositionPtr|
  1113     |sourcePosition sourcePositionPtr|
  1136 
  1114 
  1137     self isMethodOrLazyMethod ifTrue:[
  1115     self isMethodOrLazyMethod ifTrue:[
  1138         sourcePositionPtr := self at:(Method instVarOffsetOf:'sourcePosition').
  1116         sourcePositionPtr := self at:(Method instVarOffsetOf:'sourcePosition').
  1139         sourcePosition := memory fetchObjectAt:sourcePositionPtr.
  1117         sourcePosition := memory fetchObjectAt:sourcePositionPtr.
  1140         ^ sourcePosition 
  1118         ^ sourcePosition 
  1141     ].
  1119     ].
  1142     self halt.!
  1120     self halt.
       
  1121 !
  1143 
  1122 
  1144 sourceStream
  1123 sourceStream
  1145     |sourcePosition source aStream fileName junk who 
  1124     |sourcePosition source aStream fileName junk who 
  1146      myClass mgr className sep dir mod package|
  1125      myClass mgr className sep dir mod package|
  1147 
  1126 
  1263         cachedContents isNil ifTrue:[
  1242         cachedContents isNil ifTrue:[
  1264             self cacheMethodDictionary.
  1243             self cacheMethodDictionary.
  1265         ].
  1244         ].
  1266         ^ cachedContents at:aSelector ifAbsent:exceptionValue
  1245         ^ cachedContents at:aSelector ifAbsent:exceptionValue
  1267     ].
  1246     ].
  1268     self halt.!
  1247     self halt.
       
  1248 !
  1269 
  1249 
  1270 cacheMethodDictionary
  1250 cacheMethodDictionary
  1271     |symPtr symRef mthdPtr mthdRef s|
  1251     |symPtr symRef mthdPtr mthdRef s|
  1272 
  1252 
  1273     cachedContents isNil ifTrue:[
  1253     cachedContents isNil ifTrue:[
  1280             s := memory fetchStringFor:symRef.
  1260             s := memory fetchStringFor:symRef.
  1281             mthdPtr := self at:idx + 1.
  1261             mthdPtr := self at:idx + 1.
  1282             mthdRef := memory fetchObjectAt:mthdPtr.
  1262             mthdRef := memory fetchObjectAt:mthdPtr.
  1283             cachedContents at:s asSymbol put:mthdRef.
  1263             cachedContents at:s asSymbol put:mthdRef.
  1284         ].
  1264         ].
  1285     ].!
  1265     ].
       
  1266 !
  1286 
  1267 
  1287 do:aBlock
  1268 do:aBlock
  1288     self isMethodDictionary ifTrue:[
  1269     self isMethodDictionary ifTrue:[
  1289         cachedContents isNil ifTrue:[
  1270         cachedContents isNil ifTrue:[
  1290             self cacheMethodDictionary.
  1271             self cacheMethodDictionary.
  1300         cachedContents isNil ifTrue:[
  1281         cachedContents isNil ifTrue:[
  1301             self cacheMethodDictionary.
  1282             self cacheMethodDictionary.
  1302         ].
  1283         ].
  1303         ^ cachedContents includesKey:aSelector
  1284         ^ cachedContents includesKey:aSelector
  1304     ].
  1285     ].
  1305     self halt.!
  1286     self halt.
       
  1287 !
  1306 
  1288 
  1307 keyAtValue:aMethod ifAbsent:exceptionValue
  1289 keyAtValue:aMethod ifAbsent:exceptionValue
  1308     self isMethodDictionary ifTrue:[
  1290     self isMethodDictionary ifTrue:[
  1309         cachedContents isNil ifTrue:[
  1291         cachedContents isNil ifTrue:[
  1310             self cacheMethodDictionary.
  1292             self cacheMethodDictionary.
  1311         ].
  1293         ].
  1312         ^ cachedContents keyAtValue:aMethod ifAbsent:exceptionValue
  1294         ^ cachedContents keyAtValue:aMethod ifAbsent:exceptionValue
  1313     ].
  1295     ].
  1314     self halt.!
  1296     self halt.
       
  1297 !
  1315 
  1298 
  1316 keysAndValuesDo:aBlock
  1299 keysAndValuesDo:aBlock
  1317     self isMethodDictionary ifTrue:[
  1300     self isMethodDictionary ifTrue:[
  1318         cachedContents isNil ifTrue:[
  1301         cachedContents isNil ifTrue:[
  1319             self cacheMethodDictionary.
  1302             self cacheMethodDictionary.
  1341     ].
  1324     ].
  1342     ^ category
  1325     ^ category
  1343 !
  1326 !
  1344 
  1327 
  1345 categorySlot
  1328 categorySlot
  1346     ^ self at:(Class instVarOffsetOf:'category')!
  1329     ^ self at:(Class instVarOffsetOf:'category')
       
  1330 !
  1347 
  1331 
  1348 classFilename
  1332 classFilename
  1349     |classFilenameRef classFilename|
  1333     |classFilenameRef classFilename|
  1350 
  1334 
  1351     classFilenameRef := self classFilenameSlot.
  1335     classFilenameRef := self classFilenameSlot.
  1353         classFilenameRef := memory fetchObjectAt:classFilenameRef.
  1337         classFilenameRef := memory fetchObjectAt:classFilenameRef.
  1354     ].
  1338     ].
  1355     classFilenameRef notNil ifTrue:[
  1339     classFilenameRef notNil ifTrue:[
  1356         classFilename := memory fetchStringFor:classFilenameRef.
  1340         classFilename := memory fetchStringFor:classFilenameRef.
  1357     ].
  1341     ].
  1358     ^ classFilename!
  1342     ^ classFilename
       
  1343 !
  1359 
  1344 
  1360 classFilenameSlot
  1345 classFilenameSlot
  1361     ^ self at:(Class instVarOffsetOf:'classFilename')!
  1346     ^ self at:(Class instVarOffsetOf:'classFilename')
       
  1347 !
  1362 
  1348 
  1363 classVarNames
  1349 classVarNames
  1364     |classVarNamesRef classVarNames s|
  1350     |classVarNamesRef classVarNames s|
  1365 
  1351 
  1366     classVarNamesRef := self classVarsSlot.
  1352     classVarNamesRef := self classVarsSlot.
  1415     ].
  1401     ].
  1416     ^ comment
  1402     ^ comment
  1417 !
  1403 !
  1418 
  1404 
  1419 commentSlot
  1405 commentSlot
  1420     ^ self at:(Class instVarOffsetOf:'comment')!
  1406     ^ self at:(Class instVarOffsetOf:'comment')
       
  1407 !
  1421 
  1408 
  1422 flags
  1409 flags
  1423     |flags amount|
  1410     |flags amount|
  1424 
  1411 
  1425     flags := self flagsSlot.
  1412     flags := self flagsSlot.
  1430     amount := -1.
  1417     amount := -1.
  1431     ^ flags bitShift:amount.
  1418     ^ flags bitShift:amount.
  1432 !
  1419 !
  1433 
  1420 
  1434 flagsSlot
  1421 flagsSlot
  1435     ^ self at:(Class instVarOffsetOf:'flags')!
  1422     ^ self at:(Class instVarOffsetOf:'flags')
       
  1423 !
  1436 
  1424 
  1437 instSize
  1425 instSize
  1438     |instSizeRef|
  1426     |instSizeRef|
  1439 
  1427 
  1440     instSizeRef := self instSizeSlot.
  1428     instSizeRef := self instSizeSlot.
  1441     ^ memory fetchObjectAt:instSizeRef.!
  1429     ^ memory fetchObjectAt:instSizeRef.
       
  1430 !
  1442 
  1431 
  1443 instSizeSlot
  1432 instSizeSlot
  1444     ^ self at:(Class instVarOffsetOf:'instSize')!
  1433     ^ self at:(Class instVarOffsetOf:'instSize')
       
  1434 !
  1445 
  1435 
  1446 instVarNames
  1436 instVarNames
  1447     |instVarNamesRef instVarNames s|
  1437     |instVarNamesRef instVarNames s|
  1448 
  1438 
  1449     instVarNamesRef := self instVarsSlot.
  1439     instVarNamesRef := self instVarsSlot.
  1464                 s := memory fetchStringFor:s.
  1454                 s := memory fetchStringFor:s.
  1465                 instVarNames at:idx put:s.
  1455                 instVarNames at:idx put:s.
  1466             ].
  1456             ].
  1467         ].
  1457         ].
  1468     ].
  1458     ].
  1469     ^ instVarNames ? #()!
  1459     ^ instVarNames ? #()
       
  1460 !
  1470 
  1461 
  1471 instVarsSlot
  1462 instVarsSlot
  1472     ^ self at:6
  1463     ^ self at:6
  1473 !
  1464 !
  1474 
  1465 
  1482     ].
  1473     ].
  1483     ^ methodDictionary
  1474     ^ methodDictionary
  1484 !
  1475 !
  1485 
  1476 
  1486 methodDictionarySlot
  1477 methodDictionarySlot
  1487     ^ self at:(Class instVarOffsetOf:'methodDictionary')!
  1478     ^ self at:(Class instVarOffsetOf:'methodDictionary')
       
  1479 !
  1488 
  1480 
  1489 name
  1481 name
  1490     |nameRef name|
  1482     |nameRef name|
  1491 
  1483 
  1492     self isMeta ifTrue:[
  1484     self isMeta ifTrue:[
  1505     ].
  1497     ].
  1506     ^ name
  1498     ^ name
  1507 !
  1499 !
  1508 
  1500 
  1509 nameSlot
  1501 nameSlot
  1510     ^ self at:(Class instVarOffsetOf:'name')!
  1502     ^ self at:(Class instVarOffsetOf:'name')
       
  1503 !
  1511 
  1504 
  1512 packageSlot
  1505 packageSlot
  1513     ^ self at:(Class instVarOffsetOf:'package')!
  1506     ^ self at:(Class instVarOffsetOf:'package')
       
  1507 !
  1514 
  1508 
  1515 primitiveSpec
  1509 primitiveSpec
  1516     |primitiveSpecRef primitiveSpec|
  1510     |primitiveSpecRef primitiveSpec|
  1517 
  1511 
  1518     primitiveSpecRef := self primitiveSpecSlot.
  1512     primitiveSpecRef := self primitiveSpecSlot.
  1524     ].
  1518     ].
  1525     ^ primitiveSpec
  1519     ^ primitiveSpec
  1526 !
  1520 !
  1527 
  1521 
  1528 primitiveSpecSlot
  1522 primitiveSpecSlot
  1529     ^ self at:(Class instVarOffsetOf:'primitiveSpec')!
  1523     ^ self at:(Class instVarOffsetOf:'primitiveSpec')
       
  1524 !
  1530 
  1525 
  1531 revision
  1526 revision
  1532     |revisionRef revision|
  1527     |revisionRef revision|
  1533 
  1528 
  1534     revisionRef := self revisionSlot.
  1529     revisionRef := self revisionSlot.
  1536         revisionRef := memory fetchObjectAt:revisionRef.
  1531         revisionRef := memory fetchObjectAt:revisionRef.
  1537     ].
  1532     ].
  1538     revisionRef notNil ifTrue:[
  1533     revisionRef notNil ifTrue:[
  1539         revision := memory fetchStringFor:revisionRef.
  1534         revision := memory fetchStringFor:revisionRef.
  1540     ].
  1535     ].
  1541     ^ revision!
  1536     ^ revision
       
  1537 !
  1542 
  1538 
  1543 revisionSlot
  1539 revisionSlot
  1544     ^ self at:14
  1540     ^ self at:14
  1545 !
  1541 !
  1546 
  1542 
  1570         superclass addAllClassVarNamesTo:aCollection
  1566         superclass addAllClassVarNamesTo:aCollection
  1571     ].
  1567     ].
  1572     (classvars := self classVariableString) notNil ifTrue:[
  1568     (classvars := self classVariableString) notNil ifTrue:[
  1573         aCollection addAll:(classvars asCollectionOfWords).
  1569         aCollection addAll:(classvars asCollectionOfWords).
  1574     ].
  1570     ].
  1575     ^ aCollection!
  1571     ^ aCollection
       
  1572 !
  1576 
  1573 
  1577 addAllInstVarNamesTo:aCollection
  1574 addAllInstVarNamesTo:aCollection
  1578     |superInsts instvars superclass|
  1575     |superInsts instvars superclass|
  1579 
  1576 
  1580     (superclass := self superclass) notNil ifTrue:[
  1577     (superclass := self superclass) notNil ifTrue:[
  1581         self superclass addAllInstVarNamesTo:aCollection
  1578         self superclass addAllInstVarNamesTo:aCollection
  1582     ].
  1579     ].
  1583     aCollection addAll:self instVarNames.
  1580     aCollection addAll:self instVarNames.
  1584     ^ aCollection!
  1581     ^ aCollection
  1585 
  1582 !
  1586 addChangeRecordForClassFileOut:aClass!
  1583 
       
  1584 addChangeRecordForClassFileOut:aClass
       
  1585 !
  1587 
  1586 
  1588 allClassVarNames
  1587 allClassVarNames
  1589     "return a collection of all the class variable name-strings
  1588     "return a collection of all the class variable name-strings
  1590      this includes all superclass-class variables"
  1589      this includes all superclass-class variables"
  1591 
  1590 
  1592     ^ self addAllClassVarNamesTo:(OrderedCollection new)!
  1591     ^ self addAllClassVarNamesTo:(OrderedCollection new)
       
  1592 !
  1593 
  1593 
  1594 allInstVarNames
  1594 allInstVarNames
  1595     self superclass isNil ifTrue:[^ self instVarNames].
  1595     self superclass isNil ifTrue:[^ self instVarNames].
  1596     ^ self addAllInstVarNamesTo:(OrderedCollection new)!
  1596     ^ self addAllInstVarNamesTo:(OrderedCollection new)
       
  1597 !
  1597 
  1598 
  1598 allSubclassesDo:aBlock
  1599 allSubclassesDo:aBlock
  1599     "evaluate aBlock for all of my subclasses.
  1600     "evaluate aBlock for all of my subclasses.
  1600      There is no specific order, in which the entries are enumerated.
  1601      There is no specific order, in which the entries are enumerated.
  1601      Warning:
  1602      Warning:
  1640     ].
  1641     ].
  1641     ^ aCollection
  1642     ^ aCollection
  1642 
  1643 
  1643     "
  1644     "
  1644      String allSuperclasses 
  1645      String allSuperclasses 
  1645     "!
  1646     "
       
  1647 !
  1646 
  1648 
  1647 allSuperclassesDo:aBlock
  1649 allSuperclassesDo:aBlock
  1648     "evaluate aBlock for all of my superclasses"
  1650     "evaluate aBlock for all of my superclasses"
  1649 
  1651 
  1650     |theClass|
  1652     |theClass|
  1664     "append an expression on aStream, which defines myself."
  1666     "append an expression on aStream, which defines myself."
  1665 
  1667 
  1666     self
  1668     self
  1667         basicFileOutDefinitionOn:aStream 
  1669         basicFileOutDefinitionOn:aStream 
  1668         withNameSpace:forceNameSpace 
  1670         withNameSpace:forceNameSpace 
  1669         withPackage:true!
  1671         withPackage:true
       
  1672 !
  1670 
  1673 
  1671 basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace withPackage:showPackage
  1674 basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace withPackage:showPackage
  1672     "append an expression on aStream, which defines myself."
  1675     "append an expression on aStream, which defines myself."
  1673 
  1676 
  1674     |s owner ns nsName fullName superName cls topOwner
  1677     |s owner ns nsName fullName superName cls topOwner
  1835     ].
  1838     ].
  1836     aStream cr
  1839     aStream cr
  1837 
  1840 
  1838     "Created: / 4.1.1997 / 20:38:16 / cg"
  1841     "Created: / 4.1.1997 / 20:38:16 / cg"
  1839     "Modified: / 8.8.1997 / 10:59:50 / cg"
  1842     "Modified: / 8.8.1997 / 10:59:50 / cg"
  1840     "Modified: / 18.3.1999 / 18:15:46 / stefan"!
  1843     "Modified: / 18.3.1999 / 18:15:46 / stefan"
       
  1844 !
  1841 
  1845 
  1842 basicFileOutInstvarTypeKeywordOn:aStream
  1846 basicFileOutInstvarTypeKeywordOn:aStream
  1843     "a helper for fileOutDefinition"
  1847     "a helper for fileOutDefinition"
  1844 
  1848 
  1845     |isVar s superclass|
  1849     |isVar s superclass|
  1897      SystemBrowser browseClasses:classes title:'classes which are not up-to-date'
  1901      SystemBrowser browseClasses:classes title:'classes which are not up-to-date'
  1898     "
  1902     "
  1899 
  1903 
  1900     "Created: 7.12.1995 / 10:58:47 / cg"
  1904     "Created: 7.12.1995 / 10:58:47 / cg"
  1901     "Modified: 1.4.1997 / 23:33:01 / stefan"
  1905     "Modified: 1.4.1997 / 23:33:01 / stefan"
  1902     "Modified: 9.9.1997 / 12:05:41 / cg"!
  1906     "Modified: 9.9.1997 / 12:05:41 / cg"
       
  1907 !
  1903 
  1908 
  1904 compiledMethodAt:aSelector
  1909 compiledMethodAt:aSelector
  1905 
  1910 
  1906     ^ self compiledMethodAt:aSelector ifAbsent:nil
  1911     ^ self compiledMethodAt:aSelector ifAbsent:nil
  1907 !
  1912 !
  1948 "/     applied again
  1953 "/     applied again
  1949 "/    "
  1954 "/    "
  1950 "/    self addChangeRecordForClassFileOut:self
  1955 "/    self addChangeRecordForClassFileOut:self
  1951 
  1956 
  1952     "Modified: / 7.6.1996 / 09:14:43 / stefan"
  1957     "Modified: / 7.6.1996 / 09:14:43 / stefan"
  1953     "Modified: / 27.8.1998 / 02:02:57 / cg"!
  1958     "Modified: / 27.8.1998 / 02:02:57 / cg"
       
  1959 !
  1954 
  1960 
  1955 fileOutAllDefinitionsOn:aStream
  1961 fileOutAllDefinitionsOn:aStream
  1956     "append expressions on aStream, which defines myself and all of my private classes."
  1962     "append expressions on aStream, which defines myself and all of my private classes."
  1957 
  1963 
  1958     self fileOutDefinitionOn:aStream.
  1964     self fileOutDefinitionOn:aStream.
  1977             aClass fileOutAllDefinitionsOn:aStream
  1983             aClass fileOutAllDefinitionsOn:aStream
  1978         ]
  1984         ]
  1979     ].
  1985     ].
  1980 
  1986 
  1981     "Created: 15.10.1996 / 11:15:19 / cg"
  1987     "Created: 15.10.1996 / 11:15:19 / cg"
  1982     "Modified: 22.3.1997 / 16:11:56 / cg"!
  1988     "Modified: 22.3.1997 / 16:11:56 / cg"
       
  1989 !
  1983 
  1990 
  1984 fileOutAs:fileNameString
  1991 fileOutAs:fileNameString
  1985     "create a file consisting of all methods in myself in
  1992     "create a file consisting of all methods in myself in
  1986      sourceForm, from which the class can be reconstructed (by filing in).
  1993      sourceForm, from which the class can be reconstructed (by filing in).
  1987      The given fileName should be a full path, including suffix.
  1994      The given fileName should be a full path, including suffix.
  2127     "
  2134     "
  2128     self addChangeRecordForClassFileOut:self
  2135     self addChangeRecordForClassFileOut:self
  2129 
  2136 
  2130     "Modified: / 7.6.1996 / 09:14:43 / stefan"
  2137     "Modified: / 7.6.1996 / 09:14:43 / stefan"
  2131     "Created: / 16.4.1997 / 20:44:05 / cg"
  2138     "Created: / 16.4.1997 / 20:44:05 / cg"
  2132     "Modified: / 12.8.1998 / 11:14:56 / cg"!
  2139     "Modified: / 12.8.1998 / 11:14:56 / cg"
       
  2140 !
  2133 
  2141 
  2134 fileOutCategory:aCategory
  2142 fileOutCategory:aCategory
  2135     "create a file 'class-category.st' consisting of all methods in aCategory.
  2143     "create a file 'class-category.st' consisting of all methods in aCategory.
  2136      If the current project is not nil, create the file in the projects
  2144      If the current project is not nil, create the file in the projects
  2137      directory."
  2145      directory."
  2164     self fileOutCategory:aCategory on:aStream.
  2172     self fileOutCategory:aCategory on:aStream.
  2165     aStream close
  2173     aStream close
  2166 
  2174 
  2167     "Modified: / 1.4.1997 / 16:00:24 / stefan"
  2175     "Modified: / 1.4.1997 / 16:00:24 / stefan"
  2168     "Created: / 1.4.1997 / 16:04:18 / stefan"
  2176     "Created: / 1.4.1997 / 16:04:18 / stefan"
  2169     "Modified: / 28.10.1997 / 14:40:28 / cg"!
  2177     "Modified: / 28.10.1997 / 14:40:28 / cg"
       
  2178 !
  2170 
  2179 
  2171 fileOutCategory:aCategory except:skippedMethods only:savedMethods methodFilter:methodFilter on:aStream
  2180 fileOutCategory:aCategory except:skippedMethods only:savedMethods methodFilter:methodFilter on:aStream
  2172     |dict source sortedSelectors first privacy interestingMethods cat|
  2181     |dict source sortedSelectors first privacy interestingMethods cat|
  2173 
  2182 
  2174     dict := self methodDictionary.
  2183     dict := self methodDictionary.
  2245     ]
  2254     ]
  2246 
  2255 
  2247     "Modified: 28.8.1995 / 14:30:41 / claus"
  2256     "Modified: 28.8.1995 / 14:30:41 / claus"
  2248     "Modified: 12.6.1996 / 11:37:33 / stefan"
  2257     "Modified: 12.6.1996 / 11:37:33 / stefan"
  2249     "Modified: 15.11.1996 / 11:32:21 / cg"
  2258     "Modified: 15.11.1996 / 11:32:21 / cg"
  2250     "Created: 1.4.1997 / 16:04:33 / stefan"!
  2259     "Created: 1.4.1997 / 16:04:33 / stefan"
       
  2260 !
  2251 
  2261 
  2252 fileOutCategory:aCategory methodFilter:methodFilter on:aStream
  2262 fileOutCategory:aCategory methodFilter:methodFilter on:aStream
  2253     "file out all methods belonging to aCategory, aString onto aStream"
  2263     "file out all methods belonging to aCategory, aString onto aStream"
  2254 
  2264 
  2255     self fileOutCategory:aCategory except:nil only:nil methodFilter:methodFilter on:aStream!
  2265     self fileOutCategory:aCategory except:nil only:nil methodFilter:methodFilter on:aStream
       
  2266 !
  2256 
  2267 
  2257 fileOutCategory:aCategory on:aStream
  2268 fileOutCategory:aCategory on:aStream
  2258     Class fileOutNameSpaceQuerySignal answer:true do:[
  2269     Class fileOutNameSpaceQuerySignal answer:true do:[
  2259         self fileOutCategory:aCategory except:nil only:nil methodFilter:nil on:aStream
  2270         self fileOutCategory:aCategory except:nil only:nil methodFilter:nil on:aStream
  2260     ]!
  2271     ]
       
  2272 !
  2261 
  2273 
  2262 fileOutClassInstVarDefinitionOn:aStream withNameSpace:withNameSpace
  2274 fileOutClassInstVarDefinitionOn:aStream withNameSpace:withNameSpace
  2263     "append an expression to define my classInstanceVariables on aStream"
  2275     "append an expression to define my classInstanceVariables on aStream"
  2264 
  2276 
  2265     |anySuperClassInstVar|
  2277     |anySuperClassInstVar|
  2306 !
  2318 !
  2307 
  2319 
  2308 fileOutDefinitionOn:aStream
  2320 fileOutDefinitionOn:aStream
  2309     "append an expression on aStream, which defines myself."
  2321     "append an expression on aStream, which defines myself."
  2310 
  2322 
  2311     ^ self basicFileOutDefinitionOn:aStream withNameSpace:false!
  2323     ^ self basicFileOutDefinitionOn:aStream withNameSpace:false
       
  2324 !
  2312 
  2325 
  2313 fileOutMethod:aMethod
  2326 fileOutMethod:aMethod
  2314     |aStream fileName selector|
  2327     |aStream fileName selector|
  2315 
  2328 
  2316     selector := self selectorAtMethod:aMethod.
  2329     selector := self selectorAtMethod:aMethod.
  2344         aStream close
  2357         aStream close
  2345     ]
  2358     ]
  2346 
  2359 
  2347     "Modified: / 1.4.1997 / 16:00:57 / stefan"
  2360     "Modified: / 1.4.1997 / 16:00:57 / stefan"
  2348     "Created: / 2.4.1997 / 00:24:28 / stefan"
  2361     "Created: / 2.4.1997 / 00:24:28 / stefan"
  2349     "Modified: / 28.10.1997 / 14:40:34 / cg"!
  2362     "Modified: / 28.10.1997 / 14:40:34 / cg"
       
  2363 !
  2350 
  2364 
  2351 fileOutMethod:aMethod on:aStream
  2365 fileOutMethod:aMethod on:aStream
  2352     |dict cat source privacy|
  2366     |dict cat source privacy|
  2353 
  2367 
  2354     dict := self methodDictionary.
  2368     dict := self methodDictionary.
  2384     ]
  2398     ]
  2385 
  2399 
  2386     "Modified: 27.8.1995 / 01:23:19 / claus"
  2400     "Modified: 27.8.1995 / 01:23:19 / claus"
  2387     "Modified: 12.6.1996 / 11:44:41 / stefan"
  2401     "Modified: 12.6.1996 / 11:44:41 / stefan"
  2388     "Modified: 15.11.1996 / 11:32:43 / cg"
  2402     "Modified: 15.11.1996 / 11:32:43 / cg"
  2389     "Created: 2.4.1997 / 00:24:33 / stefan"!
  2403     "Created: 2.4.1997 / 00:24:33 / stefan"
       
  2404 !
  2390 
  2405 
  2391 fileOutOn:aStream
  2406 fileOutOn:aStream
  2392 
  2407 
  2393     ^ self fileOutOn:aStream withTimeStamp:true!
  2408     ^ self fileOutOn:aStream withTimeStamp:true
       
  2409 !
  2394 
  2410 
  2395 fileOutOn:aStream withTimeStamp:stampIt
  2411 fileOutOn:aStream withTimeStamp:stampIt
  2396     "file out my definition and all methods onto aStream.
  2412     "file out my definition and all methods onto aStream.
  2397      If stampIt is true, a timeStamp comment is prepended."
  2413      If stampIt is true, a timeStamp comment is prepended."
  2398 
  2414 
  2399     self fileOutOn:aStream withTimeStamp:stampIt withInitialize:true!
  2415     self fileOutOn:aStream withTimeStamp:stampIt withInitialize:true
       
  2416 !
  2400 
  2417 
  2401 fileOutOn:aStream withTimeStamp:stampIt withInitialize:initIt
  2418 fileOutOn:aStream withTimeStamp:stampIt withInitialize:initIt
  2402     "file out my definition and all methods onto aStream.
  2419     "file out my definition and all methods onto aStream.
  2403      If stampIt is true, a timeStamp comment is prepended.
  2420      If stampIt is true, a timeStamp comment is prepended.
  2404      If initIt is true, and the class implements a class-initialize method,
  2421      If initIt is true, and the class implements a class-initialize method,
  2407     self 
  2424     self 
  2408         fileOutOn:aStream 
  2425         fileOutOn:aStream 
  2409         withTimeStamp:stampIt 
  2426         withTimeStamp:stampIt 
  2410         withInitialize:initIt 
  2427         withInitialize:initIt 
  2411         withDefinition:true
  2428         withDefinition:true
  2412         methodFilter:nil!
  2429         methodFilter:nil
       
  2430 !
  2413 
  2431 
  2414 fileOutOn:aStream withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter
  2432 fileOutOn:aStream withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter
  2415     "file out my definition and all methods onto aStream.
  2433     "file out my definition and all methods onto aStream.
  2416      If stampIt is true, a timeStamp comment is prepended.
  2434      If stampIt is true, a timeStamp comment is prepended.
  2417      If initIt is true, and the class implements a class-initialize method,
  2435      If initIt is true, and the class implements a class-initialize method,
  2572         ]
  2590         ]
  2573     ]
  2591     ]
  2574 
  2592 
  2575     "Created: / 15.11.1995 / 12:53:06 / cg"
  2593     "Created: / 15.11.1995 / 12:53:06 / cg"
  2576     "Modified: / 1.4.1997 / 16:01:05 / stefan"
  2594     "Modified: / 1.4.1997 / 16:01:05 / stefan"
  2577     "Modified: / 13.3.1998 / 12:23:59 / cg"!
  2595     "Modified: / 13.3.1998 / 12:23:59 / cg"
       
  2596 !
  2578 
  2597 
  2579 fileOutPrimitiveDefinitionsOn:aStream
  2598 fileOutPrimitiveDefinitionsOn:aStream
  2580     "append primitive defs (if any) to aStream."
  2599     "append primitive defs (if any) to aStream."
  2581 
  2600 
  2582     |s|
  2601     |s|
  2601                 cr.
  2620                 cr.
  2602         aStream nextPutAll:s.
  2621         aStream nextPutAll:s.
  2603         aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr
  2622         aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr
  2604     ].
  2623     ].
  2605 
  2624 
  2606     "Modified: 8.1.1997 / 17:45:40 / cg"!
  2625     "Modified: 8.1.1997 / 17:45:40 / cg"
       
  2626 !
  2607 
  2627 
  2608 fileOutPrimitiveSpecsOn:aStream
  2628 fileOutPrimitiveSpecsOn:aStream
  2609     "append primitive defs (if any) to aStream."
  2629     "append primitive defs (if any) to aStream."
  2610 
  2630 
  2611     |s|
  2631     |s|
  2625                 cr.
  2645                 cr.
  2626         aStream nextPutAll:s.
  2646         aStream nextPutAll:s.
  2627         aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr
  2647         aStream nextPutChunkSeparator; space; nextPutChunkSeparator; cr; cr
  2628     ].
  2648     ].
  2629 
  2649 
  2630     "Modified: 8.1.1997 / 17:45:51 / cg"!
  2650     "Modified: 8.1.1997 / 17:45:51 / cg"
       
  2651 !
  2631 
  2652 
  2632 firstDefinitionSelectorPart
  2653 firstDefinitionSelectorPart
  2633     "return the first part of the selector with which I was (can be) defined in my superclass"
  2654     "return the first part of the selector with which I was (can be) defined in my superclass"
  2634 
  2655 
  2635     self isVariable ifFalse:[
  2656     self isVariable ifFalse:[
  2696         ].
  2717         ].
  2697         ^ nil
  2718         ^ nil
  2698     ].
  2719     ].
  2699     ^ pos
  2720     ^ pos
  2700 
  2721 
  2701     "Modified: 15.1.1997 / 15:29:30 / stefan"!
  2722     "Modified: 15.1.1997 / 15:29:30 / stefan"
       
  2723 !
  2702 
  2724 
  2703 hasMethods
  2725 hasMethods
  2704     "return true, if there are any (local) methods in this class"
  2726     "return true, if there are any (local) methods in this class"
  2705 
  2727 
  2706     ^ (self methodDictionary size ~~ 0)!
  2728     ^ (self methodDictionary size ~~ 0)
       
  2729 !
  2707 
  2730 
  2708 implements:aSelector
  2731 implements:aSelector
  2709     ^ self includesSelector:aSelector!
  2732     ^ self includesSelector:aSelector
       
  2733 !
  2710 
  2734 
  2711 includesSelector:aSelector
  2735 includesSelector:aSelector
  2712     ^ self methodDictionary includesKey:aSelector!
  2736     ^ self methodDictionary includesKey:aSelector
       
  2737 !
  2713 
  2738 
  2714 instanceVariableString
  2739 instanceVariableString
  2715     "return a string of the instance variable names"
  2740     "return a string of the instance variable names"
  2716 
  2741 
  2717     |instvars|
  2742     |instvars|
  2744     [theClass notNil] whileTrue:[
  2769     [theClass notNil] whileTrue:[
  2745         (theClass == aClass) ifTrue:[^ true].
  2770         (theClass == aClass) ifTrue:[^ true].
  2746         theClass := theClass superclass.
  2771         theClass := theClass superclass.
  2747     ].
  2772     ].
  2748     ^ false
  2773     ^ false
       
  2774 !
       
  2775 
       
  2776 localSourceStreamFor:sourceFile
       
  2777     "return an open stream on a local sourcefile, nil if that is not available"
       
  2778 
       
  2779     |fileName info module dir fn package packageDir zar entry|
       
  2780 
       
  2781     "/
       
  2782     "/ old: look in 'source/<filename>'
       
  2783     "/ this is still kept in order to find user-private
       
  2784     "/ classes in her currentDirectory.
       
  2785     "/
       
  2786     fileName := Smalltalk getSourceFileName:sourceFile.
       
  2787     fileName notNil ifTrue:[
       
  2788         ^ fileName asFilename readStream.
       
  2789     ].
       
  2790 
       
  2791     (package := self package) notNil ifTrue:[
       
  2792         "/ newest sceme ...
       
  2793         packageDir := package copyReplaceAll:$: with:$/.
       
  2794         packageDir := Smalltalk getPackageFileName:packageDir.
       
  2795         packageDir notNil ifTrue:[
       
  2796             "/ present there ?
       
  2797             packageDir := packageDir asFilename.
       
  2798             (fn := packageDir construct:sourceFile) exists ifTrue:[
       
  2799                 ^ fn readStream.
       
  2800             ].
       
  2801 
       
  2802             "/ a source subdirectory ?
       
  2803             fn := (packageDir construct:'source') construct:sourceFile.
       
  2804             fn exists ifTrue:[
       
  2805                 ^ fn readStream.
       
  2806             ].
       
  2807 
       
  2808             "/ a zip-file ?
       
  2809             fn := (packageDir construct:'source.zip').
       
  2810             fn exists ifTrue:[
       
  2811                 zar := ZipArchive oldFileNamed:fn.
       
  2812                 zar notNil ifTrue:[
       
  2813                     entry := zar extract:sourceFile.
       
  2814                     entry notNil ifTrue:[
       
  2815                         ^ entry asString readStream
       
  2816                     ]
       
  2817                 ]
       
  2818             ]
       
  2819         ].
       
  2820 
       
  2821         "/ will vanish ...
       
  2822         (package includes:$:) ifTrue:[
       
  2823             package := package asString copyReplaceAll:$: with:$/
       
  2824         ] ifFalse:[
       
  2825             package := 'stx/' , package
       
  2826         ].
       
  2827         fileName := Smalltalk getSourceFileName:(package , '/' , sourceFile).
       
  2828         fileName notNil ifTrue:[
       
  2829             ^ fileName asFilename readStream.
       
  2830         ].
       
  2831         (package startsWith:'stx/') ifTrue:[
       
  2832             fileName := Smalltalk getSourceFileName:((package copyFrom:5) , '/' , sourceFile).
       
  2833             fileName notNil ifTrue:[
       
  2834                 ^ fileName asFilename readStream.
       
  2835             ]
       
  2836         ]
       
  2837     ].
       
  2838 
       
  2839     "/
       
  2840     "/ new: look in 'source/<module>/<package>/<filename>
       
  2841     "/ this makes the symbolic links to (or copy of) the source files
       
  2842     "/ obsolete.
       
  2843     info := self packageSourceCodeInfo.
       
  2844     info notNil ifTrue:[
       
  2845         module := info at:#module ifAbsent:nil.
       
  2846         module notNil ifTrue:[
       
  2847             dir := info at:#directory ifAbsent:nil.
       
  2848             dir notNil ifTrue:[
       
  2849                 fn := (module asFilename construct:dir) construct:sourceFile.
       
  2850                 fileName := Smalltalk getSourceFileName:(fn name).
       
  2851                 fileName notNil ifTrue:[
       
  2852                     ^ fileName asFilename readStream.
       
  2853                 ].
       
  2854 
       
  2855                 "/ brand new: look for source/<module>/package.zip
       
  2856                 "/ containing an entry for <filename>
       
  2857 
       
  2858                 fn := (module asFilename construct:dir) withSuffix:'zip'.
       
  2859                 fileName := Smalltalk getSourceFileName:(fn name).
       
  2860                 fileName notNil ifTrue:[
       
  2861                     zar := ZipArchive oldFileNamed:fileName.
       
  2862                     zar notNil ifTrue:[
       
  2863                         entry := zar extract:sourceFile.
       
  2864                         entry notNil ifTrue:[
       
  2865                             ^ entry asString readStream
       
  2866                         ]
       
  2867                     ]
       
  2868                 ].
       
  2869 
       
  2870                 "/ and also in source/source.zip ...
       
  2871 
       
  2872                 fileName := Smalltalk getSourceFileName:'source.zip'.
       
  2873                 fileName notNil ifTrue:[
       
  2874                     zar := ZipArchive oldFileNamed:fileName.
       
  2875                     zar notNil ifTrue:[
       
  2876                         entry := zar extract:sourceFile.
       
  2877                         entry notNil ifTrue:[
       
  2878                             ^ entry asString readStream
       
  2879                         ]
       
  2880                     ]
       
  2881                 ].
       
  2882             ]
       
  2883         ]
       
  2884     ].
       
  2885     ^ nil
       
  2886 
       
  2887     "Modified: / 18.7.1998 / 22:53:19 / cg"
  2749 !
  2888 !
  2750 
  2889 
  2751 nameWithoutNameSpacePrefix
  2890 nameWithoutNameSpacePrefix
  2752     |nm owner|
  2891     |nm owner|
  2753 
  2892 
  2917      MemoryMonitor packageSourceCodeInfo  
  3056      MemoryMonitor packageSourceCodeInfo  
  2918      ClockView packageSourceCodeInfo  
  3057      ClockView packageSourceCodeInfo  
  2919     "
  3058     "
  2920 
  3059 
  2921     "Created: 4.11.1995 / 20:36:53 / cg"
  3060     "Created: 4.11.1995 / 20:36:53 / cg"
  2922     "Modified: 19.9.1997 / 10:42:25 / cg"!
  3061     "Modified: 19.9.1997 / 10:42:25 / cg"
       
  3062 !
  2923 
  3063 
  2924 primitiveDefinitionsString
  3064 primitiveDefinitionsString
  2925     "{ Pragma: +optSpace }"
  3065     "{ Pragma: +optSpace }"
  2926 
  3066 
  2927     "return the primitiveDefinition string or nil"
  3067     "return the primitiveDefinition string or nil"
  2929     ^ self getPrimitiveSpecsAt:1
  3069     ^ self getPrimitiveSpecsAt:1
  2930 
  3070 
  2931     "
  3071     "
  2932      Object primitiveDefinitionsString 
  3072      Object primitiveDefinitionsString 
  2933      String primitiveDefinitionsString
  3073      String primitiveDefinitionsString
  2934     "!
  3074     "
       
  3075 !
  2935 
  3076 
  2936 primitiveFunctionsString
  3077 primitiveFunctionsString
  2937     "{ Pragma: +optSpace }"
  3078     "{ Pragma: +optSpace }"
  2938 
  3079 
  2939     "return the primitiveFunctions string or nil"
  3080     "return the primitiveFunctions string or nil"
  2940 
  3081 
  2941     ^ self getPrimitiveSpecsAt:3!
  3082     ^ self getPrimitiveSpecsAt:3
       
  3083 !
  2942 
  3084 
  2943 primitiveVariablesString
  3085 primitiveVariablesString
  2944     "{ Pragma: +optSpace }"
  3086     "{ Pragma: +optSpace }"
  2945 
  3087 
  2946     "return the primitiveVariables string or nil"
  3088     "return the primitiveVariables string or nil"
  2947 
  3089 
  2948     ^ self getPrimitiveSpecsAt:2!
  3090     ^ self getPrimitiveSpecsAt:2
       
  3091 !
  2949 
  3092 
  2950 printClassNameOn:aStream
  3093 printClassNameOn:aStream
  2951     |nm|
  3094     |nm|
  2952 
  3095 
  2953     Class fileOutNameSpaceQuerySignal query == false ifTrue:[
  3096     Class fileOutNameSpaceQuerySignal query == false ifTrue:[
  2954         nm := self nameWithoutNameSpacePrefix
  3097         nm := self nameWithoutNameSpacePrefix
  2955     ] ifFalse:[
  3098     ] ifFalse:[
  2956         nm := self name.
  3099         nm := self name.
  2957     ].
  3100     ].
  2958 
  3101 
  2959     aStream nextPutAll:nm.!
  3102     aStream nextPutAll:nm.
       
  3103 !
  2960 
  3104 
  2961 printClassVarNamesOn:aStream indent:indent
  3105 printClassVarNamesOn:aStream indent:indent
  2962     "print the class variable names indented and breaking at line end"
  3106     "print the class variable names indented and breaking at line end"
  2963 
  3107 
  2964     self printNameArray:(self classVarNames) on:aStream indent:indent
  3108     self printNameArray:(self classVarNames) on:aStream indent:indent
  3049     "{ Pragma: +optSpace }"
  3193     "{ Pragma: +optSpace }"
  3050 
  3194 
  3051     "return a collection of my private classes (if any).
  3195     "return a collection of my private classes (if any).
  3052      The classes are in any order."
  3196      The classes are in any order."
  3053 
  3197 
  3054     ^ self privateClassesOrAll:false!
  3198     ^ self privateClassesOrAll:false
       
  3199 !
  3055 
  3200 
  3056 privateClassesAt:aClassNameStringOrSymbol
  3201 privateClassesAt:aClassNameStringOrSymbol
  3057     |nmSym|
  3202     |nmSym|
  3058 
  3203 
  3059     nmSym := (self name , '::' , aClassNameStringOrSymbol) asSymbolIfInterned.
  3204     nmSym := (self name , '::' , aClassNameStringOrSymbol) asSymbolIfInterned.
  3102     "
  3247     "
  3103      UILayoutTool privateClassesOrAll:true 
  3248      UILayoutTool privateClassesOrAll:true 
  3104      UILayoutTool privateClassesOrAll:false 
  3249      UILayoutTool privateClassesOrAll:false 
  3105     "
  3250     "
  3106 
  3251 
  3107     "Modified: / 29.5.1998 / 23:23:18 / cg"!
  3252     "Modified: / 29.5.1998 / 23:23:18 / cg"
       
  3253 !
  3108 
  3254 
  3109 privateClassesSorted
  3255 privateClassesSorted
  3110     "{ Pragma: +optSpace }"
  3256     "{ Pragma: +optSpace }"
  3111 
  3257 
  3112     "return a collection of my private classes (if any).
  3258     "return a collection of my private classes (if any).
  3123     "
  3269     "
  3124      Object privateClassesSorted
  3270      Object privateClassesSorted
  3125     "
  3271     "
  3126 
  3272 
  3127     "Created: 22.3.1997 / 16:10:42 / cg"
  3273     "Created: 22.3.1997 / 16:10:42 / cg"
  3128     "Modified: 22.3.1997 / 16:11:20 / cg"!
  3274     "Modified: 22.3.1997 / 16:11:20 / cg"
       
  3275 !
  3129 
  3276 
  3130 revisionInfo
  3277 revisionInfo
  3131     "return a dictionary filled with revision info.
  3278     "return a dictionary filled with revision info.
  3132      This extracts the relevant info from the revisionString.
  3279      This extracts the relevant info from the revisionString.
  3133      The revisionInfo contains all or a subset of:
  3280      The revisionInfo contains all or a subset of:
  3153         ].
  3300         ].
  3154         info notNil ifTrue:[
  3301         info notNil ifTrue:[
  3155             info at:#binaryRevision put:self binaryRevision.
  3302             info at:#binaryRevision put:self binaryRevision.
  3156         ]
  3303         ]
  3157     ].
  3304     ].
  3158     ^ info!
  3305     ^ info
       
  3306 !
  3159 
  3307 
  3160 revisionString
  3308 revisionString
  3161     "{ Pragma: +optSpace }"
  3309     "{ Pragma: +optSpace }"
  3162 
  3310 
  3163     "return my revision string; that one is extracted from the
  3311     "return my revision string; that one is extracted from the
  3214      Metaclass revisionString
  3362      Metaclass revisionString
  3215     "
  3363     "
  3216 
  3364 
  3217     "Created: 29.10.1995 / 19:28:03 / cg"
  3365     "Created: 29.10.1995 / 19:28:03 / cg"
  3218     "Modified: 23.10.1996 / 18:23:56 / cg"
  3366     "Modified: 23.10.1996 / 18:23:56 / cg"
  3219     "Modified: 1.4.1997 / 23:37:25 / stefan"!
  3367     "Modified: 1.4.1997 / 23:37:25 / stefan"
       
  3368 !
  3220 
  3369 
  3221 selectorAtMethod:aMethod
  3370 selectorAtMethod:aMethod
  3222     ^ self selectorAtMethod:aMethod ifAbsent:[nil]!
  3371     ^ self selectorAtMethod:aMethod ifAbsent:[nil]
       
  3372 !
  3223 
  3373 
  3224 selectorAtMethod:aMethod ifAbsent:failBlock
  3374 selectorAtMethod:aMethod ifAbsent:failBlock
  3225     |md|
  3375     |md|
  3226 
  3376 
  3227     md := self methodDictionary.
  3377     md := self methodDictionary.
  3228     md isNil ifTrue:[
  3378     md isNil ifTrue:[
  3229         'OOPS - nil methodDictionary' errorPrintCR.
  3379         'OOPS - nil methodDictionary' errorPrintCR.
  3230         ^ nil
  3380         ^ nil
  3231     ].
  3381     ].
  3232     ^ md keyAtValue:aMethod ifAbsent:failBlock.!
  3382     ^ md keyAtValue:aMethod ifAbsent:failBlock.
       
  3383 !
  3233 
  3384 
  3234 soleInstance
  3385 soleInstance
  3235     self isMeta ifFalse:[self halt].
  3386     self isMeta ifFalse:[self halt].
  3236     ^ self theNonMetaclass.
  3387     ^ self theNonMetaclass.
  3237 !
  3388 !
  3448     ^ Object syntaxHighlighterClass
  3599     ^ Object syntaxHighlighterClass
  3449 !
  3600 !
  3450 
  3601 
  3451 theMetaclass
  3602 theMetaclass
  3452     self isMeta ifTrue:[^ self].
  3603     self isMeta ifTrue:[^ self].
  3453     ^ self classRef.!
  3604     ^ self classRef.
       
  3605 !
  3454 
  3606 
  3455 theNonMetaclass
  3607 theNonMetaclass
  3456     |instSlotOffs clsPtr|
  3608     |instSlotOffs clsPtr|
  3457 
  3609 
  3458     self isMeta ifFalse:[^ self].
  3610     self isMeta ifFalse:[^ self].
  3464 validateSourceStream:aStream
  3616 validateSourceStream:aStream
  3465     "check if aStream really contains my source.
  3617     "check if aStream really contains my source.
  3466      This is done by checking the version methods return value
  3618      This is done by checking the version methods return value
  3467      against the version string as contained in the version method"
  3619      against the version string as contained in the version method"
  3468 
  3620 
  3469     ^ true!
  3621     ^ true
       
  3622 !
  3470 
  3623 
  3471 withAllSuperclasses
  3624 withAllSuperclasses
  3472     "return a collection containing the receiver and all
  3625     "return a collection containing the receiver and all
  3473      of the receivers accumulated superclasses"
  3626      of the receivers accumulated superclasses"
  3474 
  3627 
  3482     ].
  3635     ].
  3483     ^ aCollection
  3636     ^ aCollection
  3484 
  3637 
  3485     "
  3638     "
  3486      String withAllSuperclasses 
  3639      String withAllSuperclasses 
  3487     "!
  3640     "
       
  3641 !
  3488 
  3642 
  3489 withAllSuperclassesDo:aBlock
  3643 withAllSuperclassesDo:aBlock
  3490     |sc|
  3644     |sc|
  3491 
  3645 
  3492     aBlock value:self.
  3646     aBlock value:self.
  3542     ^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagLongs.
  3696     ^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagLongs.
  3543 !
  3697 !
  3544 
  3698 
  3545 isMeta
  3699 isMeta
  3546     ^ self size == (Metaclass instSize).
  3700     ^ self size == (Metaclass instSize).
  3547 "/    ^ classRef classRef name = 'Metaclass'!
  3701 "/    ^ classRef classRef name = 'Metaclass'
       
  3702 !
  3548 
  3703 
  3549 isPrivate
  3704 isPrivate
  3550     ^ classRef isPrivateMeta 
  3705     ^ classRef isPrivateMeta 
  3551 !
  3706 !
  3552 
  3707 
  3569 isVariable
  3724 isVariable
  3570     ^ (self flags bitAnd:Behavior maskIndexType) ~= 0.
  3725     ^ (self flags bitAnd:Behavior maskIndexType) ~= 0.
  3571 !
  3726 !
  3572 
  3727 
  3573 isVisualStartable
  3728 isVisualStartable
  3574     ^ false!
  3729     ^ false
       
  3730 !
  3575 
  3731 
  3576 isWords
  3732 isWords
  3577     ^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagWords.
  3733     ^ (self flags bitAnd:Behavior maskIndexType) == Behavior flagWords.
  3578 !
  3734 !
  3579 
  3735 
  3623 
  3779 
  3624 wasAutoloaded
  3780 wasAutoloaded
  3625     ^ false 
  3781     ^ false 
  3626 ! !
  3782 ! !
  3627 
  3783 
       
  3784 !SnapShotImageMemory::SpaceInfo methodsFor:'accessing'!
       
  3785 
       
  3786 end
       
  3787     "return the value of the instance variable 'end' (automatically generated)"
       
  3788 
       
  3789     ^ end
       
  3790 !
       
  3791 
       
  3792 end:something
       
  3793     "set the value of the instance variable 'end' (automatically generated)"
       
  3794 
       
  3795     end := something.
       
  3796 !
       
  3797 
       
  3798 flags
       
  3799     "return the value of the instance variable 'flags' (automatically generated)"
       
  3800 
       
  3801     ^ flags
       
  3802 !
       
  3803 
       
  3804 flags:something
       
  3805     "set the value of the instance variable 'flags' (automatically generated)"
       
  3806 
       
  3807     flags := something.
       
  3808 !
       
  3809 
       
  3810 imageBase
       
  3811     "return the value of the instance variable 'imageBase' (automatically generated)"
       
  3812 
       
  3813     ^ imageBase
       
  3814 !
       
  3815 
       
  3816 imageBase:something
       
  3817     "set the value of the instance variable 'imageBase' (automatically generated)"
       
  3818 
       
  3819     imageBase := something.
       
  3820 !
       
  3821 
       
  3822 size
       
  3823     "return the value of the instance variable 'size' (automatically generated)"
       
  3824 
       
  3825     ^ size
       
  3826 !
       
  3827 
       
  3828 size:something
       
  3829     "set the value of the instance variable 'size' (automatically generated)"
       
  3830 
       
  3831     size := something.
       
  3832 !
       
  3833 
       
  3834 start
       
  3835     "return the value of the instance variable 'start' (automatically generated)"
       
  3836 
       
  3837     ^ start
       
  3838 !
       
  3839 
       
  3840 start:something
       
  3841     "set the value of the instance variable 'start' (automatically generated)"
       
  3842 
       
  3843     start := something.
       
  3844 ! !
       
  3845 
  3628 !SnapShotImageMemory::ImageByteObject methodsFor:'queries'!
  3846 !SnapShotImageMemory::ImageByteObject methodsFor:'queries'!
  3629 
  3847 
  3630 size
  3848 size
  3631     ^ byteSize
  3849     ^ byteSize
  3632 ! !
  3850 ! !