ClassDescr.st
author Claus Gittinger <cg@exept.de>
Thu, 23 Nov 1995 11:46:35 +0100
changeset 620 c7353f86a302
parent 528 a083413dfbe8
child 662 df7953db3847
permissions -rw-r--r--
checkin from browser
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
308
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
    47
	name            <String>        the classes name
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
    48
	category        <String>        the classes category
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
    49
	instvars        <String>        the names of the instance variables
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
    50
	primitiveSpec   <Array|nil>     describes primitiveIncludes, primitiveFunctions etc.
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
    51
	signature       <SmallInteger>  the classes signature (used to detect obsolete
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
    52
					or changed classes with binaryStorage)
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    53
"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    54
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    55
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    56
version
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    57
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ClassDescr.st,v 1.21 1995-11-23 10:46:35 cg Exp $'
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
    58
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    59
356
claus
parents: 328
diff changeset
    60
!ClassDescription class methodsFor:'instance creation'!
claus
parents: 328
diff changeset
    61
claus
parents: 328
diff changeset
    62
new
claus
parents: 328
diff changeset
    63
    "creates and returns a new class.
claus
parents: 328
diff changeset
    64
     Redefined to give the new class at least some name info"
claus
parents: 328
diff changeset
    65
claus
parents: 328
diff changeset
    66
    |newClass|
claus
parents: 328
diff changeset
    67
claus
parents: 328
diff changeset
    68
    newClass := super new.
claus
parents: 328
diff changeset
    69
    newClass setName:('some' , self name).
claus
parents: 328
diff changeset
    70
    ^ newClass
claus
parents: 328
diff changeset
    71
! !
claus
parents: 328
diff changeset
    72
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    73
!ClassDescription methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
10
claus
parents: 3
diff changeset
    75
allInstVarNames
claus
parents: 3
diff changeset
    76
    "return a collection of all the instance variable name-strings
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    77
     this includes all superclass-instance variables.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    78
     Instvars of superclasses come first (i.e. the position matches
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    79
     the instVarAt:-index)."
10
claus
parents: 3
diff changeset
    80
claus
parents: 3
diff changeset
    81
    ^ self addAllInstVarNamesTo:(OrderedCollection new)
claus
parents: 3
diff changeset
    82
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    83
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    84
     Dictionary instVarNames       
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    85
     Dictionary allInstVarNames    
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    86
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
a27a279701f8 Initial revision
claus
parents:
diff changeset
    89
category
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    90
    "return the category of the class. 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    91
     The returned value may be a string or symbol."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
a27a279701f8 Initial revision
claus
parents:
diff changeset
    93
    ^ category
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    94
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    95
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    96
     Point category                
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    97
     Dictionary category           
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    98
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    99
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   100
a27a279701f8 Initial revision
claus
parents:
diff changeset
   101
category:aStringOrSymbol
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   102
    "set the category of the class to be the argument, aStringOrSymbol"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   103
249
claus
parents: 216
diff changeset
   104
    aStringOrSymbol isNil ifTrue:[
claus
parents: 216
diff changeset
   105
	category := aStringOrSymbol
claus
parents: 216
diff changeset
   106
    ] ifFalse:[
claus
parents: 216
diff changeset
   107
	category := aStringOrSymbol asSymbol
claus
parents: 216
diff changeset
   108
    ]
328
claus
parents: 308
diff changeset
   109
!
claus
parents: 308
diff changeset
   110
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   111
instVarAtOffset:index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   112
    "return the name of the instance variable at index"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   113
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   114
    ^ self allInstanceVariableNames at:index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   115
