[squeak-dev] FFI: FFI-Tools-mt.27.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 6 17:27:57 UTC 2021


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

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

Name: FFI-Tools-mt.27
Author: mt
Time: 6 May 2021, 7:27:57.081981 pm
UUID: f737b5e5-71dd-604e-bce6-e42a9f4fc08d
Ancestors: FFI-Tools-mt.26

For external data with a specific size (i.e. known array type), list all elements just like in an explorer on a collection.

When closing explorer/inspector, ask users whether to free external memory if any allocated.

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

Item was changed:
  ----- Method: ExternalData>>explorerContentsStructFields (in category '*FFI-Tools') -----
  explorerContentsStructFields
  	"In case some data interpretation omitted to convert char*, which is a (null-terminated) C string, to Smalltalk string."
+ 
+ 	size notNil ifTrue: [
+ 		^ self withIndexCollect: [:each :index |
+ 			ObjectExplorerWrapper
+ 				with: each
+ 				name: index printString
+ 				model: self]].
  	
  	^ (self isNull not and: [self containerType = ExternalType string]) ifFalse: [#()] ifTrue: [	
  		{ObjectExplorerWrapper
  			with: self fromCString
  			name: 'as C string'
  			model: self}]!

Item was added:
+ ----- Method: ExternalStructure>>explorerOkToClose (in category '*FFI-Tools') -----
+ explorerOkToClose
+ 	"We are being explored and that explorer wants to close. If we point to external memory, ask the user whether we should free it to avoid leaks."
+ 	
+ 	(handle isExternalAddress and: [handle isNull not]) ifTrue: [
+ 		(Project uiManager
+ 			confirm: ('There are <b>{1}</b> bytes addressed.<br>Do you want to <b>free</b> the allocated memory?'
+ 				translated format: {
+ 					[self byteSize] ifError: ['an unknown number of']. }) asTextFromHtml
+ 			orCancel: [^ false]
+ 			title: 'External Address Detected' translated)
+ 				ifTrue: [self free]].
+ 			
+ 	^ true!

Item was added:
+ ----- Method: ExternalStructure>>inspectorOkToClose (in category '*FFI-Tools') -----
+ inspectorOkToClose
+ 	
+ 	^ self explorerOkToClose!



More information about the Squeak-dev mailing list