standard.h

Go to the documentation of this file.
00001 
00011 #pragma once
00012 
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 
00016 
00017 
00018 /*----------------- TRACE/MESSAGEBOX/DEBUGGING HELPERS -----------------------*/
00019 
00020 void Message(const char *format, ...); // vararg MessageBox helper
00021 char *fmtString(const char *format, ...); // vararg string formatting helper
00022 void printDebugString(const char *format, ...); // for printing to the debugger
00023 
00024 #ifdef _DEBUG
00025 #define MTRACE ::printDebugString
00026 #else
00027 #define MTRACE 1 ? (void)0 : ::printDebugString
00028 #endif // DEBUG
00029 
00030 // "pragma TODO" helper
00031 #define __LINE ( __LINE__ ) 
00032 #define __GETLINE(x) "(" #x ")" 
00033 #define GETLINE __GETLINE __LINE 
00034 #define TODO(y) message ( __FILE__ GETLINE " : " #y " " ) 
00035 
00036 /*---------------------- DISABLE USELESS WARNINGS ----------------------------*/
00037  
00038 #pragma warning ( disable:4786 ) // truncated identifiers
00039 #pragma warning ( disable:4097 ) // typedef-name '' used as synonym
00040 #pragma warning ( disable:4239 ) // ref conversion
00041 #pragma warning ( disable:4505 ) // unreferenced local function removed
00042 #pragma warning ( disable:4514 ) // unreferenced inline function removed
00043 
00044 
00045 
00046 /*--------------------------- MATH MACROS ------------------------------------*/
00047 
00049 #define CLAMP_MINMAX(_val,_min,_max) (_val>_max)?(_val=_max):((_val<_min)?(_val=_min):(_val))
00050 
00052 #ifndef ROUND
00053 #define ROUND(x) ((int)floor(x+0.5))
00054 #endif
00055 
00056 #define NOMINMAX
00057 
00058 #ifndef MAX
00059 #define MAX(a, b)  (((a) > (b)) ? (a) : (b)) 
00060 #define MIN(a, b)  (((a) < (b)) ? (a) : (b)) 
00061 #endif
00062 
00065 #ifndef RESCALE
00066 #define RESCALE(x, lowerOld, upperOld, lowerNew, upperNew) \
00067     ((double)lowerNew + ((double)upperNew - (double)lowerNew) * ((double)x - (double)lowerOld) / ((double)upperOld - (double)lowerOld))
00068 #endif
00069 
00070 #ifndef M_PI
00071 #define M_PI 3.14159265358979323846
00072 #endif
00073 
00074 #define LERP(t, a, b) ( a + (b - a) * t )
00075 
00076 /*--------------------------- STANDARD EXCEPTIONS ------------------------------------*/
00077 
00078 #include <stdexcept>
00079 
00081 std::exception        Error(const char *format, ...);
00082 
00084 std::invalid_argument ArgError(const char *format, ...);
00085 
00087 std::logic_error      LogicError(const char *format, ...);
00088 
00090 std::runtime_error    RuntimeError(const char *format, ...);
00091 
00093 std::exception        DiskError(const char *format, ...);
00095 std::exception        DiskError(FILE *f, const char *format, ...);
00096 
00097 /*--------------------------- INCLUDE PRAGMA ------------------------------------*/
00098 
00099 #pragma include_alias ("Matrix.h", "../common/Matrix.h")
00100 #pragma include_alias ("MatrixTypes.h", "../common/MatrixTypes.h")
00101 #pragma include_alias ("PortableFloatMap.h", "../common/PortableFloatMap.h")
00102 #pragma include_alias ("PortablePicture.h", "../common/PortablePicture.h")
00103 #pragma include_alias ("PortablePictureConverter.h", "../common/PortablePictureConverter.h")
00104 #pragma include_alias ("Shapes2d.h", "../common/Shapes2d.h")
00105 #pragma include_alias ("ProgressBar.h", "../common/ProgressBar.h")
00106 #pragma include_alias ("GLBitmapBuffer.h", "../common/GLBitmapBuffer.h")
00107 #pragma include_alias ("GLSelectionBuffer.h", "../common/GLSelectionBuffer.h")
00108 #pragma include_alias ("MemoryMap.h", "../common/MemoryMap.h")
00109 #pragma include_alias ("XmlNode.h", "../common/XmlNode.h")
00110 #pragma include_alias ("ListFixed.h", "../common/ListFixed.h")
00111 #pragma include_alias ("GLutils.h", "../common/GLutils.h")
00112 

Generated on Tue May 21 03:34:51 2002 for Archimedes by doxygen1.2.15