FFI Inbox: FFI-Kernel-nice.120.mcz

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

FFI Inbox: FFI-Kernel-nice.120.mcz

commits-2
Nicolas Cellier uploaded a new version of FFI-Kernel to project FFI Inbox:
http://source.squeak.org/FFIinbox/FFI-Kernel-nice.120.mcz

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

Name: FFI-Kernel-nice.120
Author: nice
Time: 22 June 2020, 1:03:16.106452 am
UUID: e187957c-7826-9146-bcb0-c35db3202d46
Ancestors: FFI-Kernel-nice.119

Fixup: isEmpty is only for subclass...

=============== Diff against FFI-Kernel-nice.119 ===============

Item was changed:
  ----- Method: ExternalType>>handle:at: (in category 'external data') -----
  handle: handle at: byteOffset
  "Read the receiver's external type using the given handle and the byteOffset. This is the dynamic version of #readFieldAt:."
 
  | address value |
  self isPointerType
  ifTrue:
  [address := handle pointerAt: byteOffset length: self byteSize.
  ^ExternalData
  fromHandle: address
  type: self asNonPointerType].
  self isAtomic
  ifTrue:
  ["Answer atomic value"
  value := handle
  perform: (AtomicSelectors at: self atomicType)
  with: byteOffset.
  ^referentClass ifNil: [value] ifNotNil: [referentClass fromHandle: value]].
 
  referentClass isNil
  ifTrue: [self error: 'unknown type'].
- self isEmpty ifTrue: [self error: 'Empty structure'].
 
  ^referentClass fromHandle: (handle structAt: byteOffset length: self byteSize)!

Item was changed:
  ----- Method: ExternalType>>handle:at:put: (in category 'external data') -----
  handle: handle at: byteOffset put: value
  "Write a value using the receiver's external type at the given handle and byteOffset. This is the dynamic version of #writeFieldAt:with:."
 
  self isPointerType
  ifTrue: [ "set pointer to struct/union/alias"
  self assert: [value externalType == self asNonPointerType].
  handle
  pointerAt: byteOffset
  put: value getHandle
  length: self byteSize.
  ^value].
 
  self isAtomic
  ifTrue:
  [ "set atomic value"
  self flag: #addTypeCheck. "mt: Note that there is currently no mapping from objects that represent valid atomics to atomic types."
  handle
  perform: ((AtomicSelectors at: self atomicType), 'put:') asSymbol
  with: byteOffset
  with: value.
  ^value].
 
  referentClass isNil
  ifTrue: [self error: 'unknown type'].
- self isEmpty ifTrue: [self error: 'Empty structure'].
 
  self assert: [value externalType == self].
  handle structAt: byteOffset put: value getHandle length: self byteSize.
  ^value
  !