00001 /* $Id: xstack.h,v 1.7 2003/08/16 19:59:39 gkunkel 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 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 xdb-devel@lists.sourceforge.net 00038 xdb-users@lists.sourceforge.net 00039 00040 See our website at: 00041 00042 xdb.sourceforge.net 00043 00044 */ 00045 00049 #ifndef __XB_STACK_H__ 00050 #define __XB_STACK_H__ 00051 00052 #ifdef __GNUG__ 00053 #pragma interface 00054 #endif 00055 00056 #include <xbase/xtypes.h> 00057 00059 00061 class XBDLLEXPORT xbStackElement 00062 { 00063 protected: 00064 xbStackElement *Previous; 00065 xbStackElement *Next; 00066 void *UserPtr; 00067 00068 public: 00069 xbStackElement(); 00070 ~xbStackElement(); 00071 00072 friend class xbStack; 00073 }; 00074 00076 00078 class XBDLLEXPORT xbStack 00079 { 00080 public: 00081 xbStack(void); 00082 virtual ~xbStack(); 00083 00084 void InitStack(); 00085 void *Pop(); 00086 xbShort Push(void *); 00088 00090 xbShort GetStackDepth( void ) { return StackDepth; } 00091 void DumpStack( void ); 00092 00093 protected: 00094 xbShort StackDepth; 00095 xbStackElement *First; 00096 xbStackElement *Last; 00097 }; 00098 00099 #endif // __XB_STACK_H__