Squeak 4.6: System-topa.743.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Squeak 4.6: System-topa.743.mcz

commits-2
Chris Muller uploaded a new version of System to project Squeak 4.6:
http://source.squeak.org/squeak46/System-topa.743.mcz

==================== Summary ====================

Name: System-topa.743
Author: topa
Time: 25 June 2015, 10:28:42.468 am
UUID: c215550f-71ae-4d36-859e-c11709db1363
Ancestors: System-topa.742

Character special-casing: as for DataStream as for SmartRefStream

=============== Diff against System-eem.740 ===============

Item was changed:
  ----- Method: DataStream class>>example (in category 'as yet unclassified') -----
  example
      "An example and test of DataStream/ReferenceStream.
       11/19/92 jhm: Use self testWith:."
      "DataStream example"
      "ReferenceStream example"
      | input sharedPoint |
 
      "Construct the test data."
+     input := Array new: 10.
-     input := Array new: 9.
      input at: 1 put: nil.
      input at: 2 put: true.
      input at: 3 put: (Form extent: 63 @ 50 depth: 8).
  (input at: 3) fillWithColor: Color lightBlue.
      input at: 4 put: #(3 3.0 'three').
      input at: 5 put: false.
      input at: 6 put: 1024 @ -2048.
      input at: 7 put: #x.
      input at: 8 put: (Array with: (sharedPoint := 0 @ -30000)).
      input at: 9 put: sharedPoint.
+     input at: 10 put: (Character value: 16r200d).
 
      "Write it out, read it back, and return it for inspection."
      ^ self testWith: input!

Item was added:
+ ----- Method: DataStream>>readCharacterOfSize: (in category 'write and read') -----
+ readCharacterOfSize: instSize
+ | refPosn val |
+ self assert: instSize = 1.
+ refPosn := self getCurrentReference.
+ self setCurrentReference: refPosn.
+ val := self next.
+ ^ Character value: val.
+ !

Item was changed:
  ----- Method: DataStream>>readInstance (in category 'write and read') -----
  readInstance
  "PRIVATE -- Read the contents of an arbitrary instance.
  ASSUMES: readDataFrom:size: sends me beginReference: after it
    instantiates the new object but before reading nested objects.
  NOTE: We must restore the current reference position after
    recursive calls to next.
  Let the instance, not the class read the data.  "
  | instSize aSymbol refPosn anObject newClass |
 
  instSize := (byteStream nextNumber: 4) - 1.
  refPosn := self getCurrentReference.
  aSymbol := self next.
+ aSymbol == #Character
+ ifTrue: [^ self readCharacterOfSize:  instSize].
  newClass := Smalltalk at: aSymbol asSymbol.
  anObject := newClass isVariable "Create object here"
  ifFalse: [newClass basicNew]
  ifTrue: [newClass basicNew: instSize - (newClass instSize)].
  self setCurrentReference: refPosn.  "before readDataFrom:size:"
  anObject := anObject readDataFrom: self size: instSize.
  self setCurrentReference: refPosn.  "before returning to next"
  ^ anObject!

Item was changed:
  ----- Method: DataStream>>typeIDFor: (in category 'write and read') -----
  typeIDFor: anObject
  "Return the typeID for anObject's class.  This is where the tangle of objects is clipped to stop everything from going out.  
  Classes can control their instance variables by defining objectToStoreOnDataStream.
  Any object in blockers is not written out.  See ReferenceStream.objectIfBlocked: and DataStream nextPut:.
  Morphs do not write their owners.  See Morph.storeDataOn:   Each morph tells itself to 'prepareToBeSaved' before writing out."
+
+
+ anObject isFloat ifTrue: [^14]. "shortcut floats of any representation."
-
  ^ TypeMap at: anObject class ifAbsent: [9 "instance of any normal class"]
  "See DataStream initialize.  nil=1. true=2. false=3. a SmallInteger=4. (a String was 5). a Symbol=6.  a ByteArray=7. an Array=8. other = 9.  a Bitmap=11. a Metaclass=12. a Float=14.  a Rectangle=15. any instance that can have a short header=16.  a String=17 (new format). a WordArray=18."!

Item was changed:
  ----- Method: SmartRefStream>>readInstanceSize:clsname:refPosn: (in category 'read write') -----
  readInstanceSize: instSize clsname: className refPosn: refPosn
  "The common code to read the contents of an arbitrary instance.
  ASSUMES: readDataFrom:size: sends me beginReference: after it
    instantiates the new object but before reading nested objects.
  NOTE: We must restore the current reference position after
    recursive calls to next.
  Three cases for files from older versions of the system:
  1) Class has not changed shape, read it straight.
  2) Class has changed instance variables (or needs fixup).  Call a particular method to do it.
  3) There is a new class instead.  Find it, call a particular method to read.
  All classes used to construct the structures dictionary *itself* need to be in 'steady' and they must not change!!  See setStream:"
  | anObject newName newClass dict oldInstVars isMultiSymbol |
 
  self flag: #bobconv.
 
  self setCurrentReference: refPosn.  "remember pos before readDataFrom:size:"
  newName := renamed at: className ifAbsent: [className].
+ newName == #Character
+ ifTrue: [^ self readCharacterOfSize:  instSize].
  isMultiSymbol := newName = #MultiSymbol or: [newName = #WideSymbol].
  "isMultiSymbol ifTrue: [self halt]."
  newClass := Smalltalk at: newName asSymbol.
  (steady includes: newClass) & (newName == className) ifTrue: [
  anObject := newClass isVariable "Create it here"
  ifFalse: [newClass basicNew]
  ifTrue: [newClass basicNew: instSize - (newClass instSize)].
 
  anObject := anObject readDataFrom: self size: instSize.
  self setCurrentReference: refPosn.  "before returning to next"
  isMultiSymbol ifTrue: [^ Symbol intern: anObject asString].
  ^ anObject].
  oldInstVars := structures at: className ifAbsent: [
  self error: 'class is not in structures list']. "Missing in object file"
  anObject := newClass createFrom: self size: instSize version: oldInstVars.
  "only create the instance"
  self beginReference: anObject.
  dict := self catalogValues: oldInstVars size: instSize.
  "indexed vars as (1 -> val) etc."
  dict at: #ClassName put: className. "so conversion method can know it"
 
  "Give each superclass a chance to make its changes"
  self storeInstVarsIn: anObject from: dict. "ones with the same names"
 
  anObject := self applyConversionMethodsTo: anObject className: className varMap: dict.
 
  self setCurrentReference: refPosn.  "before returning to next"
  isMultiSymbol ifTrue: [^ Symbol intern: anObject asString].
  ^ anObject!