[Pkg] The Trunk: System-topa.741.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 25 08:15:04 UTC 2015


Tobias Pape uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-topa.741.mcz

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

Name: System-topa.741
Author: topa
Time: 25 June 2015, 10:14:29.118 am
UUID: c6c42b80-9c1d-4abd-acf8-3b1b8bfce809
Ancestors: System-eem.740

Ensure characters read and write on Data/Ref streams
todo: SmartRef

=============== 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!



More information about the Packages mailing list