Moved the preprocessor.

This commit is contained in:
Roberto Raggi
2008-12-08 12:24:40 +01:00
parent 520a5c9e65
commit f6fbb274ae
16 changed files with 15 additions and 21 deletions

View File

@@ -21,7 +21,16 @@ HEADERS += \
TypeOfExpression.h \
TypePrettyPrinter.h \
ResolveExpression.h \
LookupContext.h
LookupContext.h \
pp-cctype.h \
pp-engine.h \
pp-fwd.h \
pp-macro-expander.h \
pp-scanner.h \
pp-client.h \
pp-environment.h \
pp-internal.h \
pp-macro.h
SOURCES += \
SimpleLexer.cpp \
@@ -35,6 +44,9 @@ SOURCES += \
TypeOfExpression.cpp \
TypePrettyPrinter.cpp \
ResolveExpression.cpp \
LookupContext.cpp
LookupContext.cpp \
pp-engine.cpp \
pp-environment.cpp \
pp-macro-expander.cpp
RESOURCES += cplusplus.qrc

View File

@@ -0,0 +1,74 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_CCTYPE_H
#define PP_CCTYPE_H
#include <cctype>
namespace CPlusPlus {
inline bool pp_isalpha (int __ch)
{ return std::isalpha ((unsigned char) __ch) != 0; }
inline bool pp_isalnum (int __ch)
{ return std::isalnum ((unsigned char) __ch) != 0; }
inline bool pp_isdigit (int __ch)
{ return std::isdigit ((unsigned char) __ch) != 0; }
inline bool pp_isspace (int __ch)
{ return std::isspace ((unsigned char) __ch) != 0; }
} // namespace CPlusPlus
#endif // PP_CCTYPE_H

View File

