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

commits at source.squeak.org commits at source.squeak.org
Thu Jun 11 09:13:31 UTC 2020


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

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

Name: FFI-Tools-mt.15
Author: mt
Time: 11 June 2020, 11:13:29.847059 am
UUID: ae1bb806-a075-a541-8e78-a93421394155
Ancestors: FFI-Tools-mt.14

Simplify support for C-string interpretation.

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

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."
+ 	
+ 	^ (self isNull not and: [type = ExternalType string]) ifFalse: [#()] ifTrue: [	
- 
- 	^ (self isNull not and: [self mightBeCString]) ifFalse: [#()] ifTrue: [	
  		{ObjectExplorerWrapper
+ 			with: self fromCString
- 			with: self fromCStringLimited
  			name: 'as C string'
  			model: self}]!

Item was removed:
- ----- Method: ExternalData>>fromCStringLimited (in category '*FFI-Tools') -----
- fromCStringLimited
- 	
- 	^ self fromCStringLimitedTo: 50!

Item was removed:
- ----- 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 changed:
  ----- Method: ExternalData>>hasContentsInExplorer (in category '*FFI-Tools') -----
  hasContentsInExplorer
  
  	^ super hasContentsInExplorer
+ 		or: [self isNull not and: [type = ExternalType string]]!
- 		or: [self isNull not and: [self mightBeCString]]!

Item was removed:
- ----- Method: ExternalData>>mightBeCString (in category '*FFI-Tools') -----
- mightBeCString
- 
- 	^ type isPointerType
- 		and: [(type instVarNamed: #referencedType) = ExternalType char]!



More information about the Squeak-dev mailing list