diff regexParser/cerium/ppe/Exec.cc @ 279:6cc1d9779f45

add CeriumMain.h
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Sun, 31 Jan 2016 15:59:11 +0900
parents 99d635926ef3
children b74e3b4b11d7
line wrap: on
line diff
--- a/regexParser/cerium/ppe/Exec.cc	Sat Jan 30 21:19:05 2016 +0900
+++ b/regexParser/cerium/ppe/Exec.cc	Sun Jan 31 15:59:11 2016 +0900
@@ -5,15 +5,20 @@
 #include "regexParser.h"
 #include "threadedSearch.h"
 #include "FileMapReduce.h"
+#include "CeriumMain.h"
 
 /* これは必須 */
 SchedDefineTask1(Exec,blockedGrep);
 
-TSValue blockSearch(TransitionGeneratorPtr tg,Buffer buff) {
+TSValue blockSearch(TransitionGeneratorPtr tg,Buffer buff,int task_spawned) {
     TSValue tsv;
     tsv.buff = buff;
     tsv.tg = tg;
-    tsv.current = tg->anyState->tState;
+    if (task_spawned == 0) {
+        tsv.current = tg->stateList->tState;
+    } else {
+        tsv.current = tg->anyState->tState;
+    }
     tsv.result = NULL;
     tsv.resultEnd = &tsv.result;
     unsigned char *end = buff.buffend;
@@ -37,12 +42,12 @@
 static int
 blockedGrep(SchedTask *s, void *rbuf, void *wbuf)
 {
-    long task_spwaned = (long)s->get_param(0);
+    long task_spawned = (long)s->get_param(0);
     long division_size = (long)s->get_param(1);
     long length = (long)s->get_param(2);
     long out_size = (long)s->get_param(3);
     MapReduce *w = (MapReduce*)s->get_param(4);
-    long allocation = task_spwaned + (long)s->x;
+    long allocation = task_spawned + (long)s->x;
     unsigned char* i_data;
     unsigned long * o_data;
     if (division_size) {
@@ -56,7 +61,8 @@
     Buffer buff;
     buff.buff = buff.buffptr = buff.matchBegin = i_data;
     buff.buffend = buff.buff + length;
-    TSValue tsv = blockSearch(tg,buff);
+    TSValue tsv = blockSearch(tg,buff,task_spawned);
+    resultPrint(tsv.result,"Exec");
     o_data[0] = (unsigned long)tsv.result;
     o_data[1] = (unsigned long)tsv.blockBegin->state;
     o_data[2] = (unsigned long)tsv.blockEnd->state;