ClassDescr.st
author Claus Gittinger <cg@exept.de>
Tue, 16 Apr 1996 20:09:14 +0200
changeset 1193 5784d6b2b918
parent 1179 3e0f32177af4
child 1266 cef9b3cd49df
permissions -rw-r--r--
moved some protocol from Class to upper levels
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Behavior subclass:#ClassDescription
1091
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
    14
	instanceVariableNames:'name category instvars primitiveSpec signature'
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
    15
	classVariableNames:''
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
    16
	poolDictionaries:''
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
    17
	category:'Kernel-Classes'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    20
!ClassDescription class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    24
 COPYRIGHT (c) 1993 by Claus Gittinger
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
    25
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    26
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    35
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    36
documentation
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    37
"
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    38
    this class has been added for ST-80 compatibility only.
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    39
    All class stuff used to be in Behavior and Class - but, to be
356
claus
parents: 328
diff changeset
    40
    able to file in some PD code, it became nescessary to add C'Description
claus
parents: 328
diff changeset
    41
    in between it.
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    42
    ClassDescription adds some descriptive information to the basic
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    43
    Behavior class.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    44
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    45
    Instance variables:
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    46
905
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    47
	name            <Symbol>            the classes name
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    48
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    49
	category        <String | Symbol>   the classes category
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    50
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    51
	instvars        <String>            the names of the instance variables
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    52
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    53
	primitiveSpec   <Array | nil>       describes primitiveIncludes, primitiveFunctions etc.
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    54
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    55
	signature       <SmallInteger>      the classes signature (used to detect obsolete
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    56
					    or changed classes with binaryStorage)
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
    57
					    This is filled in lazy - i.e. upon the first signature query.
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    58
"
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    59
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    60
356
claus
parents: 328
diff changeset
    61
!ClassDescription class methodsFor:'instance creation'!
claus
parents: 328
diff changeset
    62
claus
parents: 328
diff changeset
    63
new
claus
parents: 328
diff changeset
    64
    "creates and returns a new class.
claus
parents: 328
diff changeset
    65
     Redefined to give the new class at least some name info"
claus
parents: 328
diff changeset
    66
claus
parents: 328
diff changeset
    67
    |newClass|
claus
parents: 328
diff changeset
    68
claus
parents: 328
diff changeset
    69
    newClass := super new.
claus
parents: 328
diff changeset
    70
    newClass setName:('some' , self name).
claus
parents: 328
diff changeset
    71
    ^ newClass
claus
parents: 328
diff changeset
    72
! !
claus
parents: 328
diff changeset
    73
1179
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    74
!ClassDescription class methodsFor:'queries'!
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    75
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    76
isBuiltInClass
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    77
    ^ self == ClassDescription class or:[self == ClassDescription]
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    78
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    79
    "Created: 15.4.1996 / 17:16:59 / cg"
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    80
! !
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1091
diff changeset
    81
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    82
!ClassDescription methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    83
a27a279701f8 Initial revision
claus
parents:
diff changeset
    84
category
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    85
    "return the category of the class. 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    86
     The returned value may be a string or symbol."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
    ^ category
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    89
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    90
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    91
     Point category                
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    92
     Dictionary category           
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    93
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    94
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    95
a27a279701f8 Initial revision
claus
parents:
diff changeset
    96
category:aStringOrSymbol
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    97
    "set the category of the class to be the argument, aStringOrSymbol"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    98
249
claus
parents: 216
diff changeset
    99
    aStringOrSymbol isNil ifTrue:[
claus
parents: 216
diff changeset
   100
	category := aStringOrSymbol
claus
parents: 216
diff changeset
   101
    ] ifFalse:[
claus
parents: 216
diff changeset
   102
	category := aStringOrSymbol asSymbol
claus
parents: 216
diff changeset
   103
    ]
328
claus
parents: 308
diff changeset
   104
!
claus
parents: 308
diff changeset
   105
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   106
instVarAtOffset:index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   107
    "return the name of the instance variable at index"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   108
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   109
    ^ self allInstanceVariableNames at:index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   110
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   111
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   112
instVarNames
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   113
    "return a collection of the instance variable name-strings"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   114
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   115
    instvars isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   116
	^ OrderedCollection new
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   117
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   118
    ^ instvars asCollectionOfWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   119
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   120
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   121
     Point instVarNames  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   122
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   123
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   124
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   125
instVarOffsetOf:aVariableName
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   126
    "return the index (as used in instVarAt:/instVarAt:put:) of a named instance
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   127
     variable. The returned number is 1..instSize for valid variable names, nil for
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   128
     illegal names."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   129
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   130
    ^ self allInstVarNames indexOf:aVariableName ifAbsent:nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   131
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   132
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   133
instanceVariableOffsets
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   134
    "returns a dictionary containing the instance variable index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   135
     for each instVar name"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   136
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   137
    |dict index|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   138
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   139
    index := 0. dict := Dictionary new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   140
    self allInstVarNames do:[:nm | index := index + 1. dict at:nm put:index].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   141
    ^ dict
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   142
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   143
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   144
     Point instanceVariableOffsets 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   145
     GraphicsContext instanceVariableOffsets 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   146
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   147
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   148
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   149
instanceVariableString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   150
    "return a string of the instance variable names"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   151
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   152
    instvars isNil ifTrue:[^ ''].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   153
    ^ instvars
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   154
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   155
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   156
     Point instanceVariableString   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   157
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   158
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   159
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   160
name
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   161
    "return the name of the class. In the current implementation,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   162
     this returns a string, but will be changed to Symbol soon."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   163
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   164
    ^ name
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   165
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   166
328
claus
parents: 308
diff changeset
   167
organization
claus
parents: 308
diff changeset
   168
    "for ST80 compatibility; 
