1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the qmake application of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef QMAKEEVALUATOR_P_H
30 #define QMAKEEVALUATOR_P_H
31 
32 #include "proitems.h"
33 
34 #define debugMsg if (!m_debugLevel) {} else debugMsgInternal
35 #define traceMsg if (!m_debugLevel) {} else traceMsgInternal
36 #ifdef PROEVALUATOR_DEBUG
37 #  define dbgBool(b) (b ? "true" : "false")
38 #  define dbgReturn(r) \
39     (r == ReturnError ? "error" : \
40      r == ReturnBreak ? "break" : \
41      r == ReturnNext ? "next" : \
42      r == ReturnReturn ? "return" : \
43      "<invalid>")
44 #  define dbgKey(s) s.toString().toQStringRef().toLocal8Bit().constData()
45 #  define dbgStr(s) qPrintable(formatValue(s, true))
46 #  define dbgStrList(s) qPrintable(formatValueList(s))
47 #  define dbgSepStrList(s) qPrintable(formatValueList(s, true))
48 #  define dbgStrListList(s) qPrintable(formatValueListList(s))
49 #  define dbgQStr(s) dbgStr(ProString(s))
50 #else
51 #  define dbgBool(b) 0
52 #  define dbgReturn(r) 0
53 #  define dbgKey(s) 0
54 #  define dbgStr(s) 0
55 #  define dbgStrList(s) 0
56 #  define dbgSepStrList(s) 0
57 #  define dbgStrListList(s) 0
58 #  define dbgQStr(s) 0
59 #endif
60 
61 QT_BEGIN_NAMESPACE
62 
63 namespace QMakeInternal {
64 
65 struct QMakeBuiltinInit
66 {
67     const char *name;
68     int func;
69     enum { VarArgs = 1000 };
70     int min_args, max_args;
71     const char *args;
72 };
73 
74 struct QMakeBuiltin
75 {
76     QMakeBuiltin(const QMakeBuiltinInit &data);
77     QString usage;
78     int index, minArgs, maxArgs;
79 };
80 
81 struct QMakeStatics {
82     QString field_sep;
83     QString strtrue;
84     QString strfalse;
85     ProKey strCONFIG;
86     ProKey strARGS;
87     ProKey strARGC;
88     QString strDot;
89     QString strDotDot;
90     QString strever;
91     QString strforever;
92     QString strhost_build;
93     ProKey strTEMPLATE;
94     ProKey strQMAKE_PLATFORM;
95     ProKey strQMAKE_DIR_SEP;
96     ProKey strQMAKESPEC;
97 #ifdef PROEVALUATOR_FULL
98     ProKey strREQUIRES;
99 #endif
100     QHash<ProKey, QMakeBuiltin> expands;
101     QHash<ProKey, QMakeBuiltin> functions;
102     QHash<ProKey, ProKey> varMap;
103     ProStringList fakeValue;
104 };
105 
106 extern QMakeStatics statics;
107 
108 }
109 
110 Q_DECLARE_TYPEINFO(QMakeInternal::QMakeBuiltin, Q_MOVABLE_TYPE);
111 
112 QT_END_NAMESPACE
113 
114 #endif // QMAKEEVALUATOR_P_H
115