dol: initial dol commit
[jump.git] / dol / src / dol / visitor / yapi / lib / dolSupport.h
diff --git a/dol/src/dol/visitor/yapi/lib/dolSupport.h b/dol/src/dol/visitor/yapi/lib/dolSupport.h
new file mode 100644 (file)
index 0000000..897516f
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef DOLSUPPORT_H\r
+#define DOLSUPPORT_H\r
+\r
+#include "dol.h"\r
+#include "yapi.h"\r
+\r
+#define DOL_write(port, buf, len, process) \\r
+    dolwrite(static_cast<OutPort<char> *>(port), buf, len, process)\r
+#define DOL_read(port, buf, len, process) \\r
+    dolread(static_cast<InPort<char> *>(port), buf, len, process)\r
+\r
+void DOL_detach(DOLProcess* p);\r
+\r
+//fifo access functions\r
+unsigned dolwrite(OutPort<char> *out, const void *buf, unsigned len, const DOLProcess *process);\r
+unsigned dolread(InPort<char> *in, const void *buf, unsigned len, const DOLProcess *process);\r
+\r
+void createPort(void **port,\r
+                void *base,\r
+                int number_of_indices,\r
+                int index0, int range0);\r
+\r
+void createPort(void **port,\r
+                void *base,\r
+                int number_of_indices,\r
+                int index0, int range0,\r
+                int index1, int range1);\r
+\r
+void createPort(void **port,\r
+                void *base,\r
+                int number_of_indices,\r
+                int index0, int range0,\r
+                int index1, int range1,\r
+                int index2, int range2);\r
+\r
+void createPort(void **port,\r
+                void *base,\r
+                int number_of_indices,\r
+                int index0, int range0,\r
+                int index1, int range1,\r
+                int index2, int range2,\r
+                int index3, int range3);\r
+\r
+#define GETINDEX(dimension) \\r
+  static_cast<ProcessWrapper *>(p->wptr)->getIndex(dimension)\r
+\r
+/**\r
+ * macro to create a variable to store a port name\r
+ *\r
+ * @param name name of the variable\r
+ */\r
+#define CREATEPORTVAR(name) void *name\r
+\r
+/**\r
+ * Create the port name of an iterated port based on its basename and the\r
+ * given indices.\r
+ *\r
+ * @param port buffer where the result is stored (created using\r
+ *             CREATEPORTVAR)\r
+ * @param base basename of the port\r
+ * @param number_of_indices number of dimensions of the port\r
+ * @param index_range_pairs index and range values for each dimension\r
+ */\r
+#define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \\r
+  createPort((void**)(&port), base, number_of_indices, index_range_pairs)\r
+\r
+#endif\r