"$Id: fac.self,v 1.1 1995/06/20 03:09:42 root Exp $" "#source code lines (in methods): 1050" _AddSlots: (| bvcP: p B: b = ( '' _ByteVectorConcatenate: b Prototype: p. ). |) _AddSlots: ( | world = (). | ) world _Define: ( | obj0 = (). obj1 = (). obj2 = (). obj3 = (). obj4 = (). obj5 = (). obj6 = (). obj7 = (). obj8 = (). obj9 = (). obj10 = (). obj11 = (). obj12 = (). obj13 = (). obj14 = (). obj15 = (). obj16 = (). obj17 = (). obj18 = self. obj19 = vector parent. obj20 = byteVector parent. obj21 = _ThisProcess parent. obj22 = byteVectorMirror parent. obj23 = (). obj24 = (). obj25 = vectorMirror parent. obj26 = floatMirror parent. obj27 = smiMirror parent. obj28 = slotsMirror parent. obj29 = stringMirror parent. obj30 = (). obj31 = nil. obj32 = true. obj33 = false. obj34 = (). obj35 = (). obj36 = (). obj37 = (). obj38 = (). obj39 = '' parent. obj40 = (). obj41 = [] parent. obj42 = (). obj43 = 0.0 parent. obj44 = 0 parent. obj45 = (). obj46 = (). obj47 = (). obj48 = (). obj49 = (). obj50 = (). obj51 = (). obj52 = (). obj53 = (). obj54 = (). obj55 = (). obj56 = (). obj57 = (). obj58 = (). obj59 = (). obj60 = (). obj61 = (). obj62 = (). obj63 = (). obj64 = (). obj65 = (). obj66 = (). obj67 = (). obj68 = (). obj69 = (). obj70 = (). obj71 = (). obj72 = (). obj73 = (). obj74 = (). obj75 = (). obj76 = (). obj77 = (). obj78 = (). obj79 = (). obj80 = (). obj81 = (). obj82 = (). obj83 = (). obj84 = (). obj85 = (). obj86 = (). obj87 = (). obj88 = (). obj89 = (). obj90 = (). obj91 = (). obj92 = (). obj93 = (). obj94 = (). obj95 = (). obj96 = (). obj97 = (). obj98 = (). obj99 = (). obj100 = (). obj101 = (). obj102 = (). obj103 = (). obj104 = (). obj105 = (). obj106 = (). obj107 = (). obj108 = (). obj109 = (). obj110 = (). obj111 = (). obj112 = (). obj113 = (). obj114 = (). obj115 = (). obj116 = (). obj117 = (). obj118 = (). obj119 = (). obj120 = (). obj121 = (). obj122 = (). obj123 = (). obj124 = (). obj125 = (). obj126 = (). obj127 = (). obj128 = (). obj129 = (). obj130 = (). obj131 = (). obj132 = (). obj133 = (). obj134 = (). obj135 = (). obj136 = (). obj137 = (). obj138 = (). obj139 = (). obj140 = (). obj141 = (). obj142 = (). obj143 = (). obj144 = (). obj145 = (). obj146 = (). obj147 = (). obj148 = (). obj149 = (). obj150 = (). obj151 = (). obj152 = (). obj153 = (). obj154 = (). obj155 = (). obj156 = (). obj157 = (). obj158 = (). obj159 = (). obj160 = (). obj161 = (). obj162 = (). obj163 = (). obj164 = (). obj165 = (). obj166 = (). obj167 = (). obj168 = (). obj169 = (). obj170 = (). obj171 = (). obj172 = (). obj173 = (). obj174 = (). obj175 = (). obj176 = (). obj177 = (). obj178 = (). obj179 = (). obj180 = (). obj181 = (). obj182 = (). obj183 = (). obj184 = (). obj185 = (). obj186 = (). obj187 = (). obj188 = (). obj189 = (). obj190 = (). obj191 = (). obj192 = (). obj193 = (). obj194 = (). obj195 = (). obj196 = (). obj197 = (). obj198 = (). obj199 = (). obj200 = (). obj201 = (). obj202 = (). obj203 = (). obj204 = (). obj205 = (). obj206 = (). obj207 = (). obj208 = _ThisProcess. obj209 = (). obj210 = (). obj211 = (). obj212 = (). obj213 = (). obj214 = (). obj215 = (). obj216 = (). obj217 = (). obj218 = (). obj219 = (). obj220 = (). obj221 = (). obj222 = (). obj223 = (). obj224 = (). obj225 = (). obj226 = (). obj227 = (). obj228 = (). obj229 = (). obj230 = (). obj231 = (). obj232 = (). obj233 = (). obj234 = byteVector. | ) world obj0 _AddSlots: ( | two = 2. square = ( * self ). half = ( / two ). inverse = ( 1.0 /= asFloat ). power: a = ( a reversePower: self ). log: a = ( | e <- 1. m <- 0 | a <= zero ifTrue: [ error: 'log: negative or zero argument'. ]. <= one ifTrue: [ error: 'log: receiver <= 1'. ]. [ e <= a ] whileTrue: [ e: * e. m: m +1. ]. ^ m - 1 ). negate = ( zero - self ). absoluteValue = ( >= zero ifTrue: [ self ] False: [ negate ] ). zero = 0. predecessor = ( - one ). one = 1. successor = ( + one ). pred = ( predecessor ). succ = ( successor ). sign = ( compare: zero IfLess: -1 Equal: 0 Greater: 1 ). parent* = world obj219. | ) world obj1 _Define: systemObjects vector _Clone: 16 Filler: world obj221 world obj1 _At: 3 Put: 'storeStringNeeds' (world obj1 _At: 4 Put: 'isImmutableForFilingOut') _At: 7 Put: 'printString' (world obj1 _At: 8 Put: 'isMorph') _At: 9 Put: 'storeString' (world obj1 _At: 10 Put: 'storeStringIfFail:') _At: 11 Put: 'printStringSize:' world obj1 _AddSlots: ( | parent* = world obj19. | ) world obj2 _AddSlots: ( | value <- 'no value'. prev <- world obj2. next <- world obj2. parent* = world obj3. | ) world obj3 _AddSlots: ( | doLinks: b = ( | head. lnk | head: next prev. lnk: next. [head == lnk] whileFalse: [ | saveNextToPermitRemoving | saveNextToPermitRemoving: lnk next. b value: lnk. lnk: saveNextToPermitRemoving. ]. self ). addNextLink: lnk = ( lnk next: next. next prev: lnk. lnk prev: self. next: lnk. self ). removeAll = ( next: self. prev: self ). parent* = world obj216. | ) world obj4 _AddSlots: ( | rep <- world obj2. size <- 0. parent* = world obj5. | ) world obj5 _AddSlots: ( | addFirst: elem = ( size: size + 1. rep addNextLink: link copy value: elem. self ). removeAll = ( size: 0. rep removeAll. self ). parent* = world obj36. do: block = ( rep doLinks: [|:lnk| block value: lnk value With: lnk value]. self ). copyRemoveAll = ( (clone rep: rep copy) removeAll ). | ) world obj6 _AddSlots: ( | factorial = ( <= 1 ifTrue: 1 False: [ * predecessor factorial ] ). even = ( ^ ( % 2) = 0 ). odd = ( even not. "Not not even but even not!" ). reversePowerNonNegative: base = ( "As reversePower, but assumes receiver is non-negative. Much faster than simple loop we used to have. Ole Agesen, 10/12/91." = 0 ifTrue: [ ^ 1 ]. odd ifTrue: [ ^ (pred reversePowerNonNegative: base) * base ]. ^ (half reversePowerNonNegative: base) square ). reversePower: base = ( | factor | "Raise to a power; receiver is exponent, argument is base" compare: 0 IfLess: [ factor: base inverse ] Equal: [ ^ 1 ] Greater: [ factor: base ]. ^ absoluteValue reversePowerNonNegative: factor ). /+ a = ( (+ a pred) / a ). upTo: end By: step Do: block = ( to: end predecessor By: step Do: block ). downTo: end By: step Do: block = ( to: end By: step negate Do: block ). do: block = ( 0 to: pred By: 1 Do: block. self ). asCharacterIfFail: block = ( '' characterFor: self IfFail: block ). to: end ByNegative: step Do: block = ( | i | i: self. [ i >= end ] whileTrue: [ block value: i With: i. i: i + step. ]. nil ). asCharacter = ( asCharacterIfFail: [ error: 'not a legal character' ] ). asInteger = ( self ). to: end ByPositive: step Do: block = ( | i | i: self. [ i <= end ] whileTrue: [ block value: i With: i. i: i + step. ]. nil ). absDigitListBase: base Do: blk = ( | rem <- 0 | rem: self. "(*) see comment above" [0 != rem] whileTrue: [| q <- 0. | q: rem / base. blk value: rem - (q * base). "Faster than 'rem % base'." rem: q. ]. self ). to: end By: step Do: block = ( 0 < step ifTrue: [ ^ to: end ByPositive: step Do: block ]. 0 > step ifTrue: [ ^ to: end ByNegative: step Do: block ]. error: 'step is zero in to:By:Do: loop' ). to: end Do: block = ( to: end By: 1 Do: block ). /= a = ( (% a) = 0 ifTrue: [/ a] False: [asFloat /= a asFloat] ). printStringBase: base = ( | chars. i <- 0. r | "return the string representation of the integer in a given base" (base > 16) ifTrue: [ error: 'base for printing must <= 16' ]. 0 = self ifTrue: [^ '0']. chars: list copyRemoveAll. digitListBase: base Do: [|:d| chars addFirst: ('0123456789abcdef' at: d). ]. 0 > self ifTrue: [chars addFirst: '-']. r: (mutableString copySize: chars size). chars do: [|:ch| r at: i Put: ch. i: i + 1]. r ). decimalPrintString = ( printStringBase: 10 ). printString = ( decimalPrintString ). upTo: end Do: block = ( to: end predecessor Do: block ). digitListBase: base Do: blk = ( "Iterate 'blk' over the digits in the receiver when expressed in base 'base'. The least significant digit is produced first." (2 > base) || [base != base asInteger] ifTrue: [ ^ error: 'base must be an integer > 2'. ]. absoluteValue absDigitListBase: base Do: blk ). parent* = world obj0. | ) world obj7 _AddSlots: ( | main = ( 50 do: [|:i| i print. '! = ' print. i factorial printLine. ]. self. ). | ) world obj8 _AddSlots: ( | copySize: len FillingWith: filler = ( cloneSize: len FillingWith: filler asByte ). parent* = world obj10. | ) world obj9 _AddSlots: ( | copySize: len FillingWith: filler = ( "this returns a mutable version" (mutableString copySize: len FillingWith: filler) fillFrom: self ). prototypeForCopying = world obj45. parent* = world obj10. | ) world obj10 _AddSlots: ( | cachedStoreCharacters = world obj17. cachedStoreCharacterSizes = world obj16. storeStringIfFail: fb = ( | len <- 0. outputIndex <- 0. r <- '' | " return a string suitable for embedding in a file which will then parse back to the original string " false ifTrue: [ "less optimized code:" do: [|:c | r: r, cachedStoreCharacters at: c asByte. ]. '\'', r, '\''. ]. " use two passes to go faster" size do: [|:i.| len: len + (cachedStoreCharacterSizes at: byteAt: i). ]. r: mutableString copySize: len + 2. r at: 0 Put: '\''. len = size ifTrue: [ "an optimization" size do: [|:i| r at: i succ PutByte: byteAt: i]. ] False: [ outputIndex: 1. size do: [|:i. t| t: cachedStoreCharacters at: byteAt: i. t size do: [|:j| r at: outputIndex PutByte: t byteAt: j. outputIndex: outputIndex succ. ]. ]. ]. r at: r size pred Put: '\''. r ). at: index Put: value IfAbsent: b = ( at: index PutByte: value asByte IfAbsent: b ). ascii = world obj15. characterFor: i IfFail: fb = ( ascii at: i IfAbsent: fb ). hash = ( canonicalize identityHash ). at: index IfAbsent: b = ( (byteAt: index IfAbsent: [|:e| ^ b value: e]) asCharacter ). asString = ( self ). firstByte = ( byteAt: firstKey ). asByteFor: op = ( 1 = size ifFalse: [ error: op, ' only works on strings of size 1, but I', ' (', self, ') have size ', size printString. ]. firstByte ). asByte = ( asByteFor: 'asByte' ). filler = ' '. print = ( scheduler isRunning ifTrue: [stdout write: asString] False: [asString _StringPrint]. self ). parent* = world obj20. | ) world obj11 _AddSlots: ( | reflecteeID = ( reflectee _ObjectID ). completeObjectSelectors = world obj30. isOKToSend: selector = ( isComplete && [ completeObjectSelectors includes: selector ] ). name = ( nameSize: maxSmallInt PrintString: (isOKToSend: 'printString') ifTrue: [ reflectee printString. ] False: '' ). reflecteeIfFail: errBlk = ( _MirrorReflecteeIfFail: errBlk ). parent* = world obj36. reflectee = ( reflecteeIfFail: raiseError ). safeName = ( ''. ). | ) world obj12 _AddSlots: ( | primitiveFailed = world obj23. | ) world obj13 _AddSlots: ( | quote: str = ( '\'', str, '\'' ). statePrintString = ( errorString ). parent* = world obj216. | ) world obj14 _AddSlots: ( | parent* = world obj13. | ) world obj15 _Define: systemObjects vector _Clone: 256 Filler: '\x00' (| parent* = world. i <- 0. @ x = ( obj15 _At: i Put: x. i: (1 _IntAdd: i). self ). build = ( @ '\x00' @ '\x01' @ '\x02' @ '\x03' @ '\x04' @ '\x05' @ '\x06' @ '\x07' @ '\x08' @ '\x09' @ '\x0a' @ '\x0b' @ '\x0c' @ '\x0d' @ '\x0e' @ '\x0f' @ '\x10' @ '\x11' @ '\x12' @ '\x13' @ '\x14' @ '\x15' @ '\x16' @ '\x17' @ '\x18' @ '\x19' @ '\x1a' @ '\x1b' @ '\x1c' @ '\x1d' @ '\x1e' @ '\x1f' @ ' ' @ '!' @ '"' @ '#' @ '$' @ '%' @ '&' @ '\'' @ '(' @ ')' @ '*' @ '+' @ ',' @ '-' @ '.' @ '/' @ '0' @ '1' @ '2' @ '3' @ '4' @ '5' @ '6' @ '7' @ '8' @ '9' @ ':' @ ';' @ '<' @ '=' @ '>' @ '?' @ '@' @ 'A' @ 'B' @ 'C' @ 'D' @ 'E' @ 'F' @ 'G' @ 'H' @ 'I' @ 'J' @ 'K' @ 'L' @ 'M' @ 'N' @ 'O' @ 'P' @ 'Q' @ 'R' @ 'S' @ 'T' @ 'U' @ 'V' @ 'W' @ 'X' @ 'Y' @ 'Z' @ '[' @ '\\' @ ']' @ '^' @ '_' @ '`' @ 'a' @ 'b' @ 'c' @ 'd' @ 'e' @ 'f' @ 'g' @ 'h' @ 'i' @ 'j' @ 'k' @ 'l' @ 'm' @ 'n' @ 'o' @ 'p' @ 'q' @ 'r' @ 's' @ 't' @ 'u' @ 'v' @ 'w' @ 'x' @ 'y' @ 'z' @ '{' @ '|' @ '}' @ '~' @ '\x7f' @ '\x80' @ '\x81' @ '\x82' @ '\x83' @ '\x84' @ '\x85' @ '\x86' @ '\x87' @ '\x88' @ '\x89' @ '\x8a' @ '\x8b' @ '\x8c' @ '\x8d' @ '\x8e' @ '\x8f' @ '\x90' @ '\x91' @ '\x92' @ '\x93' @ '\x94' @ '\x95' @ '\x96' @ '\x97' @ '\x98' @ '\x99' @ '\x9a' @ '\x9b' @ '\x9c' @ '\x9d' @ '\x9e' @ '\x9f' @ '\xa0' @ '\xa1' @ '\xa2' @ '\xa3' @ '\xa4' @ '\xa5' @ '\xa6' @ '\xa7' @ '\xa8' @ '\xa9' @ '\xaa' @ '\xab' @ '\xac' @ '\xad' @ '\xae' @ '\xaf' @ '\xb0' @ '\xb1' @ '\xb2' @ '\xb3' @ '\xb4' @ '\xb5' @ '\xb6' @ '\xb7' @ '\xb8' @ '\xb9' @ '\xba' @ '\xbb' @ '\xbc' @ '\xbd' @ '\xbe' @ '\xbf' @ '\xc0' @ '\xc1' @ '\xc2' @ '\xc3' @ '\xc4' @ '\xc5' @ '\xc6' @ '\xc7' @ '\xc8' @ '\xc9' @ '\xca' @ '\xcb' @ '\xcc' @ '\xcd' @ '\xce' @ '\xcf' @ '\xd0' @ '\xd1' @ '\xd2' @ '\xd3' @ '\xd4' @ '\xd5' @ '\xd6' @ '\xd7' @ '\xd8' @ '\xd9' @ '\xda' @ '\xdb' @ '\xdc' @ '\xdd' @ '\xde' @ '\xdf' @ '\xe0' @ '\xe1' @ '\xe2' @ '\xe3' @ '\xe4' @ '\xe5' @ '\xe6' @ '\xe7' @ '\xe8' @ '\xe9' @ '\xea' @ '\xeb' @ '\xec' @ '\xed' @ '\xee' @ '\xef' @ '\xf0' @ '\xf1' @ '\xf2' @ '\xf3' @ '\xf4' @ '\xf5' @ '\xf6' @ '\xf7' @ '\xf8' @ '\xf9' @ '\xfa' @ '\xfb' @ '\xfc' @ '\xfd' @ '\xfe' @ '\xff'. ). |) build world obj15 _AddSlots: ( | parent* = world obj19. | ) world obj16 _Define: systemObjects vector _Clone: 256 Filler: 4 (| parent* = world. i <- 0. @ x = ( obj16 _At: i Put: x. i: (1 _IntAdd: i). self ). build = ( @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 2 @ 2 @ 1 @ 1 @ 2 @ 2 @ 1 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 1 @ 1 @ 2 @ 1 @ 1 @ 1 @ 1 @ 2 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 2 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 1 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4 @ 4. ). |) build world obj16 _AddSlots: ( | parent* = world obj19. | ) world obj17 _Define: systemObjects vector _Clone: 256 Filler: '\x09' (| parent* = world. i <- 0. @ x = ( obj17 _At: i Put: x. i: (1 _IntAdd: i). self ). build = ( @ obj53 @ obj54 @ obj51 @ obj52 @ obj55 @ obj56 @ obj57 @ obj58 @ obj59 @ '\x09' @ '\x0a' @ obj60 @ obj61 @ '\x0d' @ obj62 @ obj63 @ obj64 @ obj65 @ obj66 @ obj67 @ obj68 @ obj69 @ obj70 @ obj71 @ obj72 @ obj73 @ obj74 @ obj46 @ obj47 @ obj48 @ obj49 @ obj50 @ ' ' @ '!' @ obj75 @ '#' @ '$' @ '%' @ '&' @ obj76 @ '(' @ ')' @ '*' @ '+' @ ',' @ '-' @ '.' @ '/' @ '0' @ '1' @ '2' @ '3' @ '4' @ '5' @ '6' @ '7' @ '8' @ '9' @ ':' @ ';' @ '<' @ '=' @ '>' @ '?' @ '@' @ 'A' @ 'B' @ 'C' @ 'D' @ 'E' @ 'F' @ 'G' @ 'H' @ 'I' @ 'J' @ 'K' @ 'L' @ 'M' @ 'N' @ 'O' @ 'P' @ 'Q' @ 'R' @ 'S' @ 'T' @ 'U' @ 'V' @ 'W' @ 'X' @ 'Y' @ 'Z' @ '[' @ obj77 @ ']' @ '^' @ '_' @ '`' @ 'a' @ 'b' @ 'c' @ 'd' @ 'e' @ 'f' @ 'g' @ 'h' @ 'i' @ 'j' @ 'k' @ 'l' @ 'm' @ 'n' @ 'o' @ 'p' @ 'q' @ 'r' @ 's' @ 't' @ 'u' @ 'v' @ 'w' @ 'x' @ 'y' @ 'z' @ '{' @ '|' @ '}' @ '~' @ obj78 @ obj79 @ obj80 @ obj81 @ obj82 @ obj83 @ obj84 @ obj85 @ obj86 @ obj87 @ obj88 @ obj89 @ obj90 @ obj91 @ obj92 @ obj93 @ obj94 @ obj95 @ obj96 @ obj97 @ obj98 @ obj99 @ obj100 @ obj101 @ obj102 @ obj103 @ obj104 @ obj105 @ obj106 @ obj107 @ obj108 @ obj109 @ obj110 @ obj111 @ obj112 @ obj113 @ obj114 @ obj115 @ obj116 @ obj117 @ obj118 @ obj119 @ obj120 @ obj121 @ obj122 @ obj123 @ obj124 @ obj125 @ obj126 @ obj127 @ obj128 @ obj129 @ obj130 @ obj131 @ obj132 @ obj133 @ obj134 @ obj135 @ obj136 @ obj137 @ obj138 @ obj139 @ obj140 @ obj141 @ obj142 @ obj143 @ obj144 @ obj145 @ obj146 @ obj147 @ obj148 @ obj149 @ obj150 @ obj151 @ obj152 @ obj153 @ obj154 @ obj155 @ obj156 @ obj157 @ obj158 @ obj159 @ obj160 @ obj161 @ obj162 @ obj163 @ obj164 @ obj165 @ obj166 @ obj167 @ obj168 @ obj169 @ obj170 @ obj171 @ obj172 @ obj173 @ obj174 @ obj175 @ obj176 @ obj177 @ obj178 @ obj179 @ obj180 @ obj181 @ obj182 @ obj183 @ obj184 @ obj185 @ obj186 @ obj187 @ obj188 @ obj189 @ obj190 @ obj191 @ obj192 @ obj193 @ obj194 @ obj195 @ obj196 @ obj197 @ obj198 @ obj199 @ obj200 @ obj201 @ obj202 @ obj203 @ obj204 @ obj205 @ obj206. ). |) build world obj17 _AddSlots: ( | parent* = world obj19. | ) world obj18 _AddSlots: ( | globals* = world obj35. defaultBehavior* = world obj212. | ) world obj19 _AddSlots: ( | at: index Put: value IfAbsent: block = ( asVector _At: index Put: value IfFail: [ | :error. :name. | ('badTypeError' == error) && [index asSmallInteger !== index] ifTrue: [ ^ asVector at: index asSmallInteger Put: value IfAbsent: block ]. if: error IsIndex: block Index: index Prim: name] ). size = ( asVector _Size ). asVector = ( self ). at: index IfAbsent: block = ( asVector _At: index IfFail: [ | :error. :name. | ('badTypeError' == error) && [index asSmallInteger !== index] ifTrue: [ ^ asVector at: index asSmallInteger IfAbsent: block ]. if: error IsIndex: block Index: index Prim: name] ). parent* = world obj231. | ) world obj20 _AddSlots: ( | at: index Put: value IfAbsent: block = ( at: index PutByte: value IfAbsent: block ). at: index IfAbsent: block = ( byteAt: index IfAbsent: block ). at: index PutByte: value = ( at: index PutByte: value IfAbsent: [error: index printString, ' is absent'] ). copy = ( clone ). byteVectorCompare: s IfFail: fb = ( _ByteVectorCompare: s IfFail: fb ). = s = ( 0 = (byteVectorCompare: s IfFail: [^ resend.= s]) ). at: index PutByte: value IfAbsent: block = ( asVMByteVector _ByteAt: index Put: value IfFail: [ | :error. :name. | ('badTypeError' == error) && [(index asSmallInteger !== index) || [value asSmallInteger !== value]] ifTrue: [ ^ asVMByteVector at: index asSmallInteger PutByte: value asSmallInteger IfAbsent: block ]. if: error IsIndex: block Index: index Prim: name] ). filler = 0. cIntSize: bitSize Signed: bool At: index IfFail: errBlk = ( bool ifTrue: [ _CSignedIntSize: bitSize At: index IfFail: errBlk ] False: [ _CUnsignedIntSize: bitSize At: index IfFail: errBlk ] ). cIntSize: bitSize Signed: bool At: index Put: anInt IfFail: errBlk = ( bool ifTrue: [ _CSignedIntSize: bitSize At: index Put: anInt IfFail: errBlk. ] False: [ _CUnsignedIntSize: bitSize At: index Put: anInt IfFail: errBlk. ]. self ). cloneBytesPrim: n Filler: filler = ( _CloneBytes: n Filler: filler IfFail: [|:error| 'outOfMemoryError' == error ifFalse: [ error: error ] True: [ memory allocationFailedBytes: n. ^_CloneBytes: n Filler: filler ] ] ). prototypeForCopying = ( "allows immutable children (strings) to substitute mutableString" self ). byteAt: index IfAbsent: block = ( asVMByteVector _ByteAt: index IfFail: [ | :error. :name. | ('badTypeError' == error) && [index asSmallInteger !== index] ifTrue: [ ^ asVMByteVector byteAt: index asSmallInteger IfAbsent: block ]. if: error IsIndex: block Index: index Prim: name] ). byteAt: index = ( byteAt: index IfAbsent: [error: index printString, ' is absent'] ). cloneSize: n FillingWith: filler = ( asVMByteVector cloneBytesPrim: n Filler: filler ). fillFrom: c = ( with: c Do: [|:v1. :v2. :k1. :k2| at: k1 Put: v2 asByte] ). asVMByteVector = ( self ). size = ( asVMByteVector _ByteSize ). copySize: n FillingWith: x = ( cloneSize: n FillingWith: x ). , arg = ( " NB: copy proto, not receiver -- otherwise, would create a string if rcvr is a string (but then the result should be old and canonicalized, and that's undesirable)" _ByteVectorConcatenate: arg Prototype: prototypeForCopying IfFail: [|:error| 'outOfMemoryError' == error ifTrue: [ memory allocationFailedBytes: size + arg size. ^_ByteVectorConcatenate: arg Prototype: prototypeForCopying ]. resend., arg ] ). parent* = world obj231. | ) world obj21 _AddSlots: ( | parent* = world obj216. suspendAndTrace: error = ( error: error. ). this = ( _ThisProcess ). | ) world obj22 _AddSlots: ( | parent* = world obj225. | ) world obj23 _AddSlots: ( | receiver. selector <- 'selector'. error <- 'some error'. parent* = world obj24. | ) world obj24 _AddSlots: ( | errorString = ( error, ': the ', (quote: selector), ' primitive failed.\n', 'Its receiver was ', (reflect: receiver) safeName, '.' ). parent* = world obj14. | ) world obj25 _AddSlots: ( | parent* = world obj225. | ) world obj26 _AddSlots: ( | parent* = world obj11. safeName = ( reflectee _FloatPrintString ). | ) world obj27 _AddSlots: ( | isComplete = world obj32. nameSize: s PrintString: ps = ( reflectee printString ). parent* = world obj11. safeName = ( name ). | ) world obj28 _AddSlots: ( | parent* = world obj11. | ) world obj29 _AddSlots: ( | parent* = world obj22. evalName = ( reflectee storeString ). safeName = ( evalName ). | ) world obj30 _AddSlots: ( | removedMarker = world obj220. emptyMarker = world obj221. myKeys <- world obj1. safety* = world obj222. parent* = world obj223. | ) world obj31 _AddSlots: ( | parent* = world obj217. | ) world obj32 _AddSlots: ( | || b = ( true ). not = world obj33. && b = ( b value ). parent* = world obj233. ifTrue: b1 False: b2 = ( b1 value ). | ) world obj33 _AddSlots: ( | || b = ( b value ). && b = ( false ). not = world obj32. parent* = world obj233. ifTrue: b1 False: b2 = ( b2 value ). | ) world obj34 _AddSlots: ( | link = world obj2. list = world obj4. | ) world obj35 _AddSlots: ( | collections* = world obj209. system* = world obj210. | ) world obj36 _AddSlots: ( | equalsCollection: c = ( size = c size ifFalse: [^ false]. with: c Do: [|:e1. :e2| e1 = e2 ifFalse: [^ false]]. true ). = c = ( == c ifTrue: [^ true ]. c equalsCollection: self ). isPrefixOf: c = ( with: c Do: [ | :prefixElem. :testElem. | prefixElem = testElem ifFalse: [^false]. ]. size <= c size ). at: k = ( at: k IfAbsent: [ error: k printString, ' is absent'] ). isEmpty = ( 0 = size ). parent* = world obj218. | ) world obj37 _AddSlots: ( | day <- 8073. msec <- 28800000. parent* = world obj40. | ) world obj38 _Define: world obj37 _Clone world obj38 msec: 85308791 world obj38 day: 9207 world obj39 _AddSlots: ( | equalsCanonicalString: s = ( == s ). = s = ( == s ifTrue: true False: [ s equalsCanonicalString: self ] ). canonicalize = ( self ). isPrefixOf: s = ( == s ifTrue: true False: [ resend.isPrefixOf: s ] ). parent* = world obj9. | ) world obj40 _AddSlots: ( | subtractTime: t = ( ((t day - day) * msecPerDay) + (t msec - msec) ). msecPerDay = 86400000. rationalize = ( msec >= msecPerDay ifTrue: [ day: day + (msec / msecPerDay). msec: msec % msecPerDay. ] False: [ msec < 0 ifTrue: [ day: day + ((msec / msecPerDay) - 1). msec: msec % msecPerDay. ]. ]. self ). parent* = world obj218. copyDay: d Msec: m = ( ((copy day: d) msec: m) rationalize ). currentTime = ( _TimeReal ). - x = ( x subtractTime: self ). current = ( | ct | ct: currentTime. copyDay: (ct at: 0) Msec: ct at: 1 ). | ) world obj41 _AddSlots: ( | whileFalse: b = ( [ value ifTrue: [ ^ nil ]. b value. ] loop ). loop = ( value. _Restart ). whileTrue: b = ( [ value ifFalse: [ ^ nil ]. b value. ] loop ). parent* = world obj216. | ) world obj42 _AddSlots: ( | verboseLowSpaceHandler = world obj33. maxGCWorkLoad <- 0.8. lastGCDurationMsec <- 6294. allocationFailed: nOops Bytes: nBytes = ( lowSpaceHandler: nBytes + (nOops * 4) UserRequested: false ). allocationFailedBytes: nBytes = ( allocationFailed: 0 Bytes: nBytes ). timeOfLastGC <- world obj38. lowSpaceHandler: desiredBytes UserRequested: fromUser = ( | memoryStateAfterGC. memoryStateBeforeExpansion. memoryStateBeforeGC. timeAfterGC. timeBeforeGC. timeSinceLastGCMsec. defaultExpansion <- world obj33. ineffectiveGC <- world obj33. reclaimed. reclaimedALot <- world obj33. mustExpand <- world obj33. needContiguousSpace <- world obj33 | timeBeforeGC: time current. timeSinceLastGCMsec: timeBeforeGC - timeOfLastGC. "Force a heap expansion if too much time is being spent in GC (but ignore user-initiated GC)" fromUser not && [(lastGCDurationMsec /= (lastGCDurationMsec + timeSinceLastGCMsec)) >= maxGCWorkLoad] ifTrue: [ mustExpand: true. verboseLowSpaceHandler ifTrue: [ ('expanding due to too much GC : ', lastGCDurationMsec printString, ' ms in ', timeSinceLastGCMsec printString, ' ms.') printLine ]. memoryStateBeforeExpansion: memoryState copy. ] False: [ "OK to GC" verboseLowSpaceHandler ifTrue: [ 'Low space handler: GC' printLine ]. memoryStateBeforeGC: memoryState copy. doGarbageCollect. timeAfterGC: time current. timeOfLastGC: timeAfterGC. lastGCDurationMsec: timeAfterGC - timeBeforeGC. memoryStateAfterGC: memoryState copy. needContiguousSpace: memoryStateAfterGC maxContiguousFree < desiredBytes. defaultExpansion: (memoryStateAfterGC free /= memoryStateAfterGC capacity) < freeSpaceExpansionFraction. reclaimed: memoryStateAfterGC free - memoryStateBeforeGC free. reclaimedALot: (reclaimed /= memoryStateBeforeGC used) >= bigReclaimThreshold. ineffectiveGC: reclaimedALot not && [(reclaimed /= lastGCDurationMsec) < minReclaimRate]. verboseLowSpaceHandler ifTrue: [ 'time since last GC (ms) : ' print. timeSinceLastGCMsec printLine. 'GC duration (ms) : ' print. lastGCDurationMsec printLine. needContiguousSpace ifTrue: [ ('no contiguous segment of ', desiredBytes printString, ' bytes.') printLine. ]. defaultExpansion ifTrue: [ 'free space below default threshold of ' print. freeSpaceExpansionFraction printLine. ]. ineffectiveGC ifTrue: [ ('GC reclaimed only ', reclaimed printString, ' bytes.') printLine. ]. reclaimedALot ifTrue: [ ('Reclaimed more than ', bigReclaimThreshold print, ' of the heap.') printLine. ]. ]. memoryStateBeforeExpansion: memoryStateAfterGC ]. reclaimedALot ifTrue: [ "Set the low space threshold back to do earlier GCs" lowSpaceThresholdInVM: ( (memoryStateAfterGC capacity - (memoryStateAfterGC used * 1.5)) asInteger max: minLowSpaceThresholdInVM) IfFail: [| :e | warning: 'unexpected error setting low space threshold: ', e]. ]. fromUser not && [mustExpand || needContiguousSpace || defaultExpansion || ineffectiveGC] ifTrue: [| exp. swapStats. desired. slop = 20480. alreadyAllocated. oldLowSpaceThresh | desired: (desiredBytes + slop + _MemoryVMReservedAmount) max: (memoryStateBeforeExpansion capacity * expansionRatio) asSmallInteger. "See if we can push back the yellow line" oldLowSpaceThresh: lowSpaceThresholdInVM. alreadyAllocated: oldLowSpaceThresh - minLowSpaceThresholdInVM. lowSpaceThresholdInVM: ((alreadyAllocated - desired) max: 0) + minLowSpaceThresholdInVM IfFail: [| :e | warning: 'unexpected error setting low space threshold: ', e]. desired: desired - (oldLowSpaceThresh - lowSpaceThresholdInVM). swapStats: _MemorySwapSpaceIfFail: nil. swapStats !== nil ifTrue: [| swapSize. swapFree. swapReserve | swapSize: swapStats at: 0. swapFree: swapStats at: 1. swapReserve: (swapSize * reservedSwapFraction) asInteger max: reservedSwapSize. swapReserve < swapFree ifTrue: [ desired: desired min: (swapFree - swapReserve). ] False: [ userQuery report: 'Cannot expand heap: swap space almost gone!'. mustExpand ifTrue: ["haven't GCd" doGarbageCollect]. ^self. ] ]. verboseLowSpaceHandler ifTrue: [ ('Low space handler: expanding heap by ', desired printString, ' bytes.') printLine. ]. [ exp: _MemoryExpandHeap: desired. exp != 0 ifTrue: [^self]. desired: desired / 2. desired < minimumExpansionAmount ifTrue: [ mustExpand ifTrue: ["haven't GCd" doGarbageCollect]. userQuery report: 'Could not expand heap!'. ^self ] ] loop ]. self ). parent* = world obj217. allocationFailed = ( lowSpaceHandler: 0 UserRequested: false ). | ) world obj43 _AddSlots: ( | equalsSmallInteger: a = ( a asFloat = asFloat ). multiplyBigInteger: a = ( a asFloat * asFloat ). multiplySmallInteger: a = ( a asFloat * asFloat ). asSmallInteger = ( asFloat _FloatAsInt ). asInteger = ( asSmallInteger ). asBigInteger = ( asInteger asBigInteger ). reverseLessThanFloat: a = ( a < asFloat ). < a = ( asFloat _FloatLT: a IfFail: [ a reverseLessThanFloat: asFloat] ). equalsFloat: a = ( a = asFloat ). = a = ( asFloat _FloatEQ: a IfFail: [ a equalsFloat: asFloat] ). subtractFloat: a = ( a - asFloat ). - a = ( asFloat _FloatSub: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a subtractFloat: asFloat ] False: [ primitiveFailedError: error Name: name ]] ). zero = 0.0. compare: x IfLess: lb Equal: eb Greater: gb = ( ( _FloatLT: x "Hack! This method is an optimization--dmu" IfFail: [^resend.compare: x IfLess: lb Equal: eb Greater: gb] ) ifTrue: lb False: [ = x ifTrue: eb False: gb ] ). compareBigInteger: a IfLess: lb Equal: eb Greater: gb = ( asFloat compare: a asFloat IfLess: lb Equal: eb Greater: gb ). addFloat: a = ( a + asFloat ). multiplyFloat: a = ( a * asFloat ). + a = ( asFloat _FloatAdd: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a addFloat: asFloat ] False: [ primitiveFailedError: error Name: name ]] ). * a = ( asFloat _FloatMul: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a multiplyFloat: asFloat ] False: [ primitiveFailedError: error Name: name ]] ). reverseGreaterThanOrEqualSmallInteger: a = ( a asFloat >= asFloat ). reverseGreaterThanOrEqualFloat: a = ( a >= asFloat ). divideFloat: a = ( a / asFloat ). parent* = world obj0. asFloat = ( self ). / a = ( asFloat _FloatDiv: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a divideFloat: asFloat ] False: [ primitiveFailedError: error Name: name ]] ). /= a = ( / a ). >= a = ( asFloat _FloatGE: a IfFail: [ a reverseGreaterThanOrEqualFloat: asFloat] ). | ) world obj44 _AddSlots: ( | divideBigInteger: a = ( a / asBigInteger ). moduloBigInteger: a = ( a % asBigInteger ). equalsBigInteger: a = ( asBigInteger = a asBigInteger ). multiplyBigInteger: a = ( a * asBigInteger ). compareBigInteger: a IfLess: lb Equal: eb Greater: gb = ( asBigInteger compare: a asBigInteger IfLess: lb Equal: eb Greater: gb ). addBigInteger: a = ( a + asBigInteger ). subtractBigInteger: a = ( a - asBigInteger ). asByte = ( self ). && a = ( asSmallInteger _IntAnd: a asSmallInteger ). reverseLessThanOrEqualSmallInteger: a = ( a <= asSmallInteger ). != a = ( asSmallInteger _IntNE: a IfFail: [(= a) not] ). reverseGreaterThanSmallInteger: a = ( a > asSmallInteger ). asFloat = ( asSmallInteger _IntAsFloat ). subtractSmallInteger: a = ( a - asSmallInteger ). - a = ( asSmallInteger _IntSub: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a subtractSmallInteger: asSmallInteger ] False: [ ('overflowError' == error) ifTrue: [ " retry after coercing to bigInts " asBigInteger - a asBigInteger ] False: [ primitiveFailedError: error Name: name ]]] ). <= a = ( asSmallInteger _IntLE: a IfFail: [ a reverseLessThanOrEqualSmallInteger: asSmallInteger] ). > a = ( asSmallInteger _IntGT: a IfFail: [ a reverseGreaterThanSmallInteger: asSmallInteger] ). moduloSmallInteger: a = ( a % asSmallInteger ). divideSmallInteger: a = ( a / asSmallInteger ). % a = ( asSmallInteger _IntMod: a IfFail: [| :error. :name. | "Return a modulo receiver. Always non-negative result." ('badTypeError' == error) ifTrue: [ " use double dispatching " a moduloSmallInteger: asSmallInteger ] False: [ ('overflowError' == error) ifTrue: [ " retry after coercing to bigInts " asBigInteger % a asBigInteger ] False: [ primitiveFailedError: error Name: name ]]] ). / a = ( asSmallInteger _IntDiv: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a divideSmallInteger: asSmallInteger ] False: [ ('overflowError' == error) ifTrue: [ " retry after coercing to bigInts " asBigInteger / a asBigInteger ] False: [ primitiveFailedError: error Name: name ]]] ). reverseLessThanSmallInteger: a = ( a < asSmallInteger ). < a = ( asSmallInteger _IntLT: a IfFail: [ a reverseLessThanSmallInteger: asSmallInteger] ). reverseGreaterThanOrEqualSmallInteger: a = ( a >= asSmallInteger ). >= a = ( asSmallInteger _IntGE: a IfFail: [ a reverseGreaterThanOrEqualSmallInteger: asSmallInteger] ). multiplySmallInteger: a = ( a * asSmallInteger ). * a = ( asSmallInteger _IntMul: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a multiplySmallInteger: asSmallInteger ] False: [ ('overflowError' == error) ifTrue: [ " retry after coercing to bigInts " asBigInteger * a asBigInteger ] False: [ primitiveFailedError: error Name: name ]]] ). equalsSmallInteger: a = ( a = asSmallInteger ). + a = ( asSmallInteger _IntAdd: a IfFail: [| :error. :name. | ('badTypeError' == error) ifTrue: [ " use double dispatching " a addSmallInteger: asSmallInteger ] False: [ ('overflowError' == error) ifTrue: [ " retry after coercing to bigInts " asBigInteger + a asBigInteger ] False: [ primitiveFailedError: error Name: name ]]] ). addSmallInteger: a = ( a + asSmallInteger ). = a = ( asSmallInteger _IntEQ: a IfFail: [ a equalsSmallInteger: asSmallInteger] ). asBigInteger = ( bigInt fromInt: asSmallInteger ). parent* = world obj6. asSmallInteger = ( self ). | ) world obj45 _Define: systemObjects byteVector _CloneBytes: 0 Filler: 0 world obj45 _AddSlots: ( | parent* = world obj8. | ) world obj46 _Define: (bvcP: world obj45 B: '\\x1b') world obj47 _Define: (bvcP: world obj45 B: '\\x1c') world obj48 _Define: (bvcP: world obj45 B: '\\x1d') world obj49 _Define: (bvcP: world obj45 B: '\\x1e') world obj50 _Define: (bvcP: world obj45 B: '\\x1f') world obj51 _Define: (bvcP: world obj45 B: '\\x02') world obj52 _Define: (bvcP: world obj45 B: '\\x03') world obj53 _Define: (bvcP: world obj45 B: '\\x00') world obj54 _Define: (bvcP: world obj45 B: '\\x01') world obj55 _Define: (bvcP: world obj45 B: '\\x04') world obj56 _Define: (bvcP: world obj45 B: '\\x05') world obj57 _Define: (bvcP: world obj45 B: '\\x06') world obj58 _Define: (bvcP: world obj45 B: '\\a') world obj59 _Define: (bvcP: world obj45 B: '\\b') world obj60 _Define: (bvcP: world obj45 B: '\\v') world obj61 _Define: (bvcP: world obj45 B: '\\f') world obj62 _Define: (bvcP: world obj45 B: '\\x0e') world obj63 _Define: (bvcP: world obj45 B: '\\x0f') world obj64 _Define: (bvcP: world obj45 B: '\\x10') world obj65 _Define: (bvcP: world obj45 B: '\\x11') world obj66 _Define: (bvcP: world obj45 B: '\\x12') world obj67 _Define: (bvcP: world obj45 B: '\\x13') world obj68 _Define: (bvcP: world obj45 B: '\\x14') world obj69 _Define: (bvcP: world obj45 B: '\\x15') world obj70 _Define: (bvcP: world obj45 B: '\\x16') world obj71 _Define: (bvcP: world obj45 B: '\\x17') world obj72 _Define: (bvcP: world obj45 B: '\\x18') world obj73 _Define: (bvcP: world obj45 B: '\\x19') world obj74 _Define: (bvcP: world obj45 B: '\\x1a') world obj75 _Define: (bvcP: world obj45 B: '\\"') world obj76 _Define: (bvcP: world obj45 B: '\\\'') world obj77 _Define: world obj45 _CloneBytes: 2 Filler: 92 world obj78 _Define: (bvcP: world obj45 B: '\\x7f') world obj79 _Define: (bvcP: world obj45 B: '\\x80') world obj80 _Define: (bvcP: world obj45 B: '\\x81') world obj81 _Define: (bvcP: world obj45 B: '\\x82') world obj82 _Define: (bvcP: world obj45 B: '\\x83') world obj83 _Define: (bvcP: world obj45 B: '\\x84') world obj84 _Define: (bvcP: world obj45 B: '\\x85') world obj85 _Define: (bvcP: world obj45 B: '\\x86') world obj86 _Define: (bvcP: world obj45 B: '\\x87') world obj87 _Define: (bvcP: world obj45 B: '\\x88') world obj88 _Define: (bvcP: world obj45 B: '\\x89') world obj89 _Define: (bvcP: world obj45 B: '\\x8a') world obj90 _Define: (bvcP: world obj45 B: '\\x8b') world obj91 _Define: (bvcP: world obj45 B: '\\x8c') world obj92 _Define: (bvcP: world obj45 B: '\\x8d') world obj93 _Define: (bvcP: world obj45 B: '\\x8e') world obj94 _Define: (bvcP: world obj45 B: '\\x8f') world obj95 _Define: (bvcP: world obj45 B: '\\x90') world obj96 _Define: (bvcP: world obj45 B: '\\x91') world obj97 _Define: (bvcP: world obj45 B: '\\x92') world obj98 _Define: (bvcP: world obj45 B: '\\x93') world obj99 _Define: (bvcP: world obj45 B: '\\x94') world obj100 _Define: (bvcP: world obj45 B: '\\x95') world obj101 _Define: (bvcP: world obj45 B: '\\x96') world obj102 _Define: (bvcP: world obj45 B: '\\x97') world obj103 _Define: (bvcP: world obj45 B: '\\x98') world obj104 _Define: (bvcP: world obj45 B: '\\x99') world obj105 _Define: (bvcP: world obj45 B: '\\x9a') world obj106 _Define: (bvcP: world obj45 B: '\\x9b') world obj107 _Define: (bvcP: world obj45 B: '\\x9c') world obj108 _Define: (bvcP: world obj45 B: '\\x9d') world obj109 _Define: (bvcP: world obj45 B: '\\x9e') world obj110 _Define: (bvcP: world obj45 B: '\\x9f') world obj111 _Define: (bvcP: world obj45 B: '\\xa0') world obj112 _Define: (bvcP: world obj45 B: '\\xa1') world obj113 _Define: (bvcP: world obj45 B: '\\xa2') world obj114 _Define: (bvcP: world obj45 B: '\\xa3') world obj115 _Define: (bvcP: world obj45 B: '\\xa4') world obj116 _Define: (bvcP: world obj45 B: '\\xa5') world obj117 _Define: (bvcP: world obj45 B: '\\xa6') world obj118 _Define: (bvcP: world obj45 B: '\\xa7') world obj119 _Define: (bvcP: world obj45 B: '\\xa8') world obj120 _Define: (bvcP: world obj45 B: '\\xa9') world obj121 _Define: (bvcP: world obj45 B: '\\xaa') world obj122 _Define: (bvcP: world obj45 B: '\\xab') world obj123 _Define: (bvcP: world obj45 B: '\\xac') world obj124 _Define: (bvcP: world obj45 B: '\\xad') world obj125 _Define: (bvcP: world obj45 B: '\\xae') world obj126 _Define: (bvcP: world obj45 B: '\\xaf') world obj127 _Define: (bvcP: world obj45 B: '\\xb0') world obj128 _Define: (bvcP: world obj45 B: '\\xb1') world obj129 _Define: (bvcP: world obj45 B: '\\xb2') world obj130 _Define: (bvcP: world obj45 B: '\\xb3') world obj131 _Define: (bvcP: world obj45 B: '\\xb4') world obj132 _Define: (bvcP: world obj45 B: '\\xb5') world obj133 _Define: (bvcP: world obj45 B: '\\xb6') world obj134 _Define: (bvcP: world obj45 B: '\\xb7') world obj135 _Define: (bvcP: world obj45 B: '\\xb8') world obj136 _Define: (bvcP: world obj45 B: '\\xb9') world obj137 _Define: (bvcP: world obj45 B: '\\xba') world obj138 _Define: (bvcP: world obj45 B: '\\xbb') world obj139 _Define: (bvcP: world obj45 B: '\\xbc') world obj140 _Define: (bvcP: world obj45 B: '\\xbd') world obj141 _Define: (bvcP: world obj45 B: '\\xbe') world obj142 _Define: (bvcP: world obj45 B: '\\xbf') world obj143 _Define: (bvcP: world obj45 B: '\\xc0') world obj144 _Define: (bvcP: world obj45 B: '\\xc1') world obj145 _Define: (bvcP: world obj45 B: '\\xc2') world obj146 _Define: (bvcP: world obj45 B: '\\xc3') world obj147 _Define: (bvcP: world obj45 B: '\\xc4') world obj148 _Define: (bvcP: world obj45 B: '\\xc5') world obj149 _Define: (bvcP: world obj45 B: '\\xc6') world obj150 _Define: (bvcP: world obj45 B: '\\xc7') world obj151 _Define: (bvcP: world obj45 B: '\\xc8') world obj152 _Define: (bvcP: world obj45 B: '\\xc9') world obj153 _Define: (bvcP: world obj45 B: '\\xca') world obj154 _Define: (bvcP: world obj45 B: '\\xcb') world obj155 _Define: (bvcP: world obj45 B: '\\xcc') world obj156 _Define: (bvcP: world obj45 B: '\\xcd') world obj157 _Define: (bvcP: world obj45 B: '\\xce') world obj158 _Define: (bvcP: world obj45 B: '\\xcf') world obj159 _Define: (bvcP: world obj45 B: '\\xd0') world obj160 _Define: (bvcP: world obj45 B: '\\xd1') world obj161 _Define: (bvcP: world obj45 B: '\\xd2') world obj162 _Define: (bvcP: world obj45 B: '\\xd3') world obj163 _Define: (bvcP: world obj45 B: '\\xd4') world obj164 _Define: (bvcP: world obj45 B: '\\xd5') world obj165 _Define: (bvcP: world obj45 B: '\\xd6') world obj166 _Define: (bvcP: world obj45 B: '\\xd7') world obj167 _Define: (bvcP: world obj45 B: '\\xd8') world obj168 _Define: (bvcP: world obj45 B: '\\xd9') world obj169 _Define: (bvcP: world obj45 B: '\\xda') world obj170 _Define: (bvcP: world obj45 B: '\\xdb') world obj171 _Define: (bvcP: world obj45 B: '\\xdc') world obj172 _Define: (bvcP: world obj45 B: '\\xdd') world obj173 _Define: (bvcP: world obj45 B: '\\xde') world obj174 _Define: (bvcP: world obj45 B: '\\xdf') world obj175 _Define: (bvcP: world obj45 B: '\\xe0') world obj176 _Define: (bvcP: world obj45 B: '\\xe1') world obj177 _Define: (bvcP: world obj45 B: '\\xe2') world obj178 _Define: (bvcP: world obj45 B: '\\xe3') world obj179 _Define: (bvcP: world obj45 B: '\\xe4') world obj180 _Define: (bvcP: world obj45 B: '\\xe5') world obj181 _Define: (bvcP: world obj45 B: '\\xe6') world obj182 _Define: (bvcP: world obj45 B: '\\xe7') world obj183 _Define: (bvcP: world obj45 B: '\\xe8') world obj184 _Define: (bvcP: world obj45 B: '\\xe9') world obj185 _Define: (bvcP: world obj45 B: '\\xea') world obj186 _Define: (bvcP: world obj45 B: '\\xeb') world obj187 _Define: (bvcP: world obj45 B: '\\xec') world obj188 _Define: (bvcP: world obj45 B: '\\xed') world obj189 _Define: (bvcP: world obj45 B: '\\xee') world obj190 _Define: (bvcP: world obj45 B: '\\xef') world obj191 _Define: (bvcP: world obj45 B: '\\xf0') world obj192 _Define: (bvcP: world obj45 B: '\\xf1') world obj193 _Define: (bvcP: world obj45 B: '\\xf2') world obj194 _Define: (bvcP: world obj45 B: '\\xf3') world obj195 _Define: (bvcP: world obj45 B: '\\xf4') world obj196 _Define: (bvcP: world obj45 B: '\\xf5') world obj197 _Define: (bvcP: world obj45 B: '\\xf6') world obj198 _Define: (bvcP: world obj45 B: '\\xf7') world obj199 _Define: (bvcP: world obj45 B: '\\xf8') world obj200 _Define: (bvcP: world obj45 B: '\\xf9') world obj201 _Define: (bvcP: world obj45 B: '\\xfa') world obj202 _Define: (bvcP: world obj45 B: '\\xfb') world obj203 _Define: (bvcP: world obj45 B: '\\xfc') world obj204 _Define: (bvcP: world obj45 B: '\\xfd') world obj205 _Define: (bvcP: world obj45 B: '\\xfe') world obj206 _Define: (bvcP: world obj45 B: '\\xff') world obj207 _AddSlots: ( | mutableString = world obj45. | ) world obj208 _AddSlots: ( | parent* = world obj21. | ) world obj209 _AddSlots: ( | ordered* = world obj34. vectors* = world obj207. | ) world obj210 _AddSlots: ( | maxSmallInt = 536870911. raiseError = world obj232. memoryState = world obj226. true = world obj32. scheduler = world obj211. nil = world obj31. time = world obj37. false = world obj33. memory = world obj42. minSmallInt = -536870912. bigInt = world obj228. processErrors = world obj12. process = world obj208. | ) world obj211 _AddSlots: ( | stopping <- world obj32. isRunning = ( stopping not ). | ) world obj212 _AddSlots: ( | storeString = ( storeStringIfFail: [ | :e | error: 'Cannot find a storeString for this object: ', e] ). equalsCanonicalString: x = ( false ). value: a With: b With: c = ( value: a With: b ). value: a With: b With: c With: d = ( value: a With: b With: c ). identityHash = ( _IdentityHash ). !== x = ( ( == x ) not ). value: a = ( value ). value = ( self ). reflect: x = ( x _Mirror ). namePrintString = ( ''. ). printString = ( | sp | sp: statePrintString. namePrintString, (sp isEmpty ifTrue: '' False: ['(', sp, ')']) ). print = ( printString print. self ). printLine = ( print. '\n' print. self ). error: message = ( message printLine. "Print the error message." _ThisProcess _AbortProcess. "Try to abort cleanly (depends on scheduler how well this works, I think)." this_send_in_error_fails. "Definately force abort here!" ). value: a With: b = ( value: a ). clone = ( _CloneIfFail: [|:error| 'outOfMemoryError' == error ifFalse: [ error: error ] True: [ memory allocationFailed. _Clone ] ] ). primitiveFailedError: error Name: sel = ( | env = world obj18 | env process this suspendAndTrace: ((processErrors primitiveFailed copy receiver: self) selector: sel) error: error. env process this errorContinueValue ). == x = ( _Eq: x ). | ) world obj213 _AddSlots: ( | copy = ( clone ). | ) world obj214 _AddSlots: ( | = x = ( == x ). | ) world obj215 _AddSlots: ( | > x = ( ( <= x ) not ). <= x = ( (x < self) not ). compare: x IfLess: lb Equal: eb Greater: gb = ( = x ifTrue: eb False: [ < x ifTrue: lb False: gb ] ). >= x = ( ( < x ) not ). | ) world obj216 _AddSlots: ( | parent* = world obj18. cloning* = world obj213. | ) world obj217 _AddSlots: ( | comparing* = world obj214. parent* = world obj18. | ) world obj218 _AddSlots: ( | cloning* = world obj213. parent* = world obj18. | ) world obj219 _AddSlots: ( | ordering* = world obj215. parent* = world obj18. | ) world obj220 _AddSlots: ( | p* = world obj217. | ) world obj221 _Define: world obj220 _Clone world obj222 _AddSlots: ( | sync: b = ( b value ). | ) world obj223 _AddSlots: ( | at: i ReplaceKey: k Value: v = ( myKeys at: i Put: k. self ). key: k OrValueAt: i = ( k ). parent* = world obj224. includes: v = ( indexOf: v IfPresent: true IfAbsent: false ). | ) world obj224 _AddSlots: ( | indexOf: key IfPresent: pb IfAbsent: ab FirstRM: firstRM = ( | firstWrap <- world obj32. i <- 0 | i: firstRM + 1. [|k| k: (myKeys at: i IfAbsent: [ firstWrap ifTrue: [firstWrap: false. i: 0. myKeys at: 0] False: [^ ab value: firstRM]. ]). emptyMarker = k ifTrue: [^ ab value: firstRM]. (removedMarker = k) not && [key = k] ifTrue: [ at: firstRM ReplaceKey: k Value: (key: k OrValueAt: i). at: i ReplaceKey: removedMarker Value: nil. ^ pb value: firstRM. ]. i: i + 1. ] loop ). buckets = ( myKeys size ). hash: x = ( buckets predecessor && x hash ). unsafe_indexOf: key IfPresent: pb IfAbsent: ab = ( | firstWrap <- world obj32. i <- 0 | i: hash: key. [|k| k: (myKeys at: i IfAbsent: [ firstWrap ifTrue: [firstWrap: false. i: 0. myKeys at: 0] False: [error: 'I should never get this full!']. ]). emptyMarker = k ifTrue: [^ ab value: i]. removedMarker = k ifTrue: [^ indexOf: key IfPresent: pb IfAbsent: ab FirstRM: i]. key = k ifTrue: [^ pb value: i]. i: i + 1. ] loop ). indexOf: key IfPresent: pb IfAbsent: ab = ( sync: [ unsafe_indexOf: key IfPresent: pb IfAbsent: ab ] ). parent* = world obj36. | ) world obj225 _AddSlots: ( | parent* = world obj11. | ) world obj226 _AddSlots: ( | parent* = world obj227. | ) world obj227 _AddSlots: ( | init = ( _MemoryCurrentState: self. capacity: 0. used: 0. maxContiguousFree: 0. numNonEmptyOldSpaceSegments: 0. old do: [| :v. thisCap. thisUsed. thisFree | thisCap: (v at: 2). thisUsed: (v at: 0) + (v at: 1). thisUsed > 0 ifTrue: [ numNonEmptyOldSpaceSegments: numNonEmptyOldSpaceSegments succ ]. thisFree: thisCap - thisUsed. used: used + thisUsed. capacity: capacity + thisCap. maxContiguousFree: maxContiguousFree max: thisFree. ]. free: capacity - used. self ). parent* = world obj216. copy = ( resend.copy init ). | ) world obj228 _AddSlots: ( | digits <- world obj234. sign <- 0. parent* = world obj229. | ) world obj229 _AddSlots: ( | moduloSmallInteger: a = ( a asBigInteger % asBigInteger ). mulOne: m Digits: digits1 ResultStream: blk = ( | carry <- 0 | 0 upTo: digits1 size By: cByteSize Do: [|:idx. d <- 0. x <- 0. | d: (in: digits1 At: idx). x: (m * d) + carry. carry: x / base. x: x - (base * carry). "Faster than x: x % base." blk value: x With: idx. ]. carry ). addDigits: digits1 And: digits2 = ( "Like 'addDigitsSE:And:' but does not side effect 'digits1'. Note: result may contain leading zeros." digits1 size < digits2 size ifTrue: [ addDigitsSE: (digits2 copySize: digits2 size + cByteSize FillingWith: 0) And: digits1. ] False: [ addDigitsSE: (digits1 copySize: digits1 size + cByteSize FillingWith: 0) And: digits2. ] ). mostSignificantDigit: d = ( in: d At: d size - cByteSize ). base = 10000. absoluteValue = ( -1 = sign ifTrue: [negate] False: [self] ). fbase = 10000.0. reverseLessThanSmallInteger: a = ( a asBigInteger < asBigInteger ). moduloBigInteger: a = ( | r <- 1 | "Return a modulo receiver. Always non-negative result." r: a - ((a / self) * self). 0 > r ifTrue: [r: r + self]. r ). assert: blk = ( checkAsserts ifTrue: [blk assert]. self ). in: d At: idx Put: d0 IfFail: errBlk = ( assert: [d0 < base. "cIntSize:... checks for negative."]. d cIntSize: cBitSize Signed: false At: idx Put: d0 IfFail: errBlk ). in: d At: idx Put: d0 = ( in: d At: idx Put: d0 IfFail: raiseError ). asSmallIntegerIfFail: errBlk = ( | res <- 0 | digitsDo: [|:d| res: res _IntMul: base IfFail: [|:e| ^ errBlk value: e]. res: res _IntAdd: d IfFail: [|:e| ^ errBlk value: e] ]. 0 > sign ifTrue: [res: res negate]. res ). divideSmallInteger: a = ( a asBigInteger / asBigInteger ). subDigitsSE: digits1 And: digits2 = ( | borrow <- 0 | assert: [digits1 size >= digits2 size]. 0 upTo: digits1 size By: cByteSize Do: [|:idx. x <- 0. | x: (in: digits1 At: idx) - (in: digits2 At: idx IfFail: 0) - borrow. 0 > x ifTrue: [borrow: 1. x: x + base] False: [borrow: 0]. in: digits1 At: idx Put: x. ]. assert: [0 = borrow]. digits1 ). negate = ( lowLevelClone sign: sign negate ). cByteSize = 2. % a = ( a moduloBigInteger: asBigInteger ). compare: x IfLess: lb Equal: eb Greater: gb = ( x compareBigInteger: asBigInteger IfLess: gb Equal: eb Greater: lb ). * a = ( a multiplyBigInteger: asBigInteger ). fromInt: x = ( | d. i <- 0. res | minSmallInt = x ifTrue: [^ (fromInt: x succ) pred]. d: (digitsRep copySize: smiSize FillingWith: 0). res: lowLevelClone. res sign: x sign. x digitListBase: base Do: [|:digit| in: d At: i Put: digit IfFail: [ error: 'unexpectedly many digits in smallInt'. ]. i: i + cByteSize. ]. res setDigits: d. res ). - a = ( a subtractBigInteger: asBigInteger ). + a = ( a addBigInteger: asBigInteger ). / a = ( a divideBigInteger: asBigInteger ). digitsRep = world obj234. addSmallInteger: a = ( a asBigInteger + asBigInteger ). reverseLessThanOrEqualSmallInteger: a = ( a asBigInteger <= asBigInteger ). subtractSmallInteger: a = ( a asBigInteger - asBigInteger ). multiplySmallInteger: a = ( a asBigInteger * asBigInteger ). < x = ( compare: x IfLess: true Equal: false Greater: false ). = x = ( x equalsBigInteger: self ). mulDigits: digits1 And: digits2 = ( | carryIdx <- 0. carryM <- 0. dsize1 <- 0. dsize2 <- 0. res | dsize1: digits1 size. dsize2: digits2 size. carryIdx: dsize2 - cByteSize. res: (digitsRep copySize: dsize1 + dsize2 FillingWith: 0). 0 upTo: dsize1 By: cByteSize Do: [ |:idx1. carryA <- 0. | carryM: (mulOne: (in: digits1 At: idx1) Digits: digits2 ResultStream: [|:x. :idx2. idx <- 0. y <- 0. c <- 0. | idx: idx1 + idx2. idx2 = carryIdx ifTrue: [ "Last digit in 'digits2' so use left over carry from last round." c: carryM. ]. y: c + x + (in: res At: idx) + carryA. base <= y ifTrue: [carryA: 1. y: y - base] False: [carryA: 0]. in: res At: idx Put: y. ]). carryM: carryM + carryA. ]. "Finish off with carry." assert: [0 = (mostSignificantDigit: res)]. in: res At: res size - cByteSize Put: carryM. res ). multiplyBigInteger: a = ( | res | 0 = sign ifTrue: [^ self]. 0 = a sign ifTrue: [^ a]. res: lowLevelClone. res sign: sign * a sign. res setDigits: (mulDigits: digits And: a digits). res ). reverseGreaterThanOrEqualSmallInteger: a = ( a asBigInteger >= asBigInteger ). oneDigitDiv: divisor And: partial = ( | dsize <- 0. ld <- 0. lp <- 0. psize <- 0. q <- 0. qHi <- 0. qLo <- 0 | "First let's see if we have enough digits for a non-zero quotient." psize: partial size. dsize: divisor size. psize < dsize ifTrue: [^ 0]. lp: (mostSignificantDigit: partial). ld: (mostSignificantDigit: divisor). (psize = dsize) ifTrue: [ lp < ld ifTrue: [^ 0]. "leading digits reveal result." ] False: [ assert: [psize = (cByteSize + dsize)]. lp: (lp * base) + (in: partial At: psize - cByteSize - cByteSize). ]. qLo: lp / (1 + ld). qHi: (lp + 1) / ld. "qLo and qHi are bounds on the result. The bigger ld is, the smaller is the difference between the bounds." "To find q, we now do a binary search." [qHi > (1 + qLo)] whileTrue: [| carry <- 0. | q: (qHi + qLo) / 2. "Now determine the sign of 'partial - divisor*q'." compareDigits: partial And: (mulOne: q Digits: divisor) IfLess: [qHi: q - 1] Equal: [qLo: q. qHi: q] Greater: [qLo: q "Not q+1"]. ]. "The loop above terminates when qHi <= qLo + 1. This can be true in two ways: 1: qHi < qLo + 1 <=> qHi <= qLo. 2: qHi = qLo + 1 and In case 1, we always pick q = qLo, but in case 2 we have to do an additional test to see if q = qLo + 1 = qHi is the right value." qHi <= qLo ifTrue: [ "Case 1:" q: qLo. ] False: [ "Case 2:" compareDigits: (mulOne: qHi Digits: divisor) And: partial IfLess: [q: qHi] Equal: [q: qHi] Greater: [q: qLo]. ]. "(q * divisor) > partial ifTrue: [ error: 'too big' ]." "(q + 1) * divisor <= partial ifTrue: [ error: 'too small']." q ). asSmallInteger = ( asSmallIntegerIfFail: [ error: 'doesn\'t fit into small integer' ] ). checkAsserts = world obj33. divDigits: divisor And: dividend = ( | divisorSize <- 0. partial. quotient | assert: [ compareDigits: divisor And: dividend IfLess: true Equal: true Greater: false. ]. divisorSize: divisor size. quotient: (digitsRep copySize: cByteSize + (dividend size - divisorSize) FillingWith: 0). partial: dividend copy. quotient size - cByteSize downTo: 0 By: cByteSize Do: [|:idx1. d <- 0. borrow <- 0. i <- 0. | "'partial' may have gotten very short." partial size < idx1 ifTrue: [ d: 0. ] False: [ d: (oneDigitDiv: divisor And: (partial copyFrom: idx1)). ]. in: quotient At: idx1 Put: d. "Now that we have stored the digit 'd', subtract 'd*divisor' from 'partial'." 0 != d ifTrue: [ "If 'd = 0' 'partial' may be short so this is not just an optimization." 0 upTo: divisorSize By: cByteSize Do: [|:idx2. x <- 0. | x: (in: partial At: idx1 + idx2) - ((in: divisor At: idx2) * d) - borrow. 0 > x ifTrue: [ borrow: (0 - x) /+ base. x: x + (base * borrow). ] False: [ borrow: 0. ]. in: partial At: idx1 + idx2 Put: x. ]. "Now handle the borrow." i: divisorSize + idx1. [0 != borrow] whileTrue: [| x <- 0. | x: (in: partial At: i) - borrow. 0 > x ifTrue: [borrow: 1. x: x + base] False: [borrow: 0]. in: partial At: i Put: x. i: cByteSize + i. ]. partial: (removeLeadingZeros: partial). ]. ]. quotient ). divideBigInteger: a = ( | res | 0 = sign ifTrue: [^ error: 'division by zero']. 0 = a sign ifTrue: [^ 0]. compareDigits: digits And: a digits IfLess: nil Equal: [^ sign * a sign] Greater: [^ 0]. res: lowLevelClone. res sign: sign * a sign. res setDigits: (divDigits: digits And: a digits). res ). addBigInteger: a = ( | res | sign = 0 ifTrue: [^ a]. a sign = 0 ifTrue: [^ self]. res: lowLevelClone. sign = a sign ifTrue: [ res setDigits: (addDigits: digits And: a digits). res sign: sign. ^ res. ]. compareDigits: digits And: a digits IfLess: [res setDigits: (subDigits: a digits And: digits). res sign: a sign] Equal: [res: bigInt. "bigInt prototype has value 0."] Greater: [res setDigits: (subDigits: digits And: a digits). res sign: sign]. res ). reverseGreaterThanSmallInteger: a = ( a asBigInteger > asBigInteger ). mulOne: m Digits: digits1 = ( | carry <- 0. res | res: digits1 copy. carry: (mulOne: m Digits: digits1 ResultStream: [|:x. :idx| in: res At: idx Put: x]). 0 != carry ifTrue: [ res: (res copySize: res size + cByteSize). in: res At: digits1 size Put: carry. ]. res ). parent* = world obj6. digitsDo: blk = ( 0 upTo: digits size By: cByteSize Do: [|:idx| blk value: (in: digits At: idx). ]. self ). equalsBigInteger: x = ( (sign = x sign) && [digits = x digits] ). subtractBigInteger: a = ( negate addBigInteger: a ). removeLeadingZeros: d = ( | i <- 0. j <- 0 | i: d size - cByteSize. j: i. [(0 <= i) && [0 = (in: d At: i)]] whileTrue: [i: i - cByteSize]. i = j ifTrue: [d] "Just optim." False: [d copySize: i + cByteSize] ). absDigitListBase: lBase Do: blk = ( | pow <- 4. remainingDigits <- 0 | base = lBase ifTrue: [ "The fastest case of them all." ^ digitsDo: blk. ] . pow: (lBase log: base). base != (lBase power: pow) ifTrue: [ "do it the slow way" ^ resend.absDigitListBase: lBase Do: blk. ]. remainingDigits: digits size / cByteSize. digitsDo: [|:d. n <- 0. | remainingDigits: remainingDigits - 1. d absDigitListBase: lBase Do: [|:dg| blk value: dg. n: 1 + n]. 0 != remainingDigits ifTrue: [ n upTo: pow Do: [blk value: 0]. "Leading 0's." ]. ]. self ). subDigits: digits1 And: digits2 = ( "Like 'subDigitsSE:And:' but does not side effect 'digits1'." subDigitsSE: digits1 copy And: digits2 ). asFloat = ( | res <- 0.0 | digitsDo: [|:d| res: (res * fbase) + d asFloat]. 0 > sign ifTrue: [res: res negate]. res ). compareDigits: digits1 And: digits2 IfLess: lb Equal: eb Greater: gb = ( "check rough size of numbers" assert: [0 != (mostSignificantDigit: digits1)]. assert: [0 != (mostSignificantDigit: digits2)]. digits1 size compare: digits2 size IfLess: [^ lb value] Equal: nil Greater: [^ gb value]. digits1 size - cByteSize downTo: 0 By: cByteSize Do: [|:idx| (in: digits1 At: idx) compare: (in: digits2 At: idx) IfLess: [^ lb value] Equal: nil Greater: [^ gb value]. ]. eb value ). in: d At: idx IfFail: errBlk = ( assert: [ (d cIntSize: cBitSize Signed: false At: idx IfFail: 0) < base. ]. d cIntSize: cBitSize Signed: false At: idx IfFail: errBlk ). setDigits: d = ( digits: (removeLeadingZeros: d) ). asBigInteger = ( self ). cBitSize = 16. lowLevelClone = ( clone ). smiSize = 6. addDigitsSE: digits1 And: digits2 = ( | carry <- 0 | assert: [digits1 size > digits2 size]. 0 upTo: digits1 size By: cByteSize Do: [|:idx. x <- 0. | x: (in: digits1 At: idx) + (in: digits2 At: idx IfFail: 0) + carry. base <= x ifTrue: [x: x - base. carry: 1] False: [carry: 0]. in: digits1 At: idx Put: x. ]. assert: [carry = 0]. digits1 ). equalsSmallInteger: a = ( a asBigInteger = asBigInteger ). compareBigInteger: x IfLess: lb Equal: eb Greater: gb = ( "check sign" sign compare: x sign IfLess: [^ lb value] Equal: nil Greater: [^ gb value]. "same sign; check digits" 1 = sign ifTrue: [ compareDigits: digits And: x digits IfLess: lb Equal: eb Greater: gb. ] False: [ -1 = sign ifTrue: [ compareDigits: digits And: x digits IfLess: gb Equal: eb Greater: lb. ] False: [ "both bigints have sign 0, i.e. both equal to 0." eb value. ]] ). in: d At: idx = ( in: d At: idx IfFail: raiseError ). | ) world obj230 _AddSlots: ( | copyFrom: start UpTo: stop = ( | r | "Copy elements in the range [start..stop-1]." r: copySize: stop - start. start = firstKey ifTrue: [^r]. "an optimization -- dmu 1/92" stop - start do: [ |:i | r at: i Put: at: i + start]. r ). copyFrom: start = ( "Copy elements in the range [start..lastKey]." copyFrom: start UpTo: lastKey succ ). do: b = ( firstKey to: lastKey Do: [|:i| b value: (at: i) With: i]. self ). lastKey = ( size pred ). with: c Do: b = ( | i <- 0. last <- 0 | i: firstKey. last: lastKey. c do: [|:v. :k| i <= last ifFalse: [^self]. b value: (at: i) With: v With: i With: k. i: i succ. ]. self ). if: error IsIndex: outOfBoundsBlock Index: i Prim: prim = ( ('badIndexError' isPrefixOf: error) || ['badSignError' isPrefixOf: error] ifTrue: [outOfBoundsBlock value: i] False: [primitiveFailedError: error Name: prim] ). firstKey = 0. copySize: n = ( copySize: n FillingWith: filler ). parent* = world obj36. | ) world obj231 _AddSlots: ( | at: k Put: v = ( at: k Put: v IfAbsent: [| :k | error: k printString, ' is absent'] ). , c = ( | j <- 0. new | new: copySize: size + c size. size upTo: new size Do: [| :i | new at: i Put: (c at: j). j: j succ. ]. new ). parent* = world obj230. | ) world obj232 _AddSlots: ( | value: e = ( error: e ). parent* = world obj212. | ) world obj233 _AddSlots: ( | ifFalse: b = ( ifTrue: nil False: b ). parent* = world obj219. ifTrue: b = ( ifTrue: b False: nil ). ifFalse: b1 True: b2 = ( ifTrue: b2 False: b1 ). | ) world obj234 _AddSlots: ( | parent* = world obj20. | ) _RemoveSlot: 'systemObjects' _RemoveSlot: 'bvcP:B:' snapshotAction _AddSlots: ( | "_" parent* = self. "The lobby." "^" postRead = ( world obj7 main. ). | ) _Flush _Tenure _GarbageCollect 'factorials' _WriteSnapshot ' Written snapshot: ' _StringPrint 'factorials\n' _StringPrint _Quit