]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Other/Maintained/Tools/Pccts/sorcerer/lib/sstack.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Other / Maintained / Tools / Pccts / sorcerer / lib / sstack.c
1 /*
2 * sstack.c
3 *
4 * SOFTWARE RIGHTS
5 *
6 * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
7 * domain. An individual or company may do whatever they wish with
8 * source code distributed with SORCERER or the code generated by
9 * SORCERER, including the incorporation of SORCERER, or its output, into
10 * commerical software.
11 *
12 * We encourage users to develop software with SORCERER. However, we do
13 * ask that credit is given to us for developing SORCERER. By "credit",
14 * we mean that if you incorporate our source code into one of your
15 * programs (commercial product, research project, or otherwise) that you
16 * acknowledge this fact somewhere in the documentation, research report,
17 * etc... If you like SORCERER and have developed a nice tool with the
18 * output, please mention that you developed it using SORCERER. In
19 * addition, we ask that this header remain intact in our source code.
20 * As long as these guidelines are kept, we expect to continue enhancing
21 * this system and expect to make other tools available as they are
22 * completed.
23 *
24 * SORCERER 1.00B
25 * Terence Parr
26 * AHPCRC, University of Minnesota
27 * 1992-1994
28 */
29
30 #include "pcctscfg.h"
31 #include <stdio.h>
32 #include <setjmp.h>
33
34 #ifdef PCCTS_USE_STDARG
35 #include <stdarg.h>
36 #else
37 #include <varargs.h>
38 #endif
39
40 #include "CASTBase.h"
41 #include "sstack.h"
42
43 void
44 #ifdef __USE_PROTOS
45 sstack_push( SStack **st, void *e )
46 #else
47 sstack_push( st, e )
48 SStack **st;
49 void *e;
50 #endif
51 {
52 SStack *p;
53 require(e!=NULL, "sstack_push: attempting to add NULL list element");
54
55 p = newSStack;
56 require(p!=NULL, "sstack_push: cannot alloc new list node");
57 p->elem = e;
58 p->next = *st;
59 *st = p;
60 }
61
62 void *
63 #ifdef __USE_PROTOS
64 sstack_pop( SStack **st )
65 #else
66 sstack_pop( st )
67 SStack **st;
68 #endif
69 {
70 SStack *p = *st;
71 void *r;
72
73 *st = (*st)->next;
74 r = p->elem;
75 free(p);
76 return r;
77 }
78