[squeak-dev] FFI: FFI-Kernel-mt.175.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 27 08:48:19 UTC 2021
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.175.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.175
Author: mt
Time: 27 May 2021, 10:48:18.236247 am
UUID: 95c5280e-eb69-9748-8139-7835cd7e2f06
Ancestors: FFI-Kernel-mt.174
Complements Monticello-mt.748. Also removes some variable shadows.
=============== Diff against FFI-Kernel-mt.174 ===============
Item was changed:
----- Method: ExternalData>>from: (in category 'accessing') -----
from: firstIndex
"Move the start of this array. Size not needed."
+ | byteOffset numElements byteSize |
+ byteOffset := ((firstIndex-1) * self contentType byteSize)+1.
- | byteOffset numElements byteSize contentType |
- contentType := self contentType.
- byteOffset := ((firstIndex-1) * contentType byteSize)+1.
numElements := (self size ifNotNil: [:sz | sz - firstIndex + 1 max: 0]).
byteSize := numElements
+ ifNil: [self contentType byteSize]
+ ifNotNil: [numElements * self contentType byteSize].
- ifNil: [contentType byteSize]
- ifNotNil: [numElements * contentType byteSize].
^ ExternalData
fromHandle: (handle structAt: byteOffset length: (byteSize ifNil: [1]))
+ type: self contentType
- type: contentType
size: numElements!
Item was changed:
----- Method: ExternalData>>from:to: (in category 'accessing') -----
from: firstIndex to: lastIndex
"Only copy data if already in object memory, that is, as byte array. Only check size if configured."
+ | byteOffset numElements byteSize |
- | byteOffset numElements byteSize contentType |
ExtraSizeChecks == true ifTrue: [
self sizeCheck: firstIndex.
self sizeCheck: lastIndex].
+ byteOffset := ((firstIndex-1) * self contentType byteSize)+1.
- contentType := self contentType.
- byteOffset := ((firstIndex-1) * contentType byteSize)+1.
numElements := lastIndex - firstIndex + 1 max: 0.
+ byteSize := numElements * self contentType byteSize.
- byteSize := numElements * contentType byteSize.
^ ExternalData
fromHandle: (handle structAt: byteOffset length: byteSize)
+ type: self contentType
- type: contentType
size: numElements!
Item was added:
+ ----- Method: ExternalStructure class>>compileFieldsSafely (in category 'field definition') -----
+ compileFieldsSafely
+
+ [self compileFields]
+ ifError: [:msg | Transcript showln: '[FFI] Field compilation failed: ', msg].!
Item was changed:
----- Method: ExternalStructure class>>doneCompiling (in category 'class management') -----
doneCompiling
"Base class changed to something that is an external structure now."
+ self compileFieldsSafely.
+ self externalType becomeKnownTypeSafely.!
- [self compileFields]
- ifError: [ "Ignore unfinished field specs" ].
- self externalType isUnknownType
- ifTrue: [self externalType becomeKnownTypeSafely].!
Item was added:
+ ----- Method: ExternalType>>becomeKnownTypeSafely (in category 'private') -----
+ becomeKnownTypeSafely
+ "Ignore. We are already a known type."
+
+ self assert: [self isUnknownType not].!
Item was changed:
----- Method: ExternalUnknownType>>becomeKnownTypeSafely (in category 'construction') -----
becomeKnownTypeSafely
"Give me some purpose. :-)"
^ [self becomeKnownType]
+ ifError: [:msg |
+ Transcript showln: '[FFI] Type still unknown: ', msg.
- on: Error
- do: [
self assert: [self isUnknownType].
self].!
More information about the Squeak-dev
mailing list
|