[squeak-dev] FFI: FFI-Kernel-nice.118.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jun 21 11:20:36 UTC 2020

Nicolas Cellier uploaded a new version of FFI-Kernel to project FFI:

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

Name: FFI-Kernel-nice.118
Author: nice
Time: 21 June 2020, 1:20:34.369348 pm
UUID: a8c48997-991d-4e32-9b67-6d93fc0dabe0
Ancestors: FFI-Kernel-mt.117

Add the ability to allocate: an ExternalType or an ExternalStructure/Alias.

It's equivalent to new: but we want a specific idiom, C types are not exactly classes.

Add the ability to compare aliases (at least for equality)

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

Item was added:
+ ----- Method: ExternalStructure class>>allocate: (in category 'instance creation') -----
+ allocate: anInteger
+ 	"Create an ExternalData with enough room for storing an array of size anInteger of such structure"
+ 	^self externalType allocate: anInteger!

Item was added:
+ ----- Method: ExternalType>>allocate: (in category 'external data') -----
+ allocate: anInteger
+ 	"Allocate space for containing an array of size anInteger of this dataType"
+ 	| handle |
+ 	handle := ByteArray new: self byteSize * anInteger.
+ 	^(ExternalData fromHandle: handle type: self) size: anInteger!

Item was added:
+ ----- Method: ExternalTypeAlias>>= (in category 'comparing') -----
+ = anExternalTypeAlias
+ 	^self class = anExternalTypeAlias class and: [self value = anExternalTypeAlias value]!

Item was added:
+ ----- Method: ExternalTypeAlias>>hash (in category 'comparing') -----
+ hash
+ 	^self class hash hashMultiply bitXor: self value hash!

More information about the Squeak-dev mailing list