1 /* $XConsortium: stack.h /main/3 1995/11/01 17:39:49 rswiston $ */
2 /***************************************************************
6 * THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
9 * Copyright (c) 1995 AT&T Corp. *
10 * All Rights Reserved *
12 * This software is licensed by AT&T Corp. *
13 * under the terms and conditions of the license in *
14 * http://www.research.att.com/orgs/ssr/book/reuse *
16 * This software was created by the *
17 * Software Engineering Research Department *
18 * AT&T Bell Laboratories *
20 * For further information contact *
21 * gsf@research.att.com *
23 ***************************************************************/
25 /* : : generated by proto : : */
29 * AT&T Bell Laboratories
31 * homogenous stack routine definitions
35 #if !defined(__PROTO__)
36 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
37 #if defined(__cplusplus)
38 #define __MANGLE__ "C"
43 #define __PROTO__(x) x
45 #define __PARAM__(n,o) n
46 #if !defined(__STDC__) && !defined(__cplusplus)
47 #if !defined(c_plusplus)
58 #define __PROTO__(x) ()
59 #define __OTORP__(x) x
60 #define __PARAM__(n,o) o
68 #if defined(__cplusplus) || defined(c_plusplus)
69 #define __VARARG__ ...
73 #if defined(__STDARG__)
74 #define __VA_START__(p,a) va_start(p,a)
76 #define __VA_START__(p,a) va_start(p)
82 typedef struct stacktable* STACK; /* stack pointer */
83 typedef struct stackposition STACKPOS; /* stack position */
85 struct stackblock /* stack block cell */
87 __V_** stack; /* actual stack */
88 struct stackblock* prev; /* previous block in list */
89 struct stackblock* next; /* next block in list */
92 struct stackposition /* stack position */
94 struct stackblock* block; /* current block pointer */
95 int index; /* index within current block */
98 struct stacktable /* stack information */
100 struct stackblock* blocks; /* stack table blocks */
101 __V_* error; /* error return value */
102 int size; /* size of each block */
103 STACKPOS position; /* current stack position */
107 * map old names to new
110 #define mkstack stackalloc
111 #define rmstack stackfree
112 #define clrstack stackclear
113 #define getstack stackget
114 #define pushstack stackpush
115 #define popstack stackpop
116 #define posstack stacktell
118 extern __MANGLE__ STACK stackalloc __PROTO__((int, __V_*));
119 extern __MANGLE__ void stackfree __PROTO__((STACK));
120 extern __MANGLE__ void stackclear __PROTO__((STACK));
121 extern __MANGLE__ __V_* stackget __PROTO__((STACK));
122 extern __MANGLE__ int stackpush __PROTO__((STACK, __V_*));
123 extern __MANGLE__ int stackpop __PROTO__((STACK));
124 extern __MANGLE__ void stacktell __PROTO__((STACK, int, STACKPOS*));