[squeak-dev] FFI: FFI-Tests-mt.57.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Aug 11 11:42:48 UTC 2021
Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.57.mcz
==================== Summary ====================
Name: FFI-Tests-mt.57
Author: mt
Time: 11 August 2021, 1:42:46.963463 pm
UUID: d13da95f-1541-eb47-9347-f47444977cd2
Ancestors: FFI-Tests-mt.56
Avoid requesting author initials during tests.
=============== Diff against FFI-Tests-mt.56 ===============
Item was changed:
----- Method: FFIPluginLibraryTests>>invoke:withArguments: (in category 'support') -----
invoke: functionName withArguments: someObjects
"Use an instance of the library. Compile class-side methods to instance-side methods as needed."
| selector library |
selector := self lookupSelector: functionName numArgs: someObjects size.
library := FFITestLibrary new.
+ (library respondsTo: selector) ifFalse: [ | signature source prototype priorAuthorInitials |
- (library respondsTo: selector) ifFalse: [ | signature source prototype |
"1) Build method signature."
signature := String streamContents: [:s | | index |
index := 0. selector do: [:char | s nextPut: char.
char = $: ifTrue: [ index := index + 1.
s space; nextPutAll: 'arg'; nextPutAll: index asString; space]]].
"2) Construct method source."
prototype := library class class compiledMethodAt: selector.
source := '{1}\ {2}\ <generated>\ {3}\ ^ self externalCallFailed' withCRs
format: {
signature.
'"This method was automatically generated. See {1}>>{2}"'
format: {prototype methodClass. prototype selector}.
prototype externalLibraryFunction copy
setModule: nil; printString }.
"3) Compile instance-side FFI call in library."
+ priorAuthorInitials := Utilities authorInitialsPerSe.
+ [Utilities authorInitials: 'FFI'.
+ library class compile: source classified: '*autogenerated - primitives'
+ ] ensure: [Utilities authorInitials: priorAuthorInitials]].
- library class compile: source classified: '*autogenerated - primitives'].
^ library perform: selector withArguments: someObjects!
More information about the Squeak-dev
mailing list
|