Class.st
changeset 22210 be747818af07
parent 22035 e5f116a882a5
child 22364 62c8c34ccc2a
equal deleted inserted replaced
22209:f3a62df156f0 22210:be747818af07
  2000     ^ coll
  2000     ^ coll
  2001 
  2001 
  2002     "Created: / 18-07-2011 / 09:14:38 / cg"
  2002     "Created: / 18-07-2011 / 09:14:38 / cg"
  2003 ! !
  2003 ! !
  2004 
  2004 
  2005 
       
  2006 !Class methodsFor:'adding & removing'!
  2005 !Class methodsFor:'adding & removing'!
  2007 
  2006 
  2008 removeFromSystem
  2007 removeFromSystem
  2009     "ST-80 compatibility
  2008     "ST-80 compatibility
  2010      remove myself from the system"
  2009      remove myself from the system"
  2088 
  2087 
  2089     "Modified: 7.6.1996 / 09:15:05 / stefan"
  2088     "Modified: 7.6.1996 / 09:15:05 / stefan"
  2090     "Modified: 4.6.1997 / 14:48:02 / cg"
  2089     "Modified: 4.6.1997 / 14:48:02 / cg"
  2091 ! !
  2090 ! !
  2092 
  2091 
       
  2092 !Class methodsFor:'binary storage'!
       
  2093 
       
  2094 storeBinaryDefinitionOn: stream manager: manager
       
  2095     "store the receiver in a binary format on stream.
       
  2096      This is an internal interface for binary storage mechanism.
       
  2097      classes only store the name, signature and instvar names.
       
  2098      They restore by looking for that name in the Smalltalk dictionary.
       
  2099      However, using the signature, a check for being valid is made at
       
  2100      restore time.
       
  2101      This avoids a full recursive store of a class in the normal binary
       
  2102      storage - however, it also means that a classes semantics cannot
       
  2103      be stored with the basic storeBinary operation
       
  2104      (we depend on the class being present at binaryLoad time.
       
  2105     To store classes, use #storeBinaryClassOn:manager: or BOSS>>nextPutClasses:."
       
  2106 
       
  2107     |varnames n sz|
       
  2108 
       
  2109     "/
       
  2110     "/ output the signature
       
  2111     "/
       
  2112     stream nextNumber:4 put:self signature MSB:true.
       
  2113 
       
  2114     varnames := self allInstVarNames.
       
  2115     n := varnames size.
       
  2116     n == 0 ifTrue:[
       
  2117         sz := 0
       
  2118     ] ifFalse:[
       
  2119         sz := varnames inject:0 into:[:sum :nm | sum + nm size].
       
  2120         sz := sz + n - 1.
       
  2121     ].
       
  2122     "/
       
  2123     "/ output the nmber of instvars
       
  2124     "/ followed by each instvar name
       
  2125     "/
       
  2126     stream nextNumber:2 put:sz MSB:true.
       
  2127     varnames keysAndValuesDo:[:i :nm |
       
  2128         stream nextPutBytes:(nm size) from:nm startingAt:1.
       
  2129         i ~~ n ifTrue:[stream nextPut:(Character space codePoint)]
       
  2130     ].
       
  2131 
       
  2132     "/
       
  2133     "/ output my name
       
  2134     "/
       
  2135     stream nextNumber:2 put:name size MSB:true.
       
  2136     stream nextPutBytes:(name size) from:name startingAt:1.
       
  2137 
       
  2138     "
       
  2139      |s|
       
  2140      s := WriteStream on:ByteArray new.
       
  2141      Rectangle storeBinaryOn:s.
       
  2142      Object readBinaryFrom:(ReadStream on:s contents)
       
  2143     "
       
  2144 
       
  2145     "Modified: / 19-03-1997 / 18:47:10 / cg"
       
  2146     "Modified (comment): / 25-08-2017 / 09:01:26 / cg"
       
  2147 ! !
  2093 
  2148 
  2094 !Class methodsFor:'changes management'!
  2149 !Class methodsFor:'changes management'!
  2095 
  2150 
  2096 addChangeRecordForChangeCategory
  2151 addChangeRecordForChangeCategory
  2097     "{ Pragma: +optSpace }"
  2152     "{ Pragma: +optSpace }"