[squeak-dev] FFI: FFI-Kernel-mt.176.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 27 12:23:47 UTC 2021


Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.176.mcz

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

Name: FFI-Kernel-mt.176
Author: mt
Time: 27 May 2021, 2:23:46.798609 pm
UUID: c7798b80-05bc-ba49-a177-790da21a663a
Ancestors: FFI-Kernel-mt.175

Fixes #allocate for alias-to-array types.
Fixes field access for alias-to-array types.
Adds #pointer alias to quickly get a pointer type.
Adds #type:at:(put:) as convenient way to fill a byte array with a mix of typed contents.

=============== Diff against FFI-Kernel-mt.175 ===============

Item was changed:
  ----- Method: ByteArray>>pointerAt: (in category '*FFI-Kernel-examples') -----
  pointerAt: byteOffset
  	"For documentation and convenient exploration only. Type-safe access to byte arrays or external addresses SHOULD happen via external objects that have a type set such as instances of ExternalStructure and ExternalData."
  	
+ 	^ ExternalType pointer handle: self at: byteOffset!
- 	^ ExternalType void asPointerType handle: self at: byteOffset!

Item was changed:
  ----- Method: ByteArray>>pointerAt:put: (in category '*FFI-Kernel-examples') -----
  pointerAt: byteOffset put: value
  	"For documentation and convenient exploration only. Type-safe access to byte arrays or external addresses SHOULD happen via external objects that have a type set such as instances of ExternalStructure and ExternalData."
  	
+ 	^ ExternalType pointer handle: self at: byteOffset put: value!
- 	^ ExternalType void asPointerType handle: self at: byteOffset put: value!

Item was added:
+ ----- Method: ByteArray>>type:at: (in category '*FFI-Kernel') -----
+ type: spec at: byteOffset
+ 	"For convenience, when the receiver needs to filled with a mix of typed contents. See FFICallback for an example."
+ 	
+ 	^ (ExternalType lookupType: spec) handle: self at: byteOffset!

Item was added:
+ ----- Method: ByteArray>>type:at:put: (in category '*FFI-Kernel') -----
+ type: spec at: byteOffset put: value
+ 	"For convenience, when the receiver needs to filled with a mix of typed contents. See FFICallback for an example."
+ 
+ 	^ (ExternalType lookupType: spec) handle: self at: byteOffset put: value!

Item was changed:
  ----- Method: ExternalArrayType>>allocate (in category 'external data') -----
  allocate
  
+ 	| data |
+ 	data := self contentType allocate: self size.
+ 	^ self isTypeAlias
+ 		ifTrue: [referentClass fromHandle: data getHandle]
+ 		ifFalse: [data]!
- 	^ self contentType allocate: self size!

Item was added:
+ ----- Method: ExternalTypeAlias>>at: (in category 'proxy') -----
+ at: index
+ 	"Compatibility for alias-to-array types."
+ 	
+ 	^ self value at: index!

Item was added:
+ ----- Method: ExternalTypeAlias>>at:put: (in category 'proxy') -----
+ at: index put: object
+ 	"Compatibility for alias-to-array types."
+ 	
+ 	^ self value at: index put: object!



More information about the Squeak-dev mailing list