ClassDescr.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Jan 1996 19:22:35 +0100
changeset 905 75bf79eb2314
parent 662 df7953db3847
child 1091 2c5955064bbd
permissions -rw-r--r--
commentary
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
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    14
	 instanceVariableNames:'name category instvars primitiveSpec signature'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    15
	 classVariableNames:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    16
	 poolDictionaries:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
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
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
!ClassDescription methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    75
10
claus
parents: 3
diff changeset
    76
allInstVarNames
claus
parents: 3
diff changeset
    77
    "return a collection of all the instance variable name-strings
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    78
     this includes all superclass-instance variables.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    79
     Instvars of superclasses come first (i.e. the position matches
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    80
     the instVarAt:-index)."
10
claus
parents: 3
diff changeset
    81
claus
parents: 3
diff changeset
    82
    ^ self addAllInstVarNamesTo:(OrderedCollection new)
claus
parents: 3
diff changeset
    83
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    84
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    85
     Dictionary instVarNames       
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    86
     Dictionary allInstVarNames    
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    87
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    89
a27a279701f8 Initial revision
claus
parents:
diff changeset
    90
category
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    91
    "return the category of the class. 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    92
     The returned value may be a string or symbol."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    93
a27a279701f8 Initial revision
claus
parents:
diff changeset
    94
    ^ category
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    95
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    96
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    97
     Point category                
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    98
     Dictionary category           
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    99
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   100
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   101
a27a279701f8 Initial revision
claus
parents:
diff changeset
   102
category:aStringOrSymbol
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   103
    "set the category of the class to be the argument, aStringOrSymbol"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   104
249
claus
parents: 216
diff changeset
   105
    aStringOrSymbol isNil ifTrue:[
claus
parents: 216
diff changeset
   106
	category := aStringOrSymbol
claus
parents: 216
diff changeset
   107
    ] ifFalse:[
claus
parents: 216
diff changeset
   108
	category := aStringOrSymbol asSymbol
claus
parents: 216
diff changeset
   109
    ]
328
claus
parents: 308
diff changeset
   110
!
claus
parents: 308
diff changeset
   111
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   112
instVarAtOffset:index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   113
    "return the name of the instance variable at index"
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
    ^ self allInstanceVariableNames at:index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   116
!
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
instVarNames
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   119
    "return a collection of the instance variable name-strings"
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
    instvars isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   122
	^ OrderedCollection new
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
    ^ instvars asCollectionOfWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   125
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   126
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   127
     Point instVarNames  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   128
    "
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   131
instVarOffsetOf:aVariableName
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   132
    "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
   133
     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
   134
     illegal names."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   135
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   136
    ^ self allInstVarNames indexOf:aVariableName ifAbsent:nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   137
!
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
instanceVariableOffsets
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   140
    "returns a dictionary containing the instance variable index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   141
     for each instVar name"
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
    |dict index|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   144
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   145
    index := 0. dict := Dictionary new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   146
    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
   147
    ^ dict
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   150
     Point instanceVariableOffsets 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   151
     GraphicsContext instanceVariableOffsets 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   152
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   153
!
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
instanceVariableString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   156
    "return a string of the instance variable names"
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
    instvars isNil ifTrue:[^ ''].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   159
    ^ instvars
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   160
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   161
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   162
     Point instanceVariableString   
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
!
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
name
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   167
    "return the name of the class. In the current implementation,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   168
     this returns a string, but will be changed to Symbol soon."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   169
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   170
    ^ name
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   171
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   172
328
claus
parents: 308
diff changeset
   173
organization
claus
parents: 308
diff changeset
   174
    "for ST80 compatibility; 
claus
parents: 308
diff changeset
   175
     read the documentation in ClassOrganizer for more info."
claus
parents: 308
diff changeset
   176
claus
parents: 308
diff changeset
   177
    ^ ClassOrganizer for:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   178
! !
10
claus
parents: 3
diff changeset
   179
92
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
   180
!ClassDescription methodsFor:'printing & storing'!
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   181
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   182
displayString
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   183
    "return a string for display in inspectors"
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   184
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   185
    |nm more|
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   186
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   187
    category == #obsolete ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   188
	"add obsolete - to make life easier ..."
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   189
	more := ' (obsolete)'
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   190
    ].
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   191
    category == #removed ifTrue:[
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   192
	"add removed - to make life easier ..."
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   193
	more := ' (removed)'
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   194
    ].
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   195
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   196
    nm := self name.
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   197
    more isNil ifTrue:[^ nm].
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   198
    ^ nm , more    
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   199
! !
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   200
10
claus
parents: 3
diff changeset
   201
!ClassDescription methodsFor:'private'!
claus
parents: 3
diff changeset
   202
claus
parents: 3
diff changeset
   203
addAllInstVarNamesTo:aCollection
308
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
   204
    "helper for allInstVarNames - add the name-strings of the instance variables
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
   205
     and of the inst-vars of all superclasses to the argument, aCollection. 
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
   206
     Return aCollection."
10
claus
parents: 3
diff changeset
   207
459
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   208
    |superInsts|
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   209
10
claus
parents: 3
diff changeset
   210
    (superclass notNil) ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   211
	superclass addAllInstVarNamesTo:aCollection
