Mercurial > hg > Members > masakoha > testcode
changeset 188:109d22faf7b5 pairPro
remove errors and warnings
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 25 Dec 2015 02:57:21 +0900 |
parents | ef798db705e9 |
children | fccf7941ecc2 |
files | regexParser/bitVector.cc regexParser/mergeTest.cc regexParser/regexParser.cc regexParser/regexParser.h regexParser/subsetConstraction.cc regexParser/subsetConstraction.h |
diffstat | 6 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/bitVector.cc Thu Dec 24 22:38:50 2015 +0900 +++ b/regexParser/bitVector.cc Fri Dec 25 02:57:21 2015 +0900 @@ -3,7 +3,7 @@ #include <string.h> #include "bitVector.h" -BitVector createBitvector(int state) { +BitVector createBitVector(int state) { unsigned long tmp = 1 << state; BitVector bi1 = (BitVector){.bitContainer = tmp}; return bi1;
--- a/regexParser/mergeTest.cc Thu Dec 24 22:38:50 2015 +0900 +++ b/regexParser/mergeTest.cc Fri Dec 25 02:57:21 2015 +0900 @@ -9,7 +9,7 @@ int main(int argc, char **argv) { RegexInfoPtr ri = (RegexInfoPtr)malloc(sizeof(RegexInfo)); - ri->nodeNumber = 1; + ri->stateNumber = 1; unsigned char* merge = NULL; for (int i = 1; i < argc; i++) { if (strcmp(argv[i],"-regex") == 0) {
--- a/regexParser/regexParser.cc Thu Dec 24 22:38:50 2015 +0900 +++ b/regexParser/regexParser.cc Fri Dec 25 02:57:21 2015 +0900 @@ -15,7 +15,6 @@ * regexPosition(state) * stateTransitionTable */ - static NodePtr allocateNode() { NodePtr n = NEW(Node); @@ -72,13 +71,13 @@ */ CharClassPtr insertCharClass(CharClassPtr cc, unsigned long begin, unsigned long end) { if (cc == NULL) { - createCharClassRange(begin,end,0,0); + createCharClassRange(begin,end,0,0,0); } if (end < cc->cond.range.begin ) { // 1 if (cc->left) { cc->left = insertCharClass(cc->left,begin,end); } else { - cc->left = createCharClassRange(begin,end,0,0); + cc->left = createCharClassRange(begin,end,0,0,0); } return cc; } else if (end == cc->cond.range.begin ) { // 2 @@ -93,7 +92,7 @@ if (cc->right) { cc->right = insertCharClass(cc->right,begin,end); } else { - cc->right = createCharClassRange(begin,end,0,0); + cc->right = createCharClassRange(begin,end,0,0,0); } return cc; }
--- a/regexParser/regexParser.h Thu Dec 24 22:38:50 2015 +0900 +++ b/regexParser/regexParser.h Fri Dec 25 02:57:21 2015 +0900 @@ -1,8 +1,9 @@ #include "error.h" - #define NEW(type) (type*)malloc(sizeof(type)) #define SYNTAX_NODENUMBER 100 +#ifndef INCLUDED_STRUCT +#define INCLUDED_STRUCT typedef struct bitVector { unsigned long bitContainer; }BitVector,*BitVectorPtr; @@ -58,6 +59,8 @@ node::StatePtr state; node::StatePtr stateArray; node::StatePtr currentState; + node::StatePtr startState; + node::StatePtr endState; } TransitionGenerator, *TransitionGeneratorPtr; typedef struct tgValue { @@ -93,6 +96,6 @@ unsigned char *tokenValue; int stateNumber; } RegexInfo, *RegexInfoPtr; - +#endif NodePtr createNode(RegexInfoPtr ri,unsigned char type,CharClassPtr cc, NodePtr left, NodePtr right); -CharClassPtr createCharClassRange(unsigned long begin, unsigned long end, CharClassPtr left, CharClassPtr right); +extern CharClassPtr createCharClassRange(unsigned long begin, unsigned long end,unsigned long state, CharClassPtr left, CharClassPtr right);
--- a/regexParser/subsetConstraction.cc Thu Dec 24 22:38:50 2015 +0900 +++ b/regexParser/subsetConstraction.cc Fri Dec 25 02:57:21 2015 +0900 @@ -35,7 +35,7 @@ // 変更があった場合は新しくリストを作って返す if (end < cc->cond.range.begin ) { // 1 if (cc->left) { - return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,charClassMerge(cc->left,begin,end,nextState),cc->right); + return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,nextState.bitContainer,charClassMerge(cc->left,begin,end,nextState),cc->right); } else { return createCharClassRange(begin,end,nextState.bitContainer,NULL,cc); } @@ -75,7 +75,7 @@ } if (begin > cc->cond.range.end ) { // 13 if (cc->right) { - return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,cc->left,charClassMerge(cc->right,begin,end,nextState)); + return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,nextState.bitContainer,cc->left,charClassMerge(cc->right,begin,end,nextState)); } else { return createCharClassRange(begin,end,nextState.bitContainer,cc,NULL); } @@ -237,7 +237,6 @@ TGValue tgRight = tgLeft; tgRight.stateBegin = ++tgRight.stateNum; n->right->state = createState(tgRight,n->right); - TGValue tgv1 = stateAllocate(n->right,tgLeft); return tgLeft; } else if (n->tokenType == '|') { TGValue tgv = stateAllocate(n->left,tg); @@ -316,9 +315,9 @@ TGValue tgv; tgv.asterisk = false; tgv.tg = tg; - node::StatePtr start = createState(tgv,n); + tgv.tg->startState = createState(tgv,n); NodePtr eof = createNode(NULL,'e',NULL,NULL,NULL); - node::StatePtr end = createState(tgv,eof); + tgv.tg->endState = createState(tgv,eof); tgv.stateBegin = 0; tgv.stateEnd = 1; stateAllocate(n,tgv);
--- a/regexParser/subsetConstraction.h Thu Dec 24 22:38:50 2015 +0900 +++ b/regexParser/subsetConstraction.h Fri Dec 25 02:57:21 2015 +0900 @@ -1,4 +1,3 @@ #include "transition.h" -#define INIT_STATE_BIT 0 -#define END_STATE_BIT 63 +#include "bitVector.h" CharClassPtr charClassMerge(CharClassPtr cc,unsigned long begin, unsigned long end, BitVector nextState);