@@ -0,0 +1,79 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef PP_CLIENT_H
#define PP_CLIENT_H
#include <QByteArray>
#include <QString>
#include <QFile>
namespace CPlusPlus {
class Macro;
class Client
{
Client(const Client &other);
void operator=(const Client &other);
public:
enum IncludeType {
IncludeLocal,
IncludeGlobal
};
public:
Client()
{ }
virtual ~Client()
{ }
virtual void macroAdded(const QByteArray &macroId, const QByteArray &text) = 0;
virtual void sourceNeeded(QString &fileName, IncludeType mode) = 0; // ### FIX the signature.
virtual void startExpandingMacro(unsigned offset,
const Macro &macro,
const QByteArray &originalTextt) = 0;
virtual void stopExpandingMacro(unsigned offset,
const Macro &macro) = 0;
virtual void startSkippingBlocks(unsigned offset) = 0;
virtual void stopSkippingBlocks(unsigned offset) = 0;
};
} // namespace CPlusPlus
#endif // PP_CLIENT_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,231 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_ENGINE_H
#define PP_ENGINE_H
#include "pp-client.h"
#include <Token.h>
#include <QVector>
namespace CPlusPlus {
class Token;
}
namespace CPlusPlus {
struct Value
{
enum Kind {
Kind_Long,
Kind_ULong,
};
Kind kind;
union {
long l;
unsigned long ul;
};
Value()
: kind(Kind_Long), l(0)
{ }
inline bool is_ulong () const
{ return kind == Kind_ULong; }
inline void set_ulong (unsigned long v)
{
ul = v;
kind = Kind_ULong;
}
inline void set_long (long v)
{
l = v;
kind = Kind_Long;
}
inline bool is_zero () const
{ return l == 0; }
#define PP_DEFINE_BIN_OP(name, op) \
inline Value operator op(const Value &other) const \
{ \
Value v = *this; \
if (v.is_ulong () || other.is_ulong ()) \
v.set_ulong (v.ul op other.ul); \
else \
v.set_long (v.l op other.l); \
return v; \
}
PP_DEFINE_BIN_OP(op_add, +)
PP_DEFINE_BIN_OP(op_sub, -)
PP_DEFINE_BIN_OP(op_mult, *)
PP_DEFINE_BIN_OP(op_div, /)
PP_DEFINE_BIN_OP(op_mod, %)
PP_DEFINE_BIN_OP(op_lhs, <<)
PP_DEFINE_BIN_OP(op_rhs, >>)
PP_DEFINE_BIN_OP(op_lt, <)
PP_DEFINE_BIN_OP(op_gt, >)
PP_DEFINE_BIN_OP(op_le, <=)
PP_DEFINE_BIN_OP(op_ge, >=)
PP_DEFINE_BIN_OP(op_eq, ==)
PP_DEFINE_BIN_OP(op_ne, !=)
PP_DEFINE_BIN_OP(op_bit_and, &)
PP_DEFINE_BIN_OP(op_bit_or, |)
PP_DEFINE_BIN_OP(op_bit_xor, ^)
PP_DEFINE_BIN_OP(op_and, &&)
PP_DEFINE_BIN_OP(op_or, ||)
#undef PP_DEFINE_BIN_OP
};
class pp
{
Client *client;
Environment &env;
MacroExpander expand;
enum { MAX_LEVEL = 512 };
bool _skipping[MAX_LEVEL]; // ### move in state
bool _true_test[MAX_LEVEL]; // ### move in state
int iflevel; // ### move in state
enum PP_DIRECTIVE_TYPE
{
PP_UNKNOWN_DIRECTIVE,
PP_DEFINE,
PP_INCLUDE,
PP_INCLUDE_NEXT,
PP_ELIF,
PP_ELSE,
PP_ENDIF,
PP_IF,
PP_IFDEF,
PP_IFNDEF,
PP_UNDEF
};
typedef const CPlusPlus::Token *TokenIterator;
struct State {
QByteArray source;
QVector<CPlusPlus::Token> tokens;
TokenIterator dot;
};
QList<State> _savedStates;
State state() const;
void pushState(const State &state);
void popState();
QByteArray _source;
QVector<CPlusPlus::Token> _tokens;
TokenIterator _dot;
State createStateFromSource(const QByteArray &source) const;
public:
pp(Client *client, Environment &env);
void operator()(const QByteArray &filename,
const QByteArray &source,
QByteArray *result);
void operator()(const QByteArray &source,
QByteArray *result);
private:
void resetIfLevel();
bool testIfLevel();
int skipping() const;
PP_DIRECTIVE_TYPE classifyDirective(const QByteArray &directive) const;
Value evalExpression(TokenIterator firstToken,
TokenIterator lastToken,
const QByteArray &source) const;
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
const char *startOfToken(const CPlusPlus::Token &token) const;
const char *endOfToken(const CPlusPlus::Token &token) const;
QByteArray tokenSpell(const CPlusPlus::Token &token) const;
QByteArray tokenText(const CPlusPlus::Token &token) const; // does a deep copy
void processDirective(TokenIterator dot, TokenIterator lastToken);
void processInclude(bool skipCurrentPath,
TokenIterator dot, TokenIterator lastToken,
bool acceptMacros = true);
void processDefine(TokenIterator dot, TokenIterator lastToken);
void processIf(TokenIterator dot, TokenIterator lastToken);
void processElse(TokenIterator dot, TokenIterator lastToken);
void processElif(TokenIterator dot, TokenIterator lastToken);
void processEndif(TokenIterator dot, TokenIterator lastToken);
void processIfdef(bool checkUndefined,
TokenIterator dot, TokenIterator lastToken);
void processUndef(TokenIterator dot, TokenIterator lastToken);
bool isQtReservedWord(const QByteArray &name) const;
};
} // namespace CPlusPlus
#endif // PP_ENGINE_H

View File

