Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

aptree.c File Reference

Patricia index tree for name lookup: data type = pointer. More...

#include <sent/stddefs.h>
#include <sent/ptree.h>

Include dependency graph for aptree.c:

Go to the source code of this file.

Functions

static APATNODEnew_node ()
static int testbit_local (int bitplace)
static void * aptree_search_data_r (APATNODE *node)
void * aptree_search_data (char *str, APATNODE *node)
APATNODEaptree_make_root_node (void *data)
static void aptree_add_entry_at (char *str, int bitloc, void *data, APATNODE **parentlink)
void aptree_add_entry (char *str, void *data, char *matchstr, APATNODE **rootnode)
static void aptree_remove_entry_r (APATNODE *now, APATNODE *up, APATNODE *up2)
void aptree_remove_entry (char *str, APATNODE **rootnode)
void aptree_traverse_and_do (APATNODE *node, void(*callback)(void *))
void free_aptree (APATNODE *node)

Variables

static char * tmp_str
 Local work area: current string we are searching for.
static int maxbitplace
 Local work area: Maximum bit length of tmp_str.
static APATNODEtmproot
 Work area to hold current root node for removing entry.


Detailed Description

Patricia index tree for name lookup: data type = pointer.

Author:
Akinobu LEE
Date:
Thu Feb 17 15:21:53 2005
Revision
1.1.1.1

Definition in file aptree.c.


Function Documentation

static APATNODE* new_node  )  [static]
 

Allocate a new node.

Returns:
pointer to the new node.

Definition at line 34 of file aptree.c.

Referenced by aptree_add_entry_at(), aptree_make_root_node(), make_ptree(), ptree_add_entry_at(), and ptree_make_root_node().

static int testbit_local int  bitplace  )  [static]
 

Local bit test function for search.

Parameters:
bitplace [in] bit place to test.
Returns:
the content of tested bit in tmp_str, either 0 or 1.

Definition at line 57 of file aptree.c.

Referenced by aptree_remove_entry_r(), aptree_search_data_r(), and ptree_search_data_r().

static void* aptree_search_data_r APATNODE node  )  [static]
 

Recursive function to search the data in the tree

Parameters:
node [in] current node.
Returns:
pointer to the found data

Definition at line 81 of file aptree.c.

Referenced by aptree_search_data().

void* aptree_search_data char *  str,
APATNODE node
 

Search for the data whose key string matches the given string.

Parameters:
str [in] search key string
node [in] root node of index tree
Returns:
the exactly found data pointer, or the nearest one.

Definition at line 103 of file aptree.c.

Referenced by add_to_error(), cdset_lookup(), codebook_add(), codebook_lookup(), dens_add(), dens_lookup(), hmm_add_physical_to_logical(), hmm_add_pseudo_phones_sub(), htk_hmmdata_add(), htk_hmmdata_lookup_logical(), htk_hmmdata_lookup_physical(), make_hmm_basephone_list(), mark_word_edge(), new_str2phseq(), rdhmmlist(), regist_cdset(), remove_cdset(), state_add(), state_lookup(), trans_add(), trans_lookup(), var_add(), and var_lookup().

APATNODE* aptree_make_root_node void *  data  ) 
 

Make a root node of a index tree.

Parameters:
data [in] the first data
Returns:
the newly allocated root node.

Definition at line 125 of file aptree.c.

Referenced by add_to_error(), aptree_add_entry(), codebook_add(), dens_add(), hmm_add_physical_to_logical(), hmm_add_pseudo_phones_sub(), htk_hmmdata_add(), make_hmm_basephone_list(), rdhmmlist(), regist_cdset(), state_add(), trans_add(), and var_add().

static void aptree_add_entry_at char *  str,
int  bitloc,
void *  data,
APATNODE **  parentlink
[static]
 

Insert a new node to the existing index tree.

Parameters:
str [in] new key string
bitloc [in] bit branch to which this node will be added
data [in] new data pointer
parentlink [i/o] the parent node to which this node will be added

Definition at line 143 of file aptree.c.

Referenced by aptree_add_entry().

void aptree_add_entry char *  str,
void *  data,
char *  matchstr,
APATNODE **  rootnode
 

Insert a new node to the index tree.

Parameters:
str [in] new key string
data [in] new data pointer
matchstr [in] the most matching data already exist in the index tree, as obtained by aptree_search_data()
rootnode [i/o] pointer to root index node

Definition at line 183 of file aptree.c.

Referenced by add_to_error(), codebook_add(), dens_add(), hmm_add_physical_to_logical(), hmm_add_pseudo_phones_sub(), htk_hmmdata_add(), make_hmm_basephone_list(), rdhmmlist(), regist_cdset(), state_add(), trans_add(), and var_add().

static void aptree_remove_entry_r APATNODE now,
APATNODE up,
APATNODE up2
[static]
 

Recursive sunction to find and remove an entry.

Parameters:
now [in] current node
up [in] parent node
up2 [in] parent parent node

Definition at line 208 of file aptree.c.

Referenced by aptree_remove_entry().

void aptree_remove_entry char *  str,
APATNODE **  rootnode
 

Remove a node from the index tree.

Parameters:
str [in] existing key string (must exist in the index tree)
rootnode [i/o] pointer to root index node

Definition at line 254 of file aptree.c.

Referenced by remove_cdset().

void aptree_traverse_and_do APATNODE node,
void(*)(void *)  callback
 

Recursive function to traverse index tree and execute the callback for all the existing data.

Parameters:
node [in] current node
callback [in] callback function

Definition at line 276 of file aptree.c.

Referenced by aptree_traverse_and_do(), count_all_phone(), print_all_basephone_detail(), print_all_basephone_name(), put_all_cdinfo(), test_interword_triphone(), triphone_callback_left(), and wt_tmix().

void free_aptree APATNODE node  ) 
 

Free all the sub nodes from specified node.

Parameters:
node [in] current node.

Definition at line 296 of file aptree.c.

Referenced by free_aptree().


Generated on Tue Mar 28 16:03:31 2006 for Julius by  doxygen 1.4.2