Class.st
changeset 1667 253c5f7340ba
parent 1661 3d9c07c3390d
child 1669 4951596746f7
equal deleted inserted replaced
1666:4797ec69fc53 1667:253c5f7340ba
  3726     "Modified: 7.12.1995 / 23:34:43 / cg"
  3726     "Modified: 7.12.1995 / 23:34:43 / cg"
  3727 ! !
  3727 ! !
  3728 
  3728 
  3729 !Class methodsFor:'subclass creation'!
  3729 !Class methodsFor:'subclass creation'!
  3730 
  3730 
  3731 subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3731 subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3732     "create a new class as a subclass of an existing class (the receiver).
  3732     "create a new class as a subclass of an existing class (the receiver).
  3733      The subclass will have indexed variables if the receiving-class has."
  3733      The subclass will have indexed variables if the receiving-class has."
  3734 
  3734 
  3735     self isVariable ifFalse:[
  3735     self isVariable ifFalse:[
  3736 	^ self class
  3736         ^ self class
  3737 	    name:t
  3737             name:nameSymbol
  3738 	    inEnvironment:(Smalltalk currentNameSpace)
  3738             inEnvironment:(Smalltalk currentNameSpace)
  3739 	    subclassOf:self
  3739             subclassOf:self
  3740 	    instanceVariableNames:f
  3740             instanceVariableNames:instVarNameString
  3741 	    variable:false
  3741             variable:false
  3742 	    words:true
  3742             words:true
  3743 	    pointers:true
  3743             pointers:true
  3744 	    classVariableNames:d
  3744             classVariableNames:classVarString
  3745 	    poolDictionaries:s
  3745             poolDictionaries:pool
  3746 	    category:cat
  3746             category:cat
  3747 	    comment:nil
  3747             comment:nil
  3748 	    changed:true 
  3748             changed:true 
  3749     ].
  3749     ].
  3750     self isBytes ifTrue:[
  3750     self isBytes ifTrue:[
  3751 	^ self
  3751         ^ self
  3752 	    variableByteSubclass:t
  3752             variableByteSubclass:nameSymbol
  3753 	    instanceVariableNames:f
  3753             instanceVariableNames:instVarNameString
  3754 	    classVariableNames:d
  3754             classVariableNames:classVarString
  3755 	    poolDictionaries:s
  3755             poolDictionaries:pool
  3756 	    category:cat
  3756             category:cat
  3757     ].
  3757     ].
  3758     self isLongs ifTrue:[
  3758     self isLongs ifTrue:[
  3759 	^ self
  3759         ^ self
  3760 	    variableLongSubclass:t
  3760             variableLongSubclass:nameSymbol
  3761 	    instanceVariableNames:f
  3761             instanceVariableNames:instVarNameString
  3762 	    classVariableNames:d
  3762             classVariableNames:classVarString
  3763 	    poolDictionaries:s
  3763             poolDictionaries:pool
  3764 	    category:cat
  3764             category:cat
  3765     ].
  3765     ].
  3766     self isFloats ifTrue:[
  3766     self isFloats ifTrue:[
  3767 	^ self
  3767         ^ self
  3768 	    variableFloatSubclass:t
  3768             variableFloatSubclass:nameSymbol
  3769 	    instanceVariableNames:f
  3769             instanceVariableNames:instVarNameString
  3770 	    classVariableNames:d
  3770             classVariableNames:classVarString
  3771 	    poolDictionaries:s
  3771             poolDictionaries:pool
  3772 	    category:cat
  3772             category:cat
  3773     ].
  3773     ].
  3774     self isDoubles ifTrue:[
  3774     self isDoubles ifTrue:[
  3775 	^ self
  3775         ^ self
  3776 	    variableDoubleSubclass:t
  3776             variableDoubleSubclass:nameSymbol
  3777 	    instanceVariableNames:f
  3777             instanceVariableNames:instVarNameString
  3778 	    classVariableNames:d
  3778             classVariableNames:classVarString
  3779 	    poolDictionaries:s
  3779             poolDictionaries:pool
  3780 	    category:cat
  3780             category:cat
  3781     ].
  3781     ].
  3782     self isWords ifTrue:[
  3782     self isWords ifTrue:[
  3783 	^ self
  3783         ^ self
  3784 	    variableWordSubclass:t
  3784             variableWordSubclass:nameSymbol
  3785 	    instanceVariableNames:f
  3785             instanceVariableNames:instVarNameString
  3786 	    classVariableNames:d
  3786             classVariableNames:classVarString
  3787 	    poolDictionaries:s
  3787             poolDictionaries:pool
  3788 	    category:cat
  3788             category:cat
  3789     ].
  3789     ].
  3790     self isSignedWords ifTrue:[
  3790     self isSignedWords ifTrue:[
  3791         ^ self
  3791         ^ self
  3792             variableSignedWordSubclass:t
  3792             variableSignedWordSubclass:nameSymbol
  3793             instanceVariableNames:f
  3793             instanceVariableNames:instVarNameString
  3794             classVariableNames:d
  3794             classVariableNames:classVarString
  3795             poolDictionaries:s
  3795             poolDictionaries:pool
  3796             category:cat
  3796             category:cat
  3797     ].
  3797     ].
  3798     self isSignedLongs ifTrue:[
  3798     self isSignedLongs ifTrue:[
  3799         ^ self
  3799         ^ self
  3800             variableSignedLongSubclass:t
  3800             variableSignedLongSubclass:nameSymbol
  3801             instanceVariableNames:f
  3801             instanceVariableNames:instVarNameString
  3802             classVariableNames:d
  3802             classVariableNames:classVarString
  3803             poolDictionaries:s
  3803             poolDictionaries:pool
  3804             category:cat
  3804             category:cat
  3805     ].
  3805     ].
  3806 
  3806 
  3807     ^ self
  3807     ^ self
  3808 	variableSubclass:t
  3808         variableSubclass:nameSymbol
  3809 	instanceVariableNames:f
  3809         instanceVariableNames:instVarNameString
  3810 	classVariableNames:d
  3810         classVariableNames:classVarString
  3811 	poolDictionaries:s
  3811         poolDictionaries:pool
  3812 	category:cat
  3812         category:cat
  3813 !
  3813 
  3814 
  3814     "Modified: 18.9.1996 / 15:22:08 / cg"
  3815 variableByteSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3815 !
       
  3816 
       
  3817 variableByteSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3816     "create a new class as a subclass of an existing class (the receiver) 
  3818     "create a new class as a subclass of an existing class (the receiver) 
  3817      in which the subclass has indexable byte-sized nonpointer variables"
  3819      in which the subclass has indexable byte-sized nonpointer variables"
  3818 
  3820 
  3819     self isVariable ifTrue:[
  3821     self isVariable ifTrue:[
  3820 	self isBytes ifFalse:[
  3822         self isBytes ifFalse:[
  3821 	    ^ self error:
  3823             ^ self error:
  3822 		'cannot make a variable byte subclass of a variable non-byte class'
  3824                 'cannot make a variable byte subclass of a variable non-byte class'
  3823 	].
  3825         ].
  3824     ].
  3826     ].
  3825 
  3827 
  3826     ^ self class
  3828     ^ self class
  3827 	name:t
  3829         name:nameSymbol
  3828 	inEnvironment:(Smalltalk currentNameSpace)
  3830         inEnvironment:(Smalltalk currentNameSpace)
  3829 	subclassOf:self
  3831         subclassOf:self
  3830 	instanceVariableNames:f
  3832         instanceVariableNames:instVarNameString
  3831 	variable:true
  3833         variable:true
  3832 	words:false
  3834         words:false
  3833 	pointers:false
  3835         pointers:false
  3834 	classVariableNames:d
  3836         classVariableNames:classVarString
  3835 	poolDictionaries:s
  3837         poolDictionaries:pool
  3836 	category:cat
  3838         category:cat
  3837 	comment:nil
  3839         comment:nil
  3838 	changed:true 
  3840         changed:true
  3839 !
  3841 
  3840 
  3842     "Modified: 18.9.1996 / 15:24:54 / cg"
  3841 variableDoubleSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3843 !
       
  3844 
       
  3845 variableDoubleSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3842 
  3846 
  3843     "create a new class as a subclass of an existing class (the receiver) 
  3847     "create a new class as a subclass of an existing class (the receiver) 
  3844      in which the subclass has indexable double-sized nonpointer variables"
  3848      in which the subclass has indexable double-sized nonpointer variables"
  3845 
  3849 
  3846     self isVariable ifTrue:[
  3850     self isVariable ifTrue:[
  3847 	self isDoubles ifFalse:[
  3851         self isDoubles ifFalse:[
  3848 	    ^ self error:
  3852             ^ self error:
  3849 		'cannot make a variable double subclass of a variable non-double class'
  3853                 'cannot make a variable double subclass of a variable non-double class'
  3850 	].
  3854         ].
  3851     ].
  3855     ].
  3852 
  3856 
  3853     ^ self class
  3857     ^ self class
  3854 	name:t
  3858         name:nameSymbol
  3855 	inEnvironment:(Smalltalk currentNameSpace)
  3859         inEnvironment:(Smalltalk currentNameSpace)
  3856 	subclassOf:self
  3860         subclassOf:self
  3857 	instanceVariableNames:f
  3861         instanceVariableNames:instVarNameString
  3858 	variable:#double 
  3862         variable:#double 
  3859 	words:false
  3863         words:false
  3860 	pointers:false
  3864         pointers:false
  3861 	classVariableNames:d
  3865         classVariableNames:classVarString
  3862 	poolDictionaries:s
  3866         poolDictionaries:pool
  3863 	category:cat
  3867         category:cat
  3864 	comment:nil
  3868         comment:nil
  3865 	changed:true 
  3869         changed:true
  3866 !
  3870 
  3867 
  3871     "Modified: 18.9.1996 / 15:25:03 / cg"
  3868 variableFloatSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3872 !
       
  3873 
       
  3874 variableFloatSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3869 
  3875 
  3870     "create a new class as a subclass of an existing class (the receiver) 
  3876     "create a new class as a subclass of an existing class (the receiver) 
  3871      in which the subclass has indexable float-sized nonpointer variables"
  3877      in which the subclass has indexable float-sized nonpointer variables"
  3872 
  3878 
  3873     self isVariable ifTrue:[
  3879     self isVariable ifTrue:[
  3874 	self isFloats ifFalse:[
  3880         self isFloats ifFalse:[
  3875 	    ^ self error:
  3881             ^ self error:
  3876 		'cannot make a variable float subclass of a variable non-float class'
  3882                 'cannot make a variable float subclass of a variable non-float class'
  3877 	].
  3883         ].
  3878     ].
  3884     ].
  3879 
  3885 
  3880     ^ self class
  3886     ^ self class
  3881 	name:t
  3887         name:nameSymbol
  3882 	inEnvironment:(Smalltalk currentNameSpace)
  3888         inEnvironment:(Smalltalk currentNameSpace)
  3883 	subclassOf:self
  3889         subclassOf:self
  3884 	instanceVariableNames:f
  3890         instanceVariableNames:instVarNameString
  3885 	variable:#float 
  3891         variable:#float 
  3886 	words:false
  3892         words:false
  3887 	pointers:false
  3893         pointers:false
  3888 	classVariableNames:d
  3894         classVariableNames:classVarString
  3889 	poolDictionaries:s
  3895         poolDictionaries:pool
  3890 	category:cat
  3896         category:cat
  3891 	comment:nil
  3897         comment:nil
  3892 	changed:true 
  3898         changed:true
  3893 !
  3899 
  3894 
  3900     "Modified: 18.9.1996 / 15:25:14 / cg"
  3895 variableLongSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3901 !
       
  3902 
       
  3903 variableLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3896     "create a new class as a subclass of an existing class (the receiver) 
  3904     "create a new class as a subclass of an existing class (the receiver) 
  3897      in which the subclass has indexable long-sized nonpointer variables"
  3905      in which the subclass has indexable long-sized nonpointer variables"
  3898 
  3906 
  3899     self isVariable ifTrue:[
  3907     self isVariable ifTrue:[
  3900 	self isLongs ifFalse:[
  3908         self isLongs ifFalse:[
  3901 	    ^ self error:
  3909             ^ self error:
  3902 		'cannot make a variable long subclass of a variable non-long class'
  3910                 'cannot make a variable long subclass of a variable non-long class'
  3903 	].
  3911         ].
  3904     ].
  3912     ].
  3905 
  3913 
  3906     ^ self class
  3914     ^ self class
  3907 	name:t
  3915         name:nameSymbol
  3908 	inEnvironment:(Smalltalk currentNameSpace)
  3916         inEnvironment:(Smalltalk currentNameSpace)
  3909 	subclassOf:self
  3917         subclassOf:self
  3910 	instanceVariableNames:f
  3918         instanceVariableNames:instVarNameString
  3911 	variable:#long 
  3919         variable:#long 
  3912 	words:false
  3920         words:false
  3913 	pointers:false
  3921         pointers:false
  3914 	classVariableNames:d
  3922         classVariableNames:classVarString
  3915 	poolDictionaries:s
  3923         poolDictionaries:pool
  3916 	category:cat
  3924         category:cat
  3917 	comment:nil
  3925         comment:nil
  3918 	changed:true 
  3926         changed:true
  3919 !
  3927 
  3920 
  3928     "Modified: 18.9.1996 / 15:25:22 / cg"
  3921 variableSignedLongSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3929 !
       
  3930 
       
  3931 variableSignedLongSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3922     "create a new class as a subclass of an existing class (the receiver) 
  3932     "create a new class as a subclass of an existing class (the receiver) 
  3923      in which the subclass has indexable signed long-sized nonpointer variables"
  3933      in which the subclass has indexable signed long-sized nonpointer variables"
  3924 
  3934 
  3925     self isVariable ifTrue:[
  3935     self isVariable ifTrue:[
  3926         self isSignedLongs ifFalse:[
  3936         self isSignedLongs ifFalse:[
  3928                 'cannot make a variable signed long subclass of a variable non-long class'
  3938                 'cannot make a variable signed long subclass of a variable non-long class'
  3929         ].
  3939         ].
  3930     ].
  3940     ].
  3931 
  3941 
  3932     ^ self class
  3942     ^ self class
  3933         name:t
  3943         name:nameSymbol
  3934         inEnvironment:(Smalltalk currentNameSpace)
  3944         inEnvironment:(Smalltalk currentNameSpace)
  3935         subclassOf:self
  3945         subclassOf:self
  3936         instanceVariableNames:f
  3946         instanceVariableNames:instVarNameString
  3937         variable:#signedLong
  3947         variable:#signedLong
  3938         words:false
  3948         words:false
  3939         pointers:false
  3949         pointers:false
  3940         classVariableNames:d
  3950         classVariableNames:classVarString
  3941         poolDictionaries:s
  3951         poolDictionaries:pool
  3942         category:cat
  3952         category:cat
  3943         comment:nil
  3953         comment:nil
  3944         changed:true 
  3954         changed:true
  3945 !
  3955 
  3946 
  3956     "Modified: 18.9.1996 / 15:25:31 / cg"
  3947 variableSignedWordSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3957 !
       
  3958 
       
  3959 variableSignedWordSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3948     "create a new class as a subclass of an existing class (the receiver) 
  3960     "create a new class as a subclass of an existing class (the receiver) 
  3949      in which the subclass has indexable word-sized signed nonpointer variables"
  3961      in which the subclass has indexable word-sized signed nonpointer variables"
  3950 
  3962 
  3951     self isVariable ifTrue:[
  3963     self isVariable ifTrue:[
  3952         self isSignedWords ifFalse:[
  3964         self isSignedWords ifFalse:[
  3954                 'cannot make a variable signed word subclass of a variable non-word class'
  3966                 'cannot make a variable signed word subclass of a variable non-word class'
  3955         ].
  3967         ].
  3956     ].
  3968     ].
  3957 
  3969 
  3958     ^ self class
  3970     ^ self class
  3959         name:t
  3971         name:nameSymbol
  3960         inEnvironment:(Smalltalk currentNameSpace)
  3972         inEnvironment:(Smalltalk currentNameSpace)
  3961         subclassOf:self
  3973         subclassOf:self
  3962         instanceVariableNames:f
  3974         instanceVariableNames:instVarNameString
  3963         variable:#signedWord
  3975         variable:#signedWord
  3964         words:false
  3976         words:false
  3965         pointers:false
  3977         pointers:false
  3966         classVariableNames:d
  3978         classVariableNames:classVarString
  3967         poolDictionaries:s
  3979         poolDictionaries:pool
  3968         category:cat
  3980         category:cat
  3969         comment:nil
  3981         comment:nil
  3970         changed:true 
  3982         changed:true
  3971 !
  3983 
  3972 
  3984     "Modified: 18.9.1996 / 15:25:40 / cg"
  3973 variableSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  3985 !
       
  3986 
       
  3987 variableSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  3974     "create a new class as a subclass of an existing class (the receiver) 
  3988     "create a new class as a subclass of an existing class (the receiver) 
  3975      in which the subclass has indexable pointer variables"
  3989      in which the subclass has indexable pointer variables"
  3976 
  3990 
  3977     self isVariable ifTrue:[
  3991     self isVariable ifTrue:[
  3978 	self isPointers ifFalse:[
  3992         self isPointers ifFalse:[
  3979 	    ^ self error:
  3993             ^ self error:
  3980 		'cannot make a variable pointer subclass of a variable non-pointer class'
  3994                 'cannot make a variable pointer subclass of a variable non-pointer class'
  3981 	]
  3995         ]
  3982     ].
  3996     ].
  3983 
  3997 
  3984     ^ self class
  3998     ^ self class
  3985 	name:t
  3999         name:nameSymbol
  3986 	inEnvironment:(Smalltalk currentNameSpace)
  4000         inEnvironment:(Smalltalk currentNameSpace)
  3987 	subclassOf:self
  4001         subclassOf:self
  3988 	instanceVariableNames:f
  4002         instanceVariableNames:instVarNameString
  3989 	variable:true
  4003         variable:true
  3990 	words:false
  4004         words:false
  3991 	pointers:true
  4005         pointers:true
  3992 	classVariableNames:d
  4006         classVariableNames:classVarString
  3993 	poolDictionaries:s
  4007         poolDictionaries:pool
  3994 	category:cat
  4008         category:cat
  3995 	comment:nil
  4009         comment:nil
  3996 	changed:true 
  4010         changed:true
  3997 !
  4011 
  3998 
  4012     "Modified: 18.9.1996 / 15:25:46 / cg"
  3999 variableWordSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
  4013 !
       
  4014 
       
  4015 variableWordSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
  4000     "create a new class as a subclass of an existing class (the receiver) 
  4016     "create a new class as a subclass of an existing class (the receiver) 
  4001      in which the subclass has indexable word-sized nonpointer variables"
  4017      in which the subclass has indexable word-sized nonpointer variables"
  4002 
  4018 
  4003     self isVariable ifTrue:[
  4019     self isVariable ifTrue:[
  4004 	self isWords ifFalse:[
  4020         self isWords ifFalse:[
  4005 	    ^ self error:
  4021             ^ self error:
  4006 		'cannot make a variable word subclass of a variable non-word class'
  4022                 'cannot make a variable word subclass of a variable non-word class'
  4007 	].
  4023         ].
  4008     ].
  4024     ].
  4009 
  4025 
  4010     ^ self class
  4026     ^ self class
  4011 	name:t
  4027         name:nameSymbol
  4012 	inEnvironment:(Smalltalk currentNameSpace)
  4028         inEnvironment:(Smalltalk currentNameSpace)
  4013 	subclassOf:self
  4029         subclassOf:self
  4014 	instanceVariableNames:f
  4030         instanceVariableNames:instVarNameString
  4015 	variable:true
  4031         variable:true
  4016 	words:true
  4032         words:true
  4017 	pointers:false
  4033         pointers:false
  4018 	classVariableNames:d
  4034         classVariableNames:classVarString
  4019 	poolDictionaries:s
  4035         poolDictionaries:pool
  4020 	category:cat
  4036         category:cat
  4021 	comment:nil
  4037         comment:nil
  4022 	changed:true 
  4038         changed:true
       
  4039 
       
  4040     "Modified: 18.9.1996 / 15:25:53 / cg"
  4023 ! !
  4041 ! !
  4024 
  4042 
  4025 !Class  class methodsFor:'documentation'!
  4043 !Class  class methodsFor:'documentation'!
  4026 
  4044 
  4027 version
  4045 version
  4028     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.168 1996-09-12 07:42:45 cg Exp $'
  4046     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.169 1996-09-18 13:26:39 cg Exp $'
  4029 ! !
  4047 ! !
  4030 Class initialize!
  4048 Class initialize!