@@ -0,0 +1,231 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "pp-environment.h"
#include "pp.h"
#include <cstring>
using namespace CPlusPlus;
Environment::Environment ()
: currentLine(0),
hide_next(false),
_macros(0),
_allocated_macros(0),
_macro_count(-1),
_hash(0),
_hash_count(401)
{
}
Environment::~Environment ()
{
if (_macros) {
qDeleteAll(firstMacro(), lastMacro());
free(_macros);
}
if (_hash)
free(_hash);
}
unsigned Environment::macroCount () const
{ return _macro_count + 1; }
Macro *Environment::macroAt (unsigned index) const
{ return _macros[index]; }
Macro *Environment::bind(const Macro &__macro)
{
Q_ASSERT(! __macro.name.isEmpty());
Macro *m = new Macro (__macro);
m->hashcode = hash_code(m->name);
m->fileName = current_file;
m->line = currentLine;
if (++_macro_count == _allocated_macros) {
if (! _allocated_macros)
_allocated_macros = 401;
else
_allocated_macros <<= 1;
_macros = (Macro **) realloc(_macros, sizeof(Macro *) * _allocated_macros);
}
_macros[_macro_count] = m;
if (! _hash || _macro_count > (_hash_count >> 1)) {
rehash();
} else {
const unsigned h = m->hashcode % _hash_count;
m->next = _hash[h];
_hash[h] = m;
}
return m;
}
void Environment::remove (const QByteArray &name)
{
Macro macro;
macro.name = name;
macro.hidden = true;
bind(macro);
}
bool Environment::isBuiltinMacro(const QByteArray &s) const
{
if (s.length() != 8)
return false;
if (s[0] == '_') {
if (s[1] == '_') {
if (s[2] == 'D') {
if (s[3] == 'A') {
if (s[4] == 'T') {
if (s[5] == 'E') {
if (s[6] == '_') {
if (s[7] == '_') {
return true;
}
}
}
}
}
}
else if (s[2] == 'F') {
if (s[3] == 'I') {
if (s[4] == 'L') {
if (s[5] == 'E') {
if (s[6] == '_') {
if (s[7] == '_') {
return true;
}
}
}
}
}
}
else if (s[2] == 'L') {
if (s[3] == 'I') {
if (s[4] == 'N') {
if (s[5] == 'E') {
if (s[6] == '_') {
if (s[7] == '_') {
return true;
}
}
}
}
}
}
else if (s[2] == 'T') {
if (s[3] == 'I') {
if (s[4] == 'M') {
if (s[5] == 'E') {
if (s[6] == '_') {
if (s[7] == '_') {
return true;
}
}
}
}
}
}
}
}
return false;
}
Macro *Environment::resolve (const QByteArray &name) const
{
if (! _macros)
return 0;
Macro *it = _hash[hash_code (name) % _hash_count];
for (; it; it = it->next) {
if (it->name != name)
continue;
else if (it->hidden)
return 0;
else break;
}
return it;
}
unsigned Environment::hash_code (const QByteArray &s)
{
unsigned hash_value = 0;
for (int i = 0; i < s.size (); ++i)
hash_value = (hash_value << 5) - hash_value + s.at (i);
return hash_value;
}
void Environment::rehash()
{
if (_hash) {
free(_hash);
_hash_count <<= 1;
}
_hash = (Macro **) calloc(_hash_count, sizeof(Macro *));
for (Macro **it = firstMacro(); it != lastMacro(); ++it) {
Macro *m= *it;
const unsigned h = m->hashcode % _hash_count;
m->next = _hash[h];
_hash[h] = m;
}
}

View File

@@ -0,0 +1,109 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_ENVIRONMENT_H
#define PP_ENVIRONMENT_H
#include <QVector>
#include <QByteArray>
namespace CPlusPlus {
struct Macro;
class Environment
{
public:
Environment();
~Environment();
unsigned macroCount() const;
Macro *macroAt(unsigned index) const;
Macro *bind(const Macro &macro);
void remove(const QByteArray &name);
Macro *resolve(const QByteArray &name) const;
bool isBuiltinMacro(const QByteArray &name) const;
const Macro *const *firstMacro() const
{ return _macros; }
Macro **firstMacro()
{ return _macros; }
const Macro *const *lastMacro() const
{ return _macros + _macro_count + 1; }
Macro **lastMacro()
{ return _macros + _macro_count + 1; }
private:
static unsigned hash_code (const QByteArray &s);
void rehash();
public:
QByteArray current_file;
unsigned currentLine;
bool hide_next;
private:
Macro **_macros;
int _allocated_macros;
int _macro_count;
Macro **_hash;
int _hash_count;
};
} // namespace CPlusPlus
#endif // PP_ENVIRONMENT_H