claus
parents: 308
diff changeset
   169
     read the documentation in ClassOrganizer for more info."
claus
parents: 308
diff changeset
   170
claus
parents: 308
diff changeset
   171
    ^ ClassOrganizer for:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
! !
10
claus
parents: 3
diff changeset
   173
92
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
   174
!ClassDescription methodsFor:'printing & storing'!
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   175
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   176
displayString
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   177
    "return a string for display in inspectors"
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   178
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   179
    |nm more|
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   180
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   181
    category == #obsolete ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   182
	"add obsolete - to make life easier ..."
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   183
	more := ' (obsolete)'
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   184
    ].
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   185
    category == #removed ifTrue:[
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   186
	"add removed - to make life easier ..."
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   187
	more := ' (removed)'
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   188
    ].
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   189
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   190
    nm := self name.
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   191
    more isNil ifTrue:[^ nm].
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   192
    ^ nm , more    
1091
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   193
!
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   194
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   195
isObsolete 
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   196
    "return true, if the receiver is obsolete 
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   197
     (i.e. has been replaced by a different class or was removed, 
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   198
      but is still referenced by instanced)"
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   199
2c5955064bbd added #isObsolete
ca
parents: 905
diff changeset
   200
    ^ category == #obsolete or:[category == #removed]
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   201
! !
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   202
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   203
!ClassDescription methodsFor:'renaming'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   204
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   205
renameTo:newName
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   206
    "change the name of the class"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   207
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   208
    |oldSym|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   209
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   210
    oldSym := name asSymbol.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   211
    self setName:newName.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   212
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   213
    Smalltalk at:oldSym put:nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   214
    Smalltalk removeKey:oldSym.             "26.jun 93"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   215
    Smalltalk at:(newName asSymbol) put:self.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   216
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   217
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   218
!ClassDescription methodsFor:'signature checking'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   219
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   220
classinstSizeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   221
    "for checking class compatibility: return some number based on 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   222
     the classinstSize from a signature key (not always the real classinstsize)."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   223
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   224
    ^ (aSignature bitShift:-7) bitAnd:7
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   225
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   226
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   227
instNameKeyFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   228
    "for checking class compatibility: return a number based on the
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   229
     names and order of the instance variables from a signature key."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   230
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   231
    ^ (aSignature bitShift:-14) bitAnd:16rFFFF
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   232
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   233
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   234
     Point instNameKeyFromSignature:Point signature.             
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   235
     Association instNameKeyFromSignature:Association signature.  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   236
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   237
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   238
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   239
instSizeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   240
    "for checking class compatibility: return the some number based on
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   241
     the instSize from a signature key (not always the real instSize)."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   242
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   243
    ^ aSignature bitAnd:16r7F
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   244
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   246
     Class instSizeFromSignature:Point signature.     
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
     Class instSizeFromSignature:Association signature.   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   248
     Class instSizeFromSignature:Dictionary signature.    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   249
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   250
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   251
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   252
instTypeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   253
    "for checking class compatibility: return some number based on
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   254
     the instType (i.e. variableBytes/Pointers etc.) from a signature key."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   255
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   256
    ^ (aSignature bitShift:-10) bitAnd:(Class maskIndexType)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   257
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   258
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   259
     Class instTypeFromSignature:Object signature.               
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   260
     Class instTypeFromSignature:Array signature.                
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   261
     Class instTypeFromSignature:String signature.               
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   262
     Class instTypeFromSignature:OrderedCollection signature.    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   263
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   264
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   265
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   266
signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   267
    "return a signature number - this number is useful for a quick
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   268
     check for changed classes, and is done in the binary-object loader, 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   269
     and the dynamic class loader.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   270
     Do NOT change the algorithm here - others may depend on it.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   271
     Also, the algorithm may change - so never interpret the returned value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   272
     (if at all, use the access #XXXFromSignature: methods)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   273
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   274
    |value   "{ Class: SmallInteger }"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   275
     nameKey "{ Class: SmallInteger }" |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   276
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   277
    signature notNil ifTrue:[^ signature].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   278
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   279
    value := self flags bitAnd:(Class maskIndexType).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   280
    value := (value bitShift:3) + ((self class instSize - Class instSize) bitAnd:7).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   281
    value := (value bitShift:7) + (self instSize bitAnd:16r7F).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   282
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   283
    nameKey := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   284
    self allInstVarNames do:[:name |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   285
	nameKey := nameKey bitShift:1.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   286
	(nameKey bitAnd:16r10000) ~~ 0 ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   287
	    nameKey := nameKey bitXor:1.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   288
	    nameKey := nameKey bitAnd:16rFFFF.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   289
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   290
	nameKey := (nameKey + (name at:1) asciiValue) bitAnd:16rFFFF.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   291
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   292
    value := value + (nameKey bitShift:14).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   293
    signature := value.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   294
    ^ value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   295
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   296
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   297
     Array signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   298
     ByteArray signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   299
     View signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   300
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   301
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   302
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   303
!ClassDescription methodsFor:'special accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   304
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   305
setInstanceVariableString:aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   306
    "set the classes instvarnames string - no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   307
     or updates are done and no changeList records are written.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   308
     This is NOT for general use."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   309
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   310
    instvars := aString.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   311
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   312
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   313
setName:aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   314
    "set the classes name - be careful, it will be still
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   315
     in the Smalltalk dictionary - under another key.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   316
     This is NOT for general use - see renameTo:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   317
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   318
    name := aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   319
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   320
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   321
!ClassDescription class methodsFor:'documentation'!
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   322
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   323
version
1193
5784d6b2b918 moved some protocol from Class to upper levels
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
   324
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ClassDescr.st,v 1.26 1996-04-16 18:09:14 cg Exp $'
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   325
! !