10
claus
parents: 3
diff changeset
   212
    ].
claus
parents: 3
diff changeset
   213
    instvars notNil ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   214
	aCollection addAll:(instvars asCollectionOfWords).
459
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   215
    ] ifFalse:[
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   216
	"/ mhmh - either someone klduged around, or this is
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   217
	"/ a system running without sourceInfo. Generate
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   218
	"/ synthetic names.
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   219
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   220
	superclass isNil ifTrue:[
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   221
	    superInsts := 0
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   222
	] ifFalse:[
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   223
	    superInsts := superclass instSize
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   224
	].
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   225
	aCollection addAll:((superInsts+1 to:self instSize) 
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   226
				collect:[:index | '* instVar' , index printString , ' *'])
10
claus
parents: 3
diff changeset
   227
    ].
claus
parents: 3
diff changeset
   228
    ^ aCollection
459
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   229
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   230
    "Modified: 30.10.1995 / 19:46:21 / cg"
10
claus
parents: 3
diff changeset
   231
! !
620
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
!ClassDescription methodsFor:'renaming'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   234
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   235
renameTo:newName
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   236
    "change the name of the class"
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
    |oldSym|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   239
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   240
    oldSym := name asSymbol.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   241
    self setName:newName.
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
    Smalltalk at:oldSym put:nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   244
    Smalltalk removeKey:oldSym.             "26.jun 93"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
    Smalltalk at:(newName asSymbol) put:self.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   246
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   248
!ClassDescription methodsFor:'signature checking'!
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
classinstSizeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   251
    "for checking class compatibility: return some number based on 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   252
     the classinstSize from a signature key (not always the real classinstsize)."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   253
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   254
    ^ (aSignature bitShift:-7) bitAnd:7
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   257
instNameKeyFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   258
    "for checking class compatibility: return a number based on the
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   259
     names and order of the instance variables from a signature key."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   260
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   261
    ^ (aSignature bitShift:-14) bitAnd:16rFFFF
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   262
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
     Point instNameKeyFromSignature:Point signature.             
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   265
     Association instNameKeyFromSignature:Association signature.  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   266
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   267
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   268
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   269
instSizeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   270
    "for checking class compatibility: return the some number based on
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   271
     the instSize from a signature key (not always the real instSize)."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   272
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   273
    ^ aSignature bitAnd:16r7F
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   274
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   275
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   276
     Class instSizeFromSignature:Point signature.     
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   277
     Class instSizeFromSignature:Association signature.   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   278
     Class instSizeFromSignature:Dictionary signature.    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   279
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   280
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   281
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   282
instTypeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   283
    "for checking class compatibility: return some number based on
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   284
     the instType (i.e. variableBytes/Pointers etc.) from a signature key."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   285
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   286
    ^ (aSignature bitShift:-10) bitAnd:(Class maskIndexType)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   287
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   288
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   289
     Class instTypeFromSignature:Object signature.               
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   290
     Class instTypeFromSignature:Array signature.                
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   291
     Class instTypeFromSignature:String signature.               
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   292
     Class instTypeFromSignature:OrderedCollection signature.    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   293
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   294
!
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
signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   297
    "return a signature number - this number is useful for a quick
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   298
     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
   299
     and the dynamic class loader.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   300
     Do NOT change the algorithm here - others may depend on it.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   301
     Also, the algorithm may change - so never interpret the returned value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   302
     (if at all, use the access #XXXFromSignature: methods)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   303
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   304
    |value   "{ Class: SmallInteger }"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   305
     nameKey "{ Class: SmallInteger }" |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   306
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   307
    signature notNil ifTrue:[^ signature].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   308
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   309
    value := self flags bitAnd:(Class maskIndexType).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   310
    value := (value bitShift:3) + ((self class instSize - Class instSize) bitAnd:7).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   311
    value := (value bitShift:7) + (self instSize bitAnd:16r7F).
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
    nameKey := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   314
    self allInstVarNames do:[:name |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   315
	nameKey := nameKey bitShift:1.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   316
	(nameKey bitAnd:16r10000) ~~ 0 ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   317
	    nameKey := nameKey bitXor:1.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   318
	    nameKey := nameKey bitAnd:16rFFFF.
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
	nameKey := (nameKey + (name at:1) asciiValue) bitAnd:16rFFFF.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   321
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   322
    value := value + (nameKey bitShift:14).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   323
    signature := value.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   324
    ^ value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   325
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   326
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   327
     Array signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   328
     ByteArray signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   329
     View signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   330
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   331
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   332
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   333
!ClassDescription methodsFor:'special accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   334
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   335
setInstanceVariableString:aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   336
    "set the classes instvarnames string - no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   337
     or updates are done and no changeList records are written.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   338
     This is NOT for general use."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   339
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   340
    instvars := aString.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   341
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   342
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   343
setName:aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   344
    "set the classes name - be careful, it will be still
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   345
     in the Smalltalk dictionary - under another key.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   346
     This is NOT for general use - see renameTo:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   347
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   348
    name := aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   349
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   350
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   351
!ClassDescription class methodsFor:'documentation'!
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   352
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   353
version
905
75bf79eb2314 commentary
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   354
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ClassDescr.st,v 1.23 1996-01-25 18:22:35 cg Exp $'
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   355
! !