View File

View File

@@ -0,0 +1,78 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_INTERNAL_H
#define PP_INTERNAL_H
#include <QByteArray>
namespace CPlusPlus {
namespace _PP_internal {
inline bool comment_p (const char *__first, const char *__last)
{
if (__first == __last)
return false;
if (*__first != '/')
return false;
if (++__first == __last)
return false;
return (*__first == '/' || *__first == '*');
}
} // _PP_internal
} // namespace CPlusPlus
#endif // PP_INTERNAL_H

View File

@@ -0,0 +1,361 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "pp.h"
#include "pp-macro-expander.h"
#include <QDateTime>
using namespace CPlusPlus;
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
: env(env), frame(frame),
lines(0), generated_lines(0)
{ }
const QByteArray *MacroExpander::resolve_formal(const QByteArray &__name)
{
if (! (frame && frame->expanding_macro))
return 0;
const QVector<QByteArray> &formals = frame->expanding_macro->formals;
for (int index = 0; index < formals.size(); ++index) {
const QByteArray formal = formals.at(index);
if (formal == __name && index < frame->actuals.size())
return &frame->actuals.at(index);
}
return 0;
}
const char *MacroExpander::operator () (const char *__first, const char *__last,
QByteArray *__result)
{
generated_lines = 0;
__first = skip_blanks (__first, __last);
lines = skip_blanks.lines;
while (__first != __last)
{
if (*__first == '\n')
{
__result->append("\n# ");
__result->append(QByteArray::number(env.currentLine));
__result->append(' ');
__result->append('"');
__result->append(env.current_file);
__result->append('"');
__result->append('\n');
++lines;
__first = skip_blanks (++__first, __last);
lines += skip_blanks.lines;
if (__first != __last && *__first == '#')
break;
}
else if (*__first == '#')
{
__first = skip_blanks (++__first, __last);
lines += skip_blanks.lines;
const char *end_id = skip_identifier (__first, __last);
const QByteArray fast_name(__first, end_id - __first);
__first = end_id;
if (const QByteArray *actual = resolve_formal (fast_name))
{
__result->append('\"');
const char *actual_begin = actual->constData ();
const char *actual_end = actual_begin + actual->size ();
for (const char *it = skip_whitespaces (actual_begin, actual_end);
it != actual_end; ++it)
{
if (*it == '"' || *it == '\\')
{
__result->append('\\');
__result->append(*it);
}
else if (*it == '\n')
{
__result->append('"');
__result->append('\n');
__result->append('"');
}
else
__result->append(*it);
}
__result->append('\"');
}
else
__result->append('#'); // ### warning message?
}
else if (*__first == '\"')
{
const char *next_pos = skip_string_literal (__first, __last);
lines += skip_string_literal.lines;
__result->append(__first, next_pos - __first);
__first = next_pos;
}
else if (*__first == '\'')
{
const char *next_pos = skip_char_literal (__first, __last);
lines += skip_char_literal.lines;
__result->append(__first, next_pos - __first);
__first = next_pos;
}
else if (_PP_internal::comment_p (__first, __last))
{
__first = skip_comment_or_divop (__first, __last);
int n = skip_comment_or_divop.lines;
lines += n;
while (n-- > 0)
__result->append('\n');
}
else if (pp_isspace (*__first))
{
for (; __first != __last; ++__first)
{
if (*__first == '\n' || !pp_isspace (*__first))
break;
}
__result->append(' ');
}
else if (pp_isdigit (*__first))
{
const char *next_pos = skip_number (__first, __last);
lines += skip_number.lines;
__result->append(__first, next_pos - __first);
__first = next_pos;
}
else if (pp_isalpha (*__first) || *__first == '_')
{
const char *name_begin = __first;
const char *name_end = skip_identifier (__first, __last);
__first = name_end; // advance
// search for the paste token
const char *next = skip_blanks (__first, __last);
bool paste = false;
if (next != __last && *next == '#')
{
paste = true;
++next;
if (next != __last && *next == '#')
__first = skip_blanks(++next, __last);
}
const QByteArray fast_name(name_begin, name_end - name_begin);
if (const QByteArray *actual = resolve_formal (fast_name))
{
const char *begin = actual->constData ();
const char *end = begin + actual->size ();
if (paste) {
for (--end; end != begin - 1; --end) {
if (! pp_isspace(*end))
break;
}
++end;
}
__result->append(begin, end - begin);
continue;
}
Macro *macro = env.resolve (fast_name);
if (! macro || macro->hidden || env.hide_next)
{
if (fast_name.size () == 7 && fast_name [0] == 'd' && fast_name == "defined")
env.hide_next = true;
else
env.hide_next = false;
if (fast_name.size () == 8 && fast_name [0] == '_' && fast_name [1] == '_')
{
if (fast_name == "__LINE__")
{
char buf [16];
const size_t count = qsnprintf (buf, 16, "%d", env.currentLine + lines);
__result->append(buf, count);
continue;
}
else if (fast_name == "__FILE__")
{
__result->append('"');
__result->append(env.current_file);
__result->append('"');
continue;
}
else if (fast_name == "__DATE__")
{
__result->append('"');
__result->append(QDate::currentDate().toString().toUtf8());
__result->append('"');
continue;
}
else if (fast_name == "__TIME__")
{
__result->append('"');
__result->append(QTime::currentTime().toString().toUtf8());
__result->append('"');
continue;
}
}
__result->append(name_begin, name_end - name_begin);
continue;
}
if (! macro->function_like)
{
Macro *m = 0;
if (! macro->definition.isEmpty())
{
macro->hidden = true;
QByteArray __tmp;
__tmp.reserve (256);
MacroExpander expand_macro (env);
expand_macro (macro->definition.constBegin (), macro->definition.constEnd (), &__tmp);
generated_lines += expand_macro.lines;
if (! __tmp.isEmpty ())
{
const char *__tmp_begin = __tmp.constBegin();
const char *__tmp_end = __tmp.constEnd();
const char *__begin_id = skip_whitespaces (__tmp_begin, __tmp_end);
const char *__end_id = skip_identifier (__begin_id, __tmp_end);
if (__end_id == __tmp_end)
{
const QByteArray __id (__begin_id, __end_id - __begin_id);
m = env.resolve (__id);
}
if (! m)
*__result += __tmp;
}
macro->hidden = false;
}
if (! m)
continue;
macro = m;
}
// function like macro
const char *arg_it = skip_whitespaces (__first, __last);
if (arg_it == __last || *arg_it != '(')
{
__result->append(name_begin, name_end - name_begin);
lines += skip_whitespaces.lines;
__first = arg_it;
continue;
}
QVector<QByteArray> actuals;
actuals.reserve (5);
++arg_it; // skip '('
MacroExpander expand_actual (env, frame);
const char *arg_end = skip_argument_variadics (actuals, macro, arg_it, __last);
if (arg_it != arg_end)
{
const QByteArray actual (arg_it, arg_end - arg_it);
QByteArray expanded;
expand_actual (actual.constBegin (), actual.constEnd (), &expanded);
actuals.push_back (expanded);
arg_it = arg_end;
}
while (arg_it != __last && *arg_end == ',')
{
++arg_it; // skip ','
arg_end = skip_argument_variadics (actuals, macro, arg_it, __last);
const QByteArray actual (arg_it, arg_end - arg_it);
QByteArray expanded;
expand_actual (actual.constBegin (), actual.constEnd (), &expanded);
actuals.push_back (expanded);
arg_it = arg_end;
}
if (! (arg_it != __last && *arg_it == ')'))
return __last;
++arg_it; // skip ')'
__first = arg_it;
pp_frame frame (macro, actuals);
MacroExpander expand_macro (env, &frame);
macro->hidden = true;
expand_macro (macro->definition.constBegin (), macro->definition.constEnd (), __result);
macro->hidden = false;
generated_lines += expand_macro.lines;
}
else
__result->append(*__first++);
}
return __first;
}
const char *MacroExpander::skip_argument_variadics (QVector<QByteArray> const &__actuals,
Macro *__macro,
const char *__first, const char *__last)
{
const char *arg_end = skip_argument (__first, __last);
while (__macro->variadics && __first != arg_end && arg_end != __last && *arg_end == ','
&& (__actuals.size () + 1) == __macro->formals.size ())
{
arg_end = skip_argument (++arg_end, __last);
}
return arg_end;
}

