/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped22/*23* Glenn Fowler24* AT&T Research25*26* homogenous stack routine definitions27*/2829#ifndef _STACK_H30#define _STACK_H3132typedef struct stacktable* STACK; /* stack pointer */33typedef struct stackposition STACKPOS; /* stack position */3435struct stackblock /* stack block cell */36{37void** stack; /* actual stack */38struct stackblock* prev; /* previous block in list */39struct stackblock* next; /* next block in list */40};4142struct stackposition /* stack position */43{44struct stackblock* block; /* current block pointer */45int index; /* index within current block */46};4748struct stacktable /* stack information */49{50struct stackblock* blocks; /* stack table blocks */51void* error; /* error return value */52int size; /* size of each block */53STACKPOS position; /* current stack position */54};5556/*57* map old names to new58*/5960#define mkstack stackalloc61#define rmstack stackfree62#define clrstack stackclear63#define getstack stackget64#define pushstack stackpush65#define popstack stackpop66#define posstack stacktell6768#if _BLD_ast && defined(__EXPORT__)69#define extern __EXPORT__70#endif7172extern STACK stackalloc(int, void*);73extern void stackfree(STACK);74extern void stackclear(STACK);75extern void* stackget(STACK);76extern int stackpush(STACK, void*);77extern int stackpop(STACK);78extern void stacktell(STACK, int, STACKPOS*);7980#undef extern8182#endif838485