-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
45 lines (36 loc) · 826 Bytes
/
Copy pathstack.h
File metadata and controls
45 lines (36 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef STACK_H
#define STACK_H
#define StackDumpMacro(stk) (StackDump(stk, __FILE__, __LINE__, __FUNCTION__))
typedef double StackElem_t;
typedef uint64_t Canary_t;
#define CANARY_VALUE 0xDEAD
#define FILL_VALUE -666
// #define CANARY
// #define HASH
enum CodeError {
Overflow,
Size,
Underflow,
NullPointer,
CanaryError,
HashError,
NoError
};
struct Stack
{
Canary_t LEFT_CANARY;
StackElem_t* data;
int size;
size_t capacity;
CodeError err;
Canary_t RIGHT_CANARY;
uint64_t hash;
};
CodeError StackPush(Stack* stk, StackElem_t elem);
CodeError StackPop(Stack* stk, StackElem_t* DeletedValue);
int StackPopV(Stack* stk);
void StackCtor(Stack* stk);
void StackDtor(Stack* stk);
StackElem_t* SizeUpStack(Stack* stk);
StackElem_t* SizeDownStack(Stack* stk);
#endif