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

📄 acsm.h

📁 AC算法 用指针实现 用指针指向状态机的状态变量
💻 H
字号:
//this is top file used in acsm
#ifndef ACSM_H
#define ACSM_H


#include <stdio.h>
#include <string.h>
#include <stdlib.h>


#define MAXLEN 256
#define ALPHABET_SIZE 256
#define ACSM_FAIL_STATE NULL




typedef struct _pattern                               //define a struct pattern
{
	struct _pattern *nextpattern;
	unsigned char *pattern;
	int num;
}ACSM_PATTERN;



typedef struct _state                                 //define a state
{
	struct  _state * aNextState[ALPHABET_SIZE];   
	struct  _state * FailState;   
	ACSM_PATTERN   * MatchList;   
}STATE;



typedef struct                                                //define a acsm
{
	STATE *aStateMachine;
}STATEMACHINE;



STATEMACHINE * acsmnew();
int AddPatternStates (STATEMACHINE * acsm,unsigned char * pat,int m);
void acsmFree(STATEMACHINE * acsm);


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -