Mercurial > hg > Members > masakoha > testcode
view c/regexParser/transition.cc @ 139:6c258910cacb pairPro
remove some warning and error
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 07 Dec 2015 02:20:13 +0900 |
parents | 66c633575b53 |
children | 84a2a5209d3a |
line wrap: on
line source
#include <stdlib.h> #include "transition.h" TransitionPtr createTransition(CharClass,BitVectorPtr); TransitionPtr appendTransition0(TransitionPtr,TransitionPtr); TransitionPtr appendTransition(TransitionPtr,TransitionPtr); TransitionPtr createTransition(CharClassPtr cc, BitVectorPtr state) { TransitionPtr transition = (TransitionPtr)malloc(sizeof(Transition)); transition->condition = cc; transition->nextState = state; return transition; } TransitionPtr appendTransition0(TransitionPtr x, TransitionPtr y) { TransitionPtr x0 = x; for(;;) { if (x->next == NULL) { x->next = y; return x0; } } return x; } TransitionPtr appendTransition(TransitionPtr x, TransitionPtr y) { TransitionPtr x0 = createTransition(x->condition, x->nextState); TransitionPtr x1 = x0; for(;;) { if (x->next == NULL) { x1->next = y; return x0; } x = x->next; x1->next = createTransition(x->condition, x->nextState); x1 = x1->next; } return x0; }