X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fyapi%2Flib%2FdolSupport.h;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fyapi%2Flib%2FdolSupport.h;h=897516fb5d905e31e7a90c426025000387b59d6c;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/yapi/lib/dolSupport.h b/dol/src/dol/visitor/yapi/lib/dolSupport.h new file mode 100644 index 0000000..897516f --- /dev/null +++ b/dol/src/dol/visitor/yapi/lib/dolSupport.h @@ -0,0 +1,67 @@ +#ifndef DOLSUPPORT_H +#define DOLSUPPORT_H + +#include "dol.h" +#include "yapi.h" + +#define DOL_write(port, buf, len, process) \ + dolwrite(static_cast *>(port), buf, len, process) +#define DOL_read(port, buf, len, process) \ + dolread(static_cast *>(port), buf, len, process) + +void DOL_detach(DOLProcess* p); + +//fifo access functions +unsigned dolwrite(OutPort *out, const void *buf, unsigned len, const DOLProcess *process); +unsigned dolread(InPort *in, const void *buf, unsigned len, const DOLProcess *process); + +void createPort(void **port, + void *base, + int number_of_indices, + int index0, int range0); + +void createPort(void **port, + void *base, + int number_of_indices, + int index0, int range0, + int index1, int range1); + +void createPort(void **port, + void *base, + int number_of_indices, + int index0, int range0, + int index1, int range1, + int index2, int range2); + +void createPort(void **port, + void *base, + int number_of_indices, + int index0, int range0, + int index1, int range1, + int index2, int range2, + int index3, int range3); + +#define GETINDEX(dimension) \ + static_cast(p->wptr)->getIndex(dimension) + +/** + * macro to create a variable to store a port name + * + * @param name name of the variable + */ +#define CREATEPORTVAR(name) void *name + +/** + * Create the port name of an iterated port based on its basename and the + * given indices. + * + * @param port buffer where the result is stored (created using + * CREATEPORTVAR) + * @param base basename of the port + * @param number_of_indices number of dimensions of the port + * @param index_range_pairs index and range values for each dimension + */ +#define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \ + createPort((void**)(&port), base, number_of_indices, index_range_pairs) + +#endif