More pointer support, cpp mode default in toast, cleanup
This commit is contained in:
parent
a8bb2dc01f
commit
b9b5174759
11 changed files with 132 additions and 89 deletions
|
|
@ -4,13 +4,15 @@ int test_call_int() {
|
|||
return 5;
|
||||
}
|
||||
|
||||
struct STRUCT1 test_call_int_param(int param1) {
|
||||
#ifdef FORCE
|
||||
struct STRUCT1 _test_call_int_param_(int param1) {
|
||||
struct STRUCT1 s;
|
||||
|
||||
s.field1 = param1;
|
||||
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
STRUCT2 test_call_int_param2(int param1, STRUCT2 param2) {
|
||||
STRUCT2 s;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,15 @@ typedef enum {
|
|||
enum6
|
||||
} ENUM2;
|
||||
|
||||
typedef void * VOIDPTR;
|
||||
typedef int * INTPTR;
|
||||
|
||||
typedef struct {
|
||||
int *field;
|
||||
} STRUCT4;
|
||||
|
||||
int test_call_int();
|
||||
struct STRUCT1 test_call_int_param(int param1);
|
||||
struct STRUCT1 _test_call_int_param_(int param1);
|
||||
STRUCT2 test_call_int_param2(int param1, STRUCT2 param2);
|
||||
STRUCT2 test_call_int_param3(int param1, struct STRUCT1 param2);
|
||||
ENUM2 test_call_int_param4(enum ENUM param1);
|
||||
|
|
@ -2,6 +2,7 @@ import nimterop/cimport
|
|||
|
||||
cDebug()
|
||||
|
||||
cDefine("FORCE")
|
||||
cIncludeDir "include"
|
||||
cAddSearchDir "include"
|
||||
cCompile cSearchPath("test.c")
|
||||
|
|
@ -18,10 +19,14 @@ var
|
|||
s: STRUCT1
|
||||
s2: STRUCT2
|
||||
s3: STRUCT3
|
||||
s4: STRUCT4
|
||||
|
||||
e: ENUM
|
||||
e2: ENUM2 = enum5
|
||||
|
||||
vptr: VOIDPTR
|
||||
iptr: INTPTR
|
||||
|
||||
pt = 3
|
||||
ct = 4
|
||||
|
||||
|
|
@ -31,9 +36,11 @@ s3.field1 = 7
|
|||
|
||||
e = enum1
|
||||
e2 = enum4
|
||||
|
||||
|
||||
doAssert test_call_int() == 5
|
||||
doAssert test_call_int_param(5).field1 == 5
|
||||
doAssert test_call_int_param2(5, s2).field1 == 11
|
||||
doAssert test_call_int_param3(5, s).field1 == 10
|
||||
doAssert test_call_int_param4(e) == e2
|
||||
|
||||
cAddStdDir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue