897516fb5d905e31e7a90c426025000387b59d6c
[jump.git] / dol / src / dol / visitor / yapi / lib / dolSupport.h
1 #ifndef DOLSUPPORT_H\r
2 #define DOLSUPPORT_H\r
3 \r
4 #include "dol.h"\r
5 #include "yapi.h"\r
6 \r
7 #define DOL_write(port, buf, len, process) \\r
8     dolwrite(static_cast<OutPort<char> *>(port), buf, len, process)\r
9 #define DOL_read(port, buf, len, process) \\r
10     dolread(static_cast<InPort<char> *>(port), buf, len, process)\r
11 \r
12 void DOL_detach(DOLProcess* p);\r
13 \r
14 //fifo access functions\r
15 unsigned dolwrite(OutPort<char> *out, const void *buf, unsigned len, const DOLProcess *process);\r
16 unsigned dolread(InPort<char> *in, const void *buf, unsigned len, const DOLProcess *process);\r
17 \r
18 void createPort(void **port,\r
19                 void *base,\r
20                 int number_of_indices,\r
21                 int index0, int range0);\r
22 \r
23 void createPort(void **port,\r
24                 void *base,\r
25                 int number_of_indices,\r
26                 int index0, int range0,\r
27                 int index1, int range1);\r
28 \r
29 void createPort(void **port,\r
30                 void *base,\r
31                 int number_of_indices,\r
32                 int index0, int range0,\r
33                 int index1, int range1,\r
34                 int index2, int range2);\r
35 \r
36 void createPort(void **port,\r
37                 void *base,\r
38                 int number_of_indices,\r
39                 int index0, int range0,\r
40                 int index1, int range1,\r
41                 int index2, int range2,\r
42                 int index3, int range3);\r
43 \r
44 #define GETINDEX(dimension) \\r
45   static_cast<ProcessWrapper *>(p->wptr)->getIndex(dimension)\r
46 \r
47 /**\r
48  * macro to create a variable to store a port name\r
49  *\r
50  * @param name name of the variable\r
51  */\r
52 #define CREATEPORTVAR(name) void *name\r
53 \r
54 /**\r
55  * Create the port name of an iterated port based on its basename and the\r
56  * given indices.\r
57  *\r
58  * @param port buffer where the result is stored (created using\r
59  *             CREATEPORTVAR)\r
60  * @param base basename of the port\r
61  * @param number_of_indices number of dimensions of the port\r
62  * @param index_range_pairs index and range values for each dimension\r
63  */\r
64 #define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \\r
65   createPort((void**)(&port), base, number_of_indices, index_range_pairs)\r
66 \r
67 #endif\r