mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-18 16:51:51 +03:00
[ ffi ] Fix missing structure declarations in scheme ffi
This commit is contained in:
parent
db4c5e7fbb
commit
a945b5d2df
@ -365,7 +365,7 @@ mkStruct (CFStruct n flds)
|
||||
showFld : (String, CFType) -> Core Builder
|
||||
showFld (n, ty) = pure $ "[" ++ fromString n ++ " " ++ !(cftySpec emptyFC ty) ++ "]"
|
||||
mkStruct (CFIORes t) = mkStruct t
|
||||
mkStruct (CFFun a b) = do ignore (mkStruct a); mkStruct b
|
||||
mkStruct (CFFun a b) = do [| mkStruct a ++ mkStruct b |]
|
||||
mkStruct _ = pure ""
|
||||
|
||||
schFgnDef : {auto c : Ref Ctxt Defs} ->
|
||||
|
@ -328,7 +328,7 @@ mkStruct (CFStruct n flds)
|
||||
showFld : (String, CFType) -> Core Builder
|
||||
showFld (n, ty) = pure $ "(" ++ fromString n ++ " " ++ !(cftySpec emptyFC ty) ++ ")"
|
||||
mkStruct (CFIORes t) = mkStruct t
|
||||
mkStruct (CFFun a b) = do ignore (mkStruct a); mkStruct b
|
||||
mkStruct (CFFun a b) = [| mkStruct a ++ mkStruct b |]
|
||||
mkStruct _ = pure ""
|
||||
|
||||
schFgnDef : {auto c : Ref Ctxt Defs} ->
|
||||
|
@ -311,7 +311,7 @@ mkStruct (CFStruct n flds)
|
||||
showFld : (String, CFType) -> Core Builder
|
||||
showFld (n, ty) = pure $ "[" ++ fromString n ++ " " ++ !(cftySpec emptyFC ty) ++ "]"
|
||||
mkStruct (CFIORes t) = mkStruct t
|
||||
mkStruct (CFFun a b) = do ignore (mkStruct a); mkStruct b
|
||||
mkStruct (CFFun a b) = [| mkStruct a ++ mkStruct b |]
|
||||
mkStruct _ = pure ""
|
||||
|
||||
schFgnDef : {auto f : Ref Done (List String) } ->
|
||||
|
13
tests/allschemes/ffi001/Struct.idr
Normal file
13
tests/allschemes/ffi001/Struct.idr
Normal file
@ -0,0 +1,13 @@
|
||||
import System.FFI
|
||||
|
||||
PtrAST : Type
|
||||
PtrAST = Struct "AST" [("value", AnyPtr)]
|
||||
|
||||
%foreign "C:freeAST,foo"
|
||||
prim_freeAST : (PtrAST -> Int) -> PrimIO ()
|
||||
|
||||
freeAST : HasIO io => (PtrAST -> Int) -> io ()
|
||||
freeAST ast = primIO $ prim_freeAST ast
|
||||
|
||||
main : IO ()
|
||||
main = freeAST (\x => 1)
|
0
tests/allschemes/ffi001/expected
Normal file
0
tests/allschemes/ffi001/expected
Normal file
4
tests/allschemes/ffi001/run
Executable file
4
tests/allschemes/ffi001/run
Executable file
@ -0,0 +1,4 @@
|
||||
. ../../testutils.sh
|
||||
|
||||
# Previously reported: unrecognized foreign-callable argument ftype name AST
|
||||
idris2 -c Struct.idr -o out </dev/null
|
Loading…
Reference in New Issue
Block a user