Mercurial > hg > Applications > Grep
comparison 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 |
comparison
equal
deleted
inserted
replaced
271:6640b0d5bf13 | 272:5aa9d01926f1 |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <string.h> | 2 #include <string.h> |
3 #include "Print.h" | 3 #include "Print.h" |
4 #include "Func.h" | 4 #include "Func.h" |
5 #include "FileMapReduce.h" | 5 #include "FileMapReduce.h" |
6 #include "regexParser.h" | |
6 | 7 |
7 #define STATUS_NUM 2 | 8 #define STATUS_NUM 2 |
8 /* これは必須 */ | 9 /* これは必須 */ |
9 SchedDefineTask1(Print,run_print); | 10 SchedDefineTask1(Print,run_print); |
10 | 11 |
11 static int | 12 static int |
12 run_print(SchedTask *s, void *rbuf, void *wbuf) | 13 run_print(SchedTask *s, void *rbuf, void *wbuf) |
13 { | 14 { |
14 MapReduce *w = (MapReduce*)s->get_input(0); | 15 MapReduce *w = (MapReduce*)s->get_input(0); |
15 | 16 |
16 unsigned char* buff = (unsigned char*)w->i_data; | |
17 int out_size = w->division_out_size / sizeof(unsigned long long); | 17 int out_size = w->division_out_size / sizeof(unsigned long long); |
18 int out_task_num = w->task_num; | |
18 ResultPtr prev = NULL; | 19 ResultPtr prev = NULL; |
19 for (int i = 0; i < out_task_num ; i++) { | 20 for (int i = 0; i < out_task_num ; i++) { |
20 ResultPtr *idata = (ResultPtr*)w->o_data[i*3+0]; | 21 ResultPtr *idata = (ResultPtr*)w->o_data[i*3+0]; |
21 StatePtr *blockEnd = (StatePtr)w->o_data[i*3+2]; | 22 StatePtr blockEnd = (StatePtr)w->o_data[i*3+2]; |
22 StatePtr *blockBegin = (StatePtr)w->o_data[i*3+4]; // next Block's blockBegin. | 23 StatePtr blockBegin = (StatePtr)w->o_data[i*3+4]; // next Block's blockBegin. |
23 ResultPtr r = idata[i*out_size]; | 24 ResultPtr r = idata[i*out_size]; |
24 if (prev && i != out_task_num-1) { | 25 if (prev && i != out_task_num-1) { |
25 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) | 26 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) |
26 if (blockBegin->bi.bitContainer & blockEnd->bi.bitContainer) { | 27 if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { |
27 // 前のブロックの matchBegin から最初 result の end までがマッチ | 28 // 前のブロックの matchBegin から最初 result の end までがマッチ |
28 fwrite(prev->result,r->end - prev->begin,1,stdout); | 29 fwrite(prev->begin,r->end - prev->begin,1,stdout); |
29 } | 30 } |
30 r = r->next; | 31 r = r->next; |
31 } | 32 } |
32 for (;r;r = r->next) { | 33 for (;r;r = r->next) { |
33 if (r->end == NULL) { | 34 if (r->end == NULL) { |