aboutsummaryrefslogtreecommitdiff
path: root/src/include/stack.h
blob: 7a1636642f09bc556ea243a7a433f8ca9987b9df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef STACK_H
#define STACK_H

#include <stdlib.h>
#include "util.h"

#define STACK_MAXLEN 256

typedef struct STACK {
   int sp;  /* Index of first unused element of val. */
   void* val[STACK_MAXLEN];
} stack_t;

stack_t* stack_init();
void stack_destroy(stack_t*);

void stack_push(stack_t* stack, void* val);
void* stack_pop(stack_t* stack);
size_t stack_len(stack_t* stack);

void stack_print(stack_t* stack);

#endif