View File

@@ -0,0 +1,103 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_MACRO_EXPANDER_H
#define PP_MACRO_EXPANDER_H
namespace CPlusPlus {
struct pp_frame
{
Macro *expanding_macro;
const QVector<QByteArray> actuals;
pp_frame (Macro *expanding_macro, const QVector<QByteArray> &actuals)
: expanding_macro (expanding_macro),
actuals (actuals)
{ }
};
class MacroExpander
{
Environment &env;
pp_frame *frame;
pp_skip_number skip_number;
pp_skip_identifier skip_identifier;
pp_skip_string_literal skip_string_literal;
pp_skip_char_literal skip_char_literal;
pp_skip_argument skip_argument;
pp_skip_comment_or_divop skip_comment_or_divop;
pp_skip_blanks skip_blanks;
pp_skip_whitespaces skip_whitespaces;
const QByteArray *resolve_formal (const QByteArray &name);
public:
MacroExpander (Environment &env, pp_frame *frame = 0);
const char *operator () (const char *first, const char *last,
QByteArray *result);
const char *skip_argument_variadics (const QVector<QByteArray> &actuals,
Macro *macro,
const char *first, const char *last);
public: // attributes
int lines;
int generated_lines;
};
} // namespace CPlusPlus
#endif // PP_MACRO_EXPANDER_H

