3505 the directory info defaults to library name. |
3542 the directory info defaults to library name. |
3506 The library name may not be left blank. |
3543 The library name may not be left blank. |
3507 (this is done for backward compatibility,) |
3544 (this is done for backward compatibility,) |
3508 |
3545 |
3509 For example: |
3546 For example: |
3510 '....(libbasic)' -> module: stx directory: libbasic library: libbasic |
3547 '....(libbasic)' -> module: stx directory: libbasic library: libbasic |
3511 '....(stx:libbasic)' -> module: stx directory: libbasic library: libbasic |
3548 '....(stx:libbasic)' -> module: stx directory: libbasic library: libbasic |
3512 '....(aeg:libIECInterface)' -> module: aeg directory: libIECInterface library:libIECInterface |
3549 '....(aeg:libIECInterface)' -> module: aeg directory: libIECInterface library:libIECInterface |
3513 '....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase |
3550 '....(stx:goodies/persistency:libdbase)' -> module: stx directory: goodies/persistency library:libdbase |
3514 |
3551 |
3515 The way how the sourceCodeManager uses this to find the source location |
3552 The way how the sourceCodeManager uses this to find the source location |
3516 depends on the scheme used. For CVS, the module is taken as the -d arg, |
3553 depends on the scheme used. For CVS, the module is taken as the -d arg, |
3517 while the directory is prepended to the file name. |
3554 while the directory is prepended to the file name. |
3518 Other schemes may do things differently - these are not yet specified. |
3555 Other schemes may do things differently - these are not yet specified. |
3519 |
3556 |
3520 Caveat: |
3557 Caveat: |
3521 Encoding this info in the package string seems somewhat kludgy. |
3558 Encoding this info in the package string seems somewhat kludgy. |
3522 " |
3559 " |
3523 |
3560 |
3524 |sourceInfo packageString idx1 idx2 |
3561 |owner sourceInfo packageString idx1 idx2 |
3525 moduleString directoryString libraryString components| |
3562 moduleString directoryString libraryString components| |
|
3563 |
|
3564 (owner := self owningClass) notNil ifTrue:[^ owner packageSourceCodeInfo]. |
3526 |
3565 |
3527 package isNil ifTrue:[^ nil]. |
3566 package isNil ifTrue:[^ nil]. |
3528 |
3567 |
3529 packageString := package asString. |
3568 packageString := package asString. |
3530 idx1 := packageString lastIndexOf:$(. |
3569 idx1 := packageString lastIndexOf:$(. |
3531 idx1 ~~ 0 ifTrue:[ |
3570 idx1 ~~ 0 ifTrue:[ |
3532 idx2 := packageString indexOf:$) startingAt:idx1+1. |
3571 idx2 := packageString indexOf:$) startingAt:idx1+1. |
3533 idx2 ~~ 0 ifTrue:[ |
3572 idx2 ~~ 0 ifTrue:[ |
3534 sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1 |
3573 sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1 |
3535 ] |
3574 ] |
3536 ]. |
3575 ]. |
3537 sourceInfo isNil ifTrue:[^ nil]. |
3576 sourceInfo isNil ifTrue:[^ nil]. |
3538 components := sourceInfo asCollectionOfSubstringsSeparatedBy:$:. |
3577 components := sourceInfo asCollectionOfSubstringsSeparatedBy:$:. |
3539 components size == 0 ifTrue:[ |
3578 components size == 0 ifTrue:[ |
3540 moduleString := 'stx'. |
3579 moduleString := 'stx'. |
3541 directoryString := libraryString := ''. |
3580 directoryString := libraryString := ''. |
3542 ^ nil |
3581 ^ nil |
3543 ] ifFalse:[ |
3582 ] ifFalse:[ |
3544 components size == 1 ifTrue:[ |
3583 components size == 1 ifTrue:[ |
3545 "/ a single name given - the module becomes 'stx', |
3584 "/ a single name given - the module becomes 'stx', |
3546 "/ if the component includes slashes, its the directory |
3585 "/ if the component includes slashes, its the directory |
3547 "/ otherwise the library |
3586 "/ otherwise the library |
3548 "/ |
3587 "/ |
3549 moduleString := 'stx'. |
3588 moduleString := 'stx'. |
3550 directoryString := libraryString := components at:1. |
3589 directoryString := libraryString := components at:1. |
3551 (libraryString includes:$/) ifTrue:[ |
3590 (libraryString includes:$/) ifTrue:[ |
3552 libraryString := libraryString asFilename baseName |
3591 libraryString := libraryString asFilename baseName |
3553 ] |
3592 ] |
3554 ] ifFalse:[ |
3593 ] ifFalse:[ |
3555 components size == 2 ifTrue:[ |
3594 components size == 2 ifTrue:[ |
3556 "/ two components - assume its the module and the directory; |
3595 "/ two components - assume its the module and the directory; |
3557 "/ the library is assumed to be named after the directory |
3596 "/ the library is assumed to be named after the directory |
3558 "/ except, if slashes are in the name; then the libraryname |
3597 "/ except, if slashes are in the name; then the libraryname |
3559 "/ is the last component. |
3598 "/ is the last component. |
3560 "/ |
3599 "/ |
3561 moduleString := components at:1. |
3600 moduleString := components at:1. |
3562 directoryString := libraryString := components at:2. |
3601 directoryString := libraryString := components at:2. |
3563 (libraryString includes:$/) ifTrue:[ |
3602 (libraryString includes:$/) ifTrue:[ |
3564 libraryString := libraryString asFilename baseName |
3603 libraryString := libraryString asFilename baseName |
3565 ] |
3604 ] |
3566 ] ifFalse:[ |
3605 ] ifFalse:[ |
3567 "/ all components given |
3606 "/ all components given |
3568 moduleString := components at:1. |
3607 moduleString := components at:1. |
3569 directoryString := components at:2. |
3608 directoryString := components at:2. |
3570 libraryString := components at:3. |
3609 libraryString := components at:3. |
3571 ] |
3610 ] |
3572 ] |
3611 ] |
3573 ]. |
3612 ]. |
3574 libraryString isEmpty ifTrue:[ |
3613 libraryString isEmpty ifTrue:[ |
3575 directoryString notEmpty ifTrue:[ |
3614 directoryString notEmpty ifTrue:[ |
3576 libraryString := directoryString asFilename baseName |
3615 libraryString := directoryString asFilename baseName |
3577 ]. |
3616 ]. |
3578 libraryString isEmpty ifTrue:[ |
3617 libraryString isEmpty ifTrue:[ |
3579 "/ lets extract the library from the liblist file ... |
3618 "/ lets extract the library from the liblist file ... |
3580 libraryString := Smalltalk libraryFileNameOfClass:self. |
3619 libraryString := Smalltalk libraryFileNameOfClass:self. |
3581 libraryString isNil ifTrue:[^ nil]. |
3620 libraryString isNil ifTrue:[^ nil]. |
3582 ] |
3621 ] |
3583 ]. |
3622 ]. |
3584 |
3623 |
3585 moduleString isEmpty ifTrue:[ |
3624 moduleString isEmpty ifTrue:[ |
3586 moduleString := 'stx'. |
3625 moduleString := 'stx'. |
3587 ]. |
3626 ]. |
3588 directoryString isEmpty ifTrue:[ |
3627 directoryString isEmpty ifTrue:[ |
3589 directoryString := libraryString. |
3628 directoryString := libraryString. |
3590 ]. |
3629 ]. |
3591 |
3630 |
3592 ^ IdentityDictionary |
3631 ^ IdentityDictionary |
3593 with:(#module->moduleString) |
3632 with:(#module->moduleString) |
3594 with:(#directory->directoryString) |
3633 with:(#directory->directoryString) |
3595 with:(#library->libraryString) |
3634 with:(#library->libraryString) |
3596 |
3635 |
3597 " |
3636 " |
3598 Object packageSourceCodeInfo |
3637 Object packageSourceCodeInfo |
3599 View packageSourceCodeInfo |
3638 View packageSourceCodeInfo |
3600 Model packageSourceCodeInfo |
3639 Model packageSourceCodeInfo |
3634 |
3673 |
3635 revisionInfo |
3674 revisionInfo |
3636 "return a dictionary filled with revision info. |
3675 "return a dictionary filled with revision info. |
3637 This extracts the relevant info from the revisionString. |
3676 This extracts the relevant info from the revisionString. |
3638 The revisionInfo contains all or a subset of: |
3677 The revisionInfo contains all or a subset of: |
3639 #binaryRevision - the revision upon which the binary of this class is based |
3678 #binaryRevision - the revision upon which the binary of this class is based |
3640 #revision - the revision upon which the class is based logically |
3679 #revision - the revision upon which the class is based logically |
3641 (different, if a changed class was checked in, but not yet recompiled) |
3680 (different, if a changed class was checked in, but not yet recompiled) |
3642 #user - the user who checked in the logical revision |
3681 #user - the user who checked in the logical revision |
3643 #date - the date when the logical revision was checked in |
3682 #date - the date when the logical revision was checked in |
3644 #time - the time when the logical revision was checked in |
3683 #time - the time when the logical revision was checked in |
3645 #fileName - the classes source file name |
3684 #fileName - the classes source file name |
3646 #repositoryPath - the classes source container |
3685 #repositoryPath - the classes source container |
3647 " |
3686 " |
3648 |
3687 |
3649 |vsnString info| |
3688 |vsnString info| |
3650 |
3689 |
3651 vsnString := self revisionString. |
3690 vsnString := self revisionString. |
3652 vsnString notNil ifTrue:[ |
3691 vsnString notNil ifTrue:[ |
3653 info := Class revisionInfoFromString:vsnString. |
3692 info := Class revisionInfoFromString:vsnString. |
3654 info notNil ifTrue:[ |
3693 info notNil ifTrue:[ |
3655 info at:#binaryRevision put:revision. |
3694 info at:#binaryRevision put:revision. |
3656 ] |
3695 ] |
3657 ]. |
3696 ]. |
3658 ^ info |
3697 ^ info |
3659 |
3698 |
3660 " |
3699 " |
3661 Object revisionString |
3700 Object revisionString |
3662 Object revisionInfo |
3701 Object revisionInfo |
3663 Image revisionInfo |
3702 Image revisionInfo |
3664 " |
3703 " |
3665 |
3704 |
3666 "Created: 11.11.1995 / 14:27:20 / cg" |
3705 "Created: 11.11.1995 / 14:27:20 / cg" |
3667 "Modified: 9.12.1995 / 21:35:26 / cg" |
3706 "Modified: 15.10.1996 / 18:56:44 / cg" |
3668 ! |
3707 ! |
3669 |
3708 |
3670 revisionString |
3709 revisionString |
3671 "return my revision string; that one is extracted from the |
3710 "return my revision string; that one is extracted from the |
3672 classes #version method. Either this is a method returning that string, |
3711 classes #version method. Either this is a method returning that string, |
3673 or its a comment-only method and the comment defines the version. |
3712 or its a comment-only method and the comment defines the version. |
3674 If the source is not accessable or no such method exists, |
3713 If the source is not accessable or no such method exists, |
3675 nil is returned." |
3714 nil is returned." |
3676 |
3715 |
3677 |cls meta m src val| |
3716 |owner cls meta m src val| |
|
3717 |
|
3718 (owner := self owningClass) notNil ifTrue:[^ owner revisionString]. |
3678 |
3719 |
3679 thisContext isRecursive ifTrue:[^ nil ]. |
3720 thisContext isRecursive ifTrue:[^ nil ]. |
3680 |
3721 |
3681 self isMeta ifTrue:[ |
3722 self isMeta ifTrue:[ |
3682 meta := self. cls := self soleInstance |
3723 meta := self. cls := self soleInstance |
3812 ! |
3836 ! |
3813 |
3837 |
3814 sourceStream |
3838 sourceStream |
3815 "return an open stream on my sourcefile, nil if that is not available" |
3839 "return an open stream on my sourcefile, nil if that is not available" |
3816 |
3840 |
3817 |source cls| |
3841 |owner source cls| |
|
3842 |
|
3843 (owner := self owningClass) notNil ifTrue:[^ owner sourceStream]. |
3818 |
3844 |
3819 self isMeta ifTrue:[ |
3845 self isMeta ifTrue:[ |
3820 cls := self soleInstance |
3846 cls := self soleInstance |
3821 ] ifFalse:[ |
3847 ] ifFalse:[ |
3822 cls := self |
3848 cls := self |
3823 ]. |
3849 ]. |
3824 classFilename notNil ifTrue:[ |
3850 classFilename notNil ifTrue:[ |
3825 source := classFilename |
3851 source := classFilename |
3826 ] ifFalse:[ |
3852 ] ifFalse:[ |
3827 source := (Smalltalk fileNameForClass:cls) , '.st' |
3853 source := (Smalltalk fileNameForClass:cls) , '.st' |
3828 ]. |
3854 ]. |
3829 ^ cls sourceStreamFor:source |
3855 ^ cls sourceStreamFor:source |
|
3856 |
|
3857 "Modified: 15.10.1996 / 18:59:40 / cg" |
3830 ! |
3858 ! |
3831 |
3859 |
3832 sourceStreamFor:source |
3860 sourceStreamFor:source |
3833 "return an open stream on a sourcefile, nil if that is not available" |
3861 "return an open stream on a sourcefile, nil if that is not available" |
3834 |
3862 |
3835 |fileName aStream mgr| |
3863 |owner fileName aStream mgr| |
|
3864 |
|
3865 (owner := self owningClass) notNil ifTrue:[^ owner sourceStreamFor:source]. |
3836 |
3866 |
3837 "/ |
3867 "/ |
3838 "/ if there is no SourceCodeManager, |
3868 "/ if there is no SourceCodeManager, |
3839 "/ or TryLocalSourceFirst is true, |
3869 "/ or TryLocalSourceFirst is true, |
3840 "/ look in standard places first |
3870 "/ look in standard places first |
3911 Clock sourceStream |
3941 Clock sourceStream |
3912 Autoload sourceStream |
3942 Autoload sourceStream |
3913 " |
3943 " |
3914 |
3944 |
3915 "Created: 10.11.1995 / 21:05:13 / cg" |
3945 "Created: 10.11.1995 / 21:05:13 / cg" |
3916 "Modified: 12.10.1996 / 17:21:10 / cg" |
3946 "Modified: 15.10.1996 / 18:59:53 / cg" |
3917 ! |
3947 ! |
3918 |
3948 |
3919 updateVersionMethodFor:newRevisionString |
3949 updateVersionMethodFor:newRevisionString |
3920 "helper for the checkin procedure. |
3950 "helper for the checkin procedure. |
3921 Update my #version method, to now return newRevisionString." |
3951 Update my #version method, to now return newRevisionString." |
3922 |
3952 |
3923 |cls "vs m mgr"| |
3953 |cls "vs m mgr"| |
3924 |
3954 |
3925 cls := self. |
3955 cls := self. |
3926 self isMeta ifFalse:[ |
3956 self isMeta ifFalse:[ |
3927 cls := self class |
3957 cls := self class |
3928 ]. |
3958 ]. |
|
3959 |
3929 "/ m := cls compiledMethodAt:#version. |
3960 "/ m := cls compiledMethodAt:#version. |
3930 "/ m isNil ifTrue:[^ false]. |
3961 "/ m isNil ifTrue:[^ false]. |
3931 "/ vs := self revisionString. |
3962 "/ vs := self revisionString. |
3932 "/ vs isNil ifTrue:[^ false]. |
3963 "/ vs isNil ifTrue:[^ false]. |
3933 "/ |
3964 "/ |
3934 "/ (mgr := self sourceCodeManager) isNil ifTrue:[^ false]. |
3965 "/ (mgr := self sourceCodeManager) isNil ifTrue:[^ false]. |
3935 "/ newString := mgr updatedRevisionStringOf:cls forRevision:newRevision with:vs. |
3966 "/ newString := mgr updatedRevisionStringOf:cls forRevision:newRevision with:vs. |
3936 "/ newString isNil ifTrue:[^ false]. |
3967 "/ newString isNil ifTrue:[^ false]. |
3937 |
3968 |
3938 Class withoutUpdatingChangesDo:[ |
3969 Class withoutUpdatingChangesDo:[ |
3939 Compiler compile:'version |
3970 Compiler compile:'version |
3940 ^ ''' , newRevisionString , ''' |
3971 ^ ''' , newRevisionString , ''' |
3941 ' |
3972 ' |
3942 forClass:cls inCategory:#documentation notifying:nil |
3973 forClass:cls inCategory:#documentation notifying:nil |
3943 install:true skipIfSame:false silent:true. |
3974 install:true skipIfSame:false silent:true. |
3944 ]. |
3975 ]. |
3945 "/ ('updated to :' , newRevisionString) printNL. |
3976 "/ ('updated to :' , newRevisionString) printNL. |
3946 |
3977 |
3947 ^ true |
3978 ^ true |
3948 |
3979 |
3949 "Created: 7.12.1995 / 20:42:22 / cg" |
3980 "Created: 7.12.1995 / 20:42:22 / cg" |
3950 "Modified: 7.12.1995 / 23:34:43 / cg" |
3981 "Modified: 15.10.1996 / 18:59:58 / cg" |
3951 ! ! |
3982 ! ! |
3952 |
3983 |
3953 !Class class methodsFor:'documentation'! |
3984 !Class class methodsFor:'documentation'! |
3954 |
3985 |
3955 version |
3986 version |
3956 ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.186 1996-10-15 11:29:55 cg Exp $' |
3987 ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.187 1996-10-15 18:00:43 cg Exp $' |
3957 ! ! |
3988 ! ! |
3958 Class initialize! |
3989 Class initialize! |