diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-07 17:40:59 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-07 17:40:59 -0500 |
| commit | 4ccde62d4f3ed699832c845fde83598027820d8e (patch) | |
| tree | cc2964349fd045dc780991809d583ff1e45a95ff /tests | |
| parent | 4c513a50de64d7675b652e08deeb4c7c0db4124a (diff) | |
| download | nimterop-4ccde62d4f3ed699832c845fde83598027820d8e.tar.gz nimterop-4ccde62d4f3ed699832c845fde83598027820d8e.zip | |
ast2 fix issue 156 - abstract function pointer
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/include/tast2.h | 24 | ||||
| -rw-r--r-- | tests/tast2.nim | 12 | ||||
| -rw-r--r-- | tests/tmath.nim | 3 |
3 files changed, 37 insertions, 2 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h index 75e9446..348e225 100644 --- a/tests/include/tast2.h +++ b/tests/include/tast2.h @@ -123,6 +123,17 @@ typedef MagickBooleanType const int,void *), (*UpdateImageViewMethod)(ImageView *,const size_t,const int,void *); +// Issue #156, math.h +void + *absfunptr1 (int (*)(struct A0 *)), + **absfunptr2 (int (**)(struct A1 *)), + absfunptr3 (int *(*)(struct A2 *)), + *absfunptr4 (int *(**)(struct A3 *)), + absfunptr5 (int (*a)(A4 *)); + +int sqlite3_bind_blob(struct A1*, int, const void*, int n, void(*)(void*)); + + @@ -241,6 +252,7 @@ void (*pcre_free)(void *), *(*pcre_stack_malloc)(size_t); +typedef int ImageView, MagickBooleanType; typedef MagickBooleanType (*DuplexTransferImageViewMethod)(const ImageView *,const ImageView *, ImageView *,const size_t,const int,void *), @@ -250,6 +262,18 @@ typedef MagickBooleanType const int,void *), (*UpdateImageViewMethod)(ImageView *,const size_t,const int,void *); +// Issue #156, math.h +void + *absfunptr1 (int (*)(struct A0 *)), + **absfunptr2 (int (**)(struct A1 *)), + absfunptr3 (int *(*)(struct A2 *)), + *absfunptr4 (int *(**)(struct A3 *)), + absfunptr5 (int (*a)(A4 *)); + +int sqlite3_bind_blob(struct A1*, int, const void*, int n, void(*)(void*)); + + + #endif diff --git a/tests/tast2.nim b/tests/tast2.nim index 4e60172..d1b0f26 100644 --- a/tests/tast2.nim +++ b/tests/tast2.nim @@ -324,4 +324,14 @@ assert TransferImageViewMethod is proc (a1: ptr ImageView; a2: ptr ImageView; a3: uint; a4: cint; a5: pointer): MagickBooleanType {.cdecl.} assert UpdateImageViewMethod is - proc (a1: ptr ImageView; a2: uint; a3: cint; a4: pointer): MagickBooleanType {.cdecl.}
\ No newline at end of file + proc (a1: ptr ImageView; a2: uint; a3: cint; a4: pointer): MagickBooleanType {.cdecl.} + +# Issue #156, math.h +assert absfunptr1 is proc(a1: proc(a1: ptr A0): cint {.cdecl.}): pointer {.cdecl.} +assert absfunptr2 is proc(a1: ptr proc(a1: ptr A1): cint {.cdecl.}): ptr pointer {.cdecl.} +assert absfunptr3 is proc(a1: proc(a1: ptr A2): ptr cint {.cdecl.}) {.cdecl.} +assert absfunptr4 is proc(a1: ptr proc(a1: ptr A3): ptr cint {.cdecl.}): pointer {.cdecl.} +assert absfunptr5 is proc(a1: proc(a1: ptr A4): cint {.cdecl.}) {.cdecl.} + +assert sqlite3_bind_blob is + proc(a1: ptr A1, a2: cint, a3: pointer, n: cint, a5: proc(a1: pointer) {.cdecl.}): cint {.cdecl.} diff --git a/tests/tmath.nim b/tests/tmath.nim index 9f3df79..1f804ab 100644 --- a/tests/tmath.nim +++ b/tests/tmath.nim @@ -22,7 +22,8 @@ cPlugin: proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = sym.name = sym.name.strip(chars={'_'}).replace("__", "_") -cImport cSearchPath("math.h") +const FLAGS {.strdefine.} = "" +cImport(cSearchPath("math.h"), flags = FLAGS) check sin(5) == -0.9589242746631385 check abs(-5) == 5 |
