1*4887Schin 
2*4887Schin /* : : generated by proto : : */
3*4887Schin /***********************************************************************
4*4887Schin *                                                                      *
5*4887Schin *               This software is part of the ast package               *
6*4887Schin *           Copyright (c) 1985-2007 AT&T Knowledge Ventures            *
7*4887Schin *                      and is licensed under the                       *
8*4887Schin *                  Common Public License, Version 1.0                  *
9*4887Schin *                      by AT&T Knowledge Ventures                      *
10*4887Schin *                                                                      *
11*4887Schin *                A copy of the License is available at                 *
12*4887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
13*4887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14*4887Schin *                                                                      *
15*4887Schin *              Information and Software Systems Research               *
16*4887Schin *                            AT&T Research                             *
17*4887Schin *                           Florham Park NJ                            *
18*4887Schin *                                                                      *
19*4887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
20*4887Schin *                  David Korn <dgk@research.att.com>                   *
21*4887Schin *                   Phong Vo <kpv@research.att.com>                    *
22*4887Schin *                                                                      *
23*4887Schin ***********************************************************************/
24*4887Schin 
25*4887Schin /*
26*4887Schin  * Glenn Fowler
27*4887Schin  * AT&T Research
28*4887Schin  *
29*4887Schin  * homogenous stack routine definitions
30*4887Schin  */
31*4887Schin 
32*4887Schin #ifndef _STACK_H
33*4887Schin #if !defined(__PROTO__)
34*4887Schin #include <prototyped.h>
35*4887Schin #endif
36*4887Schin #if !defined(__LINKAGE__)
37*4887Schin #define __LINKAGE__		/* 2004-08-11 transition */
38*4887Schin #endif
39*4887Schin 
40*4887Schin #define _STACK_H
41*4887Schin 
42*4887Schin typedef struct stacktable* STACK;	/* stack pointer		*/
43*4887Schin typedef struct stackposition STACKPOS;	/* stack position		*/
44*4887Schin 
45*4887Schin struct stackblock			/* stack block cell		*/
46*4887Schin {
47*4887Schin 	__V_**		  stack;	/* actual stack			*/
48*4887Schin 	struct stackblock* prev;	/* previous block in list	*/
49*4887Schin 	struct stackblock* next;	/* next block in list		*/
50*4887Schin };
51*4887Schin 
52*4887Schin struct stackposition			/* stack position		*/
53*4887Schin {
54*4887Schin 	struct stackblock* block;	/* current block pointer	*/
55*4887Schin 	int		index;		/* index within current block	*/
56*4887Schin };
57*4887Schin 
58*4887Schin struct stacktable			/* stack information		*/
59*4887Schin {
60*4887Schin 	struct stackblock* blocks;	/* stack table blocks		*/
61*4887Schin 	__V_*		error;		/* error return value		*/
62*4887Schin 	int		size;		/* size of each block		*/
63*4887Schin 	STACKPOS	position;	/* current stack position	*/
64*4887Schin };
65*4887Schin 
66*4887Schin /*
67*4887Schin  * map old names to new
68*4887Schin  */
69*4887Schin 
70*4887Schin #define mkstack		stackalloc
71*4887Schin #define rmstack		stackfree
72*4887Schin #define clrstack	stackclear
73*4887Schin #define getstack	stackget
74*4887Schin #define pushstack	stackpush
75*4887Schin #define popstack	stackpop
76*4887Schin #define posstack	stacktell
77*4887Schin 
78*4887Schin #if _BLD_ast && defined(__EXPORT__)
79*4887Schin #undef __MANGLE__
80*4887Schin #define __MANGLE__ __LINKAGE__		__EXPORT__
81*4887Schin #endif
82*4887Schin 
83*4887Schin extern __MANGLE__ STACK		stackalloc __PROTO__((int, __V_*));
84*4887Schin extern __MANGLE__ void		stackfree __PROTO__((STACK));
85*4887Schin extern __MANGLE__ void		stackclear __PROTO__((STACK));
86*4887Schin extern __MANGLE__ __V_*		stackget __PROTO__((STACK));
87*4887Schin extern __MANGLE__ int		stackpush __PROTO__((STACK, __V_*));
88*4887Schin extern __MANGLE__ int		stackpop __PROTO__((STACK));
89*4887Schin extern __MANGLE__ void		stacktell __PROTO__((STACK, int, STACKPOS*));
90*4887Schin 
91*4887Schin #undef __MANGLE__
92*4887Schin #define __MANGLE__ __LINKAGE__
93*4887Schin 
94*4887Schin #endif
95