[squeak-dev] FFI: FFI-Callbacks-mt.3.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jul 28 11:37:15 UTC 2020


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

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

Name: FFI-Callbacks-mt.3
Author: mt
Time: 28 July 2020, 1:37:14.847011 pm
UUID: 9d6c3731-a9c3-2742-a9bb-d47d40a156d2
Ancestors: FFI-Callbacks-mt.2

Updates for FFI-Kernel-mt.119. You may need to re-generate the fields in FFICallbackContext and FFICallbackResult.

=============== Diff against FFI-Callbacks-mt.2 ===============

Item was changed:
  ----- Method: ExternalAddress class>>fromInteger: (in category '*FFI-Callbacks') -----
  fromInteger: anInteger
  	"Read the given interger as an address pointing to an external memory area."
  	
  	| buffer type |
+ 	self flag: #refactor. "Maybe: ExternalAddress new fromInteger: anInteger --- and maybe move to FFI-Kernel"
  	type := ExternalType uintptr_t.
  	buffer := ByteArray new: type byteSize.
  	type handle: buffer at: 1 put: anInteger.
  	^ buffer asExternalPointer!

Item was removed:
- ----- Method: FFICallbackContext>>floatRegArgs (in category 'accessing') -----
- floatRegArgs
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	^ExternalData fromHandle: (handle shortPointerAt: 13) type: ExternalType double asPointerType!

Item was removed:
- ----- Method: FFICallbackContext>>floatRegArgs: (in category 'accessing') -----
- floatRegArgs: someExternalData
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	handle shortPointerAt: 13 put: someExternalData getHandle.!

Item was removed:
- ----- Method: FFICallbackContext>>intRegArgs (in category 'accessing') -----
- intRegArgs
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	^ExternalData fromHandle: (handle shortPointerAt: 9) type: ExternalType long asPointerType!

Item was removed:
- ----- Method: FFICallbackContext>>intRegArgs: (in category 'accessing') -----
- intRegArgs: someExternalData
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	handle shortPointerAt: 9 put: someExternalData getHandle.!

Item was removed:
- ----- Method: FFICallbackContext>>rvs (in category 'accessing') -----
- rvs
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	^FFICallbackResult fromHandle: (handle structAt: 25 length: 8)!

Item was removed:
- ----- Method: FFICallbackContext>>rvs: (in category 'accessing') -----
- rvs: aFFICallbackResult
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	handle structAt: 25 put: aFFICallbackResult getHandle length: 8.!

Item was removed:
- ----- Method: FFICallbackContext>>stackPtr (in category 'accessing') -----
- stackPtr
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	^ExternalData fromHandle: (handle shortPointerAt: 5) type: ExternalType long asPointerType!

Item was removed:
- ----- Method: FFICallbackContext>>stackPtr: (in category 'accessing') -----
- stackPtr: someExternalData
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	handle shortPointerAt: 5 put: someExternalData getHandle.!

Item was removed:
- ----- Method: FFICallbackContext>>thunkp (in category 'accessing') -----
- thunkp
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	^ExternalData fromHandle: (handle shortPointerAt: 1) type: ExternalType void asPointerType!

Item was removed:
- ----- Method: FFICallbackContext>>thunkp: (in category 'accessing') -----
- thunkp: someExternalData
- 	"This method was automatically generated. See FFICallbackContext class>>fields."
- 	<generated>
- 	handle shortPointerAt: 1 put: someExternalData getHandle.!

Item was changed:
  ----- Method: FFICallbackMemory class>>unload (in category 'class initialization') -----
  unload
  
+ 	Smalltalk removeFromStartUpList: self.
+ 	Smalltalk specialObjectsArray at: 53 put: nil.!
- 	Smalltalk removeFromStartUpList: self.!

Item was changed:
  ----- Method: FFICallbackMemory>>externalPointer: (in category 'accessing') -----
  externalPointer: anExternalAddress
  
+ 	self addressFieldPut: anExternalAddress asInteger.!
- 	| type integer |
- 	self flag: #debugging.
- 	type := ExternalType uintptr_t.
- 	integer := type
- 		handle: anExternalAddress asByteArrayPointer
- 		at: 1.
- 		
- 	self addressFieldPut: integer.!

Item was removed:
- ----- Method: FFICallbackResult>>booleanResult (in category 'accessing') -----
- booleanResult
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	^handle booleanAt: 1!

