Mercurial > hg > Members > masakoha > testcode
view regexParser/cerium/ppe/Exec.cc @ 324:879dc5d1cb6a default tip
fix
author | mir3636 |
---|---|
date | Fri, 27 May 2016 21:21:09 +0900 |
parents | c48a8671ce34 |
children |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include "Exec.h" #include "Func.h" #include "regexParser.h" #include "threadedSearch.h" #include "FileMapReduce.h" #include "CeriumMain.h" /* これは必須 */ SchedDefineTask1(Exec,blockedGrep); TSValue blockSearch(TSValue tsv,Buffer buff,int task_spawned) { tsv.current = tsv.tg->stateStart->tState; tsv.blk->result = NULL; ResultPtr result = NULL; tsv.blk->resultEnd = &result; tsv.blk->blockBegin = tsv.current; addResult(tsv,true,buff.buff,buff.buffend); // entire buffer tsv = tSearch(tsv); tsv.blk->blockEnd = tsv.current; if (tsv.blk->blockEnd->state->bitState.bitContainer != 1) { if (tsv.matchBegin != tsv.buff.buffptr) { // partial match case at block end. addResult(tsv,true,tsv.matchBegin,tsv.matchEnd); // printf("Exec %lx r->begin : %p r->end : %p\n",tsv.blockEnd->state->bitState.bitContainer, r->begin,r->end); } } tsv.blk->result = result; return tsv; } static int blockedGrep(SchedTask *s, void *rbuf, void *wbuf) { 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_spawned + (long)s->x; unsigned char* i_data; unsigned long * o_data; if (division_size) { i_data = (unsigned char*)s->get_input(rbuf,0) + allocation*division_size; o_data = (unsigned long *)s->get_output(wbuf,1) + allocation*out_size; } else { i_data = (unsigned char*)s->get_input(0); o_data = (unsigned long *)s->get_output(0); } TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global; Buffer buff; buff.buff = buff.buffptr = i_data; buff.buffend = buff.buff + length; BlockOutput blk; TSValue tsv = createTSValue(tg,buff); tsv.blk = &blk; tsv = blockSearch(tsv,buff,task_spawned); // resultPrint(tsv.result,"Exec"); o_data[0] = (unsigned long)tsv.blk->result; o_data[1] = (unsigned long)tsv.blk->blockBegin->state; // never used now o_data[2] = (unsigned long)tsv.blk->blockEnd->state; return 0; } /* end */