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