!
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
instVarNames
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   118
    "return a collection of the instance variable name-strings"
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
    instvars isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   121
	^ OrderedCollection new
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
    ^ instvars asCollectionOfWords
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   126
     Point instVarNames  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   127
    "
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
instVarOffsetOf:aVariableName
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   131
    "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
   132
     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
   133
     illegal names."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   134
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   135
    ^ self allInstVarNames indexOf:aVariableName ifAbsent:nil
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   138
instanceVariableOffsets
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   139
    "returns a dictionary containing the instance variable index
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   140
     for each instVar name"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   141
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   142
    |dict index|
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
    index := 0. dict := Dictionary new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   145
    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
   146
    ^ dict
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
     Point instanceVariableOffsets 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   150
     GraphicsContext instanceVariableOffsets 
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
!
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
instanceVariableString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   155
    "return a string of the instance variable names"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   156
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   157
    instvars isNil ifTrue:[^ ''].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   158
    ^ instvars
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   161
     Point instanceVariableString   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   162
    "
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
name
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   166
    "return the name of the class. In the current implementation,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   167
     this returns a string, but will be changed to Symbol soon."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   168
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   169
    ^ name
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   170
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   171
328
claus
parents: 308
diff changeset
   172
organization
claus
parents: 308
diff changeset
   173
    "for ST80 compatibility; 
claus
parents: 308
diff changeset
   174
     read the documentation in ClassOrganizer for more info."
claus
parents: 308
diff changeset
   175
claus
parents: 308
diff changeset
   176
    ^ ClassOrganizer for:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   177
! !
10
claus
parents: 3
diff changeset
   178
92
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
   179
!ClassDescription methodsFor:'printing & storing'!
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   180
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   181
displayString
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   182
    "return a string for display in inspectors"
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   183
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   184
    |nm more|
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   185
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   186
    category == #obsolete ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   187
	"add obsolete - to make life easier ..."
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   188
	more := ' (obsolete)'
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   189
    ].
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   190
    category == #removed ifTrue:[
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   191
	"add removed - to make life easier ..."
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   192
	more := ' (removed)'
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   193
    ].
293
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   194
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   195
    nm := self name.
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   196
    more isNil ifTrue:[^ nm].
31df3850e98c *** empty log message ***
claus
parents: 249
diff changeset
   197
    ^ nm , more    
68
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   198
! !
59faa75185ba *** empty log message ***
claus
parents: 10
diff changeset
   199
10
claus
parents: 3
diff changeset
   200
!ClassDescription methodsFor:'private'!
claus
parents: 3
diff changeset
   201
claus
parents: 3
diff changeset
   202
addAllInstVarNamesTo:aCollection
308
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
   203
    "helper for allInstVarNames - add the name-strings of the instance variables
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
   204
     and of the inst-vars of all superclasses to the argument, aCollection. 
f04744ef7b5d *** empty log message ***
claus
parents: 293
diff changeset
   205
     Return aCollection."
10
claus
parents: 3
diff changeset
   206
459
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   207
    |superInsts|
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   208
10
claus
parents: 3
diff changeset
   209
    (superclass notNil) ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   210
	superclass addAllInstVarNamesTo:aCollection
10
claus
parents: 3
diff changeset
   211
    ].
claus
parents: 3
diff changeset
   212
    instvars notNil ifTrue:[
155
edd7fc34e104 *** empty log message ***
claus
parents: 92
diff changeset
   213
	aCollection addAll:(instvars asCollectionOfWords).
459
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   214
    ] ifFalse:[
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   215
	"/ mhmh - either someone klduged around, or this is
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   216
	"/ a system running without sourceInfo. Generate
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   217
	"/ synthetic names.
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   218
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   219
	superclass isNil ifTrue:[
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   220
	    superInsts := 0
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   221
	] ifFalse:[
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   222
	    superInsts := superclass instSize
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   223
	].
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   224
	aCollection addAll:((superInsts+1 to:self instSize) 
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   225
				collect:[:index | '* instVar' , index printString , ' *'])
10
claus
parents: 3
diff changeset
   226
    ].
claus
parents: 3
diff changeset
   227
    ^ aCollection
459
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   228
744b144ae909 generate synthetic instvar names (for -sourceInfo)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
   229
    "Modified: 30.10.1995 / 19:46:21 / cg"
