Mercurial > hg > Applications > Grep
comparison 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 |
comparison
equal
deleted
inserted
replaced
109:6401c708f5dd | 110:a3adc5c24e19 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <ctype.h> | |
4 #include "bitVector.h" | |
5 #include "regexParser.h" | |
6 | |
7 BitVectorListPtr allocateBitVectorList() { | |
8 BitVectorListPtr bvl = (BitVectorListPtr)malloc(sizeof(BitVectorList)); | |
9 if (bvl == NULL) { | |
10 fprintf(stderr, "Failed to allocate memory.\n"); | |
11 exit(-1); | |
12 } | |
13 | |
14 bvl->self = bvl; | |
15 bvl->bi = (BitVectorPtr)malloc(sizeof(BitVector)); | |
16 if (bvl->bi == NULL) { | |
17 fprintf(stderr, "Failed to allocate memory.\n"); | |
18 exit(-1); | |
19 } | |
20 | |
21 | |
22 return bvl; | |
23 } | |
24 | |
25 | |
26 BitVectorListPtr initBitVector() { | |
27 | |
28 BitVectorListPtr bvl = allocateBitVectorList(); | |
29 bvl->initBvl = initBvl = bvl; | |
30 bvl->bi = bitSet(0); | |
31 | |
32 for (int i = 0; i < 256; i++) { | |
33 bvl->next[i] = NULL; | |
34 } | |
35 | |
36 return bvl; | |
37 } | |
38 |