Item was removed:
- ----- Method: FFICallbackResult>>booleanResult: (in category 'accessing') -----
- booleanResult: aBoolean
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	handle booleanAt: 1 put: aBoolean!

Item was removed:
- ----- Method: FFICallbackResult>>floatResult (in category 'accessing') -----
- floatResult
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	^handle doubleAt: 1!

Item was removed:
- ----- Method: FFICallbackResult>>floatResult: (in category 'accessing') -----
- floatResult: aFloat
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	handle doubleAt: 1 put: aFloat!

Item was removed:
- ----- Method: FFICallbackResult>>integerResult (in category 'accessing') -----
- integerResult
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	^handle signedLongAt: 1!

Item was removed:
- ----- Method: FFICallbackResult>>integerResult: (in category 'accessing') -----
- integerResult: anInteger
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	handle signedLongAt: 1 put: anInteger!

Item was removed:
- ----- Method: FFICallbackResult>>positiveIntegerResult (in category 'accessing') -----
- positiveIntegerResult
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	^handle unsignedLongAt: 1!

Item was removed:
- ----- Method: FFICallbackResult>>positiveIntegerResult: (in category 'accessing') -----
- positiveIntegerResult: anInteger
- 	"This method was automatically generated. See FFICallbackResult class>>fields."
- 	<generated>
- 	handle unsignedLongAt: 1 put: anInteger!

Item was removed:
- ----- Method: Parser>>callback (in category '*FFI-Callbacks') -----
- callback
- 	<pragmaParser>
- 	
- 	| descriptorClass retType externalName args argType |
- 	descriptorClass := ExternalFunction.
- 	"Parse return type"
- 	self advance.
- 	here = 'const' ifTrue: [self advance].
- 	retType := self externalType: descriptorClass.
- 	retType == nil ifTrue:[^self expected:'return type'].
- 	"Parse function name or index"
- 	externalName := here.
- 
- 	(self match: #leftParenthesis) ifFalse:[^self expected:'function pointer (*)'].
- 	(self matchToken: #*) ifFalse:[^self expected:'function pointer (*)'].
- 	(self match: #rightParenthesis) ifFalse:[^self expected:'function pointer (*)'].
- 
- 	(self match: #leftParenthesis) ifFalse:[^self expected:'argument list'].
- 	args := WriteStream on: Array new.
- 	[self match: #rightParenthesis] whileFalse:[
- 		here = 'const' ifTrue: [self advance].
- 		here = ',' ifTrue: [self advance].
- 		argType := self externalType: descriptorClass.
- 		argType == nil ifTrue:[^self expected:'argument'].
- 		argType isVoid & argType isPointerType not ifFalse:[args nextPut: argType]].
- 
- 	self addPragma: (Pragma keyword: #callback: arguments: {{retType}, args contents}).
- 	^true!

Item was removed:
- ----- Method: SHParserST80>>callback (in category '*FFI-Callbacks') -----
- callback
- 	<pragmaParser>
- 	
- 	self scanPast: #externalFunctionCallingConvention.	
- 	
- 	self scanPast: #externalCallType.
- 	currentToken = '*' 
- 		ifTrue: [self scanPast: #externalCallTypePointerIndicator].
- 
- 	currentTokenFirst == $( ifFalse: [^ self fail]. self scanNext.
- 	currentTokenFirst == $* ifFalse: [^ self fail]. self scanNext.
- 	currentTokenFirst == $) ifFalse: [^ self fail]. self scanNext.
- 		
- 	self failUnless: currentTokenFirst == $(.
- 	self scanPast: #leftParenthesis.
- 	[currentTokenFirst ~= $)] 
- 		whileTrue: [
- 			self failUnless: currentToken notNil.
- 			self scanPast: #externalCallType.
- 			currentToken = '*' 
- 				ifTrue: [self scanPast: #externalCallTypePointerIndicator]].
- 	self scanPast: #rightParenthesis.
- 	currentToken = 'module:' 
- 		ifTrue: [
- 			self scanPast: #module.
- 			self parseStringOrSymbol ].
- 	currentToken = 'error:' ifTrue: [
- 		self scanPast: #primitive. "there's no rangeType for error"
- 		self currentTokenType == #name
- 			ifTrue: [ self parseTemporary: #patternTempVar ]
- 			ifFalse: [ self parseStringOrSymbol ] ].
- 	self failUnless: currentToken = '>'.
- 	self scanPast: #primitiveOrExternalCallEnd!



More information about the Squeak-dev mailing list