ZE-Standard-Libraries/stack/stack.h

32 lines
635 B
C
Raw Normal View History

2018-07-23 04:59:16 +00:00
#ifndef STACK_H
#define STACK_H
#include "../list/list_expand.h"
typedef struct stack_node{
2018-07-30 09:45:33 +00:00
SID *s_id;
_Bool if_malloc;
_Bool if_sid;
unsigned int type;
2018-07-23 04:59:16 +00:00
void *value;
struct stack_node *next;
} SNode;
typedef struct stack{
2018-07-30 09:45:33 +00:00
SID *s_id;
2018-07-23 04:59:16 +00:00
unsigned long long length;
SNode *top;
2018-07-30 09:45:33 +00:00
_Bool if_sid;
2018-07-23 04:59:16 +00:00
} Stack;
Stack *initStack(void);
SNode *initSNode(void);
2018-07-30 09:45:33 +00:00
int initMallocValueForSNode(SNode *p_snode, unsigned int type, void *value);
2018-07-23 04:59:16 +00:00
SNode *popStack(Stack *p_stack);
int pushStack(Stack *p_stack, SNode *p_snode);
int releaseStack(Stack *p_stack);
int releaseSNode(SNode *p_snode);
#endif /* stack_h */