1339 The classes are sorted by inheritance." |
1339 The classes are sorted by inheritance." |
1340 |
1340 |
1341 |classes pivateClassesOf| |
1341 |classes pivateClassesOf| |
1342 |
1342 |
1343 classes := self privateClasses. |
1343 classes := self privateClasses. |
1344 (classes size > 0) ifTrue:[ |
1344 classes notEmpty ifTrue:[ |
1345 classes := classes asOrderedCollection. |
1345 classes := classes asOrderedCollection. |
1346 classes sort:[:a :b | a name < b name]. |
1346 classes sort:[:a :b | a name < b name]. |
1347 |
1347 |
1348 pivateClassesOf := IdentityDictionary new. |
1348 pivateClassesOf := IdentityDictionary new. |
1349 classes do:[:each | pivateClassesOf at:each put:(each allPrivateClasses)]. |
1349 classes do:[:each | pivateClassesOf at:each put:(each allPrivateClasses)]. |
1350 |
1350 |
1351 classes topologicalSort:[:a :b | |
1351 classes topologicalSort:[:a :b | |
1352 "/ a must come before b iff: |
1352 "/ a must come before b iff: |
1353 "/ b is a subclass of a |
1353 "/ b is a subclass of a |
1354 "/ b has a private class which is a subclass of a |
1354 "/ b has a private class which is a subclass of a |
1355 |
1355 |
1356 |mustComeBefore pivateClassesOfB| |
1356 |mustComeBefore pivateClassesOfB| |
1357 mustComeBefore := b isSubclassOf:a. |
1357 mustComeBefore := b isSubclassOf:a. |
1358 pivateClassesOfB := pivateClassesOf at:b. |
1358 pivateClassesOfB := pivateClassesOf at:b. |
1359 pivateClassesOfB do:[:eachClassInB | |
1359 pivateClassesOfB do:[:eachClassInB | |
1360 mustComeBefore := mustComeBefore or:[eachClassInB isSubclassOf:a] |
1360 mustComeBefore := mustComeBefore or:[eachClassInB isSubclassOf:a] |
1361 ]. |
1361 ]. |
1362 mustComeBefore |
1362 mustComeBefore |
1363 ]. |
1363 ]. |
1364 ]. |
1364 ]. |
1365 ^ classes. |
1365 ^ classes. |
1366 |
1366 |
1367 " |
1367 " |
1368 Object privateClassesSorted |
1368 Object privateClassesSorted |
1369 NewSystemBrowser privateClassesSorted |
1369 Class privateClassesSorted |
1370 NewSystemBrowser privateClasses |
1370 Class privateClasses |
1371 " |
1371 " |
1372 |
1372 |
1373 "Created: 22.3.1997 / 16:10:42 / cg" |
1373 "Created: 22.3.1997 / 16:10:42 / cg" |
1374 "Modified: 22.3.1997 / 16:11:20 / cg" |
1374 "Modified: 22.3.1997 / 16:11:20 / cg" |
1375 ! |
1375 ! |
3005 aStream nextPutLine:'</indexed-type>'. |
3005 aStream nextPutLine:'</indexed-type>'. |
3006 |
3006 |
3007 aStream nextPutAll:' <inst-vars>'. |
3007 aStream nextPutAll:' <inst-vars>'. |
3008 varNames := self instVarNames. |
3008 varNames := self instVarNames. |
3009 varNames size > 0 ifTrue:[ |
3009 varNames size > 0 ifTrue:[ |
3010 aStream cr. |
3010 aStream cr. |
3011 varNames do:[:nm | |
3011 varNames do:[:nm | |
3012 aStream nextPutAll:' <name>'. |
3012 aStream nextPutAll:' <name>'. |
3013 aStream nextPutAll:nm. |
3013 aStream nextPutAll:nm. |
3014 aStream nextPutLine:'</name>'. |
3014 aStream nextPutLine:'</name>'. |
3015 ]. |
3015 ]. |
3016 aStream nextPutAll:' '. |
3016 aStream nextPutAll:' '. |
3017 ]. |
3017 ]. |
3018 aStream nextPutLine:'</inst-vars>'. |
3018 aStream nextPutLine:'</inst-vars>'. |
3019 |
3019 |
3020 aStream nextPutAll:' <class-inst-vars>'. |
3020 aStream nextPutAll:' <class-inst-vars>'. |
3021 varNames := self class instVarNames. |
3021 varNames := self class instVarNames. |
3022 varNames size > 0 ifTrue:[ |
3022 varNames size > 0 ifTrue:[ |
3023 aStream cr. |
3023 aStream cr. |
3024 varNames do:[:nm | |
3024 varNames do:[:nm | |
3025 aStream nextPutAll:' <name>'. |
3025 aStream nextPutAll:' <name>'. |
3026 aStream nextPutAll:nm. |
3026 aStream nextPutAll:nm. |
3027 aStream nextPutLine:'</name>'. |
3027 aStream nextPutLine:'</name>'. |
3028 ]. |
3028 ]. |
3029 aStream nextPutAll:' '. |
3029 aStream nextPutAll:' '. |
3030 ]. |
3030 ]. |
3031 aStream nextPutLine:'</class-inst-vars>'. |
3031 aStream nextPutLine:'</class-inst-vars>'. |
3032 |
3032 |
3033 aStream nextPutAll:' <imports>'. |
3033 aStream nextPutAll:' <imports>'. |
3034 aStream nextPutAll:''. |
3034 aStream nextPutAll:''. |
3038 aStream nextPutAll:self category. |
3038 aStream nextPutAll:self category. |
3039 aStream nextPutLine:'</category>'. |
3039 aStream nextPutLine:'</category>'. |
3040 |
3040 |
3041 aStream nextPutLine:'</class>'. |
3041 aStream nextPutLine:'</class>'. |
3042 |
3042 |
3043 varNames := self classVarNames. |
3043 self classVarNames do:[:nm | |
3044 varNames size > 0 ifTrue:[ |
3044 aStream nextPutLine:'<static>'. |
3045 varNames do:[:nm | |
3045 aStream nextPutAll:' <name>'. |
3046 aStream nextPutLine:'<static>'. |
3046 aStream nextPutAll:nm. |
3047 aStream nextPutAll:' <name>'. |
3047 aStream nextPutLine:'</name>'. |
3048 aStream nextPutAll:nm. |
3048 aStream nextPutAll:' <environment>'. |
3049 aStream nextPutLine:'</name>'. |
3049 aStream nextPutAll:self name. |
3050 aStream nextPutAll:' <environment>'. |
3050 aStream nextPutLine:'</environment>'. |
3051 aStream nextPutAll:self name. |
3051 aStream nextPutLine:'</static>'. |
3052 aStream nextPutLine:'</environment>'. |
|
3053 aStream nextPutLine:'</static>'. |
|
3054 ]. |
|
3055 ]. |
3052 ]. |
3056 ! |
3053 ! |
3057 |
3054 |
3058 fileOutXMLOn:aStream |
3055 fileOutXMLOn:aStream |
3059 "WARNING: untested first version. Not for general use (yet) |
3056 "WARNING: untested first version. Not for general use (yet) |
3599 addChangeRecordForClassRemove:oldClass to:aStream |
3597 addChangeRecordForClassRemove:oldClass to:aStream |
3600 "{ Pragma: +optSpace }" |
3598 "{ Pragma: +optSpace }" |
3601 |
3599 |
3602 "append a class-remove-record to aStream" |
3600 "append a class-remove-record to aStream" |
3603 |
3601 |
3604 aStream nextPutAll:('Smalltalk removeClass:' , oldClass name). |
3602 aStream |
3605 aStream nextPutChunkSeparator. |
3603 nextPutAll:'Smalltalk removeClass:'; |
|
3604 nextPutAll:oldClass name; |
|
3605 nextPutChunkSeparator. |
3606 ! |
3606 ! |
3607 |
3607 |
3608 addChangeRecordForClassRename:oldName to:newName to:aStream |
3608 addChangeRecordForClassRename:oldName to:newName to:aStream |
3609 "{ Pragma: +optSpace }" |
3609 "{ Pragma: +optSpace }" |
3610 |
3610 |
3611 "append a class-rename-record to aStream" |
3611 "append a class-rename-record to aStream" |
3612 |
3612 |
3613 aStream nextPutAll:('Smalltalk renameClass:' , oldName, ' to:''' , newName , ''''). |
3613 aStream |
3614 aStream nextPutChunkSeparator. |
3614 nextPutAll:'Smalltalk renameClass:'; |
|
3615 nextPutAll:oldName |
|
3616 nextPutAll:' to:''' |
|
3617 nextPutAll:newName |
|
3618 nextPutAll:''''; |
|
3619 nextPutChunkSeparator. |
3615 |
3620 |
3616 "Modified: 30.10.1996 / 20:27:02 / cg" |
3621 "Modified: 30.10.1996 / 20:27:02 / cg" |
3617 ! |
3622 ! |
3618 |
3623 |
3619 addChangeRecordForPrimitiveDefinitions:aClass to:aStream |
3624 addChangeRecordForPrimitiveDefinitions:aClass to:aStream |
4263 tryVersionFromVersionMethod| |
4268 tryVersionFromVersionMethod| |
4264 |
4269 |
4265 (owner := self owningClass) notNil ifTrue:[^ owner findVersionMethodOfManager:aSourceCodemanagerOrNil]. |
4270 (owner := self owningClass) notNil ifTrue:[^ owner findVersionMethodOfManager:aSourceCodemanagerOrNil]. |
4266 |
4271 |
4267 tryVersionFromVersionMethod := |
4272 tryVersionFromVersionMethod := |
4268 [:versionMethodsName | |
4273 [:versionMethodsName | |
4269 |aVersionMethod val| |
4274 |aVersionMethod val| |
4270 |
4275 |
4271 aVersionMethod := meta compiledMethodAt:versionMethodsName. |
4276 aVersionMethod := meta compiledMethodAt:versionMethodsName. |
4272 (aVersionMethod notNil and:[aVersionMethod isExecutable]) ifTrue:[ |
4277 (aVersionMethod notNil and:[aVersionMethod isExecutable]) ifTrue:[ |
4273 "/ |
4278 "/ |
4274 "/ if it's a method returning the version string, |
4279 "/ if it's a method returning the version string, |
4275 "/ that's the returned value |
4280 "/ that's the returned value |
4276 "/ |
4281 "/ |
4277 val := cls perform:versionMethodsName. |
4282 val := cls perform:versionMethodsName. |
4278 val isString ifTrue:[^ aVersionMethod]. |
4283 val isString ifTrue:[^ aVersionMethod]. |
4279 ]. |
4284 ]. |
4280 ]. |
4285 ]. |
4281 |
4286 |
4282 meta := self theMetaclass. |
4287 meta := self theMetaclass. |
4283 cls := self theNonMetaclass. |
4288 cls := self theNonMetaclass. |
4284 |
4289 |
4285 allVersionMethodNames := meta methodDictionary keys select:[:sel | sel startsWith:AbstractSourceCodeManager prefixOfVersionMethodSelector]. |
4290 allVersionMethodNames := meta methodDictionary keys select:[:sel | sel startsWith:AbstractSourceCodeManager prefixOfVersionMethodSelector]. |
4286 |
4291 |
4287 aSourceCodemanagerOrNil notNil ifTrue:[ |
4292 aSourceCodemanagerOrNil notNil ifTrue:[ |
4288 nameOfVersionMethodForManager := aSourceCodemanagerOrNil nameOfVersionMethodInClasses. |
4293 nameOfVersionMethodForManager := aSourceCodemanagerOrNil nameOfVersionMethodInClasses. |
4289 (allVersionMethodNames includes:nameOfVersionMethodForManager) ifTrue:[ |
4294 (allVersionMethodNames includes:nameOfVersionMethodForManager) ifTrue:[ |
4290 tryVersionFromVersionMethod value:nameOfVersionMethodForManager |
4295 tryVersionFromVersionMethod value:nameOfVersionMethodForManager |
4291 ]. |
4296 ]. |
4292 |
4297 |
4293 "/ only trust the oldVersion method, iff there is no other scv-version |
4298 "/ only trust the oldVersion method, iff there is no other scv-version |
4294 "/ (i.e. do not misuse an svn-checked-in #version as a version_cvs) |
4299 "/ (i.e. do not misuse an svn-checked-in #version as a version_cvs) |
4295 (allVersionMethodNames copyWithout:nameOfVersionMethodForManager) size > 0 ifTrue:[ |
4300 (allVersionMethodNames copyWithout:nameOfVersionMethodForManager) notEmpty ifTrue:[ |
4296 ^ nil |
4301 ^ nil |
4297 ]. |
4302 ]. |
4298 ]. |
4303 ]. |
4299 |
4304 |
4300 nameOfOldVersionMethod := self nameOfOldVersionMethod. |
4305 nameOfOldVersionMethod := self nameOfOldVersionMethod. |
4301 tryVersionFromVersionMethod value:nameOfOldVersionMethod. |
4306 tryVersionFromVersionMethod value:nameOfOldVersionMethod. |
4302 |
4307 |
4303 ^ nil. |
4308 ^ nil. |
4304 |
4309 |
4305 " |
4310 " |
4306 Smalltalk allClassesDo:[:cls | |
4311 Smalltalk allClassesDo:[:cls | |
4307 Transcript show:cls name; show:' -> '; showCR:cls findVersionMethod |
4312 Transcript show:cls name; show:' -> '; showCR:cls findVersionMethod |
4308 ]. |
4313 ]. |
4309 |
4314 |
4310 Number findVersionMethod |
4315 Number findVersionMethod |
4311 FileDirectory findVersionMethod |
4316 FileDirectory findVersionMethod |
4312 Metaclass findVersionMethod |
4317 Metaclass findVersionMethod |
4477 the directory info defaults to library name. |
4482 the directory info defaults to library name. |
4478 The library name may not be left blank. |
4483 The library name may not be left blank. |
4479 (this is done for backward compatibility,) |
4484 (this is done for backward compatibility,) |
4480 |
4485 |
4481 For example: |
4486 For example: |
4482 '....(libbasic)' -> module: stx directory: libbasic library: libbasic |
4487 '....(libbasic)' -> module: stx directory: libbasic library: libbasic |
4483 '....(stx:libbasic)' -> module: stx directory: libbasic library: libbasic |
4488 '....(stx:libbasic)' -> module: stx directory: libbasic library: libbasic |
4484 '....(stx:foo:libbfoo)' -> module: stx directory: foo library: libfoo |
4489 '....(stx:foo:libbfoo)' -> module: stx directory: foo library: libfoo |
4485 '....(aeg:libIECInterface)' -> module: aeg directory: libIECInterface library:libIECInterface |
4490 '....(aeg:libIECInterface)' -> module: aeg directory: libIECInterface library:libIECInterface |
4486 '....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase |
4491 '....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase |
4487 |
4492 |
4488 The way how the sourceCodeManager uses this to find the source location |
4493 The way how the sourceCodeManager uses this to find the source location |
4489 depends on the scheme used. For CVS, the module is taken as the -d arg, |
4494 depends on the scheme used. For CVS, the module is taken as the -d arg, |
4490 while the directory is prepended to the file name. |
4495 while the directory is prepended to the file name. |
4491 Other schemes may do things differently - these are not yet specified. |
4496 Other schemes may do things differently - these are not yet specified. |
4492 |
4497 |
4493 Caveat: |
4498 Caveat: |
4494 Encoding this info in the package string seems somewhat kludgy. |
4499 Encoding this info in the package string seems somewhat kludgy. |
4495 " |
4500 " |
4496 |
4501 |
4497 |owner sourceInfo packageString idx1 idx2 |
4502 |owner sourceInfo packageString idx1 idx2 |
4498 moduleString directoryString libraryString components component1 component2 dirComponents mgr| |
4503 moduleString directoryString libraryString components component1 component2 dirComponents mgr| |
4499 |
4504 |
4503 package == (PackageId noProjectID) ifTrue:[^ nil]. |
4508 package == (PackageId noProjectID) ifTrue:[^ nil]. |
4504 |
4509 |
4505 packageString := package asString. |
4510 packageString := package asString. |
4506 idx1 := packageString lastIndexOf:$(. |
4511 idx1 := packageString lastIndexOf:$(. |
4507 idx1 ~~ 0 ifTrue:[ |
4512 idx1 ~~ 0 ifTrue:[ |
4508 idx2 := packageString indexOf:$) startingAt:idx1+1. |
4513 idx2 := packageString indexOf:$) startingAt:idx1+1. |
4509 idx2 ~~ 0 ifTrue:[ |
4514 idx2 ~~ 0 ifTrue:[ |
4510 sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1 |
4515 sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1 |
4511 ] |
4516 ] |
4512 ] ifFalse:[ |
4517 ] ifFalse:[ |
4513 sourceInfo := packageString |
4518 sourceInfo := packageString |
4514 ]. |
4519 ]. |
4515 |
4520 |
4516 sourceInfo isNil ifTrue:[^ nil]. |
4521 sourceInfo isNil ifTrue:[^ nil]. |
4517 components := sourceInfo asCollectionOfSubstringsSeparatedBy:$:. |
4522 components := sourceInfo asCollectionOfSubstringsSeparatedBy:$:. |
4518 components size == 0 ifTrue:[ |
4523 components notEmpty ifTrue:[ |
4519 "/ moduleString := 'stx'. |
4524 "/ moduleString := 'stx'. |
4520 "/ directoryString := libraryString := ''. |
4525 "/ directoryString := libraryString := ''. |
4521 ^ nil |
4526 ^ nil |
4522 ]. |
4527 ]. |
4523 |
4528 |
4524 component1 := components at:1. |
4529 component1 := components at:1. |
4525 components size == 1 ifTrue:[ |
4530 components size == 1 ifTrue:[ |
4526 "/ a single name given - the module becomes 'stx' or |
4531 "/ a single name given - the module becomes 'stx' or |
4527 "/ the very first directory component (if such a module exists). |
4532 "/ the very first directory component (if such a module exists). |
4528 "/ If the component includes slashes, its the directory |
4533 "/ If the component includes slashes, its the directory |
4529 "/ otherwise the library. |
4534 "/ otherwise the library. |
4530 "/ |
4535 "/ |
4531 dirComponents := Filename components:component1. |
4536 dirComponents := Filename components:component1. |
4532 (dirComponents size > 1 |
4537 (dirComponents size > 1 |
4533 and:[(mgr := self sourceCodeManager) notNil |
4538 and:[(mgr := self sourceCodeManager) notNil |
4534 and:[mgr checkForExistingModule:dirComponents first]]) ifTrue:[ |
4539 and:[mgr checkForExistingModule:dirComponents first]]) ifTrue:[ |
4535 moduleString := dirComponents first. |
4540 moduleString := dirComponents first. |
4536 directoryString := libraryString := (Filename fromComponents:(dirComponents copyFrom:2)) asString. |
4541 directoryString := libraryString := (Filename fromComponents:(dirComponents copyFrom:2)) asString. |
4537 ] ifFalse:[ |
4542 ] ifFalse:[ |
4538 "/ non-existing; assume directory under the stx package. |
4543 "/ non-existing; assume directory under the stx package. |
4539 moduleString := 'stx'. |
4544 moduleString := 'stx'. |
4540 (component1 startsWith:'stx/') ifTrue:[ |
4545 (component1 startsWith:'stx/') ifTrue:[ |
4541 component1 := component1 copyFrom:5 |
4546 component1 := component1 copyFrom:5 |
4542 ]. |
4547 ]. |
4543 directoryString := libraryString := component1. |
4548 directoryString := libraryString := component1. |
4544 ]. |
4549 ]. |
4545 |
4550 |
4546 (libraryString includes:$/) ifTrue:[ |
4551 (libraryString includes:$/) ifTrue:[ |
4547 libraryString := libraryString asFilename baseName |
4552 libraryString := libraryString asFilename baseName |
4548 ] |
4553 ] |
4549 ] ifFalse:[ |
4554 ] ifFalse:[ |
4550 component2 := components at:2. |
4555 moduleString := component1. |
4551 components size == 2 ifTrue:[ |
4556 component2 := components at:2. |
4552 "/ two components - assume its the module and the directory; |
4557 directoryString := component2. |
4553 "/ the library is assumed to be named after the directory |
4558 components size == 2 ifTrue:[ |
4554 "/ except, if slashes are in the name; then the libraryname |
4559 "/ two components - assume its the module and the directory; |
4555 "/ is the last component. |
4560 "/ the library is assumed to be named after the directory |
4556 "/ |
4561 "/ except, if slashes are in the name; then the libraryname |
4557 moduleString := component1. |
4562 "/ is the last component. |
4558 directoryString := libraryString := component2. |
4563 "/ |
4559 (libraryString includes:$/) ifTrue:[ |
4564 libraryString := component2. |
4560 libraryString := libraryString asFilename baseName |
4565 (libraryString includes:$/) ifTrue:[ |
4561 ] |
4566 libraryString := libraryString asFilename baseName |
4562 ] ifFalse:[ |
4567 ] |
4563 "/ all components given |
4568 ] ifFalse:[ |
4564 moduleString := component1. |
4569 "/ all components given |
4565 directoryString := component2. |
4570 libraryString := components at:3. |
4566 libraryString := components at:3. |
4571 ] |
4567 ] |
|
4568 ]. |
4572 ]. |
4569 |
4573 |
4570 libraryString isEmpty ifTrue:[ |
4574 libraryString isEmpty ifTrue:[ |
4571 directoryString notEmpty ifTrue:[ |
4575 directoryString notEmpty ifTrue:[ |
4572 libraryString := directoryString asFilename baseName |
4576 libraryString := directoryString asFilename baseName |
4573 ]. |
4577 ]. |
4574 libraryString isEmpty ifTrue:[ |
4578 libraryString isEmpty ifTrue:[ |
4575 "/ lets extract the library from the liblist file ... |
4579 "/ lets extract the library from the liblist file ... |
4576 libraryString := Smalltalk libraryFileNameOfClass:self. |
4580 libraryString := Smalltalk libraryFileNameOfClass:self. |
4577 libraryString isNil ifTrue:[^ nil]. |
4581 libraryString isNil ifTrue:[^ nil]. |
4578 ] |
4582 ] |
4579 ]. |
4583 ]. |
4580 |
4584 |
4581 moduleString isEmpty ifTrue:[ |
4585 moduleString isEmpty ifTrue:[ |
4582 moduleString := 'stx'. |
4586 moduleString := 'stx'. |
4583 ]. |
4587 ]. |
4584 directoryString isEmpty ifTrue:[ |
4588 directoryString isEmpty ifTrue:[ |
4585 directoryString := libraryString. |
4589 directoryString := libraryString. |
4586 ]. |
4590 ]. |
4587 |
4591 |
4588 ^ IdentityDictionary |
4592 ^ IdentityDictionary |
4589 with:(#module->moduleString) |
4593 with:(#module->moduleString) |
4590 with:(#directory->directoryString) |
4594 with:(#directory->directoryString) |
4591 with:(#library->libraryString) |
4595 with:(#library->libraryString) |
4592 |
4596 |
4593 " |
4597 " |
4594 Object packageSourceCodeInfo |
4598 Object packageSourceCodeInfo |
4595 View packageSourceCodeInfo |
4599 View packageSourceCodeInfo |
4596 Model packageSourceCodeInfo |
4600 Model packageSourceCodeInfo |
4960 "/ or TryLocalSourceFirst is true, |
4964 "/ or TryLocalSourceFirst is true, |
4961 "/ look in standard places first |
4965 "/ look in standard places first |
4962 "/ |
4966 "/ |
4963 ((sourceCodeManager := self sourceCodeManager) isNil |
4967 ((sourceCodeManager := self sourceCodeManager) isNil |
4964 or:[TryLocalSourceFirst == true]) ifTrue:[ |
4968 or:[TryLocalSourceFirst == true]) ifTrue:[ |
4965 sourceStream := self localSourceStreamFor:source. |
4969 sourceStream := self localSourceStreamFor:source. |
4966 ]. |
4970 ]. |
4967 |
4971 |
4968 sourceStream isNil ifTrue:[ |
4972 sourceStream isNil ifTrue:[ |
4969 "/ mhmh - still no source file. |
4973 "/ mhmh - still no source file. |
4970 "/ If there is a SourceCodeManager, ask it to aquire the |
4974 "/ If there is a SourceCodeManager, ask it to aquire the |
4971 "/ the source for my class, and return an open stream on it. |
4975 "/ the source for my class, and return an open stream on it. |
4972 "/ if that one does not know about the source, look in |
4976 "/ if that one does not know about the source, look in |
4973 "/ standard places |
4977 "/ standard places |
4974 |
4978 |
4975 sourceCodeManager notNil ifTrue:[ |
4979 sourceCodeManager notNil ifTrue:[ |
4976 classFilename ~= source ifTrue:[ |
4980 classFilename ~= source ifTrue:[ |
4977 sep := self package indexOfAny:'/\:'. |
4981 sep := self package indexOfAny:'/\:'. |
4978 sep ~~ 0 ifTrue:[ |
4982 sep ~~ 0 ifTrue:[ |
4979 mod := package copyTo:sep - 1. |
4983 mod := package copyTo:sep - 1. |
4980 dir := package copyFrom:sep + 1. |
4984 dir := package copyFrom:sep + 1. |
4981 self breakPoint:#fm. |
4985 self breakPoint:#fm. |
4982 sourceStream := sourceCodeManager streamForClass:nil fileName:source revision:(self binaryRevision) directory:dir module:mod cache:true. |
4986 sourceStream := sourceCodeManager streamForClass:nil fileName:source revision:(self binaryRevision) directory:dir module:mod cache:true. |
4983 ]. |
4987 ]. |
4984 ]. |
4988 ]. |
4985 sourceStream isNil ifTrue:[ |
4989 sourceStream isNil ifTrue:[ |
4986 classFilename isNil ifTrue:[ |
4990 classFilename isNil ifTrue:[ |
4987 guessedFileName := (Smalltalk fileNameForClass:self) , '.st'. |
4991 guessedFileName := (Smalltalk fileNameForClass:self) , '.st'. |
4988 ]. |
4992 ]. |
4989 source asFilename baseName = (classFilename ? guessedFileName) asFilename baseName ifTrue:[ |
4993 source asFilename baseName = (classFilename ? guessedFileName) asFilename baseName ifTrue:[ |
4990 sourceStream := sourceCodeManager getSourceStreamFor:self. |
4994 sourceStream := sourceCodeManager getSourceStreamFor:self. |
4991 ] |
4995 ] |
4992 ]. |
4996 ]. |
4993 sourceStream notNil ifTrue:[ |
4997 sourceStream notNil ifTrue:[ |
4994 (self validateSourceStream:sourceStream) ifFalse:[ |
4998 (self validateSourceStream:sourceStream) ifFalse:[ |
4995 ('Class [info]: repositories source for "%1" is invalid.' bindWith:self theNonMetaclass name) errorPrintCR. |
4999 ('Class [info]: repositories source for "%1" is invalid.' bindWith:self theNonMetaclass name) errorPrintCR. |
4996 sourceStream close. |
5000 sourceStream close. |
4997 sourceStream := nil |
5001 sourceStream := nil |
4998 ] ifTrue:[ |
5002 ] ifTrue:[ |
4999 validated := true. |
5003 validated := true. |
5000 ]. |
5004 ]. |
5001 ]. |
5005 ]. |
5002 ] |
5006 ] |
5003 ]. |
5007 ]. |
5004 |
5008 |
5005 sourceStream isNil ifTrue:[ |
5009 sourceStream isNil ifTrue:[ |
5006 "/ |
5010 "/ |
5007 "/ hard case - there is no source file for this class |
5011 "/ hard case - there is no source file for this class |
5008 "/ (in the source-dir-path). |
5012 "/ (in the source-dir-path). |
5009 "/ |
5013 "/ |
5010 |
5014 |
5011 "/ |
5015 "/ |
5012 "/ look if my binary is from a dynamically loaded module, |
5016 "/ look if my binary is from a dynamically loaded module, |
5013 "/ and, if so, look in the modules directory for the |
5017 "/ and, if so, look in the modules directory for the |
5014 "/ source file. |
5018 "/ source file. |
5015 "/ |
5019 "/ |
5016 ObjectFileLoader notNil ifTrue:[ |
5020 ObjectFileLoader notNil ifTrue:[ |
5017 ObjectFileLoader loadedObjectHandlesDo:[:h | |
5021 ObjectFileLoader loadedObjectHandlesDo:[:h | |
5018 |f classes| |
5022 |f classes| |
5019 |
5023 |
5020 sourceStream isNil ifTrue:[ |
5024 sourceStream isNil ifTrue:[ |
5021 (classes := h classes) size > 0 ifTrue:[ |
5025 (classes := h classes) notEmptyOrNil ifTrue:[ |
5022 (classes includes:self) ifTrue:[ |
5026 (classes includes:self) ifTrue:[ |
5023 f := h pathName. |
5027 f := h pathName. |
5024 f := f asFilename directory. |
5028 f := f asFilename directory. |
5025 f := f construct:source. |
5029 f := f construct:source. |
5026 f exists ifTrue:[ |
5030 f exists ifTrue:[ |
5027 sourceStream := f readStreamOrNil. |
5031 sourceStream := f readStreamOrNil. |
5028 ]. |
5032 ]. |
5029 ]. |
5033 ]. |
5030 ]. |
5034 ]. |
5031 ] |
5035 ] |
5032 ]. |
5036 ]. |
5033 ]. |
5037 ]. |
5034 ]. |
5038 ]. |
5035 |
5039 |
5036 "/ |
5040 "/ |
5037 "/ try along sourcePath |
5041 "/ try along sourcePath |
5038 "/ |
5042 "/ |
5039 sourceStream isNil ifTrue:[ |
5043 sourceStream isNil ifTrue:[ |
5040 sourceStream := self localSourceStreamFor:source. |
5044 sourceStream := self localSourceStreamFor:source. |
5041 ]. |
5045 ]. |
5042 |
5046 |
5043 "/ |
5047 "/ |
5044 "/ final chance: try current directory |
5048 "/ final chance: try current directory |
5045 "/ |
5049 "/ |
5046 sourceStream isNil ifTrue:[ |
5050 sourceStream isNil ifTrue:[ |
5047 sourceStream := source asFilename readStreamOrNil. |
5051 sourceStream := source asFilename readStreamOrNil. |
5048 ]. |
5052 ]. |
5049 |
5053 |
5050 (sourceStream notNil and:[validated not]) ifTrue:[ |
5054 (sourceStream notNil and:[validated not]) ifTrue:[ |
5051 (self validateSourceStream:sourceStream) ifFalse:[ |
5055 (self validateSourceStream:sourceStream) ifFalse:[ |
5052 ('Class [warning]: source for "%1" is invalid or stripped. Take care.' bindWith:self theNonMetaclass name) errorPrintCR. |
5056 ('Class [warning]: source for "%1" is invalid or stripped. Take care.' bindWith:self theNonMetaclass name) errorPrintCR. |
5053 sourceStream close. |
5057 sourceStream close. |
5054 sourceStream := nil |
5058 sourceStream := nil |
5055 ]. |
5059 ]. |
5056 ]. |
5060 ]. |
5057 "/ (sourceStream notNil and:[sourceStream isFileStream]) ifTrue:[ |
5061 "/ (sourceStream notNil and:[sourceStream isFileStream]) ifTrue:[ |
5058 "/ guessedFileName notNil ifTrue:[ |
5062 "/ guessedFileName notNil ifTrue:[ |
5059 "/ self setClassFilename:(aStream pathName asFilename baseName). |
5063 "/ self setClassFilename:(aStream pathName asFilename baseName). |
5060 "/ ] |
5064 "/ ] |