FFI: FFI-Tools-mt.31.mcz

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

FFI: FFI-Tools-mt.31.mcz

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

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

Name: FFI-Tools-mt.31
Author: mt
Time: 16 May 2021, 1:04:44.550551 pm
UUID: d9289a3f-d78b-aa45-a291-5b027280ca12
Ancestors: FFI-Tools-mt.30

Complements FFI-Kernel-mt.153

=============== Diff against FFI-Tools-mt.30 ===============

Item was changed:
  ----- Method: ExternalObjectHandleWrapper>>objectString (in category 'accessing') -----
  objectString
 
  | label handle skipLimit |
  label := super objectString.
  handle := self getHandle.
  skipLimit := 16.
 
+ ^ handle isExternalAddress ifTrue: [label] ifFalse: [
+ (thisContext objectClass: handle) == ByteArrayReadWriter
- handle isExternalAddress ifTrue: [^ label].
- handle isInternalMemory ifTrue: [
- ^ (thisContext objectClass: handle) == ByteArrayReadWriter
  ifFalse: [label]
  ifTrue: [ | begin end tokens |
  label :=(thisContext object: handle instVarAt: 3) "byteArray" printString.
  label := label copyFrom: 3 to: (label size - 1).
  begin := (thisContext object: handle instVarAt: 1) "byteOffset" + 1.
  end := begin - 1 + (thisContext object: handle instVarAt: 2) "byteSize".
  String streamContents: [:stream |
  stream nextPutAll: '#[ '.
  tokens := label findTokens: ' ' "#[0 0 0 0 0]".
  begin > skipLimit ifTrue: [
  stream nextPutAll: '. . ', (begin - 1) asString, ' bytes . . '.
  tokens := tokens allButFirst: begin - 1.
  end := end - begin + 1. begin := 1].
  (1 to: end) do: [:index | | token |
  token := tokens at: index.
  index >= begin
  ifTrue: [stream nextPutAll: token]
  ifFalse: ["Skip byte info" stream nextPut: $.].
  stream space].
  (tokens size - end + 1) > skipLimit ifTrue: [
  stream nextPutAll: '. . ', (tokens size - end) asString, ' bytes . . '.
  tokens := tokens allButLast: tokens size - end.
  end := tokens size].
  (tokens size - end) timesRepeat: [
  "Skip byte info" stream nextPut: $..
  stream space].
  stream nextPutAll: ']'.
+ ]]].!
- ]]].
-
- "Type aliases to atomic types store primitive Smalltalk objects in their handle. Indicate that role of actually being a handle for the FFI plugin with a small prefix."
- ^ '-> ', label!