Mercurial > hg > Members > masakoha > testcode
view c/regexParser/createBitVectorList.cc @ 99:1e5b56e8263b impl-bitvector
remove some variable
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 10 Nov 2015 20:57:59 +0900 |
parents | d0d2262d4edf |
children | 804e51f19f17 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "bitVector.h" #include "regexParser.h" extern BitVectorPtr bitSet(int); extern void bitPrint(BitVectorPtr); BitVectorListPtr createBitVector(NodePtr); BitVectorListPtr descendTreeNode(NodePtr,BitVectorListPtr); BitVectorListPtr initBvl; BitVectorListPtr createBitVector(NodePtr n,BitVectorListPtr bvl) { BitVectorListPtr nextBvl = bvl->next[(int)n->Value.character] = (BitVectorListPtr)malloc(sizeof(BitVectorList)); nextBvl->self = bvl->next[(int)n->Value.character]; nextBvl->bi = (BitVectorPtr)malloc(sizeof(BitVector)); nextBvl->bi = bitSet(n->nodeNumber); nextBvl->initBvl = initBvl; puts("-----"); printf(" state : "); bitPrint(bvl->bi); for (int i = 0; i < 256; i++) { if (bvl->next[i] != NULL) { printf("input char : %c\n",i); } } printf("next state : ");bitPrint(bvl->next[(int)n->Value.character]->bi); puts("-----"); return bvl->next[(int)n->Value.character]; } BitVectorListPtr initBitVector() { BitVectorListPtr bvl = (BitVectorListPtr)malloc(sizeof(BitVectorList)); bvl->initBvl = bvl->self = initBvl = bvl; bvl->bi = (BitVectorPtr)malloc(sizeof(BitVector)); bvl->bi = bitSet(0); return bvl; } BitVectorListPtr descendTreeNode(NodePtr n,BitVectorListPtr bvl) { if (n->tokenType == '*') { bvl = descendTreeNode(n->left,bvl); } else if (n->tokenType == '|') { } else if (n->Value.character == '+') { bvl = descendTreeNode(n->left,bvl); bvl = descendTreeNode(n->right,bvl); } else if (n->tokenType == 'a') { bvl = createBitVector(n,bvl); } return bvl; } BitVectorListPtr createBitVectorList(NodePtr n) { BitVectorListPtr bvl = initBitVector(); descendTreeNode(n,bvl); return bvl; }