pent_include.h

Go to the documentation of this file.
00001 /*
00002  *  pent_include.h - Basic Pentagram types, and precompiled header
00003  *
00004  *  Copyright (C) 2002-2006  The Pentagram Team
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef PENT_INCLUDE_H
00022 #define PENT_INCLUDE_H
00023 
00024 #define PENTAGRAM_NEW
00025 
00026 // Include config.h first if we have it
00027 #ifdef HAVE_CONFIG_H
00028 #  include <config.h>
00029 #endif
00030 
00031 // Include msvc_include under MSVC
00032 #if defined(_MSC_VER) && !defined(UNDER_CE)
00033 #  include "system/msvc/msvc_include.h"
00034 #endif
00035 
00036 // Include wince_include under Embedded Visual C++
00037 #if defined(_MSC_VER) && defined(UNDER_CE)
00038 #  include "wince_include.h"
00039 #endif
00040 
00041 #ifdef __APPLE__
00042 #  include  "macosx_include.h"
00043 #endif
00044 
00045 //
00046 // Common/base types
00047 //
00048 #include "common_types.h"
00049 
00050 
00051 //
00052 // p_dynamic_cast support
00053 //
00054 #include "p_dynamic_cast.h"
00055 
00056 
00057 //
00058 // assert
00059 //
00060 #include <cassert>
00061 
00062 
00063 //
00064 // Strings
00065 //
00066 #include <string>
00067 #include <cstring>
00068 #include "istring.h"
00069 
00070 // Empty string
00071 extern const std::string c_empty_string;
00072 
00073 
00074 //
00075 // Base Errors
00076 //
00077 
00078 #include "Errors.h"
00079 
00080 
00081 //
00082 // The Console
00083 //
00084 
00085 #include "Console.h"
00086 
00087 
00088 //
00089 // Debugging
00090 //
00091 #ifdef DEBUG
00092 #  define POUT(x)               do { pout << x << std::endl; pout.flush(); } while (0)
00093 #  define PERR(x)               do { perr << x << std::endl; perr.flush(); } while (0)
00094 #else
00095 #  define POUT(x)               do { } while(0)
00096 #  define PERR(x)               do { } while(0)
00097 #endif
00098 
00099 // Two very useful macros that one should use instead of pure delete; they 
00100 // will additionally set the old object pointer to 0, thus helping prevent
00101 // double deletes (note that "delete 0" is a no-op).
00102 #define FORGET_OBJECT(x) do { delete x; x = 0; } while(0)
00103 #define FORGET_ARRAY(x) do { delete [] x; x = 0; } while(0)
00104 
00105 
00106 //
00107 // Can't happen.
00108 // For things that really can't happen. Or shouldn't anyway.
00109 //
00110 #define CANT_HAPPEN() do { assert(false); } while(0)
00111 
00112 //
00113 // Can't happen return.
00114 // If we're guaranteed to return before this, but we want to shut the
00115 // compiler warning up.
00116 //
00117 #define CANT_HAPPEN_RETURN() do { assert(false); return 0; } while(0)
00118 
00119 // 
00120 // Can't happen with a message 
00121 //
00122 // Allows a message to be supplied.
00123 // May not work on all compilers or runtimes as expected
00124 //
00125 #define CANT_HAPPEN_MSG(msg) do { assert(msg && false); } while(0)
00126 
00127 //
00128 // Wrapper around valgrind functions.
00129 #include "pent_valgrind.h"
00130 
00131 
00132 // Memory Management through Allocators
00133 typedef void * (*allocFunc)(size_t size);
00134 typedef void (*deallocFunc)(void * ptr);
00135 
00136 namespace Pentagram
00137 {
00138 extern allocFunc palloc;
00139 extern deallocFunc pfree;
00140 void setAllocationFunctions(allocFunc a, deallocFunc d);
00141 }
00142 
00143 #define ENABLE_CUSTOM_MEMORY_ALLOCATION()                                                       \
00144         static void * operator new(size_t size);                                                \
00145         static void operator delete(void * ptr);
00146 
00147 #define DEFINE_CUSTOM_MEMORY_ALLOCATION(Classname)                                      \
00148 void * Classname::operator new(size_t size) {                                           \
00149         return Pentagram::palloc(size);                                                                 \
00150 }                                                                                                                                       \
00151                                                                                                                                         \
00152 void Classname::operator delete(void * ptr) {                                           \
00153         Pentagram::pfree(ptr);                                                                                  \
00154 }
00155 
00156 //
00157 // Precompiled Header Support
00158 //
00159 #ifdef USE_PRECOMPILED_HEADER
00160 
00161 // C Standard Library and STL
00162 #include <fstream>
00163 #include <cstdio>
00164 #include <list>
00165 #include <vector>
00166 
00167 // Useful Pentagram headers
00168 #include "getObject.h"
00169 #include "Kernel.h"
00170 #include "intrinsics.h"
00171 #include "Process.h"
00172 #include "Object.h"
00173 #include "Item.h"
00174 #include "Container.h"
00175 #include "Actor.h"
00176 #include "MainActor.h"
00177 #include "Gump.h"
00178 #include "FileSystem.h"
00179 #include "IDataSource.h"
00180 #include "ODataSource.h"
00181 #include "ShapeArchive.h"
00182 #include "Shape.h"
00183 #include "ShapeFrame.h"
00184 #include "RenderSurface.h"
00185 #include "World.h"
00186 #include "CurrentMap.h"
00187 #include "ObjectManager.h"
00188 #include "GUIApp.h"
00189 #include "Usecode.h"
00190 #include "UCList.h"
00191 #include "UCMachine.h"
00192 #include "UCProcess.h"
00193 #endif
00194 
00195 #endif //PENT_INCLUDE_H

Generated on Fri Jul 27 22:27:29 2007 for pentagram by  doxygen 1.4.7