Marcel Taeumel uploaded a new version of FFI-Tools to project FFI: http://source.squeak.org/FFI/FFI-Tools-mt.3.mcz
==================== Summary ====================
Name: FFI-Tools-mt.3 Author: mt Time: 19 May 2020, 4:22:18.962992 pm UUID: eecefd2a-10ce-5a44-b017-94281056818f Ancestors: FFI-Tools-mt.2
In the Object Explorer, show the instVars again for external structures. They got lost in the previous commit, sorry.
Adds a field for interpreting char* as C string but in a guarded fashion.
=============== Diff against FFI-Tools-mt.2 ===============
Item was added: + ----- Method: ExternalData>>explorerContents (in category '*FFI-Tools') ----- + explorerContents + + ^ super explorerContents, ((type isPointerType and: [(type instVarNamed: #referencedType) = ExternalType char]) + ifTrue: [ + {ObjectExplorerWrapper + with: self fromCStringLimited + name: 'as C string' + model: self}] + ifFalse: [])!
Item was added: + ----- Method: ExternalData>>fromCStringLimited (in category '*FFI-Tools') ----- + fromCStringLimited + + ^ self fromCStringLimitedTo: 50!
Item was added: + ----- Method: ExternalData>>fromCStringLimitedTo: (in category '*FFI-Tools') ----- + fromCStringLimitedTo: limit + "Limit the number of characters to fetch in case this is no C string." + + | stream index char | + type isPointerType ifFalse: [self error: 'External object is not a pointer type.']. + stream := WriteStream on: String new. + index := 1. + [index > limit or: [(char := handle unsignedCharAt: index) = 0 asCharacter]] whileFalse: [ + stream nextPut: char. + index := index + 1]. + ^stream contents!
Item was added: + ----- Method: ExternalData>>hasContentsInExplorer (in category '*FFI-Tools') ----- + hasContentsInExplorer + + ^ (type isPointerType and: [(type instVarNamed: #referencedType) = ExternalType char]) + or: [super hasContentsInExplorer]!
Item was changed: ----- Method: ExternalStructure>>explorerContents (in category '*FFI-Tools') ----- explorerContents
+ | basicExplorerFields | + basicExplorerFields := super explorerContents. + basicExplorerFields do: [:explorerField | + explorerField itemName: '_', explorerField itemName]. + ^ basicExplorerFields, (self class allFieldSelectors replace: [:simpleGetter | - ^ self class allFieldSelectors replace: [:simpleGetter | ObjectExplorerWrapper with: (self perform: simpleGetter) name: simpleGetter + model: self])! - model: self]!
packages@lists.squeakfoundation.org