Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtksh / ksh93 / src / lib / libast / include / stack.h
1 /* $XConsortium: stack.h /main/3 1995/11/01 17:39:49 rswiston $ */
2 /***************************************************************
3 *                                                              *
4 *                      AT&T - PROPRIETARY                      *
5 *                                                              *
6 *         THIS IS PROPRIETARY SOURCE CODE LICENSED BY          *
7 *                          AT&T CORP.                          *
8 *                                                              *
9 *                Copyright (c) 1995 AT&T Corp.                 *
10 *                     All Rights Reserved                      *
11 *                                                              *
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        *
15 *                                                              *
16 *               This software was created by the               *
17 *           Software Engineering Research Department           *
18 *                    AT&T Bell Laboratories                    *
19 *                                                              *
20 *               For further information contact                *
21 *                     gsf@research.att.com                     *
22 *                                                              *
23 ***************************************************************/
24
25 /* : : generated by proto : : */
26                   
27 /*
28  * Glenn Fowler
29  * AT&T Bell Laboratories
30  *
31  * homogenous stack routine definitions
32  */
33
34 #ifndef _STACK_H
35 #if !defined(__PROTO__)
36 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
37 #if defined(__cplusplus)
38 #define __MANGLE__      "C"
39 #else
40 #define __MANGLE__
41 #endif
42 #define __STDARG__
43 #define __PROTO__(x)    x
44 #define __OTORP__(x)
45 #define __PARAM__(n,o)  n
46 #if !defined(__STDC__) && !defined(__cplusplus)
47 #if !defined(c_plusplus)
48 #define const
49 #endif
50 #define signed
51 #define void            int
52 #define volatile
53 #define __V_            char
54 #else
55 #define __V_            void
56 #endif
57 #else
58 #define __PROTO__(x)    ()
59 #define __OTORP__(x)    x
60 #define __PARAM__(n,o)  o
61 #define __MANGLE__
62 #define __V_            char
63 #define const
64 #define signed
65 #define void            int
66 #define volatile
67 #endif
68 #if defined(__cplusplus) || defined(c_plusplus)
69 #define __VARARG__      ...
70 #else
71 #define __VARARG__
72 #endif
73 #if defined(__STDARG__)
74 #define __VA_START__(p,a)       va_start(p,a)
75 #else
76 #define __VA_START__(p,a)       va_start(p)
77 #endif
78 #endif
79
80 #define _STACK_H
81
82 typedef struct stacktable* STACK;       /* stack pointer                */
83 typedef struct stackposition STACKPOS;  /* stack position               */
84
85 struct stackblock                       /* stack block cell             */
86 {
87         __V_**            stack;        /* actual stack                 */
88         struct stackblock* prev;        /* previous block in list       */
89         struct stackblock* next;        /* next block in list           */
90 };
91
92 struct stackposition                    /* stack position               */
93 {
94         struct stackblock* block;       /* current block pointer        */
95         int             index;          /* index within current block   */
96 };
97
98 struct stacktable                       /* stack information            */
99 {
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       */
104 };
105
106 /*
107  * map old names to new
108  */
109
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
117
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*));
125
126 #endif