Mercurial > hg > Applications > Grep
diff regexParser/transition.cc @ 172:540fc12871d9 pairPro
remove some warnings and errors (not working)
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Dec 2015 15:56:33 +0900 |
parents | 3bf2c6d6d53e |
children | 3be0fbcd4b52 |
line wrap: on
line diff
--- a/regexParser/transition.cc Mon Dec 21 17:37:41 2015 +0900 +++ b/regexParser/transition.cc Tue Dec 22 15:56:33 2015 +0900 @@ -1,38 +1,10 @@ #include <stdlib.h> #include "transition.h" -StatePtr createState(BitVectorPtr bi, TransitionPtr ts, StatePtr next) { - StatePtr s = (StatePtr)malloc(sizeof(State)); - s->bitState = bi; - s->transition = ts; - s->next = next; - return s; -} - -StatePtr appendState(StatePtr x, StatePtr y) { - if (x == NULL) { - x = createState(y->bitState,y->transition,y->next); - return x; - } - - StatePtr x0 = createState(x->bitState, x->transition, x->next); - StatePtr x1 = x0; - for(;;) { - if (x->next == NULL) { - x1->next = y; - return x0; - } - x = x->next; - x1->next = createState(x->bitState, x->transition, x->next); - x1 = x1->next; - } - return x0; -} - TransitionPtr createTransition(CharClassPtr cc, BitVectorPtr state) { TransitionPtr transition = (TransitionPtr)malloc(sizeof(Transition)); transition->condition = cc; - transition->nextState = state; + transition->condition->nextState = *state; return transition; } @@ -48,7 +20,7 @@ } TransitionPtr appendTransition(TransitionPtr x, TransitionPtr y) { - TransitionPtr x0 = createTransition(x->condition, x->nextState); + TransitionPtr x0 = createTransition(x->condition, &x->condition->nextState); TransitionPtr x1 = x0; for(;;) { if (x->next == NULL) { @@ -56,7 +28,7 @@ return x0; } x = x->next; - x1->next = createTransition(x->condition, x->nextState); + x1->next = createTransition(x->condition, &x->condition->nextState); x1 = x1->next; } return x0;