acsm.h

来自「AC算法 用指针实现 用指针指向状态机的状态变量」· C头文件 代码 · 共 48 行

H
48
字号
//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 + =
减小字号Ctrl + -
显示快捷键?