⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fv.h

📁 SBMH算法。为字符串匹配算法。c语言开发。
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -