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