00001 //================================================================================================== 00002 // Copyright (C) 2010 Brian Tietz sdbtietz at yahoo dot com 00003 // 00004 // This program is free software; you can redistribute it and/or modify it under the terms of the 00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the 00006 // License. 00007 // 00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00010 // General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU General Public License along with this program; if 00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00014 // 02110-1301, USA. 00015 // 00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com) 00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that 00018 // license as applied to the UT library in exchange for either substantial contributions to the 00019 // development of the UT library or other forms of compensation. Any such waiver must be 00020 // established in writing between the copyright holder and the commercial entity obtaining such a 00021 // waiver. 00022 //================================================================================================== 00023 00024 00028 00029 00030 #ifndef _UT_H_ 00031 #define _UT_H_ 00032 00033 00034 //================================================================================================== 00035 //=== System headers 00036 //================================================================================================== 00037 #include <assert.h> 00038 #include <string.h> 00039 #include <stddef.h> 00040 #include <stdarg.h> 00041 #include <stdlib.h> 00042 #if __cplusplus 00043 #include <new> 00044 #include <typeinfo> 00045 #else 00046 #include <stdbool.h> 00047 #endif 00048 00049 00050 //================================================================================================== 00051 //=== C/C++ differences 00052 //================================================================================================== 00053 #if __cplusplus 00054 00057 #define EXTERN_C_BEGIN extern "C" { 00058 00061 #define EXTERN_C_END } 00062 00063 #else 00064 00065 #define EXTERN_C_BEGIN 00066 #define EXTERN_C_END 00067 00068 #endif 00069 00070 00071 //================================================================================================== 00072 //=== Target platform setup 00073 //================================================================================================== 00074 #if __linux 00075 #include "Linux/UTLinuxTarget.h" 00076 #elif WIN32 00077 #include "Windows/UTWinTarget.h" 00078 #elif __APPLE__ 00079 #include "MacOS/UTMacTarget.h" 00080 #else 00081 #error "Must include a target platform-specific header file" 00082 #endif 00083 00084 00085 //================================================================================================== 00086 //=== Flags that are always 1 or 0 00087 //================================================================================================== 00088 #if !DEBUG 00089 #undef DEBUG 00090 #define DEBUG 0 00091 #endif 00092 00093 00094 //================================================================================================== 00095 //=== Stack buffer sizes 00096 //================================================================================================== 00097 #ifndef c_max_stack_buf 00098 // Assume a normal desktop operating system 00099 00100 #if DEBUG 00101 00103 #define c_max_stack_buf 1024 00104 00106 #define c_small_string_buf 200 00107 00109 #define c_typical_input_line_buf 100 00110 00111 #else 00112 00114 #define c_max_stack_buf 8192 00115 00117 #define c_small_string_buf 2048 00118 00120 #define c_typical_input_line_buf 512 00121 00122 #endif 00123 00124 #endif // c_max_stack_buf 00125 00126 00127 //================================================================================================== 00128 //=== Entry point 00129 //================================================================================================== 00130 EXTERN_C_BEGIN 00131 00140 extern int main( int argc, char* argv[] ); 00141 00142 // \cond DOXYGEN_DOCUMENT_NEVER 00143 extern int app_main( int argc, char* argv[] ); 00144 #define main app_main 00145 // \endcond 00146 00147 EXTERN_C_END 00148 00149 00150 00151 //================================================================================================== 00152 //=== Functional groups 00153 //================================================================================================== 00154 #if UT_MEMDEBUG 00155 #include "UTMemDebug.h" 00156 #endif 00157 #include "UTMisc.h" 00158 #include "UTDebug.h" 00159 #include "UTStatus.h" 00160 00161 00162 #endif // _UT_H_ 00163 00164 // Windows redefines DispatchMessage to DispatchMessageW 00165 #undef DispatchMessage 00166 // Windows redefines SendMessage to SendMessageW 00167 #undef SendMessage 00168 // Windows redefines DrawText to DrawTextW 00169 #undef DrawText 00170 00171 #undef typeid 00172 #define typeid WINDOWS_typeid_IS_BROKEN_DO_NOT_USE