Mercurial > hg > Applications > Grep
diff c/regexParser/bitVectorNode.cc @ 110:a3adc5c24e19 pairPro
start branch
author | masa |
---|---|
date | Fri, 20 Nov 2015 21:02:00 +0900 |
parents | c/regexParser/createBitVectorList.cc@6401c708f5dd |
children | ca30f8334741 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c/regexParser/bitVectorNode.cc Fri Nov 20 21:02:00 2015 +0900 @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include "bitVector.h" +#include "regexParser.h" + +BitVectorListPtr allocateBitVectorList() { + BitVectorListPtr bvl = (BitVectorListPtr)malloc(sizeof(BitVectorList)); + if (bvl == NULL) { + fprintf(stderr, "Failed to allocate memory.\n"); + exit(-1); + } + + bvl->self = bvl; + bvl->bi = (BitVectorPtr)malloc(sizeof(BitVector)); + if (bvl->bi == NULL) { + fprintf(stderr, "Failed to allocate memory.\n"); + exit(-1); + } + + + return bvl; +} + + +BitVectorListPtr initBitVector() { + + BitVectorListPtr bvl = allocateBitVectorList(); + bvl->initBvl = initBvl = bvl; + bvl->bi = bitSet(0); + + for (int i = 0; i < 256; i++) { + bvl->next[i] = NULL; + } + + return bvl; +} +