Mercurial > hg > Applications > Grep
view regexParser/cerium/ppe/Print.cc @ 272:5aa9d01926f1
Cerium version no compile errors
author | kono |
---|---|
date | Fri, 29 Jan 2016 20:38:18 +0900 |
parents | e51cac73e42a |
children | 8879eb8c64a8 |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include "Print.h" #include "Func.h" #include "FileMapReduce.h" #include "regexParser.h" #define STATUS_NUM 2 /* これは必須 */ SchedDefineTask1(Print,run_print); static int run_print(SchedTask *s, void *rbuf, void *wbuf) { MapReduce *w = (MapReduce*)s->get_input(0); int out_size = w->division_out_size / sizeof(unsigned long long); int out_task_num = w->task_num; ResultPtr prev = NULL; for (int i = 0; i < out_task_num ; i++) { ResultPtr *idata = (ResultPtr*)w->o_data[i*3+0]; StatePtr blockEnd = (StatePtr)w->o_data[i*3+2]; StatePtr blockBegin = (StatePtr)w->o_data[i*3+4]; // next Block's blockBegin. ResultPtr r = idata[i*out_size]; if (prev && i != out_task_num-1) { // 最後のブロックでなく、前の blockEnd が state 1 でない場合) if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { // 前のブロックの matchBegin から最初 result の end までがマッチ fwrite(prev->begin,r->end - prev->begin,1,stdout); } r = r->next; } for (;r;r = r->next) { if (r->end == NULL) { prev = r; break; } fwrite(r->begin,r->end - r->begin,1,stdout); puts("\n"); } } return 0; }