Mercurial > hg > Applications > Grep
comparison regexParser/cerium/ppe/Exec.cc @ 278:99d635926ef3
ceriumCreateAnyState implemented
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jan 2016 21:19:05 +0900 |
parents | 8879eb8c64a8 |
children | 6cc1d9779f45 |
comparison
equal
deleted
inserted
replaced
277:7b4bcc7b5ae6 | 278:99d635926ef3 |
---|---|
7 #include "FileMapReduce.h" | 7 #include "FileMapReduce.h" |
8 | 8 |
9 /* これは必須 */ | 9 /* これは必須 */ |
10 SchedDefineTask1(Exec,blockedGrep); | 10 SchedDefineTask1(Exec,blockedGrep); |
11 | 11 |
12 static | |
13 TSValue stateNothing(TSValue tsv) { | |
14 return tsv; | |
15 } | |
16 | |
17 static | |
18 TSValue stateSkip(TSValue tsv) { | |
19 tsv.buff.matchBegin = tsv.buff.buffptr; | |
20 return tsv; | |
21 } | |
22 | |
23 static | |
24 TSValue stateMatch(TSValue tsv) { | |
25 ResultPtr r = NEW(Result); | |
26 r->begin = tsv.buff.matchBegin; | |
27 r->end = tsv.buff.buffptr; | |
28 *tsv.resultEnd = r; | |
29 r->next = NULL; | |
30 tsv.resultEnd = &r->next; | |
31 tsv.current = tsv.tg->stateList->tState; | |
32 tsv.buff.buffptr--; | |
33 tsv = stateSkip(tsv); | |
34 return tsv; | |
35 } | |
36 | |
37 TSValue blockSearch(TransitionGeneratorPtr tg,Buffer buff) { | 12 TSValue blockSearch(TransitionGeneratorPtr tg,Buffer buff) { |
38 TSValue tsv; | 13 TSValue tsv; |
39 tsv.buff = buff; | 14 tsv.buff = buff; |
40 tsv.tg = tg; | 15 tsv.tg = tg; |
16 tsv.current = tg->anyState->tState; | |
41 tsv.result = NULL; | 17 tsv.result = NULL; |
42 tsv.resultEnd = &tsv.result; | 18 tsv.resultEnd = &tsv.result; |
43 tsv.current = tg->anyState->tState; | |
44 tsv.current->stateSkip = stateSkip; | |
45 tsv.current->stateContinue = stateNothing; | |
46 tsv.tg->stateSkip = stateSkip; | |
47 tsv.tg->stateMatch = stateMatch; | |
48 tsv.tg->stateNothing = stateNothing; | |
49 unsigned char *end = buff.buffend; | 19 unsigned char *end = buff.buffend; |
50 buff.buffend = buff.buff+1; | 20 buff.buffend = buff.buff+1; |
51 tSearch(tsv); | 21 tSearch(tsv); |
52 tsv.blockBegin = tsv.current; | 22 tsv.blockBegin = tsv.current; |
53 buff.buffend = end; | 23 buff.buffend = end; |