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 Qt Linguist 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 #include <qregexp.h>
35 
36 #define debugMsg if (!m_debugLevel) {} else debugMsgInternal
37 #define traceMsg if (!m_debugLevel) {} else traceMsgInternal
38 #ifdef PROEVALUATOR_DEBUG
39 #  define dbgBool(b) (b ? "true" : "false")
40 #  define dbgReturn(r) \
41     (r == ReturnError ? "error" : \
42      r == ReturnBreak ? "break" : \
43      r == ReturnNext ? "next" : \
44      r == ReturnReturn ? "return" : \
45      "<invalid>")
46 #  define dbgKey(s) s.toString().toQStringRef().toLocal8Bit().constData()
47 #  define dbgStr(s) qPrintable(formatValue(s, true))
48 #  define dbgStrList(s) qPrintable(formatValueList(s))
49 #  define dbgSepStrList(s) qPrintable(formatValueList(s, true))
50 #  define dbgStrListList(s) qPrintable(formatValueListList(s))
51 #  define dbgQStr(s) dbgStr(ProString(s))
52 #else
53 #  define dbgBool(b) 0
54 #  define dbgReturn(r) 0
55 #  define dbgKey(s) 0
56 #  define dbgStr(s) 0
57 #  define dbgStrList(s) 0
58 #  define dbgSepStrList(s) 0
59 #  define dbgStrListList(s) 0
60 #  define dbgQStr(s) 0
61 #endif
62 
63 QT_BEGIN_NAMESPACE
64 
65 namespace QMakeInternal {
66 
67 struct QMakeBuiltinInit
68 {
69     const char *name;
70     int func;
71     enum { VarArgs = 1000 };
72     int min_args, max_args;
73     const char *args;
74 };
75 
76 struct QMakeBuiltin
77 {
78     QMakeBuiltin(const QMakeBuiltinInit &data);
79     QString usage;
80     int index, minArgs, maxArgs;
81 };
82 
83 struct QMakeStatics {
84     QString field_sep;
85     QString strtrue;
86     QString strfalse;
87     ProKey strCONFIG;
88     ProKey strARGS;
89     ProKey strARGC;
90     QString strDot;
91     QString strDotDot;
92     QString strever;
93     QString strforever;
94     QString strhost_build;
95     ProKey strTEMPLATE;
96     ProKey strQMAKE_PLATFORM;
97     ProKey strQMAKE_DIR_SEP;
98     ProKey strQMAKESPEC;
99 #ifdef PROEVALUATOR_FULL
100     ProKey strREQUIRES;
101 #endif
102     QHash<ProKey, QMakeBuiltin> expands;
103     QHash<ProKey, QMakeBuiltin> functions;
104     QHash<ProKey, ProKey> varMap;
105     ProStringList fakeValue;
106 };
107 
108 extern QMakeStatics statics;
109 
110 }
111 
112 Q_DECLARE_TYPEINFO(QMakeInternal::QMakeBuiltin, Q_MOVABLE_TYPE);
113 
114 QT_END_NAMESPACE
115 
116 #endif // QMAKEEVALUATOR_P_H
117