Fix CALLBACK: effect return type also not a string. Added accompanying unit test.
parent
eb3f8632dd
commit
58485af60b
|
@ -34,9 +34,14 @@ CONSTANT: eleven 11
|
||||||
|
|
||||||
] with-file-vocabs
|
] with-file-vocabs
|
||||||
|
|
||||||
FUNCTION: void* alien-parser-effect-test ( int *arg1 float arg2 ) ;
|
FUNCTION: void* alien-parser-function-effect-test ( int *arg1 float arg2 ) ;
|
||||||
[ (( arg1 arg2 -- void* )) ] [
|
[ (( arg1 arg2 -- void* )) ] [
|
||||||
\ alien-parser-effect-test "declared-effect" word-prop
|
\ alien-parser-function-effect-test "declared-effect" word-prop
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
CALLBACK: void* alien-parser-callback-effect-test ( int *arg1 float arg2 ) ;
|
||||||
|
[ (( arg1 arg2 -- void* )) ] [
|
||||||
|
\ alien-parser-callback-effect-test "callback-effect" word-prop
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Reported by mnestic
|
! Reported by mnestic
|
||||||
|
|
|
@ -93,15 +93,15 @@ IN: alien.parser
|
||||||
: library-abi ( lib -- abi )
|
: library-abi ( lib -- abi )
|
||||||
library [ abi>> ] [ "cdecl" ] if* ;
|
library [ abi>> ] [ "cdecl" ] if* ;
|
||||||
|
|
||||||
:: make-callback-type ( lib return! type-name! parameters -- word quot effect )
|
:: make-callback-type ( lib return type-name parameters -- word quot effect )
|
||||||
return type-name normalize-c-arg type-name! return!
|
return type-name normalize-c-arg :> ( return-c-type type-name )
|
||||||
type-name current-vocab create :> type-word
|
type-name current-vocab create :> type-word
|
||||||
type-word [ reset-generic ] [ reset-c-type ] bi
|
type-word [ reset-generic ] [ reset-c-type ] bi
|
||||||
void* type-word typedef
|
void* type-word typedef
|
||||||
parameters return parse-arglist :> ( types callback-effect )
|
parameters return parse-arglist :> ( types callback-effect )
|
||||||
type-word callback-effect "callback-effect" set-word-prop
|
type-word callback-effect "callback-effect" set-word-prop
|
||||||
type-word lib "callback-library" set-word-prop
|
type-word lib "callback-library" set-word-prop
|
||||||
type-word return types lib library-abi callback-quot (( quot -- alien )) ;
|
type-word return-c-type types lib library-abi callback-quot (( quot -- alien )) ;
|
||||||
|
|
||||||
: (CALLBACK:) ( -- word quot effect )
|
: (CALLBACK:) ( -- word quot effect )
|
||||||
"c-library" get
|
"c-library" get
|
||||||
|
|
Loading…
Reference in New Issue