View File

@@ -0,0 +1,95 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_MACRO_H
#define PP_MACRO_H
#include <QByteArray>
#include <QVector>
namespace CPlusPlus {
struct Macro
{
QByteArray name;
QByteArray definition;
QVector<QByteArray> formals;
QByteArray fileName;
int line;
int lines;
Macro *next;
unsigned hashcode;
union
{
unsigned state;
struct
{
unsigned hidden: 1;
unsigned function_like: 1;
unsigned variadics: 1;
};
};
inline Macro():
line(0),
lines(0),
next(0),
hashcode(0),
state(0)
{ }
};
} // namespace CPlusPlus
#endif // PP_MACRO_H

View File

@@ -0,0 +1,380 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_SCANNER_H
#define PP_SCANNER_H
namespace CPlusPlus {
struct pp_skip_blanks
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
lines = 0;
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
if (*__first == '\\')
{
const char *__begin = __first;
++__begin;
if (__begin != __last && *__begin == '\n')
++__first;
else
break;
}
else if (*__first == '\n' || !pp_isspace (*__first))
break;
}
return __first;
}
};
struct pp_skip_whitespaces
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
lines = 0;
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
if (! pp_isspace (*__first))
break;
}
return __first;
}
};
struct pp_skip_comment_or_divop
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
enum {
MAYBE_BEGIN,
BEGIN,
MAYBE_END,
END,
IN_COMMENT,
IN_CXX_COMMENT
} state (MAYBE_BEGIN);
lines = 0;
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
switch (state)
{
default:
assert (0);
break;
case MAYBE_BEGIN:
if (*__first != '/')
return __first;
state = BEGIN;
break;
case BEGIN:
if (*__first == '*')
state = IN_COMMENT;
else if (*__first == '/')
state = IN_CXX_COMMENT;
else
return __first;
break;
case IN_COMMENT:
if (*__first == '*')
state = MAYBE_END;
break;
case IN_CXX_COMMENT:
if (*__first == '\n')
return __first;
break;
case MAYBE_END:
if (*__first == '/')
state = END;
else if (*__first != '*')
state = IN_COMMENT;
break;
case END:
return __first;
}
}
return __first;
}
};
struct pp_skip_identifier
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
lines = 0;
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
if (! pp_isalnum (*__first) && *__first != '_')
break;
}
return __first;
}
};
struct pp_skip_number
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
lines = 0;
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
if (! pp_isalnum (*__first) && *__first != '.')
break;
}
return __first;
}
};
struct pp_skip_string_literal
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
enum {
BEGIN,
IN_STRING,
QUOTE,
END
} state (BEGIN);
lines = 0;
for (; __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
switch (state)
{
default:
assert (0);
break;
case BEGIN:
if (*__first != '\"')
return __first;
state = IN_STRING;
break;
case IN_STRING:
if (! (*__first != '\n'))
return __last;
if (*__first == '\"')
state = END;
else if (*__first == '\\')
state = QUOTE;
break;
case QUOTE:
state = IN_STRING;
break;
case END:
return __first;
}
}
return __first;
}
};
struct pp_skip_char_literal
{
int lines;
const char *operator () (const char *__first, const char *__last)
{
enum {
BEGIN,
IN_STRING,
QUOTE,
END
} state (BEGIN);
lines = 0;
for (; state != END && __first != __last; lines += (*__first != '\n' ? 0 : 1), ++__first)
{
switch (state)
{
default:
assert (0);
break;
case BEGIN:
if (*__first != '\'')
return __first;
state = IN_STRING;
break;
case IN_STRING:
if (! (*__first != '\n'))
return __last;
if (*__first == '\'')
state = END;
else if (*__first == '\\')
state = QUOTE;
break;
case QUOTE:
state = IN_STRING;
break;
}
}
return __first;
}
};
struct pp_skip_argument
{
pp_skip_identifier skip_number;
pp_skip_identifier skip_identifier;
pp_skip_string_literal skip_string_literal;
pp_skip_char_literal skip_char_literal;
pp_skip_comment_or_divop skip_comment_or_divop;
int lines;
const char *operator () (const char *__first, const char *__last)
{
int depth = 0;
lines = 0;
while (__first != __last)
{
if (!depth && (*__first == ')' || *__first == ','))
break;
else if (*__first == '(')
++depth, ++__first;
else if (*__first == ')')
--depth, ++__first;
else if (*__first == '\"')
{
__first = skip_string_literal (__first, __last);
lines += skip_string_literal.lines;
}
else if (*__first == '\'')
{
__first = skip_char_literal (__first, __last);
lines += skip_char_literal.lines;
}
else if (*__first == '/')
{
__first = skip_comment_or_divop (__first, __last);
lines += skip_comment_or_divop.lines;
}
else if (pp_isalpha (*__first) || *__first == '_')
{
__first = skip_identifier (__first, __last);
lines += skip_identifier.lines;
}
else if (pp_isdigit (*__first))
{
__first = skip_number (__first, __last);
lines += skip_number.lines;
}
else if (*__first == '\n')
{
++__first;
++lines;
}
else
++__first;
}
return __first;
}
};
} // namespace CPlusPlus
#endif // PP_SCANNER_H
// kate: space-indent on; indent-width 2; replace-tabs on;

69
src/libs/cplusplus/pp.h Normal file
View File

@@ -0,0 +1,69 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
/*
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PP_H
#define PP_H
#include <cassert>
#include <cstring>
#include <cctype>
#include "pp-cctype.h"
#include "pp-internal.h"
#include "pp-macro.h"
#include "pp-environment.h"
#include "pp-scanner.h"
#include "pp-macro-expander.h"
#include "pp-engine.h"
#include "pp-client.h"
#endif // PP_H