Re: FFI: FFI-Kernel-ct.243.mcz
"Marcel Taeumel (H) via Squeak-dev" <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <[email protected]> |
For backwards compatibility, an extra "#ffiSymbol:" might be more appropriate so that we do not have to rely on the latest Trunk? Hmm... then again, FFI releases used to happen together with Squeak releases because FFI still is kind of a moving target =) Best Marcel Am 24.04.2026 um 21:40 schrieb [email protected]: > Christoph Thiede uploaded a new version of FFI-Kernel to project FFI: > http://source.squeak.org/FFI/FFI-Kernel-ct.243.mcz > > ==================== Summary ==================== > > Name: FFI-Kernel-ct.243 > Author: ct > Time: 24 April 2026, 9:40:21.358338 pm > UUID: fec04c0f-75eb-4937-8817-8e089f873a63 > Ancestors: FFI-Kernel-eem.242 > > Complements Compiler-ct.532/merges and revises findSelector-findLiteral-fixes.3.cs (fixes #findSelector and #findLiteral/signal a new UnknownSymbolNotification in non-interactive Parser/Scanner before interning). > > =============== Diff against FFI-Kernel-eem.242 =============== > > Item was changed: > ----- Method: Parser>>externalErrorReapingDeclaration (in category '*FFI-Kernel') ----- > externalErrorReapingDeclaration > "Parse the function or variable declaration for the error reaping augmentation of a call to > an external library. Create an instance of ExternalLibraryFunction or ExternalVariable and > add it to an existing ExternalLibraryFunction created by externalFunctionDeclaration" > | descriptorClass errReaper extFunc | > (properties pragmas anySatisfy: [:p| p keyword keywords first = #primitive: and: [p arguments first = 120]]) ifFalse: > [^false]. > descriptorClass := cue environment valueOf: #ExternalFunction ifAbsent: [^ false]. > > errReaper := here = 'osErrFunc:' > ifTrue: > [self advance. > self parseAnExternalFunction: descriptorClass > callType: (descriptorClass callingConventionFor: #cdecl:) > checkReturnType: [:returnType| returnType isIntegralType ifFalse: [^self expected: 'integral type']] > error: [:reasonString| ^self expected: reasonString]] > ifFalse: > [self advance. > (self externalType: descriptorClass) > ifNil: [^self expected: 'variable type'] > ifNotNil: > [:argType | | variableName moduleName variableClass | > argType isIntegralType ifFalse: > [^self expected: 'integral type']. > hereType = #word ifFalse: > [^self expected: 'variable name']. > variableName := here. > self advance. > (self matchToken: 'module:') > ifTrue: > [moduleName := here. > (self match: #string) ifFalse: > [^self expected: 'module name string']. > + moduleName := self symbol: moduleName] > - moduleName := moduleName asSymbol] > ifFalse: [self advance]. > variableClass := cue environment valueOf: #ExternalVariable ifAbsent: [^ false]. > variableClass name: variableName module: moduleName type: argType]]. > > extFunc := encoder firstLiteral. > extFunc setErrorReaper: errReaper. > ^true! > > Item was changed: > ----- Method: Parser>>parseAnExternalFunction:callType:checkReturnType:error: (in category '*FFI-Kernel') ----- > parseAnExternalFunction: descriptorClass callType: callType checkReturnType: returnTypeBlockOrNil error: expectedBlock > "Parse just a function declaration followed by an optional module: name to yield an ExternalLibraryFunction." > | args externalName retType moduleName | > "Parse return type" > retType := self externalType: descriptorClass. > retType ifNil: > [expectedBlock value: 'return type']. > returnTypeBlockOrNil ifNotNil: > [returnTypeBlockOrNil value: retType]. > "Parse function name or index" > externalName := here. > (self match: #number) ifFalse: > [ "Consume all tokens as function name" > self advance. > + externalName := self symbol: externalName]. > - externalName := externalName asSymbol]. > (self match: #leftParenthesis) ifFalse: > [expectedBlock value: 'argument list']. > > args := WriteStream on: {}. > [self match: #rightParenthesis] whileFalse: > [(self externalType: descriptorClass) > ifNil: [expectedBlock value: 'argument'] > ifNotNil: [:argType | argType isVoid & argType isPointerType not ifFalse:[args nextPut: argType]]]. > > (self matchToken: 'module:') ifTrue: > [moduleName := here. > (self match: #string) ifFalse: > [^self expected: 'String']. > + moduleName := self symbol: moduleName]. > - moduleName := moduleName asSymbol]. > > ^self environment > at: #ExternalLibraryFunction > ifPresent: > [:xfn| > xfn name: externalName > module: moduleName > callType: callType > returnType: retType > argumentTypes: args contents] > ifAbsent: []! > > Squeak-dev mailing list -- [email protected] > To unsubscribe send an email to [email protected] Squeak-dev mailing list -- [email protected] To unsubscribe send an email to [email protected]