comparison regexParser/cerium/ppe/Exec.cc @ 272:5aa9d01926f1

Cerium version no compile errors
author kono
date Fri, 29 Jan 2016 20:38:18 +0900
parents 6640b0d5bf13
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 "Exec.h" 3 #include "Exec.h"
4 #include "Func.h" 4 #include "Func.h"
5 #include "regexParser.h"
6 #include "threadedSearch.h"
7 #include "FileMapReduce.h"
5 8
6 /* これは必須 */ 9 /* これは必須 */
7 SchedDefineTask1(Exec,blockedGrep); 10 SchedDefineTask1(Exec,blockedGrep);
8 11
12 static
9 TSValue stateNothing(TSValue tsv) { 13 TSValue stateNothing(TSValue tsv) {
10 return tsv; 14 return tsv;
11 } 15 }
12 16
17 static
13 TSValue stateSkip(TSValue tsv) { 18 TSValue stateSkip(TSValue tsv) {
14 tsv.buff.matchBegin = tsv.buff.buffptr; 19 tsv.buff.matchBegin = tsv.buff.buffptr;
15 return tsv; 20 return tsv;
16 } 21 }
17 22
23 static
18 TSValue stateMatch(TSValue tsv) { 24 TSValue stateMatch(TSValue tsv) {
19 ResultPtr r = NEW(Result); 25 ResultPtr r = NEW(Result);
20 r->begin = tsv.buff.matchBegin; 26 r->begin = tsv.buff.matchBegin;
21 r->end = tsv.buff.buffptr; 27 r->end = tsv.buff.buffptr;
22 *tsv.resultEnd = r; 28 *tsv.resultEnd = r;
26 tsv.buff.buffptr--; 32 tsv.buff.buffptr--;
27 tsv = stateSkip(tsv); 33 tsv = stateSkip(tsv);
28 return tsv; 34 return tsv;
29 } 35 }
30 36
31 TSValue threadedSearch(TransitionGeneratorPtr tg,Buffer buff) { 37 TSValue blockSearch(TransitionGeneratorPtr tg,Buffer buff) {
32 TSValue tsv; 38 TSValue tsv;
33 tsv.buff = buff; 39 tsv.buff = buff;
34 tsv.tg = tg; 40 tsv.tg = tg;
35 tsv.result = NULL; 41 tsv.result = NULL;
36 tsv.resultEnd = &tsv.result; 42 tsv.resultEnd = &tsv.result;
43 tSearch(tsv); 49 tSearch(tsv);
44 tsv.blockBegin = tsv.current; 50 tsv.blockBegin = tsv.current;
45 buff.buffend = end; 51 buff.buffend = end;
46 tSearch(tsv); 52 tSearch(tsv);
47 tsv.blockEnd = tsv.current; 53 tsv.blockEnd = tsv.current;
48 if (tsv.blockEnd->bi.bitContainer != 1) { 54 if (tsv.blockEnd->state->bitState.bitContainer != 1) {
49 ResultPtr r = NEW(Result); 55 ResultPtr r = NEW(Result);
50 r->begin = tsv.buff.matchBegin; 56 r->begin = tsv.buff.matchBegin;
51 r->end = NULL; 57 r->end = NULL;
52 *tsv.resultEnd = r; 58 *tsv.resultEnd = r;
53 r->next = NULL; 59 r->next = NULL;
59 static int 65 static int
60 blockedGrep(SchedTask *s, void *rbuf, void *wbuf) 66 blockedGrep(SchedTask *s, void *rbuf, void *wbuf)
61 { 67 {
62 long task_spwaned = (long)s->get_param(0); 68 long task_spwaned = (long)s->get_param(0);
63 long division_size = (long)s->get_param(1); 69 long division_size = (long)s->get_param(1);
64 long length = (long)s->get_param(2); 70 // long length = (long)s->get_param(2);
65 long out_size = (long)s->get_param(3); 71 long out_size = (long)s->get_param(3);
66 MapReduce *w = (MapReduce*)s->get_param(4); 72 MapReduce *w = (MapReduce*)s->get_param(4);
67 long allocation = task_spwaned + (long)s->x; 73 long allocation = task_spwaned + (long)s->x;
68 char* i_data; 74 unsigned char* i_data;
69 unsigned long long* o_data; 75 unsigned long * o_data;
70 if (division_size) { 76 if (division_size) {
71 i_data = (char*)s->get_input(rbuf,0) + allocation*division_size; 77 i_data = (unsigned char*)s->get_input(rbuf,0) + allocation*division_size;
72 o_data = (unsigned long long*)s->get_output(wbuf,1) + allocation*out_size; 78 o_data = (unsigned long *)s->get_output(wbuf,1) + allocation*out_size;
73 } else { 79 } else {
74 i_data = (char*)s->get_input(0); 80 i_data = (unsigned char*)s->get_input(0);
75 o_data = (unsigned long long*)s->get_output(0); 81 o_data = (unsigned long *)s->get_output(0);
76 } 82 }
77 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global; 83 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global;
78 StatePtr startState = tg->anyState;
79 Buffer buff; 84 Buffer buff;
80 buff.buff = buff.buffptr = buff.matchBegin = i_data; 85 buff.buff = buff.buffptr = buff.matchBegin = i_data;
81 buff.buffend = buff.buff + division_size; 86 buff.buffend = buff.buff + division_size;
82 TSValue tsv = threadedSearch(tg,buff); 87 TSValue tsv = blockSearch(tg,buff);
83 o_data[0] = (void*)tsv.result; 88 o_data[0] = (unsigned long)tsv.result;
84 o_data[1] = (void*)tsv.blockBegin; 89 o_data[1] = (unsigned long)tsv.blockBegin;
85 o_data[2] = (void*)tsv.blockEnd; 90 o_data[2] = (unsigned long)tsv.blockEnd;
86 return 0; 91 return 0;
87 } 92 }