Class.st
changeset 1259 8c62958114ad
parent 1237 9a6877a3b2b2
child 1266 cef9b3cd49df
equal deleted inserted replaced
1258:da1ef936ecdd 1259:8c62958114ad
  1191     stream nextNumber: 2 put: string size.
  1191     stream nextNumber: 2 put: string size.
  1192     string do: [:char| stream nextPut: char asciiValue]
  1192     string do: [:char| stream nextPut: char asciiValue]
  1193 !
  1193 !
  1194 
  1194 
  1195 storeBinaryDefinitionOn: stream manager: manager
  1195 storeBinaryDefinitionOn: stream manager: manager
  1196     "classes only store the name, signature and instvar names.
  1196     "store the receiver in a binary format on stream.
       
  1197      This is an internal interface for binary storage mechanism.
       
  1198      classes only store the name, signature and instvar names.
  1197      They restore by looking for that name in the Smalltalk dictionary.
  1199      They restore by looking for that name in the Smalltalk dictionary.
  1198      However, using the signature, a check for being valid is made at
  1200      However, using the signature, a check for being valid is made at
  1199      restore time.
  1201      restore time.
  1200      This avoids a full recursive store of a class in the normal binary
  1202      This avoids a full recursive store of a class in the normal binary
  1201      storage - however, it also means that a classes semantics cannot
  1203      storage - however, it also means that a classes semantics cannot
  1214      output the instance variable name string
  1216      output the instance variable name string
  1215     "
  1217     "
  1216     varnames := self allInstVarNames.
  1218     varnames := self allInstVarNames.
  1217     n := varnames size.
  1219     n := varnames size.
  1218     n == 0 ifTrue:[
  1220     n == 0 ifTrue:[
  1219 	sz := 0
  1221         sz := 0
  1220     ] ifFalse:[
  1222     ] ifFalse:[
  1221 	sz := varnames inject:0 into:[:sum :nm | sum + nm size].
  1223         sz := varnames inject:0 into:[:sum :nm | sum + nm size].
  1222 	sz := sz + n - 1.
  1224         sz := sz + n - 1.
  1223     ].
  1225     ].
  1224     stream nextNumber:2 put:sz.
  1226     stream nextNumber:2 put:sz.
  1225     varnames keysAndValuesDo:[:i :nm |
  1227     varnames keysAndValuesDo:[:i :nm |
  1226 	nm do:[:c |
  1228         nm do:[:c |
  1227 	    stream nextPut:c asciiValue
  1229             stream nextPut:c asciiValue
  1228 	].
  1230         ].
  1229 	i ~~ n ifTrue:[stream nextPut:(Character space asciiValue)]
  1231         i ~~ n ifTrue:[stream nextPut:(Character space asciiValue)]
  1230     ].
  1232     ].
  1231 
  1233 
  1232     "
  1234     "
  1233      output my name
  1235      output my name
  1234     "
  1236     "
  1235     stream nextNumber:2 put:name size.
  1237     stream nextNumber:2 put:name size.
  1236     name do:[:c| 
  1238     name do:[:c| 
  1237 	stream nextPut:c asciiValue
  1239         stream nextPut:c asciiValue
  1238     ]
  1240     ]
  1239 
  1241 
  1240     "
  1242     "
  1241      |s|
  1243      |s|
  1242      s := WriteStream on:ByteArray new.
  1244      s := WriteStream on:ByteArray new.
  1243      Rectangle storeBinaryOn:s.
  1245      Rectangle storeBinaryOn:s.
  1244      Object readBinaryFrom:(ReadStream on:s contents)  
  1246      Object readBinaryFrom:(ReadStream on:s contents)  
  1245     "
  1247     "
       
  1248 
       
  1249     "Modified: 23.4.1996 / 09:30:36 / cg"
  1246 ! !
  1250 ! !
  1247 
  1251 
  1248 !Class methodsFor:'c function interfacing'!
  1252 !Class methodsFor:'c function interfacing'!
  1249 
  1253 
  1250 cInterfaceFunction:selector calling:cFunctionNameString args:argTypeArray returning:returnType
  1254 cInterfaceFunction:selector calling:cFunctionNameString args:argTypeArray returning:returnType
  3957 ! !
  3961 ! !
  3958 
  3962 
  3959 !Class class methodsFor:'documentation'!
  3963 !Class class methodsFor:'documentation'!
  3960 
  3964 
  3961 version
  3965 version
  3962     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.152 1996-04-20 19:11:19 cg Exp $'
  3966     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.153 1996-04-23 07:32:33 cg Exp $'
  3963 ! !
  3967 ! !
  3964 Class initialize!
  3968 Class initialize!