10
claus
parents: 3
diff changeset
   230
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   231
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   232
!ClassDescription methodsFor:'renaming'!
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
renameTo:newName
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   235
    "change the name of the class"
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
    |oldSym|
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
    oldSym := name asSymbol.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   240
    self setName:newName.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   241
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   242
    Smalltalk at:oldSym put:nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   243
    Smalltalk removeKey:oldSym.             "26.jun 93"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   244
    Smalltalk at:(newName asSymbol) put:self.
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
!ClassDescription methodsFor:'signature checking'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   248
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   249
classinstSizeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   250
    "for checking class compatibility: return some number based on 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   251
     the classinstSize from a signature key (not always the real classinstsize)."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   252
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   253
    ^ (aSignature bitShift:-7) bitAnd:7
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   254
!
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
instNameKeyFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   257
    "for checking class compatibility: return a number based on the
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   258
     names and order of the instance variables from a signature key."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   259
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   260
    ^ (aSignature bitShift:-14) bitAnd:16rFFFF
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   261
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
     Point instNameKeyFromSignature:Point signature.             
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   264
     Association instNameKeyFromSignature:Association signature.  
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
!
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
instSizeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   269
    "for checking class compatibility: return the some number based on
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   270
     the instSize from a signature key (not always the real instSize)."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   271
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   272
    ^ aSignature bitAnd:16r7F
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   275
     Class instSizeFromSignature:Point signature.     
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   276
     Class instSizeFromSignature:Association signature.   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   277
     Class instSizeFromSignature:Dictionary 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
!
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
instTypeFromSignature:aSignature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   282
    "for checking class compatibility: return some number based on
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   283
     the instType (i.e. variableBytes/Pointers etc.) from a signature key."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   284
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   285
    ^ (aSignature bitShift:-10) bitAnd:(Class maskIndexType)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   286
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
     Class instTypeFromSignature:Object signature.               
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   289
     Class instTypeFromSignature:Array signature.                
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   290
     Class instTypeFromSignature:String signature.               
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   291
     Class instTypeFromSignature:OrderedCollection signature.    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   292
    "
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
signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   296
    "return a signature number - this number is useful for a quick
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   297
     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
   298
     and the dynamic class loader.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   299
     Do NOT change the algorithm here - others may depend on it.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   300
     Also, the algorithm may change - so never interpret the returned value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   301
     (if at all, use the access #XXXFromSignature: methods)"
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
    |value   "{ Class: SmallInteger }"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   304
     nameKey "{ Class: SmallInteger }" |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   305
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   306
    signature notNil ifTrue:[^ signature].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   307
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   308
    value := self flags bitAnd:(Class maskIndexType).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   309
    value := (value bitShift:3) + ((self class instSize - Class instSize) bitAnd:7).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   310
    value := (value bitShift:7) + (self instSize bitAnd:16r7F).
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
    nameKey := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   313
    self allInstVarNames do:[:name |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   314
	nameKey := nameKey bitShift:1.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   315
	(nameKey bitAnd:16r10000) ~~ 0 ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   316
	    nameKey := nameKey bitXor:1.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   317
	    nameKey := nameKey bitAnd:16rFFFF.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   318
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   319
	nameKey := (nameKey + (name at:1) asciiValue) bitAnd:16rFFFF.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   320
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   321
    value := value + (nameKey bitShift:14).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   322
    signature := value.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   323
    ^ value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   324
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
     Array signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   327
     ByteArray signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   328
     View signature
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   329
    "
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
!ClassDescription methodsFor:'special accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   333
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   334
setInstanceVariableString:aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   335
    "set the classes instvarnames string - no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   336
     or updates are done and no changeList records are written.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   337
     This is NOT for general use."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   338
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   339
    instvars := aString.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   340
!
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
setName:aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   343
    "set the classes name - be careful, it will be still
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   344
     in the Smalltalk dictionary - under another key.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   345
     This is NOT for general use - see renameTo:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   346
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   347
    name := aString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   348
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   349