Wed, 05 Mar 2014 05:31:07 +0200
- forgot macros.h out of the previous commit
643
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Santeri Piippo |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #define PROPERTY(ACCESS, TYPE, READ, WRITE, WRITETYPE) \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | private: \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | TYPE m_##READ; \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | public: \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | inline TYPE const& READ() const \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | { \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | return m_##READ; \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | } \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | ACCESS: \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | void WRITE (TYPE const& a) PROPERTY_##WRITETYPE (READ) \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | #define PROPERTY_STOCK_WRITE(READ) \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | { \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | m_##READ = a; \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | } |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | #define PROPERTY_CUSTOM_WRITE(READ) \ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | ; |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | #define elif(A) else if (A) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | #ifdef WIN32 |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | # define DIRSLASH "\\" |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | # define DIRSLASH_CHAR '\\' |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | #else // WIN32 |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | # define DIRSLASH "/" |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | # define DIRSLASH_CHAR '/' |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | #endif // WIN32 |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | #ifdef __GNUC__ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | #define FUNCNAME __PRETTY_FUNCTION__ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | #else |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | #define FUNCNAME __func__ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | #endif // __GNUC__ |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | #ifdef IN_IDE_PARSER |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | void dlog(void, ...) {} |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | #else |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | # ifdef DEBUG |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | # define dlog(...) log (QString (__PRETTY_FUNCTION__) + ": " __VA_ARGS__) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | # else |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | # define dlog(...) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | # endif // DEBUG |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | #endif // IN_IDE_PARSER |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | #define dvalof(A) dlog ("value of '%1' = %2\n", #A, A) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | // Replace assert with a version that shows a GUI dialog if possible. |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | // On Windows I just can't get the actual error messages otherwise. |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | // |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | #undef assert |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | #ifdef DEBUG |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | # define assert(N) { ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)); } |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | #else |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | # define assert(N) {} |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | #endif // DEBUG |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z})) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | // ============================================================================= |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | #ifdef IN_IDE_PARSER // KDevelop workarounds: |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | # error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | # define COMPILE_DATE "14-01-10 10:31:09" |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | # ifndef va_start |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | # define va_start(va, arg) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | # endif // va_start |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | # ifndef va_end |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | # define va_end(va) |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | # endif // va_end |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | static const char* __func__ = ""; // Current function name |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | typedef void FILE; // :| |
a79277000830
- forgot macros.h out of the previous commit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | #endif // IN_IDE_PARSER |