--- a/Structure.st Thu Jun 02 11:29:55 2016 +0200
+++ b/Structure.st Fri Jun 03 02:57:50 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1996 by Claus Gittinger
All Rights Reserved
@@ -13,13 +15,13 @@
"{ NameSpace: Smalltalk }"
-Object subclass:#Structure
- instanceVariableNames:'superclass flags methodDictionary lookupFunction instSize i1 i2
- i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20
- i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36
- i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50'
+Behavior subclass:#Structure
+ instanceVariableNames:'i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18
+ i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34
+ i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50'
classVariableNames:'OneInstance DummyClass ReadAccessMethods WriteAccessMethods
- OtherMethods OtherSelectors'
+ OtherMethods OtherSelectors IndexOfFlags IndexOfMethodDictionary
+ IndexOfInstSize'
poolDictionaries:''
category:'Programming-Support'
!
@@ -126,10 +128,13 @@
OneInstance isNil ifTrue:[
"/ check if the first few instvars correspond to Behavior's definition:
- (Behavior instSize + 1) == (self instanceVariableNames indexOf:#i1) ifFalse:[
- self halt:'you must change the definition of this class (instvars before i1 must match behavior''s)'.
- ].
-
+"/ (Behavior instSize + 1) == (self instanceVariableNames indexOf:#i1) ifFalse:[
+"/ self halt:'you must change the definition of this class (instvars before i1 must match behavior''s)'.
+"/ ].
+ IndexOfFlags := Behavior instVarIndexFor:'flags'.
+ IndexOfMethodDictionary := Behavior instVarIndexFor:'methodDictionary'.
+ IndexOfInstSize := Behavior instVarIndexFor:'instSize'.
+
OneInstance := self basicNew.
DummyClass := Behavior shallowCopy.
@@ -234,11 +239,11 @@
arr := Array new:(behviorsInstSize + nInsts).
"/ arr at:1 put:nil. "/ superclass
- arr at:2 put:(Behavior flagBehavior bitOr:Behavior flagPointers). "/ flags
- arr at:3 put:(MethodDictionary withKeys:sels andValues:mthds). "/ selectors & methods
-"/ arr at:4 put:nil. "/ lookupObject
- arr at:5 put:behviorsInstSize. "/ instSize
-
+ arr at:IndexOfFlags put:(Behavior flagBehavior bitOr:Behavior flagPointers). "/ flags
+ arr at:IndexOfMethodDictionary put:(MethodDictionary withKeys:sels andValues:mthds). "/ selectors & methods
+"/ arr at:IndexOfLookupObject put:nil. "/ lookupObject
+ arr at:IndexOfInstSize put:behviorsInstSize. "/ instSize
+
"/ now, the big trick ...
arr changeClassTo:DummyClass.