myset.h

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

H
44
字号
#ifndef MY_SET_H
#define MY_SET_H

#include "myafx.h"
#include "MyHash.h"

// Set

// The sets with same values has a same handler
typedef struct MySet {
	size_t size;  // char size of the set
	size_t count; // number of members in the set
	void** set;  // end by NULL
} SET;

typedef struct MySetFactory {

	void** temp_set_space;
	size_t temp_set_space_size;
	
	HASH_TABLE* set_hash_table;
} SET_FACTORY;

SET_FACTORY* initialize_set_factory();
void release_set_factory( SET_FACTORY* f );

// new set
SET* new_set( SET_FACTORY* factory, void** set, size_t count);
// new set which contains two element
SET* new_set( SET_FACTORY* factory, void* n1, void* n2 );
// new set which contains one element
SET* new_set( SET_FACTORY* factory, void* n1 );

// union two set
SET* union_set( SET_FACTORY* factory, SET* s1, SET* s2 );
// union a set and a sorted list
SET* union_set( SET_FACTORY* factory, SET* s1, void** set, size_t count );
// find a set handler
SET* find_set( SET_FACTORY* factory, void** set, size_t count );

REG_EXPORT void PrintSet ( SET* s );


#endif

⌨️ 快捷键说明

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