Mercurial > hg > Applications > Grep
changeset 138:ea2810db8d87 pairPro
remove warning and error
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 06 Dec 2015 15:54:05 +0900 |
parents | c292c67b3100 |
children | 6c258910cacb |
files | c/regexParser/bitVector.cc c/regexParser/bitVector.h c/regexParser/bitVectorNode.cc c/regexParser/bitVectorNode.h |
diffstat | 4 files changed, 6 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/c/regexParser/bitVector.cc Fri Dec 04 20:32:09 2015 +0900 +++ b/c/regexParser/bitVector.cc Sun Dec 06 15:54:05 2015 +0900 @@ -3,10 +3,11 @@ #include <string.h> #include "bitVector.h" const BitVectorPtr allocateBitVector(); +void bitSet(BitVectorPtr bi, int bitSetPosition); -BitVectorListPtr createBitVector(NodePtr n) { - BitVectorListPtr nextBvl = allocateBitVectorList(); - nextBvl->bi = bitSet(nextBvl,n->nodeNumber); +BitVectorPtr createBitVector(NodePtr n) { + BitVectorPtr nextBvl = allocateBitVector(); + bitSet(nextBvl,n->nodeNumber); return nextBvl; } @@ -25,7 +26,7 @@ void bitPrint(BitVectorPtr bi) { unsigned long vec = bi->bitContainer; for (int j = 0; j < BITBLOCK; j++) { - putchar((vec & 1)?'1:'0'); + putchar((vec & 1) ? '1':'0'); vec >>= 1; } printf("\n");
--- a/c/regexParser/bitVector.h Fri Dec 04 20:32:09 2015 +0900 +++ b/c/regexParser/bitVector.h Sun Dec 06 15:54:05 2015 +0900 @@ -1,4 +1,5 @@ #include "regexParser.h" +#define BITBLOCK 64 typedef struct bitVector { unsigned long bitContainer; @@ -8,7 +9,3 @@ bitVectorList *self; bitVectorList *next; }BitVectorList, *BitVectorListPtr; - -extern BitVectorListPtr createBitVector(NodePtr node); -extern BitVectorPtr bitSet(BitVector bitVetor,int bitPosition); -extern void bitPrint(BitVectorPtr bitVector);
--- a/c/regexParser/bitVectorNode.cc Fri Dec 04 20:32:09 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include "bitVectorNode.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 = bvl; - bvl->bi = bitSet(0); - - for (int i = 0; i < 256; i++) { - bvl->next[i] = NULL; - } - - return bvl; -} -