stack.h

Go to the documentation of this file.
00001 /* Copyright (c) 2005 by John M. Boyer, All Rights Reserved.  Please see
00002  * License.txt for use and redistribution license. */
00003 /* Copyright (c) 1997 by John M. Boyer, All Rights Reserved.
00004         This code may not be reproduced in whole or in part without
00005         the written permission of the author. */
00006 
00007 #ifndef STACK_H
00008 #define STACK_H
00009 typedef struct
00010 {
00011   int *S;
00012   int Top,
00013     Size;
00014 }
00015 stack;
00016 typedef stack *stackP;
00017 stackP sp_New (int);
00018 void sp_Free (stackP *);
00019 int sp_Copy (stackP,
00020              stackP);
00021 
00022 #ifndef SPEED_MACROS
00023 int sp_ClearStack (stackP);
00024 int sp_IsEmpty (stackP);
00025 int sp_NonEmpty (stackP);
00026 int sp_Push (stackP,
00027              int);
00028 int sp_Push2 (stackP,
00029               int,
00030               int);
00031 
00032 #define sp_Pop(theStack, a) sp__Pop(theStack, &(a))
00033 #define sp_Pop2(theStack, a, b) sp__Pop2(theStack, &(a), &(b))
00034 int sp__Pop (stackP,
00035              int *);
00036 int sp__Pop2 (stackP,
00037               int *,
00038               int *);
00039 
00040 #else /*  */
00041 
00042 #define sp_ClearStack(theStack) theStack->Top=0
00043 
00044 #define sp_IsEmpty(theStack) !theStack->Top
00045 #define sp_NonEmpty(theStack) theStack->Top
00046 
00047 #define sp_Push(theStack, a) theStack->S[theStack->Top++] = a
00048 #define sp_Push2(theStack, a, b) sp_Push(theStack, a); sp_Push(theStack, b)
00049 
00050 #define sp_Pop(theStack, a) a=theStack->S[--theStack->Top]
00051 #define sp_Pop2(theStack, a, b) sp_Pop(theStack, b);sp_Pop(theStack, a)
00052 
00053 #endif /*  */
00054 
00055 #endif /*  */

Generated on Thu Oct 20 14:58:42 2005 for DominoParitySeparator by  doxygen 1.4.5