Julius 4.2
|
00001 00023 /* 00024 * Copyright (c) 1991-2011 Kawahara Lab., Kyoto University 00025 * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology 00026 * Copyright (c) 2005-2011 Julius project team, Nagoya Institute of Technology 00027 * All rights reserved 00028 */ 00029 00030 #ifndef __PATRICIA_TREE_H__ 00031 #define __PATRICIA_TREE_H__ 00032 00034 typedef struct _apatnode { 00042 union { 00043 void *data; 00044 int thres_bit; 00045 } value; 00046 struct _apatnode *left0; 00047 struct _apatnode *right1; 00048 } APATNODE; 00049 00051 typedef struct _patnode { 00059 union { 00060 int data; 00061 int thres_bit; 00062 } value; 00063 struct _patnode *left0; 00064 struct _patnode *right1; 00065 } PATNODE; 00066 00067 00068 #ifdef __cplusplus 00069 extern "C" { 00070 #endif 00071 00072 int testbit(char *str, int slen, int bitplace); 00073 int testbit_max(char *str, int bitplace, int maxbitplace); 00074 int where_the_bit_differ(char *str1, char *str2); 00075 PATNODE *make_ptree(char **words, int *data, int wordsnum, int bitplace, BMALLOC_BASE **mroot); 00076 void disp_ptree(PATNODE *node, int level); 00077 int ptree_search_data(char *str, PATNODE *rootnode); 00078 int ptree_replace_data(char *str, int val, PATNODE *node); 00079 PATNODE *ptree_make_root_node(int data, BMALLOC_BASE **mroot); 00080 void ptree_add_entry(char *str, int data, char *matchstr, PATNODE **rootnode, BMALLOC_BASE **mroot); 00081 00082 void *aptree_search_data(char *str, APATNODE *rootnode); 00083 APATNODE *aptree_make_root_node(void *data, BMALLOC_BASE **mroot); 00084 void aptree_add_entry(char *str, void *data, char *matchstr, APATNODE **rootnode, BMALLOC_BASE **mroot); 00085 void aptree_remove_entry(char *str, APATNODE **rootnode); 00086 void aptree_traverse_and_do(APATNODE *node, void (*callback)(void *)); 00087 boolean aptree_write(FILE *fp, APATNODE *root, boolean (*save_data_func)(void *, FILE *fp)); 00088 boolean aptree_read(FILE *fp, APATNODE **root, BMALLOC_BASE **mroot, void *data, boolean (*load_data_func)(void **, void *, FILE *fp)); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif 00093 00094 #endif /* __PATRICIA_TREE_H__ */