Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 42 lines (31 sloc) 1.156 kb
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
/*
+----------------------------------------------+
| DPL Programming Language v1.1 |
+----------------------------------------------+
| The DPL langauge was developed for a school |
| project at ThunderRidge High School. |
| |
| Development of the language after its |
| completion is reserved to Brian Rosner. |
+----------------------------------------------+
| Author: Brian Rosner <br@brosner.com> |
+----------------------------------------------+
*/

#ifndef _STACK_H
#define _STACK_H

typedef struct _StackElement {

void *data;
struct _StackElement *next;

} StackElement;

typedef struct _Stack {

int size;
StackElement *head;
StackElement *tail;

} Stack;

extern void stackInit(Stack *stack);
extern void stackDestroy(Stack *stack);

extern int stackPush(Stack *stack, void *data, int size);
extern int stackPop(Stack *stack, void **data);

#define stackPeek(stack) ((stack)->head == NULL ? NULL : (stack)->head->data)
#define stackSize(stack) (stack)->size

#endif
Something went wrong with that request. Please try again.