dstate.h

来自「我的一个利用有限状态机的正则表达式的实现。」· C头文件 代码 · 共 39 行

H
39
字号
#ifndef DSTATE_H
#define DSTATE_H

#include "myafx.h"
#include "myhash.h"
#include "myset.h"

REG_EXPORT typedef struct DState DSTATE;
REG_EXPORT typedef struct DTran DTRAN;

struct DState {
	SET* node_set;
	int marked;
	int end; // if the dstate contains any end node, it's true
	size_t dtrans_size;
	size_t dtrans_count;
	DTRAN** dtrans;
};

struct DTran {
	DSTATE* src;
	DSTATE* tar;
	char c;
};

DSTATE* new_dstate( SET* s );
DTRAN* new_dtran( DSTATE* src, DSTATE* tar, char c );

// dfa afx
HASH_TABLE::LLNode* insert_dstate( HASH_TABLE* hash_table, DSTATE* ds );
DSTATE* find_dstate( HASH_TABLE* hash_table, SET* s );
DTRAN* find_dtran( DSTATE* ds, char c );

void release_dstate( void* v );

void PrintDTran( DTRAN* dt );
void PrintDState( DSTATE* ds );

#endif

⌨️ 快捷键说明

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