Mercurial > hg > Members > masakoha > testcode
changeset 177:8de9a33f6ae5 pairPro
change createState aug
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 23 Dec 2015 17:28:59 +0900 |
parents | c092dd0e1ae0 |
children | 5e8c6857934c |
files | regexParser/subsetConstraction.cc regexParser/transition.cc regexParser/transition.h |
diffstat | 3 files changed, 10 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/subsetConstraction.cc Wed Dec 23 15:41:27 2015 +0900 +++ b/regexParser/subsetConstraction.cc Wed Dec 23 17:28:59 2015 +0900 @@ -148,7 +148,6 @@ CharClassPtr next = findLeftMost(current->right,walk)->next; walk->next = next; } else { - /* TransitionPtr tsOld = ts; ts = ts->next; free(tsOld); @@ -156,7 +155,6 @@ if (ts) ret = ts->cc; else ret = NULL; walk->next = ret; - */ } return current; } @@ -227,14 +225,14 @@ // Init State : 00...00(64bit) BitVectorPtr initStateBi = NEW(BitVector); bitSet(initStateBi,INIT_STATE_BIT); - StatePtr initState = createState(tg.stateArray,*initStateBi); + StatePtr initState = createState(*initStateBi); // Last State : 10...00(64bit) BitVectorPtr lastStateBi = NEW(BitVector); bitSet(lastStateBi,END_STATE_BIT); - StatePtr lastState = createState(tg.stateArray,*lastStateBi); + StatePtr lastState = createState(*lastStateBi); tg.stateArray = appendState(initState,lastState); tg.stateArrayLast = lastState; - tg.currentState = NEW(State); + tg.currentState = initState; tg.nextState = NEW(State); return tg; }
--- a/regexParser/transition.cc Wed Dec 23 15:41:27 2015 +0900 +++ b/regexParser/transition.cc Wed Dec 23 17:28:59 2015 +0900 @@ -7,7 +7,7 @@ return stateArray; } if (stateArray->next == NULL) { - StatePtr s = createState(state,state->bitState); + StatePtr s = createState(state->bitState); stateArray = appendState(stateArray,s); return stateArray; } @@ -16,17 +16,16 @@ return stateArray; } -StatePtr createState(StatePtr state,BitVector bi) { - StatePtr s = state; - state = NEW(State); +StatePtr createState(BitVector bi) { + StatePtr state = NEW(State); state->bitState = bi; state->transition = NEW(Transition); state->nextNode = NEW(Node); - return s; + return state; } StatePtr appendState(StatePtr x,StatePtr y) { - StatePtr x0 = createState(x,x->bitState); + StatePtr x0 = createState(x->bitState); StatePtr x1 = x0; for(;;) { if (x->next == NULL) { @@ -34,7 +33,7 @@ return x0; } x = x->next; - x1->next = createState(x,x->bitState); + x1->next = createState(x->bitState); x1 = x1->next; } return x0;
--- a/regexParser/transition.h Wed Dec 23 15:41:27 2015 +0900 +++ b/regexParser/transition.h Wed Dec 23 17:28:59 2015 +0900 @@ -12,7 +12,7 @@ struct state *next; } State, *StatePtr; -StatePtr createState(StatePtr state,BitVector bi); +StatePtr createState(BitVector bi); StatePtr appendState(StatePtr x,StatePtr y); TransitionPtr createTransition(CharClassPtr cc, BitVectorPtr state); TransitionPtr appendTransition0(TransitionPtr curr,TransitionPtr next);