src/macros.h

changeset 130
885fd60e8bf1
parent 129
54f27fa8f32f
child 133
dbbdb870c835
equal deleted inserted replaced
129:54f27fa8f32f 130:885fd60e8bf1
37 #define APPNAME "botc" 37 #define APPNAME "botc"
38 #define VERSION_MAJOR 1 38 #define VERSION_MAJOR 1
39 #define VERSION_MINOR 0 39 #define VERSION_MINOR 0
40 #define VERSION_PATCH 0 40 #define VERSION_PATCH 0
41 41
42 #define MACRO_TO_STRING_HELPER(A) #A
43 #define MACRO_TO_STRING(A) MACRO_TO_STRING_HELPER(A)
44
42 #define MAKE_VERSION_NUMBER(MAJ, MIN, PAT) ((MAJ * 10000) + (MIN * 100) + PAT) 45 #define MAKE_VERSION_NUMBER(MAJ, MIN, PAT) ((MAJ * 10000) + (MIN * 100) + PAT)
43 #define VERSION_NUMBER MAKE_VERSION_NUMBER (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) 46 #define VERSION_NUMBER MAKE_VERSION_NUMBER (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
44 47
45 // On Windows, files are case-insensitive 48 // On Windows, files are case-insensitive
46 #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__) 49 #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
61 template<typename... argtypes> 64 template<typename... argtypes>
62 void error (const char* fmtstr, const argtypes&... args); 65 void error (const char* fmtstr, const argtypes&... args);
63 66
64 #ifdef DEBUG 67 #ifdef DEBUG
65 # define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) ((A OP B) ? (void) 0 : \ 68 # define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) ((A OP B) ? (void) 0 : \
66 error ("assertion failed at " __FILE__ ":%1: " #A " (%2) " COMPLAINT " " #B " (%3)", __LINE__, A, B)); 69 error ("assertion failed at " __FILE__ ":" MACRO_TO_STRING(__LINE__) ": " #A " (%1) " COMPLAINT " " #B " (%2)", A, B));
67 #else 70 #else
68 # define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) {} 71 # define BOTC_GENERIC_ASSERT(A,B,OP,COMPLAINT) {}
69 #endif 72 #endif
70 73
71 #define ASSERT_EQ(A,B) BOTC_GENERIC_ASSERT (A, B, ==, "does not equal") 74 #define ASSERT_EQ(A,B) BOTC_GENERIC_ASSERT (A, B, ==, "does not equal")

mercurial