更新栈
parent
11b94b6e7a
commit
9a87d5a219
|
|
@ -2,23 +2,19 @@
|
|||
#ifndef _STACK_H
|
||||
#define _STACK_H
|
||||
|
||||
//bzero函数,如果使用的是win32平台则使用memset函数替代
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#define bzero(ptr,size) memset(ptr,0,size)
|
||||
#endif
|
||||
//键和参数的最大值
|
||||
//键和参数的默认最大值
|
||||
#define MAX_ARG_SIZE 512
|
||||
#define STACK_MAX -6 //过大的参数
|
||||
/*栈数据结构*/
|
||||
typedef struct
|
||||
{
|
||||
int len; //当前插入字符的数量
|
||||
char data[MAX_ARG_SIZE]; //插入的字符数据
|
||||
size_t len; //当前插入字符的数量
|
||||
size_t size; //当前栈大小
|
||||
char *data; //插入的字符数据
|
||||
}STACK;
|
||||
|
||||
//初始化栈结构
|
||||
void conf_stack_init(STACK *stack);
|
||||
int conf_stack_init(STACK *stack);
|
||||
|
||||
//插入字符
|
||||
int conf_stack_push(STACK *stack,char data);
|
||||
|
|
@ -31,4 +27,11 @@ int conf_stack_empty(STACK *stack);
|
|||
|
||||
//清理栈数据结构
|
||||
void conf_stack_cleanup(STACK *stack);
|
||||
|
||||
//销毁栈
|
||||
void conf_stack_destroy(STACK *stack);
|
||||
|
||||
//获取栈中字符串
|
||||
char *conf_stack_get_data(STACK *stack);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue