ucif/antlr3/src/antlr3collections.c
pANTLR3_INT_TRIE
antlr3IntTrieNew(ANTLR3_UINT32 depth)
{
        pANTLR3_INT_TRIE        trie;

        trie    = (pANTLR3_INT_TRIE) ANTLR3_CALLOC(1, sizeof(ANTLR3_INT_TRIE)); /* Base memory required */

        if (trie == NULL)
        {
                return  (pANTLR3_INT_TRIE) ANTLR3_FUNC_PTR(ANTLR3_ERR_NOMEM);
        }

        /* Now we need to allocate the root node. This makes it easier
         * to use the tree as we don't have to do anything special
         * for the root node.
         */
        trie->root      = (pANTLR3_INT_TRIE_NODE) ANTLR3_CALLOC(1, sizeof(ANTLR3_INT_TRIE));

        if (trie->root == NULL)
        {
                ANTLR3_FREE(trie);
                return  (pANTLR3_INT_TRIE) ANTLR3_FUNC_PTR(ANTLR3_ERR_NOMEM);
        }

        trie->add       = intTrieAdd;
        trie->del       = intTrieDel;
        trie->free      = intTrieFree;
        trie->get       = intTrieGet;

        /* Now we seed the root node with the index being the
         * highest left most bit we want to test, which limits the
         * keys in the trie. This is the trie 'depth'. The limit for
         * this implementation is 63 (bits 0..63).
         */
        trie->root->bitNum = depth;

        /* And as we have nothing in here yet, we set both child pointers
         * of the root node to point back to itself.
         */
        trie->root->leftN       = trie->root;
        trie->root->rightN      = trie->root;
        trie->count                     = 0;

        /* Finally, note that the key for this root node is 0 because
         * we use calloc() to initialise it.
         */

        return trie;
}
/* INT TRIE Implementation of depth 64 bits, being the number of bits
 * in a 64 bit integer.
 */
INT TRIE Implementation of depth 64 bits, being the number of bits
in a 64 bit integer.
INT TRIE Implementation of depth 64 bits being the number of bits in a 64 bit integer .
pANTLR3_INT_TRIE
antlr3IntTrieNew(ANTLR3_UINT32 depth)
{
        pANTLR3_INT_TRIE        trie;
        trie    = (pANTLR3_INT_TRIE) ANTLR3_CALLOC(1, sizeof(ANTLR3_INT_TRIE)); 
        if (trie == NULL)
        {
                return  (pANTLR3_INT_TRIE) ANTLR3_FUNC_PTR(ANTLR3_ERR_NOMEM);
        }
        trie->root      = (pANTLR3_INT_TRIE_NODE) ANTLR3_CALLOC(1, sizeof(ANTLR3_INT_TRIE));
        if (trie->root == NULL)
        {
                ANTLR3_FREE(trie);
                return  (pANTLR3_INT_TRIE) ANTLR3_FUNC_PTR(ANTLR3_ERR_NOMEM);
        }
        trie->add       = intTrieAdd;
        trie->del       = intTrieDel;
        trie->free      = intTrieFree;
        trie->get       = intTrieGet;
        trie->root->bitNum = depth;
        trie->root->leftN       = trie->root;
        trie->root->rightN      = trie->root;
        trie->count                     = 0;
        return trie;
}
pANTLR3_INT_TRIE antlr3IntTrieNew ( ANTLR3_UINT32 depth ) { pANTLR3_INT_TRIE trie ; trie = ( pANTLR3_INT_TRIE ) ANTLR3_CALLOC ( 1 , sizeof ( ANTLR3_INT_TRIE ) ) ; if ( trie == NULL ) { return ( pANTLR3_INT_TRIE ) ANTLR3_FUNC_PTR ( ANTLR3_ERR_NOMEM ) ; } trie -> root = ( pANTLR3_INT_TRIE_NODE ) ANTLR3_CALLOC ( 1 , sizeof ( ANTLR3_INT_TRIE ) ) ; if ( trie -> root == NULL ) { ANTLR3_FREE ( trie ) ; return ( pANTLR3_INT_TRIE ) ANTLR3_FUNC_PTR ( ANTLR3_ERR_NOMEM ) ; } trie -> add = intTrieAdd ; trie -> del = intTrieDel ; trie -> free = intTrieFree ; trie -> get = intTrieGet ; trie -> root -> bitNum = depth ; trie -> root -> leftN = trie -> root ; trie -> root -> rightN = trie -> root ; trie -> count = 0 ; return trie ; }
INT TRIE Implementation of depth 64 bits, being the number of bits
 in a 64 bit integer.
INT TRIE Implementation of depth 64 bits being the number of bits in a 64 bit integer .
/* Base memory required */ /* Now we need to allocate the root node. This makes it easier
         * to use the tree as we don't have to do anything special
         * for the root node.
         */ /* Now we seed the root node with the index being the
         * highest left most bit we want to test, which limits the
         * keys in the trie. This is the trie 'depth'. The limit for
         * this implementation is 63 (bits 0..63).
         */ /* And as we have nothing in here yet, we set both child pointers
         * of the root node to point back to itself.
         */ /* Finally, note that the key for this root node is 0 because
         * we use calloc() to initialise it.
         */