FFI: FFI-Kernel-mt.165.mcz

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

FFI: FFI-Kernel-mt.165.mcz

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

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

Name: FFI-Kernel-mt.165
Author: mt
Time: 21 May 2021, 11:54:01.161285 am
UUID: 849d8c16-bd3f-e941-8765-2d5813f9e0eb
Ancestors: FFI-Kernel-mt.164

For consistency, make raw-bits arrays compatible with handle-based access. They are both handle and (FFI) array after all. Unlike ExternalData. See #getHandle.

Note that the intended use is still through the array protocol: #at:, #at:put:, #from:to:, #from:, ...

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

Item was added:
+ ----- Method: ByteString>>atByteOffset: (in category '*FFI-Kernel-accessing') -----
+ atByteOffset: byteOffset
+
+ | index |
+ index := ((byteOffset-1) / self contentType byteSize) + 1.
+ ^ self at: index!

Item was added:
+ ----- Method: ByteString>>atByteOffset:put: (in category '*FFI-Kernel-accessing') -----
+ atByteOffset: byteOffset put: value
+
+ | index |
+ index := ((byteOffset-1) / self contentType byteSize) + 1.
+ ^ self at: index put: value!

Item was changed:
+ ----- Method: ByteString>>contentType (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>contentType (in category '*FFI-Kernel') -----
  contentType
 
  ^ self externalType contentType!

Item was changed:
+ ----- Method: ByteString>>externalType (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>externalType (in category '*FFI-Kernel') -----
  externalType
 
  ^ self class externalType contentType asArrayType: self size!

Item was changed:
+ ----- Method: ByteString>>free (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>free (in category '*FFI-Kernel') -----
  free
 
  self shouldNotImplement.!

Item was changed:
+ ----- Method: ByteString>>from: (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>from: (in category '*FFI-Kernel') -----
  from: firstIndex
  "See ExternalData"
 
  ^ self copyFrom: firstIndex to: self size!

Item was changed:
+ ----- Method: ByteString>>from:to: (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>from:to: (in category '*FFI-Kernel') -----
  from: firstIndex to: lastIndex
  "See ExternalData"
 
  ^ self copyFrom: firstIndex to: lastIndex!

Item was changed:
+ ----- Method: ByteString>>getHandle (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>getHandle (in category '*FFI-Kernel') -----
  getHandle
  "I am my own handle."
 
  ^ self!

Item was added:
+ ----- Method: ByteString>>integerAt:put:size:signed: (in category '*FFI-Kernel-accessing') -----
+ integerAt: byteOffset put: value size: nBytes signed: aBoolean
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:put:."
+
+ ^ self atByteOffset: byteOffset put: value asCharacter.!

Item was added:
+ ----- Method: ByteString>>integerAt:size:signed: (in category '*FFI-Kernel-accessing') -----
+ integerAt: byteOffset size: nBytes signed: aBoolean
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:."
+
+ ^ self atByteOffset: byteOffset!

Item was changed:
+ ----- Method: ByteString>>isFFIArray (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>isFFIArray (in category '*FFI-Kernel') -----
  isFFIArray
 
  ^ true!

Item was changed:
+ ----- Method: ByteString>>isNull (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>isNull (in category '*FFI-Kernel') -----
  isNull
 
  ^ false!

Item was changed:
+ ----- Method: ByteString>>reader (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>reader (in category '*FFI-Kernel') -----
  reader
 
  ^ self!

Item was changed:
+ ----- Method: ByteString>>setContentType: (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>setContentType: (in category '*FFI-Kernel') -----
  setContentType: type
  "See ExternalData."
 
  self shouldNotImplement.!

Item was changed:
+ ----- Method: ByteString>>setSize: (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>setSize: (in category '*FFI-Kernel') -----
  setSize: size
  "See ExternalData."
 
  self shouldNotImplement.!

Item was changed:
+ ----- Method: ByteString>>writer (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>writer (in category '*FFI-Kernel') -----
  writer
 
  ^ self!

Item was changed:
+ ----- Method: ByteString>>zeroMemory (in category '*FFI-Kernel-external data') -----
- ----- Method: ByteString>>zeroMemory (in category '*FFI-Kernel') -----
  zeroMemory
 
  1 to: self size do: [:index |
  self at: index put: Character null].!

Item was added:
+ ----- Method: RawBitsArray>>atByteOffset: (in category '*FFI-Kernel-accessing') -----
+ atByteOffset: byteOffset
+
+ | index |
+ index := ((byteOffset-1) / self contentType byteSize) + 1.
+ ^ self at: index!

Item was added:
+ ----- Method: RawBitsArray>>atByteOffset:put: (in category '*FFI-Kernel-accessing') -----
+ atByteOffset: byteOffset put: value
+
+ | index |
+ index := ((byteOffset-1) / self contentType byteSize) + 1.
+ ^ self at: index put: value!

Item was changed:
+ ----- Method: RawBitsArray>>contentType (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>contentType (in category '*FFI-Kernel') -----
  contentType
 
  ^ self externalType contentType!

Item was added:
+ ----- Method: RawBitsArray>>doubleAt: (in category '*FFI-Kernel-accessing') -----
+ doubleAt: byteOffset
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:."
+
+ ^ self atByteOffset: byteOffset!

Item was added:
+ ----- Method: RawBitsArray>>doubleAt:put: (in category '*FFI-Kernel-accessing') -----
+ doubleAt: byteOffset put: value
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:put:."
+
+ ^ self atByteOffset: byteOffset put: value!

Item was changed:
+ ----- Method: RawBitsArray>>externalType (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>externalType (in category '*FFI-Kernel') -----
  externalType
 
  ^ self class externalType contentType asArrayType: self size!

Item was added:
+ ----- Method: RawBitsArray>>floatAt: (in category '*FFI-Kernel-accessing') -----
+ floatAt: byteOffset
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:."
+
+ ^ self atByteOffset: byteOffset!

Item was added:
+ ----- Method: RawBitsArray>>floatAt:put: (in category '*FFI-Kernel-accessing') -----
+ floatAt: byteOffset put: value
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:put:."
+
+ ^ self atByteOffset: byteOffset put: value!

Item was changed:
+ ----- Method: RawBitsArray>>free (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>free (in category '*FFI-Kernel') -----
  free
 
  self shouldNotImplement.!

Item was changed:
+ ----- Method: RawBitsArray>>from: (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>from: (in category '*FFI-Kernel') -----
  from: firstIndex
  "See ExternalData"
 
  ^ self copyFrom: firstIndex to: self size!

Item was changed:
+ ----- Method: RawBitsArray>>from:to: (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>from:to: (in category '*FFI-Kernel') -----
  from: firstIndex to: lastIndex
  "See ExternalData"
 
  ^ self copyFrom: firstIndex to: lastIndex!

Item was changed:
+ ----- Method: RawBitsArray>>getHandle (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>getHandle (in category '*FFI-Kernel') -----
  getHandle
  "I am my own handle."
 
  ^ self!

Item was added:
+ ----- Method: RawBitsArray>>integerAt:put:size:signed: (in category '*FFI-Kernel-accessing') -----
+ integerAt: byteOffset put: value size: nBytes signed: aBoolean
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:put:."
+
+ ^ self atByteOffset: byteOffset put: value!

Item was added:
+ ----- Method: RawBitsArray>>integerAt:size:signed: (in category '*FFI-Kernel-accessing') -----
+ integerAt: byteOffset size: nBytes signed: aBoolean
+ "Backstop for compatibility with handle-based access. Raw-bits arrays are their own handle. See #getHandle and ExternalType >> #handle:at:."
+
+ ^ self atByteOffset: byteOffset!

Item was changed:
+ ----- Method: RawBitsArray>>isFFIArray (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>isFFIArray (in category '*FFI-Kernel') -----
  isFFIArray
 
  ^ true!

Item was changed:
+ ----- Method: RawBitsArray>>isNull (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>isNull (in category '*FFI-Kernel') -----
  isNull
 
  ^ false!

Item was changed:
+ ----- Method: RawBitsArray>>reader (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>reader (in category '*FFI-Kernel') -----
  reader
 
  ^ self!

Item was changed:
+ ----- Method: RawBitsArray>>setContentType: (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>setContentType: (in category '*FFI-Kernel') -----
  setContentType: type
  "See ExternalData."
 
  self shouldNotImplement.!

Item was changed:
+ ----- Method: RawBitsArray>>setSize: (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>setSize: (in category '*FFI-Kernel') -----
  setSize: size
  "See ExternalData."
 
  self shouldNotImplement.!

Item was changed:
+ ----- Method: RawBitsArray>>writer (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>writer (in category '*FFI-Kernel') -----
  writer
 
  ^ self!

Item was changed:
+ ----- Method: RawBitsArray>>zeroMemory (in category '*FFI-Kernel-external data') -----
- ----- Method: RawBitsArray>>zeroMemory (in category '*FFI-Kernel') -----
  zeroMemory
 
  self atAllPut: 0.!