comparison regexParser/threadedSearch.cc @ 266:e51cac73e42a

CeriumGrep start
author masa
date Thu, 28 Jan 2016 21:14:34 +0900
parents ef95a7f1bc03
children 0e423d9f9647
comparison
equal deleted inserted replaced
265:1e2c12ec25b7 266:e51cac73e42a
23 tsv.buff.buffptr--; 23 tsv.buff.buffptr--;
24 tsv = stateSkip(tsv); 24 tsv = stateSkip(tsv);
25 return tsv; 25 return tsv;
26 } 26 }
27 27
28 TStatePtr generateTState(StatePtr state) { 28 TStatePtr generateTState(StatePtr state, TransitionGeneratorPtr tg) {
29 TStatePtr tState = NEW(TState); 29 TStatePtr tState = NEW(TState);
30 tState->state = state; 30 tState->state = state;
31 state->tState = tState; 31 state->tState = tState;
32 int ccvSize = 0; 32 int ccvSize = 0;
33 CharClassWalkerPtr ccw = createCharClassWalker(state->cc); 33 CharClassWalkerPtr ccw = createCharClassWalker(state->cc);
51 ccv->state = cc->nextState; 51 ccv->state = cc->nextState;
52 ccv->w = cc->cond.w; 52 ccv->w = cc->cond.w;
53 } 53 }
54 free(ccw); 54 free(ccw);
55 if (state->accept) { 55 if (state->accept) {
56 tState->stateSkip = stateMatch; 56 tState->stateSkip = tg->stateMatch;
57 tState->stateContinue = stateNothing; 57 tState->stateContinue = tg->stateNothing;
58 } else { 58 } else {
59 tState->stateSkip = stateSkip; 59 tState->stateSkip = tg->stateSkip;
60 tState->stateContinue = stateNothing; 60 tState->stateContinue = tg->stateNothing;
61 } 61 }
62 return tState; 62 return tState;
63 } 63 }
64 64
65 void tSearch(TSValue tsv) { 65 void tSearch(TSValue tsv) {
104 104
105 void threadedSearch(TransitionGeneratorPtr tg, Buffer buff) { 105 void threadedSearch(TransitionGeneratorPtr tg, Buffer buff) {
106 TSValue tsv; 106 TSValue tsv;
107 tsv.buff = buff; 107 tsv.buff = buff;
108 tsv.tg = tg; 108 tsv.tg = tg;
109 tsv.result = NULL;
109 tsv.current = generateTState(tg->stateList); 110 tsv.current = generateTState(tg->stateList);
111 tsv.tg->stateSkip = stateSkip;
112 tsv.tg->stateMatch = stateMatch;
113 tsv.tg->stateNothing = stateNothing;
110 tSearch(tsv); 114 tSearch(tsv);
111 } 115 }