Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

header.h

Go to the documentation of this file.
00001 // header.h --
00002 // $Id: header.h,v 1.11 2003/11/23 01:42:51 wcvs Exp $
00003 // This is part of Metakit, the homepage is https://www.equi4.com/metakit/
00004 
00009 #ifndef __HEADER_H__
00010 #define __HEADER_H__
00011 
00013 
00014 #include "config.h"
00015 
00017 // A number of preprocessor options are used in the source code
00018 //
00019 //  q4_DOS      MS-DOS real-mode OS
00020 //  q4_MAC      Apple Macintosh OS
00021 //  q4_UNIX     Unix, any flavor
00022 //  q4_VMS      DEC OpenVMS OS
00023 //  q4_WIN      Microsoft Windows OS, any flavor
00024 //  q4_WIN32    Microsoft Windows OS, 32-bit
00025 //  q4_WINCE    Microsoft Windows OS, embedded
00026 //
00027 //  q4_MFC      Microsoft MFC framework
00028 //  q4_STD      Standard STL version
00029 //  q4_UNIV     Universal version
00030 //
00031 //  q4_BOOL     compiler supports bool datatype
00032 //  q4_CHECK    enable assertion checks
00033 //  q4_FIX      manual header fix (see above)
00034 //  q4_INLINE   enable inline expansion
00035 //  q4_KITDLL   compile as DLL (shared library)
00036 //  q4_MULTI    compile for multi-threading
00037 //  q4_NOLIB    do not add automatic lib linkage (MSVC5)
00038 //  q4_NO_NS    don't use namespaces for STL
00039 //  q4_OK       assume all software is perfect
00040 //  q4_STRICT   do not disable any compiler warnings
00041 //  q4_TINY     small version, no floating point
00042 //
00044 
00045 #define __K4CONF_H__    // skip section in "mk4.h", since we use "header.h"
00046 
00047     // if neither MFC nor STD are specified, default to Universal version
00048 #if !q4_MFC && !q4_STD && !defined (q4_UNIV)
00049 #define q4_UNIV 1
00050 #endif
00051 
00053 // You can either use '#define q4_xxx 1' to flag the choice of an OS, or
00054 // use a '#define d4_OS_H "file.h"' to force inclusion of a header later.
00055 
00056 #if defined (__MINGW32__)
00057 #define d4_OS_H "win.h"
00058 #elif defined (MSDOS) && defined (__GNUC__)
00059 #define q4_DOS 1
00060 #elif defined(unix) || defined(__unix__) || defined(__GNUC__) || \
00061         defined(_AIX) || defined(__hpux)
00062 #define q4_UNIX 1
00063 #elif defined (__VMS)
00064 #define q4_VMS 1
00065 #elif defined (macintosh)
00066 #define q4_MAC 1
00067 #elif !defined (d4_OS_H)
00068 #define d4_OS_H "win.h"
00069 #endif
00070 
00072 // Use '#define q4_xxx 1' to flag the choice of a CPU.
00073 
00074 #if defined (_M_I86) || defined (_M_IX86) || defined (i386)
00075 #define q4_I86 1
00076 #if defined (_M_I86SM)
00077 #define q4_TINY 1
00078 #endif
00079 #elif defined (__powerc)
00080 #define q4_PPC 1
00081 #elif defined (__alpha)
00082 #define q4_AXP 1
00083 #define q4_LONG64 1
00084 #elif defined (__VMS)
00085 #define q4_VAX 1
00086 #else
00087 #define q4_M68K 1
00088 #endif
00089 
00091 // Use '#define q4_xxx 1' to flag the choice of an IDE, and optionally also
00092 // add '#include "file.h"' to force inclusion of a header file right here.
00093 
00094 #if defined (__BORLANDC__)                  // Borland C++
00095 #include "borc.h"
00096 #elif defined (__DECCXX)                    // DEC C++
00097 #define q4_DECC 1
00098 #elif defined (__GNUC__)                    // GNU C++
00099 #include "gnuc.h"
00100 #elif defined (__MWERKS__)                  // Metrowerks CodeWarrior C++
00101 #include "mwcw.h"
00102 #elif defined (_MSC_VER)                    // Microsoft Visual C++
00103 #include "msvc.h"
00104 #elif defined (__SC__)                      // Symantec C++
00105 #define q4_SYMC 1
00106 #elif defined (__WATCOMC__)                 // Watcom C++
00107 #define q4_WATC 1
00108 #endif
00109 
00111 // Some of the options take precedence over others
00112 
00113 #if !q4_BOOL && !q4_STD         // define a bool datatype
00114 #define false 0
00115 #define true 1
00116 #define bool int
00117 #endif
00118 
00119 #if !q4_CHECK                   // disable assertions
00120 #undef d4_assert
00121 #define d4_dbgdef(x)
00122 #define d4_assert(x)
00123 #endif
00124 
00125 #if q4_NO_NS                    // don't use namespaces
00126 #define d4_std
00127 #else
00128 #define d4_std std
00129 #endif
00130 
00131 #if HAVE_MEMMOVE
00132 #define d4_memmove(d,s,n)   memmove(d,s,n)
00133 #elif HAVE_BCOPY
00134 #define d4_memmove(d,s,n)   bcopy(s,d,n)
00135 #else
00136 #define d4_memmove f4_memmove
00137 extern void f4_memmove(void* d, const void* s, int n);
00138 #endif
00139 
00140 typedef unsigned char t4_byte;  // create typedefs for t4_byte, etc.
00141 
00142 #if SIZEOF_LONG == 8
00143 typedef int t4_i32;             // longs are 64b, so int must be 32b
00144 #else
00145 typedef long t4_i32;            // longs aren't 64b, so they are 32b
00146 #endif
00147 
00149 // Include header files which contain additional os/cpu/ide/fw specifics
00150 
00151 #ifdef d4_OS_H                  // operating system dependencies
00152 #include d4_OS_H
00153 #endif
00154 
00156 // Several defines should always be set
00157 
00158 #ifndef d4_assert               // assertion macro
00159 #include <assert.h>
00160 #define d4_assert assert
00161 #endif
00162 
00163 #ifndef d4_dbgdef               // conditionally compiled
00164 #ifdef NDEBUG
00165 #define d4_dbgdef(x)
00166 #else
00167 #define d4_dbgdef(x) x
00168 #endif
00169 #endif
00170 
00171 #ifndef d4_new                  // heap allocator
00172 #define d4_new new
00173 #endif
00174 
00175 #ifndef d4_reentrant            // thread-local storage
00176 #define d4_reentrant
00177 #endif
00178 
00180 // Debug logging option, called internally where properties are modified
00181 
00182 #if q4_LOGPROPMODS
00183 void f4_DoLogProp(const c4_Handler*, int, const char*, int);
00184 #else
00185 #define f4_LogPropMods(a,b) 0
00186 #endif
00187 
00189 // Public definitions, plus a few more framework-specific ones
00190 
00191 #include "mk4.h"
00192 
00193 #if q4_MFC
00194 #include "mfc.h"
00195 #elif q4_STD
00196 #include "std.h"
00197 #elif q4_UNIV
00198 #include "univ.h"
00199 #endif
00200 
00201 #ifdef _MSC_VER
00202 #pragma warning(disable: 4100 4127 4135 4244 4511 4512 4514)
00203 #endif
00204 
00205 #include <string.h>
00206 
00208 // Report unexpected combinations of settings
00209 
00210 #if !q4_FIX
00211 #if (q4_DOS+q4_MAC+q4_UNIX+q4_VMS+q4_WIN) != 1
00212 #error Exactly one operating system should have been defined
00213 #endif
00214 #if (q4_MFC+q4_STD+q4_UNIV) != 1
00215 #error Exactly one container library should have been defined
00216 #endif
00217 #endif
00218     
00220 
00221 #endif


Metakit C++ API Reference - https://www.equi4.com/metakit.html - extracted with Doxygen