25 #include <stdlib.h> |
25 #include <stdlib.h> |
26 #include <stdint.h> |
26 #include <stdint.h> |
27 #include <stdarg.h> |
27 #include <stdarg.h> |
28 #include <QString> |
28 #include <QString> |
29 #include <QTextFormat> |
29 #include <QTextFormat> |
30 |
30 #include "Macros.h" |
31 #include "Version.h" |
31 #include "Version.h" |
32 #include "PropertyMacro.h" |
|
33 #include "Configuration.h" |
32 #include "Configuration.h" |
34 |
|
35 // ============================================= |
|
36 #define alias auto& |
|
37 #define elif(A) else if (A) |
|
38 |
33 |
39 // Null pointer |
34 // Null pointer |
40 static const std::nullptr_t null = nullptr; |
35 static const std::nullptr_t null = nullptr; |
41 |
36 |
42 #ifdef WIN32 |
|
43 # define DIRSLASH "\\" |
|
44 # define DIRSLASH_CHAR '\\' |
|
45 #else // WIN32 |
|
46 # define DIRSLASH "/" |
|
47 # define DIRSLASH_CHAR '/' |
|
48 #endif // WIN32 |
|
49 |
|
50 #ifdef __GNUC__ |
|
51 #define FUNCNAME __PRETTY_FUNCTION__ |
|
52 #else |
|
53 #define FUNCNAME __func__ |
|
54 #endif // __GNUC__ |
|
55 |
|
56 #ifdef IN_IDE_PARSER |
|
57 void dlog(void, ...) {} |
|
58 #else |
|
59 # ifdef DEBUG |
|
60 # define dlog(...) log (QString (__PRETTY_FUNCTION__) + ": " __VA_ARGS__) |
|
61 # else |
|
62 # define dlog(...) |
|
63 # endif // DEBUG |
|
64 #endif // IN_IDE_PARSER |
|
65 |
|
66 #define dvalof(A) dlog ("value of '%1' = %2\n", #A, A) |
|
67 |
|
68 // Replace assert with a version that shows a GUI dialog if possible. |
|
69 // On Windows I just can't get the actual error messages otherwise. |
|
70 void assertionFailure (const char* file, int line, const char* funcname, const char* expr); |
37 void assertionFailure (const char* file, int line, const char* funcname, const char* expr); |
71 |
|
72 #undef assert |
|
73 |
|
74 #ifdef DEBUG |
|
75 # define assert(N) { ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)); } |
|
76 #else |
|
77 # define assert(N) {} |
|
78 #endif // DEBUG |
|
79 |
38 |
80 // Version string identifier. These are defined in Version.cc. |
39 // Version string identifier. These are defined in Version.cc. |
81 const char* versionString(); |
40 const char* versionString(); |
82 const char* fullVersionString(); |
41 const char* fullVersionString(); |
83 |
|
84 #define properties private |
|
85 #define typedefs public |
|
86 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z})) |
|
87 |
|
88 // ============================================================================= |
|
89 #ifdef IN_IDE_PARSER // KDevelop workarounds: |
|
90 # error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds) |
|
91 # define COMPILE_DATE "14-01-10 10:31:09" |
|
92 |
|
93 # ifndef va_start |
|
94 # define va_start(va, arg) |
|
95 # endif // va_start |
|
96 |
|
97 # ifndef va_end |
|
98 # define va_end(va) |
|
99 # endif // va_end |
|
100 |
|
101 static const char* __func__ = ""; // Current function name |
|
102 typedef void FILE; // :| |
|
103 #endif // IN_IDE_PARSER |
|