dol: initial dol commit
[jump.git] / dol / examples / example1 / src / printarray.c
diff --git a/dol/examples/example1/src/printarray.c b/dol/examples/example1/src/printarray.c
new file mode 100644 (file)
index 0000000..b140b96
--- /dev/null
@@ -0,0 +1,25 @@
+#include <stdio.h>
+
+#include "printarray.h"
+
+void printarray_init(DOLProcess *p) {
+    p->local->index = 0;
+}
+
+int printarray_fire(DOLProcess *p) {
+
+  int len;
+  int * array;
+  DOL_read((void*)PORT_IN1, &len, sizeof(int), p); 
+  DOL_read((void*)PORT_IN2, array, sizeof(int)*len, p); 
+
+  printf("sorted output\n");
+  for(i=0;i<LENGTH;i++)
+    printf("%d ", array[i]);
+  printf("\n");
+
+  free(array);
+  DOL_detach(p);
+  return -1;
+}
+