ast2 fix issue 156 - abstract function pointer
This commit is contained in:
parent
4c513a50de
commit
4ccde62d4f
5 changed files with 63 additions and 7 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.}
|
||||
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.}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue