[squeak-dev] FFI: FFI-Kernel-mt.82.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 1 07:58:13 UTC 2020


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

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

Name: FFI-Kernel-mt.82
Author: mt
Time: 1 June 2020, 9:58:11.800523 am
UUID: ace0c4b6-24ce-a847-ae5f-6f2e281592f4
Ancestors: FFI-Kernel-mt.81

Fixes bug in external type's #storeOn:. Removes ambiguous #externalTypeName, which actually generated a #storeString for the pointer type.

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

Item was changed:
  ----- Method: ExternalStructure class>>defineAliasAccessorsFor:type: (in category 'field definition') -----
  defineAliasAccessorsFor: fieldName type: type
  	"Define read/write accessors for the given field"
  	| code refClass argName |
  	(type isVoid and:[type isPointerType not]) ifTrue:[^self].
  	refClass := type referentClass.
  	code := String streamContents:[:s|
  		s 
  			nextPutAll: fieldName; crtab;
  			nextPutAll:'"This method was automatically generated"'; crtab;
  			nextPut: $<; nextPutAll: #generated; nextPut: $>; crtab.
  		refClass == nil 
  			ifTrue:[(type isAtomic and:[type isPointerType not]) 
  				ifTrue:[s nextPutAll:'^handle']
  				ifFalse:[s nextPutAll:'^ExternalData fromHandle: handle'.
  						type isPointerType ifTrue:[s nextPutAll:' asExternalPointer'].
  						s nextPutAll:' type: ';
+ 						nextPutAll: type asPointerType storeString]]
- 						nextPutAll: type externalTypeName]]
  			ifFalse:[s nextPutAll:'^', refClass name,' fromHandle: handle'.
  					type isPointerType ifTrue:[s nextPutAll:' asExternalPointer']]].
  	self compile: code classified: 'accessing'.
  
  	code := String streamContents:[:s|
  		argName := refClass == nil 
  			ifTrue:[(type isAtomic and:[type isPointerType not])
  				ifTrue:['anObject']
  				ifFalse:['anExternalData']]
  			ifFalse:['a',refClass name].
  		s
  			nextPutAll: fieldName,': '; nextPutAll: argName; crtab;
  			nextPutAll:'"This method was automatically generated"'; crtab;
  			nextPut: $<; nextPutAll: #generated; nextPut: $>; crtab.
  		(refClass == nil and:[type isAtomic and:[type isPointerType not]])
  			ifTrue:[s nextPutAll:'handle := ', argName]
  			ifFalse:[s nextPutAll:'handle := ', argName,' getHandle'.
  					type isPointerType ifTrue:[s nextPutAll:' asByteArrayPointer']]].
  	self compile: code classified: 'accessing'.!

Item was removed:
- ----- Method: ExternalType>>externalTypeName (in category 'private') -----
- externalTypeName
- 	^'ExternalType ', (AtomicTypeNames at: self atomicType), ' asPointerType'!

Item was changed:
  ----- Method: ExternalType>>storeOn: (in category 'printing') -----
  storeOn: aStream
  	referentClass == nil
  		ifTrue:[aStream nextPutAll: ExternalType name; space; nextPutAll: (AtomicTypeNames at: self atomicType)]
  		ifFalse:[aStream nextPut: $(; nextPutAll: ExternalType name; space; nextPutAll: #structTypeNamed:; space;  store: referentClass name; nextPut: $)].
+ 	self isPointerType ifTrue: [aStream space; nextPutAll: #asPointerType].!
- 	self isPointerType ifTrue: [aStream space; nextPutAll: #asPointer].!



More information about the Squeak-dev mailing list