revert runtime file.
[repair.git] / Repair / RepairInterpreter / stack.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "stack.h"
4 //#include "dmalloc.h"
5
6 void pushstack(struct StackElement **septr,void * obj) {
7   struct StackElement * nse=(struct StackElement *)malloc(sizeof(struct StackElement));
8   nse->contents=obj;
9   nse->next=*septr;
10   *septr=nse;
11 }
12
13 void * popstack(struct StackElement **septr) {
14   if(*septr==NULL) {
15     printf("Empty Stack\n");
16     return NULL;/* Empty stack */
17   }
18   {
19     void *obj=(*septr)->contents;
20     struct StackElement *ose=*septr;
21     (*septr)=ose->next;
22     free(ose);
23     return obj;
24   }
25 }