fv.h
来自「SBMH算法。为字符串匹配算法。c语言开发。」· C头文件 代码 · 共 35 行
H
35 行
#ifndef __FV_H__
#define __FV_H__
//define the size of the character set
#ifndef CHAR_SET_SIZE
#define CHAR_SET_SIZE 256
#endif
//data structure used in FV
//a pattern trie node
typedef struct pattern_trie_node {
int n_pattern_end; //to represent this is the end of a pattern or not. 0 = no 1 = yes
struct pattern_trie_node * p_next_char[CHAR_SET_SIZE]; //the child of this node
} pattern_trie_node;
//a pattern trie
typedef pattern_trie_node* pattern_trie;
//an automatic search machine
struct acsm {
pattern_trie p_trie_root; //a pattern trie used for search
int n_BCH[CHAR_SET_SIZE]; //the function for bad character heuristic
int n_pattern_number; //number of patterns in this structure
int n_min_length; //the length of the shortest pattern
};
struct acsm * acsmNew();
int acsmAddPattern(struct acsm* p_acsm, char* p_pattern, int n_pattern_length);
int acsmCompile(struct acsm* p_acsm);
int acsmSearch(struct acsm* p_acsm, char* p_text, long l_text_length);
int acsmDestroy(struct acsm* p_acsm);
int trieDelete(pattern_trie p_trie);
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?