c_src: update for new ffi syntax
[nit.git] / c_src / nit.common.h
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <gc_chooser.h>
5 typedef void(*nitmethod_t)(void); /* general C type representing a Nit method. */
6 typedef union {
7 void* val;
8 long l;
9 short int s;
10 char c;
11 double d;
12 char* str;
13 void* ptr;
14 } nitattribute_t; /* general C type representing a Nit attribute. */
15 struct class { int box_kind; nitmethod_t vft[]; }; /* general C type representing a Nit class. */
16 struct type { int id; const char *name; int color; short int is_nullable; const struct types *resolution_table; int table_size; int type_table[]; }; /* general C type representing a Nit type. */
17 struct instance { const struct type *type; const struct class *class; nitattribute_t attrs[]; }; /* general C type representing a Nit instance. */
18 struct types { int dummy; const struct type *types[]; }; /* a list types (used for vts, fts and unresolved lists). */
19 typedef struct instance val; /* general C type representing a Nit instance. */
20 void show_backtrace(int);
21 extern int glob_argc;
22 extern char **glob_argv;
23 extern val *glob_sys;
24 struct instance_posix__Passwd {
25 const struct type *type;
26 const struct class *class;
27 void* value;
28 };
29 struct instance_posix__Group {
30 const struct type *type;
31 const struct class *class;
32 void* value;
33 };
34 struct instance_string__NativeString {
35 const struct type *type;
36 const struct class *class;
37 char* value;
38 };
39 val* BOX_string__NativeString(char*);
40 struct instance_kernel__Bool {
41 const struct type *type;
42 const struct class *class;
43 short int value;
44 };
45 val* BOX_kernel__Bool(short int);
46 struct instance_kernel__Float {
47 const struct type *type;
48 const struct class *class;
49 double value;
50 };
51 val* BOX_kernel__Float(double);
52 struct instance_kernel__Int {
53 const struct type *type;
54 const struct class *class;
55 long value;
56 };
57 val* BOX_kernel__Int(long);
58 struct instance_kernel__Char {
59 const struct type *type;
60 const struct class *class;
61 char value;
62 };
63 val* BOX_kernel__Char(char);
64 struct instance_kernel__Pointer {
65 const struct type *type;
66 const struct class *class;
67 void* value;
68 };
69 struct instance_array__NativeArray {
70 const struct type *type;
71 const struct class *class;
72 val* values[0];
73 };
74 struct instance_file__FileStat {
75 const struct type *type;
76 const struct class *class;
77 void* value;
78 };
79 struct instance_file__NativeFile {
80 const struct type *type;
81 const struct class *class;
82 void* value;
83 };
84 val* BOX_file__NativeFile(void*);
85 struct instance_time__TimeT {
86 const struct type *type;
87 const struct class *class;
88 void* value;
89 };
90 struct instance_time__Tm {
91 const struct type *type;
92 const struct class *class;
93 void* value;
94 };
95 struct instance_exec__NativeProcess {
96 const struct type *type;
97 const struct class *class;
98 void* value;
99 };
100 val* BOX_exec__NativeProcess(void*);