00001 /* $Id: xstack.h,v 1.5 2000/11/10 19:04:17 dbryson Exp $ 00002 00003 Xbase project source code 00004 00005 This file conatains a header file for the xbStack object which 00006 is used for handling expressions. 00007 00008 Copyright (C) 1997 Startech, Gary A. Kunkel 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 Contact: 00025 00026 Mail: 00027 00028 Technology Associates, Inc. 00029 XBase Project 00030 1455 Deming Way #11 00031 Sparks, NV 89434 00032 USA 00033 00034 Email: 00035 00036 xbase@techass.com 00037 00038 See our website at: 00039 00040 xdb.sourceforge.net 00041 00042 00043 V 1.0 10/10/97 - Initial release of software 00044 V 1.5 1/2/97 - Added memo field support 00045 V 1.6a 4/1/98 - Added expression support 00046 V 1.6b 4/8/98 - Numeric index keys 00047 */ 00048 00052 #ifndef __XB_STACK_H__ 00053 #define __XB_STACK_H__ 00054 00055 #ifdef __GNUG__ 00056 #pragma interface 00057 #endif 00058 00059 #include <xbase/xtypes.h> 00060 00062 00065 struct xbStackElement{ 00066 xbStackElement * Previous; 00067 xbStackElement * Next; 00068 void * UserPtr; 00069 }; 00070 00072 00075 class XBDLLEXPORT xbStack{ 00076 00077 public: 00078 xbStack( void ); 00079 void InitStack( void ); 00080 void * Pop( void ); 00081 xbShort Push( void * ); 00083 00085 xbShort GetStackDepth( void ) { return StackDepth; } 00086 void DumpStack( void ); 00087 00088 protected: 00089 xbShort StackDepth; 00090 xbStackElement * First; 00091 xbStackElement * Last; 00092 xbStackElement * Free; /* points to free stack items */ 00093 xbStackElement * GetStackElement( void ); 00094 void FreeStackElement( xbStackElement * ); 00095 }; 00096 00097 #endif // __XB_STACK_H__