Mercurial > hg > Applications > Grep
comparison regexParser/transition.cc @ 187:ef798db705e9 pairPro
remove some warnings and errors(not working)
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 24 Dec 2015 22:38:50 +0900 |
parents | d97bcab546e8 |
children | 3e8e5780ad4a |
comparison
equal
deleted
inserted
replaced
186:3e8aae8beba9 | 187:ef798db705e9 |
---|---|
1 #include <stdlib.h> | 1 #include <stdlib.h> |
2 #include "transition.h" | 2 #include "transition.h" |
3 | 3 |
4 StatePtr searchState(StatePtr stateArray, StatePtr state) { | 4 node::StatePtr searchState(node::StatePtr stateArray, node::StatePtr state) { |
5 while(stateArray) { | 5 while(stateArray) { |
6 if (stateArray->bitState.bitContainer == state->bitState.bitContainer) { | 6 if (stateArray->bitState.bitContainer == state->bitState.bitContainer) { |
7 return stateArray; | 7 return stateArray; |
8 } | 8 } |
9 if (stateArray->next == NULL) { | 9 if (stateArray->next == NULL) { |
10 StatePtr s = createState(state->bitState); | 10 node::StatePtr s = createState(state->bitState); |
11 stateArray = appendState(stateArray,s); | 11 stateArray = appendState(stateArray,s); |
12 return stateArray; | 12 return stateArray; |
13 } | 13 } |
14 stateArray = stateArray->next; | 14 stateArray = stateArray->next; |
15 } | 15 } |
16 return stateArray; | 16 return stateArray; |
17 } | 17 } |
18 | 18 |
19 StatePtr createState(BitVector bi) { | 19 node::StatePtr createState(BitVector bi) { |
20 StatePtr state = NEW(State); | 20 node::StatePtr state = NEW(node::State); |
21 state->bitState = bi; | 21 state->bitState = bi; |
22 state->transition = NEW(Transition); | 22 state->node = NEW(Node); |
23 state->nextNode = NEW(Node); | |
24 return state; | 23 return state; |
25 } | 24 } |
26 | 25 |
27 StatePtr appendState(StatePtr x,StatePtr y) { | 26 node::StatePtr appendState(node::StatePtr x,node::StatePtr y) { |
28 StatePtr x0 = createState(x->bitState); | 27 node::StatePtr x0 = createState(x->bitState); |
29 StatePtr x1 = x0; | 28 node::StatePtr x1 = x0; |
30 for(;;) { | 29 for(;;) { |
31 if (x->next == NULL) { | 30 if (x->next == NULL) { |
32 x1->next = y; | 31 x1->next = y; |
33 return x0; | 32 return x0; |
34 } | 33 } |