view 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 source

#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;
}