From 4c5ff047f0a1831d1247ca73d889b283d01fd3fb Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 11:52:27 +0100 Subject: [PATCH 01/21] Initial support for doxygen comments. --- src/libs/cplusplus/SimpleLexer.cpp | 5 + src/libs/cplusplus/SimpleLexer.h | 1 + src/plugins/cppeditor/cppdoxygen.cpp | 1512 ++++++++++++++++++++ src/plugins/cppeditor/cppdoxygen.h | 160 +++ src/plugins/cppeditor/cppeditor.pro | 8 +- src/plugins/cppeditor/cpphighlighter.cpp | 58 +- src/plugins/cppeditor/cpphighlighter.h | 4 + src/plugins/cpptools/cppcodecompletion.cpp | 2 +- src/plugins/cpptools/cpptools.pro | 38 +- src/shared/cplusplus/Lexer.cpp | 42 +- src/shared/cplusplus/Lexer.h | 5 +- src/shared/cplusplus/Token.cpp | 2 +- src/shared/cplusplus/Token.h | 4 + 13 files changed, 1804 insertions(+), 37 deletions(-) create mode 100644 src/plugins/cppeditor/cppdoxygen.cpp create mode 100644 src/plugins/cppeditor/cppdoxygen.h diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index 5efa1f02d8c..85ad6e645de 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -54,6 +54,11 @@ bool SimpleToken::isKeyword() const return _kind >= T_FIRST_KEYWORD && _kind < T_FIRST_QT_KEYWORD; } +bool SimpleToken::isComment() const +{ + return _kind == T_COMMENT || _kind == T_DOXY_COMMENT; +} + SimpleLexer::SimpleLexer() : _lastState(0), _skipComments(false), diff --git a/src/libs/cplusplus/SimpleLexer.h b/src/libs/cplusplus/SimpleLexer.h index ed48e9360bf..cbcb4e1f6bb 100644 --- a/src/libs/cplusplus/SimpleLexer.h +++ b/src/libs/cplusplus/SimpleLexer.h @@ -69,6 +69,7 @@ public: bool isLiteral() const; bool isOperator() const; bool isKeyword() const; + bool isComment() const; public: int _kind; diff --git a/src/plugins/cppeditor/cppdoxygen.cpp b/src/plugins/cppeditor/cppdoxygen.cpp new file mode 100644 index 00000000000..21ea204d832 --- /dev/null +++ b/src/plugins/cppeditor/cppdoxygen.cpp @@ -0,0 +1,1512 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include +#include "cppdoxygen.h" + +using namespace CppEditor::Internal; + +/* + +~ +@ +$ +\ +# +f[ +f] +f$ + +*/ +static inline int classify1(const QChar *s) { + if (s[0].unicode() == 'a') { + return T_DOXY_A; + } + else if (s[0].unicode() == 'b') { + return T_DOXY_B; + } + else if (s[0].unicode() == 'c') { + return T_DOXY_C; + } + else if (s[0].unicode() == 'e') { + return T_DOXY_E; + } + else if (s[0].unicode() == 'n') { + return T_DOXY_N; + } + else if (s[0].unicode() == 'p') { + return T_DOXY_P; + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify2(const QChar *s) { + if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'm') { + return T_DOXY_EM; + } + } + else if (s[0].unicode() == 'f') { + if (s[1].unicode() == 'n') { + return T_DOXY_FN; + } + } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'f') { + return T_DOXY_IF; + } + } + else if (s[0].unicode() == 'l') { + if (s[1].unicode() == 'i') { + return T_DOXY_LI; + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'a') { + return T_DOXY_SA; + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify3(const QChar *s) { + if (s[0].unicode() == 'a') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'g') { + return T_DOXY_ARG; + } + } + } + else if (s[0].unicode() == 'b') { + if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'g') { + return T_DOXY_BUG; + } + } + } + else if (s[0].unicode() == 'd') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'f') { + return T_DOXY_DEF; + } + } + else if (s[1].unicode() == 'o') { + if (s[2].unicode() == 't') { + return T_DOXY_DOT; + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + return T_DOXY_PAR; + } + } + else if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'e') { + return T_DOXY_PRE; + } + } + } + else if (s[0].unicode() == 'r') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'f') { + return T_DOXY_REF; + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'e') { + return T_DOXY_SEE; + } + } + } + else if (s[0].unicode() == 'v') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + return T_DOXY_VAR; + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify4(const QChar *s) { + if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + return T_DOXY_CODE; + } + } + else if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'd') { + return T_DOXY_COND; + } + } + } + } + else if (s[0].unicode() == 'd') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + return T_DOXY_DATE; + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'l') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 'e') { + return T_DOXY_ELSE; + } + } + } + else if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'u') { + if (s[3].unicode() == 'm') { + return T_DOXY_ENUM; + } + } + } + } + else if (s[0].unicode() == 'f') { + if (s[1].unicode() == 'i') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'e') { + return T_DOXY_FILE; + } + } + } + } + else if (s[0].unicode() == 'l') { + if (s[1].unicode() == 'i') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'e') { + return T_DOXY_LINE; + } + else if (s[3].unicode() == 'k') { + return T_DOXY_LINK; + } + } + } + } + else if (s[0].unicode() == 'n') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'e') { + return T_DOXY_NAME; + } + } + } + else if (s[1].unicode() == 'o') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + return T_DOXY_NOTE; + } + } + } + } + else if (s[0].unicode() == 'o') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'y') { + return T_DOXY_ONLY; + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'g') { + if (s[3].unicode() == 'e') { + return T_DOXY_PAGE; + } + } + } + else if (s[1].unicode() == 'o') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 't') { + return T_DOXY_POST; + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'k') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'p') { + return T_DOXY_SKIP; + } + } + } + } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 't') { + return T_DOXY_TEST; + } + } + } + else if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'o') { + return T_DOXY_TODO; + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify5(const QChar *s) { + if (s[0].unicode() == 'b') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'f') { + return T_DOXY_BRIEF; + } + } + } + } + } + else if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'l') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 's') { + if (s[4].unicode() == 's') { + return T_DOXY_CLASS; + } + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'i') { + if (s[4].unicode() == 'f') { + return T_DOXY_ENDIF; + } + } + } + } + } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'f') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 't') { + return T_DOXY_IFNOT; + } + } + } + } + else if (s[1].unicode() == 'm') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'g') { + if (s[4].unicode() == 'e') { + return T_DOXY_IMAGE; + } + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 'm') { + return T_DOXY_PARAM; + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'h') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 't') { + return T_DOXY_SHORT; + } + } + } + } + else if (s[1].unicode() == 'i') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'e') { + return T_DOXY_SINCE; + } + } + } + } + } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 'h') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'w') { + return T_DOXY_THROW; + } + } + } + } + } + else if (s[0].unicode() == 'u') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'n') { + return T_DOXY_UNION; + } + } + } + else if (s[2].unicode() == 't') { + if (s[3].unicode() == 'i') { + if (s[4].unicode() == 'l') { + return T_DOXY_UNTIL; + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify6(const QChar *s) { + if (s[0].unicode() == 'a') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 'h') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'r') { + return T_DOXY_ANCHOR; + } + } + } + } + } + else if (s[1].unicode() == 'u') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'h') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'r') { + return T_DOXY_AUTHOR; + } + } + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'l') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'f') { + return T_DOXY_ELSEIF; + } + } + } + } + } + else if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'd') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 't') { + return T_DOXY_ENDDOT; + } + } + } + } + } + } + else if (s[0].unicode() == 'r') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'n') { + return T_DOXY_RETURN; + } + } + } + else if (s[3].unicode() == 'v') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'l') { + return T_DOXY_RETVAL; + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 't') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'c') { + if (s[5].unicode() == 't') { + return T_DOXY_STRUCT; + } + } + } + } + } + } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 'h') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'w') { + if (s[5].unicode() == 's') { + return T_DOXY_THROWS; + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify7(const QChar *s) { + if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'p') { + if (s[3].unicode() == 'y') { + if (s[4].unicode() == 'd') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'c') { + return T_DOXY_COPYDOC; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'd') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'f') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'e') { + return T_DOXY_DOTFILE; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + return T_DOXY_ENDCODE; + } + } + else if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'd') { + return T_DOXY_ENDCOND; + } + } + } + } + else if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'k') { + return T_DOXY_ENDLINK; + } + } + } + } + } + } + else if (s[1].unicode() == 'x') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'm') { + if (s[4].unicode() == 'p') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'e') { + return T_DOXY_EXAMPLE; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'u') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + return T_DOXY_INCLUDE; + } + } + } + } + } + else if (s[2].unicode() == 'g') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'u') { + if (s[6].unicode() == 'p') { + return T_DOXY_INGROUP; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'm') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'y') { + return T_DOXY_MANONLY; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 'k') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'g') { + if (s[6].unicode() == 'e') { + return T_DOXY_PACKAGE; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'r') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 's') { + return T_DOXY_RELATES; + } + } + } + } + } + else if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'k') { + if (s[6].unicode() == 's') { + return T_DOXY_REMARKS; + } + } + } + } + } + else if (s[2].unicode() == 't') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 's') { + return T_DOXY_RETURNS; + } + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'n') { + return T_DOXY_SECTION; + } + } + } + } + } + } + } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 'y') { + if (s[2].unicode() == 'p') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'd') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 'f') { + return T_DOXY_TYPEDEF; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'v') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 's') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'n') { + return T_DOXY_VERSION; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'w') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'g') { + return T_DOXY_WARNING; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'x') { + if (s[1].unicode() == 'm') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'y') { + return T_DOXY_XMLONLY; + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify8(const QChar *s) { + if (s[0].unicode() == 'a') { + if (s[1].unicode() == 'd') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'i') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + if (s[7].unicode() == 'x') { + return T_DOXY_ADDINDEX; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'd') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'f') { + if (s[3].unicode() == 'g') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'u') { + if (s[7].unicode() == 'p') { + return T_DOXY_DEFGROUP; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'h') { + if (s[1].unicode() == 't') { + if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'y') { + return T_DOXY_HTMLONLY; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'l') { + return T_DOXY_INTERNAL; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'm') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 'p') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'g') { + if (s[7].unicode() == 'e') { + return T_DOXY_MAINPAGE; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'o') { + if (s[1].unicode() == 'v') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'd') { + return T_DOXY_OVERLOAD; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'k') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'i') { + if (s[6].unicode() == 'n') { + if (s[7].unicode() == 'e') { + return T_DOXY_SKIPLINE; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'v') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'b') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'm') { + return T_DOXY_VERBATIM; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'x') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'f') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'e') { + if (s[7].unicode() == 'm') { + return T_DOXY_XREFITEM; + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify9(const QChar *s) { + if (s[0].unicode() == 'a') { + if (s[1].unicode() == 't') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'n') { + return T_DOXY_ATTENTION; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'g') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'p') { + if (s[8].unicode() == 'h') { + return T_DOXY_CALLGRAPH; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'x') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'p') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'n') { + return T_DOXY_EXCEPTION; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'f') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'c') { + if (s[8].unicode() == 'e') { + return T_DOXY_INTERFACE; + } + } + } + } + } + } + } + else if (s[2].unicode() == 'v') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'i') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 't') { + return T_DOXY_INVARIANT; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'l') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'x') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'n') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'y') { + return T_DOXY_LATEXONLY; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'n') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 's') { + if (s[5].unicode() == 'p') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'c') { + if (s[8].unicode() == 'e') { + return T_DOXY_NAMESPACE; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 'g') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'p') { + if (s[8].unicode() == 'h') { + return T_DOXY_PARAGRAPH; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'w') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'k') { + if (s[4].unicode() == 'g') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'o') { + if (s[7].unicode() == 'u') { + if (s[8].unicode() == 'p') { + return T_DOXY_WEAKGROUP; + } + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify10(const QChar *s) { + if (s[0].unicode() == 'a') { + if (s[1].unicode() == 'd') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'g') { + if (s[6].unicode() == 'r') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'u') { + if (s[9].unicode() == 'p') { + return T_DOXY_ADDTOGROUP; + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'd') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'p') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'c') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 't') { + if (s[8].unicode() == 'e') { + if (s[9].unicode() == 'd') { + return T_DOXY_DEPRECATED; + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'm') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'o') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'l') { + if (s[9].unicode() == 'y') { + return T_DOXY_ENDMANONLY; + } + } + } + } + } + } + } + else if (s[3].unicode() == 'x') { + if (s[4].unicode() == 'm') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'o') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'l') { + if (s[9].unicode() == 'y') { + return T_DOXY_ENDXMLONLY; + } + } + } + } + } + } + } + } + } + else if (s[1].unicode() == 'x') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'p') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'n') { + if (s[9].unicode() == 's') { + return T_DOXY_EXCEPTIONS; + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'b') { + if (s[3].unicode() == 's') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'c') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'i') { + if (s[8].unicode() == 'o') { + if (s[9].unicode() == 'n') { + return T_DOXY_SUBSECTION; + } + } + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify11(const QChar *s) { + if (s[0].unicode() == 'd') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'c') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'u') { + if (s[9].unicode() == 'd') { + if (s[10].unicode() == 'e') { + return T_DOXY_DONTINCLUDE; + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'h') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'm') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'n') { + if (s[9].unicode() == 'l') { + if (s[10].unicode() == 'y') { + return T_DOXY_ENDHTMLONLY; + } + } + } + } + } + } + } + } + else if (s[3].unicode() == 'v') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'b') { + if (s[7].unicode() == 'a') { + if (s[8].unicode() == 't') { + if (s[9].unicode() == 'i') { + if (s[10].unicode() == 'm') { + return T_DOXY_ENDVERBATIM; + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'h') { + if (s[1].unicode() == 't') { + if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'c') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'u') { + if (s[9].unicode() == 'd') { + if (s[10].unicode() == 'e') { + return T_DOXY_HTMLINCLUDE; + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'r') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 's') { + if (s[7].unicode() == 'a') { + if (s[8].unicode() == 'l') { + if (s[9].unicode() == 's') { + if (s[10].unicode() == 'o') { + return T_DOXY_RELATESALSO; + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'v') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'b') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'c') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'u') { + if (s[9].unicode() == 'd') { + if (s[10].unicode() == 'e') { + return T_DOXY_VERBINCLUDE; + } + } + } + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify12(const QChar *s) { + if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'e') { + if (s[7].unicode() == 'x') { + if (s[8].unicode() == 'o') { + if (s[9].unicode() == 'n') { + if (s[10].unicode() == 'l') { + if (s[11].unicode() == 'y') { + return T_DOXY_ENDLATEXONLY; + } + } + } + } + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify13(const QChar *s) { + if (s[0].unicode() == 'n') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'b') { + if (s[5].unicode() == 'g') { + if (s[6].unicode() == 'r') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'u') { + if (s[9].unicode() == 'p') { + if (s[10].unicode() == 'i') { + if (s[11].unicode() == 'n') { + if (s[12].unicode() == 'g') { + return T_DOXY_NOSUBGROUPING; + } + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'b') { + if (s[3].unicode() == 's') { + if (s[4].unicode() == 'u') { + if (s[5].unicode() == 'b') { + if (s[6].unicode() == 's') { + if (s[7].unicode() == 'e') { + if (s[8].unicode() == 'c') { + if (s[9].unicode() == 't') { + if (s[10].unicode() == 'i') { + if (s[11].unicode() == 'o') { + if (s[12].unicode() == 'n') { + return T_DOXY_SUBSUBSECTION; + } + } + } + } + } + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +static inline int classify15(const QChar *s) { + if (s[0].unicode() == 'h') { + if (s[1].unicode() == 'i') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 't') { + if (s[8].unicode() == 'i') { + if (s[9].unicode() == 'a') { + if (s[10].unicode() == 'l') { + if (s[11].unicode() == 'i') { + if (s[12].unicode() == 'z') { + if (s[13].unicode() == 'e') { + if (s[14].unicode() == 'r') { + return T_DOXY_HIDEINITIALIZER; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'h') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 'w') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 't') { + if (s[8].unicode() == 'i') { + if (s[9].unicode() == 'a') { + if (s[10].unicode() == 'l') { + if (s[11].unicode() == 'i') { + if (s[12].unicode() == 'z') { + if (s[13].unicode() == 'e') { + if (s[14].unicode() == 'r') { + return T_DOXY_SHOWINITIALIZER; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return T_DOXY_IDENTIFIER; +} + +int CppEditor::Internal::classifyDoxygen(const QChar *s, int n) { + switch (n) { + case 1: return classify1(s); + case 2: return classify2(s); + case 3: return classify3(s); + case 4: return classify4(s); + case 5: return classify5(s); + case 6: return classify6(s); + case 7: return classify7(s); + case 8: return classify8(s); + case 9: return classify9(s); + case 10: return classify10(s); + case 11: return classify11(s); + case 12: return classify12(s); + case 13: return classify13(s); + case 15: return classify15(s); + default: return T_DOXY_IDENTIFIER; + } // switch +} + diff --git a/src/plugins/cppeditor/cppdoxygen.h b/src/plugins/cppeditor/cppdoxygen.h new file mode 100644 index 00000000000..61c8e9da0cc --- /dev/null +++ b/src/plugins/cppeditor/cppdoxygen.h @@ -0,0 +1,160 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ +namespace CppEditor { +namespace Internal { + +enum DoxygenReservedWord { + T_DOXY_IDENTIFIER = 0, + + T_DOXY_ARG, + T_DOXY_ATTENTION, + T_DOXY_AUTHOR, + T_DOXY_CALLGRAPH, + T_DOXY_CODE, + T_DOXY_DOT, + T_DOXY_ELSE, + T_DOXY_ENDCODE, + T_DOXY_ENDCOND, + T_DOXY_ENDDOT, + T_DOXY_ENDHTMLONLY, + T_DOXY_ENDIF, + T_DOXY_ENDLATEXONLY, + T_DOXY_ENDLINK, + T_DOXY_ENDMANONLY, + T_DOXY_ENDVERBATIM, + T_DOXY_ENDXMLONLY, + T_DOXY_HIDEINITIALIZER, + T_DOXY_HTMLONLY, + T_DOXY_INTERFACE, + T_DOXY_INTERNAL, + T_DOXY_INVARIANT, + T_DOXY_LATEXONLY, + T_DOXY_LI, + T_DOXY_MANONLY, + T_DOXY_N, + T_DOXY_NOSUBGROUPING, + T_DOXY_NOTE, + T_DOXY_ONLY, + T_DOXY_POST, + T_DOXY_PRE, + T_DOXY_REMARKS, + T_DOXY_RETURN, + T_DOXY_RETURNS, + T_DOXY_SA, + T_DOXY_SEE, + T_DOXY_SHOWINITIALIZER, + T_DOXY_SINCE, + T_DOXY_TEST, + T_DOXY_TODO, + T_DOXY_VERBATIM, + T_DOXY_WARNING, + T_DOXY_XMLONLY, + + T_DOXY_A, + T_DOXY_ADDTOGROUP, + T_DOXY_ANCHOR, + T_DOXY_B, + T_DOXY_C, + T_DOXY_CLASS, + T_DOXY_COND, + T_DOXY_COPYDOC, + T_DOXY_DEF, + T_DOXY_DONTINCLUDE, + T_DOXY_DOTFILE, + T_DOXY_E, + T_DOXY_ELSEIF, + T_DOXY_EM, + T_DOXY_ENUM, + T_DOXY_EXAMPLE, + T_DOXY_EXCEPTION, + T_DOXY_EXCEPTIONS, + T_DOXY_FILE, + T_DOXY_HTMLINCLUDE, + T_DOXY_IF, + T_DOXY_IFNOT, + T_DOXY_INCLUDE, + T_DOXY_LINK, + T_DOXY_NAMESPACE, + T_DOXY_P, + T_DOXY_PACKAGE, + T_DOXY_REF, + T_DOXY_RELATES, + T_DOXY_RELATESALSO, + T_DOXY_RETVAL, + T_DOXY_THROW, + T_DOXY_THROWS, + T_DOXY_VERBINCLUDE, + T_DOXY_VERSION, + T_DOXY_XREFITEM, + + T_DOXY_PARAM, + + T_DOXY_IMAGE, + + T_DOXY_DEFGROUP, + T_DOXY_PAGE, + T_DOXY_PARAGRAPH, + T_DOXY_SECTION, + T_DOXY_STRUCT, + T_DOXY_SUBSECTION, + T_DOXY_SUBSUBSECTION, + T_DOXY_UNION, + T_DOXY_WEAKGROUP, + + T_DOXY_ADDINDEX, + T_DOXY_BRIEF, + T_DOXY_BUG, + T_DOXY_DATE, + T_DOXY_DEPRECATED, + T_DOXY_FN, + T_DOXY_INGROUP, + T_DOXY_LINE, + T_DOXY_MAINPAGE, + T_DOXY_NAME, + T_DOXY_OVERLOAD, + T_DOXY_PAR, + T_DOXY_SHORT, + T_DOXY_SKIP, + T_DOXY_SKIPLINE, + T_DOXY_TYPEDEF, + T_DOXY_UNTIL, + T_DOXY_VAR, + +}; + +int classifyDoxygen(const QChar *s, int n); + + +} // namespace Internal +} // namespace CppEditor::Internal + diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro index 2d28c6c8b86..3d4abf71679 100644 --- a/src/plugins/cppeditor/cppeditor.pro +++ b/src/plugins/cppeditor/cppeditor.pro @@ -15,12 +15,16 @@ HEADERS += cppplugin.h \ cppeditorconstants.h \ cppeditorenums.h \ cppeditor_global.h \ - cppclasswizard.h + cppclasswizard.h \ + cppdoxygen.h + SOURCES += cppplugin.cpp \ cppeditoractionhandler.cpp \ cppeditor.cpp \ cpphighlighter.cpp \ cpphoverhandler.cpp \ cppfilewizard.cpp \ - cppclasswizard.cpp + cppclasswizard.cpp \ + cppdoxygen.cpp + RESOURCES += cppeditor.qrc diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 511cb56c8b3..447f442d2b3 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -32,6 +32,7 @@ ***************************************************************************/ #include "cpphighlighter.h" +#include "cppdoxygen.h" #include #include @@ -115,23 +116,35 @@ void CppHighlighter::highlightBlock(const QString &text) } bool highlightCurrentWordAsPreprocessor = highlightAsPreprocessor; + if (highlightAsPreprocessor) highlightAsPreprocessor = false; if (i == 0 && tk.is(T_POUND)) { setFormat(tk.position(), tk.length(), m_formats[CppPreprocessorFormat]); highlightAsPreprocessor = true; + } else if (highlightCurrentWordAsPreprocessor && (tk.isKeyword() || tk.is(T_IDENTIFIER)) && isPPKeyword(tk.text())) setFormat(tk.position(), tk.length(), m_formats[CppPreprocessorFormat]); + else if (tk.is(T_INT_LITERAL) || tk.is(T_FLOAT_LITERAL)) setFormat(tk.position(), tk.length(), m_formats[CppNumberFormat]); + else if (tk.is(T_STRING_LITERAL) || tk.is(T_CHAR_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)) setFormat(tk.position(), tk.length(), m_formats[CppStringFormat]); + else if (tk.is(T_WIDE_STRING_LITERAL) || tk.is(T_WIDE_CHAR_LITERAL)) setFormat(tk.position(), tk.length(), m_formats[CppStringFormat]); - else if (tk.is(T_COMMENT)) { - setFormat(tk.position(), tk.length(), m_formats[CppCommentFormat]); + + else if (tk.isComment()) { + + if (tk.is(T_COMMENT)) + setFormat(tk.position(), tk.length(), m_formats[CppCommentFormat]); + + else // a doxygen comment + highlightDoxygenComment(text, tk.position(), tk.length()); + // we need to insert a close comment parenthesis, if // - the line starts in a C Comment (initalState != 0) // - the first token of the line is a T_COMMENT (i == 0 && tk.is(T_COMMENT)) @@ -145,12 +158,16 @@ void CppHighlighter::highlightBlock(const QString &text) // clear the initial state. initialState = 0; } + } else if (tk.isKeyword() || isQtKeyword(tk.text())) setFormat(tk.position(), tk.length(), m_formats[CppKeywordFormat]); + else if (tk.isOperator()) setFormat(tk.position(), tk.length(), m_formats[CppOperatorFormat]); + else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON)) setFormat(tk.position(), tk.length(), m_formats[CppLabelFormat]); + else if (tk.is(T_IDENTIFIER)) highlightWord(tk.text(), tk.position(), tk.length()); } @@ -304,3 +321,40 @@ void CppHighlighter::highlightWord(QStringRef word, int position, int length) setFormat(position, length, m_formats[CppTypeFormat]); } } + +void CppHighlighter::highlightDoxygenComment(const QString &text, int position, + int length) +{ + int initial = position; + int i = position; + + const QChar *uc = text.unicode(); + const QChar *it = uc + position; + + QTextCharFormat format = m_formats[CppCommentFormat]; + QTextCharFormat kwFormat = format; + kwFormat.setFontWeight(QFont::Bold); + kwFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); + + while (! it->isNull()) { + if (it->unicode() == QLatin1Char('\\') || + it->unicode() == QLatin1Char('@')) { + ++it; + + const QChar *start = it; + while (it->isLetterOrNumber() || it->unicode() == '_') + ++it; + + int k = classifyDoxygen(start, it - start); + if (k != T_DOXY_IDENTIFIER) { + setFormat(initial, start - uc - initial, format); + setFormat(start - uc - 1, it - start + 1, kwFormat); + initial = it - uc; + } + } else + ++it; + } + + setFormat(initial, it - uc - initial, format); +} + diff --git a/src/plugins/cppeditor/cpphighlighter.h b/src/plugins/cppeditor/cpphighlighter.h index 3c74460e653..90ed58957f6 100644 --- a/src/plugins/cppeditor/cpphighlighter.h +++ b/src/plugins/cppeditor/cpphighlighter.h @@ -61,6 +61,10 @@ public: private: void highlightWord(QStringRef word, int position, int length); + + void highlightDoxygenComment(const QString &text, int position, + int length); + bool isPPKeyword(const QStringRef &text) const; bool isQtKeyword(const QStringRef &text) const; diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index ccdb01d6489..2a1e13ae3f1 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -404,7 +404,7 @@ static int startOfOperator(TextEditor::ITextEditable *editor, tc.setPosition(pos); static CPlusPlus::TokenUnderCursor tokenUnderCursor; const SimpleToken tk = tokenUnderCursor(tc); - if (tk.is(T_COMMENT) || tk.isLiteral()) { + if (tk.isComment() || tk.isLiteral()) { if (kind) *kind = T_EOF_SYMBOL; return pos; diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro index 04c79d471dd..f8259c9031c 100644 --- a/src/plugins/cpptools/cpptools.pro +++ b/src/plugins/cpptools/cpptools.pro @@ -8,27 +8,27 @@ include(cpptools_dependencies.pri) DEFINES += QT_NO_CAST_TO_ASCII INCLUDEPATH += . DEFINES += CPPTOOLS_LIBRARY -HEADERS += cpptools_global.h \ - cppquickopenfilter.h \ +HEADERS += completionsettingspage.h \ cppclassesfilter.h \ - searchsymbols.h \ - cppfunctionsfilter.h \ - completionsettingspage.h -SOURCES += cppquickopenfilter.cpp \ - cpptoolseditorsupport.cpp \ - cppclassesfilter.cpp \ - searchsymbols.cpp \ - cppfunctionsfilter.cpp \ - completionsettingspage.cpp - -# Input -SOURCES += cpptoolsplugin.cpp \ - cppmodelmanager.cpp \ - cppcodecompletion.cpp -HEADERS += cpptoolsplugin.h \ - cppmodelmanager.h \ cppcodecompletion.h \ + cppfunctionsfilter.h \ + cppmodelmanager.h \ cppmodelmanagerinterface.h \ + cppquickopenfilter.h \ + cpptools_global.h \ + cpptoolsconstants.h \ cpptoolseditorsupport.h \ - cpptoolsconstants.h + cpptoolsplugin.h \ + searchsymbols.h + +SOURCES += completionsettingspage.cpp \ + cppclassesfilter.cpp \ + cppcodecompletion.cpp \ + cppfunctionsfilter.cpp \ + cppmodelmanager.cpp \ + cppquickopenfilter.cpp \ + cpptoolseditorsupport.cpp \ + cpptoolsplugin.cpp \ + searchsymbols.cpp + FORMS += completionsettingspage.ui diff --git a/src/shared/cplusplus/Lexer.cpp b/src/shared/cplusplus/Lexer.cpp index 73c12524d79..4d0b2b6e800 100644 --- a/src/shared/cplusplus/Lexer.cpp +++ b/src/shared/cplusplus/Lexer.cpp @@ -60,7 +60,7 @@ CPLUSPLUS_BEGIN_NAMESPACE Lexer::Lexer(TranslationUnit *unit) : _translationUnit(unit), - _state(Lexer::DefaultState), + _state(State_Default), _flags(0), _currentLine(1) { @@ -71,7 +71,7 @@ Lexer::Lexer(TranslationUnit *unit) Lexer::Lexer(const char *firstChar, const char *lastChar) : _translationUnit(0), - _state(Lexer::DefaultState), + _state(State_Default), _flags(0), _currentLine(1) { @@ -196,7 +196,7 @@ void Lexer::scan_helper(Token *tok) _tokenStart = _currentChar; tok->offset = _currentChar - _firstChar; - if (_state == MultiLineCommentState) { + if (_state == State_MultiLineComment || _state == State_MultiLineDoxyComment) { if (! _yychar) { tok->kind = T_EOF_SYMBOL; return; @@ -209,7 +209,7 @@ void Lexer::scan_helper(Token *tok) yyinp(); if (_yychar == '/') { yyinp(); - _state = DefaultState; + _state = State_Default; break; } } @@ -218,7 +218,11 @@ void Lexer::scan_helper(Token *tok) if (! _scanCommentTokens) goto _Lagain; - tok->kind = T_COMMENT; + else if (_state == State_MultiLineComment) + tok->kind = T_COMMENT; + + else + tok->kind = T_DOXY_COMMENT; return; // done } @@ -402,14 +406,30 @@ void Lexer::scan_helper(Token *tok) case '/': if (_yychar == '/') { - do { + yyinp(); + + bool doxy = false; + + if (_yychar == '/' || _yychar == '!') { yyinp(); - } while (_yychar && _yychar != '\n'); + + if (_yychar != '\n' && std::isspace(_yychar)) + doxy = true; + } + + while (_yychar && _yychar != '\n') + yyinp(); + if (! _scanCommentTokens) goto _Lagain; - tok->kind = T_COMMENT; + + tok->kind = doxy ? T_DOXY_COMMENT : T_COMMENT; + } else if (_yychar == '*') { yyinp(); + + const bool doxy = _yychar == '*' || _yychar == '!'; + while (_yychar) { if (_yychar != '*') { yyinp(); @@ -423,11 +443,13 @@ void Lexer::scan_helper(Token *tok) if (_yychar) yyinp(); else - _state = MultiLineCommentState; + _state = doxy ? State_MultiLineDoxyComment : State_MultiLineComment; if (! _scanCommentTokens) goto _Lagain; - tok->kind = T_COMMENT; + + tok->kind = doxy ? T_DOXY_COMMENT : T_COMMENT; + } else if (_yychar == '=') { yyinp(); tok->kind = T_SLASH_EQUAL; diff --git a/src/shared/cplusplus/Lexer.h b/src/shared/cplusplus/Lexer.h index 4cb62493db8..fb9c80ef98b 100644 --- a/src/shared/cplusplus/Lexer.h +++ b/src/shared/cplusplus/Lexer.h @@ -66,8 +66,9 @@ class CPLUSPLUS_EXPORT Lexer public: enum State { - DefaultState, - MultiLineCommentState + State_Default, + State_MultiLineComment, + State_MultiLineDoxyComment }; Lexer(TranslationUnit *unit); diff --git a/src/shared/cplusplus/Token.cpp b/src/shared/cplusplus/Token.cpp index eb672958cd6..e47a1573d9b 100644 --- a/src/shared/cplusplus/Token.cpp +++ b/src/shared/cplusplus/Token.cpp @@ -58,7 +58,7 @@ CPLUSPLUS_BEGIN_NAMESPACE static const char *token_names[] = { (""), (""), - (""), + (""), (""), (""), (""), (""), (""), (""), (""), (""), diff --git a/src/shared/cplusplus/Token.h b/src/shared/cplusplus/Token.h index f48654aa773..55cacf7379a 100644 --- a/src/shared/cplusplus/Token.h +++ b/src/shared/cplusplus/Token.h @@ -64,6 +64,7 @@ enum Kind { T_ERROR, T_COMMENT, + T_DOXY_COMMENT, T_IDENTIFIER, T_FIRST_LITERAL, @@ -297,6 +298,9 @@ public: inline bool isKeyword() const { return kind >= T_FIRST_KEYWORD && kind < T_FIRST_QT_KEYWORD; } + inline bool isComment() const + { return kind == T_COMMENT || kind == T_DOXY_COMMENT; } + inline bool isObjCAtKeyword() const { return kind >= T_FIRST_OBJC_AT_KEYWORD && kind < T_LAST_OBJC_AT_KEYWORD; } From 5bf1f27e20ee72472066664a1a3765ad62416f12 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 11:53:32 +0100 Subject: [PATCH 02/21] kill some warnings --- src/plugins/cppeditor/cpphighlighter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 447f442d2b3..a02d3fe0900 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -322,11 +322,9 @@ void CppHighlighter::highlightWord(QStringRef word, int position, int length) } } -void CppHighlighter::highlightDoxygenComment(const QString &text, int position, - int length) +void CppHighlighter::highlightDoxygenComment(const QString &text, int position, int) { int initial = position; - int i = position; const QChar *uc = text.unicode(); const QChar *it = uc + position; From 8002b1a94c027fe3550a9158cd6d22f0822e12e4 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 12:08:34 +0100 Subject: [PATCH 03/21] Customizable doxy formats. --- src/plugins/cppeditor/cppeditor.cpp | 4 +++- src/plugins/cppeditor/cppeditorenums.h | 2 ++ src/plugins/cppeditor/cpphighlighter.cpp | 6 ++---- src/plugins/texteditor/texteditorconstants.h | 3 +++ src/plugins/texteditor/texteditorsettings.cpp | 2 ++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index b0eb63ffe35..a9f88d03cc4 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -740,7 +740,9 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) << QLatin1String(TextEditor::Constants::C_OPERATOR) << QLatin1String(TextEditor::Constants::C_PREPROCESSOR) << QLatin1String(TextEditor::Constants::C_LABEL) - << QLatin1String(TextEditor::Constants::C_COMMENT); + << QLatin1String(TextEditor::Constants::C_COMMENT) + << QLatin1String(TextEditor::Constants::C_DOXYGEN_COMMENT) + << QLatin1String(TextEditor::Constants::C_DOXYGEN_TAG); } const QVector formats = fs.toTextCharFormats(categories); diff --git a/src/plugins/cppeditor/cppeditorenums.h b/src/plugins/cppeditor/cppeditorenums.h index 9b4ce75c0d7..5bca558ebfa 100644 --- a/src/plugins/cppeditor/cppeditorenums.h +++ b/src/plugins/cppeditor/cppeditorenums.h @@ -51,6 +51,8 @@ enum CppFormats { CppPreprocessorFormat, CppLabelFormat, CppCommentFormat, + CppDoxygenCommentFormat, + CppDoxygenTagFormat, NumCppFormats }; diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index a02d3fe0900..657967a3ce0 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -329,10 +329,8 @@ void CppHighlighter::highlightDoxygenComment(const QString &text, int position, const QChar *uc = text.unicode(); const QChar *it = uc + position; - QTextCharFormat format = m_formats[CppCommentFormat]; - QTextCharFormat kwFormat = format; - kwFormat.setFontWeight(QFont::Bold); - kwFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); + const QTextCharFormat &format = m_formats[CppDoxygenCommentFormat]; + const QTextCharFormat &kwFormat = m_formats[CppDoxygenTagFormat]; while (! it->isNull()) { if (it->unicode() == QLatin1Char('\\') || diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index 7db120f144a..0dfbf8fb5e1 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -84,6 +84,9 @@ const char * const C_OPERATOR = "Operator"; const char * const C_PREPROCESSOR = "Preprocessor"; const char * const C_LABEL = "Label"; const char * const C_COMMENT = "Comment"; +const char * const C_DOXYGEN_COMMENT = "Doxygen.Comment"; +const char * const C_DOXYGEN_TAG = "Doxygen.Tag"; + const char * const C_DISABLED_CODE = "DisabledCode"; const char * const C_ADDED_LINE = "AddedLine"; diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index a8f6019597d..ff28af347c6 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -84,6 +84,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent) formatDescriptions.push_back(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen)); + formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_COMMENT), tr("Doxygen Comment"), Qt::darkBlue)); + formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_TAG), tr("Doxygen Tag"), Qt::blue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray)); // Diff categories From e76c300f3ef76832ab5ffc3942738f1f87cc082c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Feb 2009 13:32:37 +0100 Subject: [PATCH 04/21] create less likely to clash fifo names on windows --- src/plugins/debugger/outputcollector.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/outputcollector.cpp b/src/plugins/debugger/outputcollector.cpp index d97f28ff0d9..9425939faea 100644 --- a/src/plugins/debugger/outputcollector.cpp +++ b/src/plugins/debugger/outputcollector.cpp @@ -39,6 +39,8 @@ #include #include +#include + #else #include @@ -80,7 +82,9 @@ bool OutputCollector::listen() return m_server->isListening(); m_server = new QLocalServer(this); connect(m_server, SIGNAL(newConnection()), SLOT(newConnectionAvailable())); - return m_server->listen(QString::fromLatin1("creator-%1").arg(QCoreApplication::applicationPid())); // XXX how to make that secure? + return m_server->listen(QString::fromLatin1("creator-%1-%2") + .arg(QCoreApplication::applicationPid()) + .arg(rand())); #else if (!m_serverPath.isEmpty()) return true; From ece56b572eed738a975b928ec78d01dadbfc1d9c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 18 Feb 2009 17:33:03 +0100 Subject: [PATCH 05/21] connect right signal --- src/plugins/debugger/outputcollector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/outputcollector.cpp b/src/plugins/debugger/outputcollector.cpp index 9425939faea..cff41a50625 100644 --- a/src/plugins/debugger/outputcollector.cpp +++ b/src/plugins/debugger/outputcollector.cpp @@ -160,7 +160,7 @@ void OutputCollector::newConnectionAvailable() if (m_socket) return; m_socket = m_server->nextPendingConnection(); - connect(m_socket, SIGNAL(bytesAvailable()), SLOT(bytesAvailable())); + connect(m_socket, SIGNAL(readyRead()), SLOT(bytesAvailable())); } #endif From b358b106223c67034eff93a4522438621b7e173e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 30 Jan 2009 12:59:54 +0100 Subject: [PATCH 06/21] less confusing "starting debugger" messages --- src/plugins/debugger/gdbengine.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 83bbc6670bb..c26cf86d2bf 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1555,9 +1555,7 @@ bool GdbEngine::startDebugger() qDebug() << "ExeFile: " << q->m_executable; #endif - q->showStatusMessage(tr("Starting Debugger")); - emit gdbInputAvailable(QString(), q->settings()->m_gdbCmd + ' ' + gdbArgs.join(" ")); - + q->showStatusMessage(tr("Starting Debugger: ") + q->settings()->m_gdbCmd + ' ' + gdbArgs.join(" ")); m_gdbProc.start(q->settings()->m_gdbCmd, gdbArgs); m_gdbProc.waitForStarted(); From 5205d86aa26db832909c16cd066af2f43130cc92 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 Feb 2009 20:34:59 +0100 Subject: [PATCH 07/21] remove weird pointless initialization --- src/plugins/projectexplorer/applicationrunconfiguration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.cpp b/src/plugins/projectexplorer/applicationrunconfiguration.cpp index 0eeae6e8eef..4127348b018 100644 --- a/src/plugins/projectexplorer/applicationrunconfiguration.cpp +++ b/src/plugins/projectexplorer/applicationrunconfiguration.cpp @@ -111,7 +111,7 @@ QWidget *ApplicationRunConfigurationRunner::configurationWidget(QSharedPointer runConfiguration) - : RunControl(runConfiguration), m_applicationLauncher() + : RunControl(runConfiguration) { connect(&m_applicationLauncher, SIGNAL(applicationError(QString)), this, SLOT(slotError(QString))); From a976385b440d08ad9c894b2acae2cba8d224510e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 12:55:01 +0100 Subject: [PATCH 08/21] Code completion of doxygen tags. --- src/libs/cplusplus/TokenUnderCursor.cpp | 3 + src/plugins/cppeditor/cppeditor.pro | 6 +- src/plugins/cppeditor/cpphighlighter.cpp | 6 +- src/plugins/cpptools/cppcodecompletion.cpp | 72 ++++++--- .../{cppeditor => cpptools}/cppdoxygen.cpp | 145 ++++++++++++++++-- .../{cppeditor => cpptools}/cppdoxygen.h | 13 +- src/plugins/cpptools/cpptools.pro | 6 +- src/plugins/cpptools/cpptools_global.h | 4 +- 8 files changed, 204 insertions(+), 51 deletions(-) rename src/plugins/{cppeditor => cpptools}/cppdoxygen.cpp (95%) rename src/plugins/{cppeditor => cpptools}/cppdoxygen.h (94%) diff --git a/src/libs/cplusplus/TokenUnderCursor.cpp b/src/libs/cplusplus/TokenUnderCursor.cpp index d103a0307f7..0caf3240766 100644 --- a/src/libs/cplusplus/TokenUnderCursor.cpp +++ b/src/libs/cplusplus/TokenUnderCursor.cpp @@ -49,6 +49,9 @@ TokenUnderCursor::~TokenUnderCursor() SimpleToken TokenUnderCursor::operator()(const QTextCursor &cursor) const { SimpleLexer tokenize; + tokenize.setObjCEnabled(true); + tokenize.setSkipComments(false); + QTextBlock block = cursor.block(); int column = cursor.columnNumber(); diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro index 3d4abf71679..5660b26b1e9 100644 --- a/src/plugins/cppeditor/cppeditor.pro +++ b/src/plugins/cppeditor/cppeditor.pro @@ -15,8 +15,7 @@ HEADERS += cppplugin.h \ cppeditorconstants.h \ cppeditorenums.h \ cppeditor_global.h \ - cppclasswizard.h \ - cppdoxygen.h + cppclasswizard.h SOURCES += cppplugin.cpp \ cppeditoractionhandler.cpp \ @@ -24,7 +23,6 @@ SOURCES += cppplugin.cpp \ cpphighlighter.cpp \ cpphoverhandler.cpp \ cppfilewizard.cpp \ - cppclasswizard.cpp \ - cppdoxygen.cpp + cppclasswizard.cpp RESOURCES += cppeditor.qrc diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 657967a3ce0..8c4919c738d 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -32,7 +32,7 @@ ***************************************************************************/ #include "cpphighlighter.h" -#include "cppdoxygen.h" +#include #include #include @@ -341,8 +341,8 @@ void CppHighlighter::highlightDoxygenComment(const QString &text, int position, while (it->isLetterOrNumber() || it->unicode() == '_') ++it; - int k = classifyDoxygen(start, it - start); - if (k != T_DOXY_IDENTIFIER) { + int k = CppTools::classifyDoxygenTag(start, it - start); + if (k != CppTools::T_DOXY_IDENTIFIER) { setFormat(initial, start - uc - initial, format); setFormat(start - uc - 1, it - start + 1, kwFormat); initial = it - uc; diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 2a1e13ae3f1..65802dd61b9 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -32,8 +32,8 @@ ***************************************************************************/ #include "cppcodecompletion.h" - #include "cppmodelmanager.h" +#include "cppdoxygen.h" #include #include @@ -371,46 +371,54 @@ static int startOfOperator(TextEditor::ITextEditable *editor, const QChar ch3 = pos > 1 ? editor->characterAt(pos - 3) : QChar(); int start = pos; + int k = T_EOF_SYMBOL; if (ch2 != QLatin1Char('.') && ch == QLatin1Char('.')) { - if (kind) - *kind = T_DOT; + k = T_DOT; --start; } else if (wantFunctionCall && ch == QLatin1Char('(')) { - if (kind) - *kind = T_LPAREN; + k = T_LPAREN; --start; } else if (ch2 == QLatin1Char(':') && ch == QLatin1Char(':')) { - if (kind) - *kind = T_COLON_COLON; + k = T_COLON_COLON; start -= 2; } else if (ch2 == QLatin1Char('-') && ch == QLatin1Char('>')) { - if (kind) - *kind = T_ARROW; + k = T_ARROW; start -= 2; } else if (ch2 == QLatin1Char('.') && ch == QLatin1Char('*')) { - if (kind) - *kind = T_DOT_STAR; + k = T_DOT_STAR; start -= 2; } else if (ch3 == QLatin1Char('-') && ch2 == QLatin1Char('>') && ch == QLatin1Char('*')) { - if (kind) - *kind = T_ARROW_STAR; + k = T_ARROW_STAR; start -= 3; + } else if (ch == QLatin1Char('@') || ch == QLatin1Char('\\')) { + k = T_DOXY_COMMENT; + --start; } - if (start != pos) { - TextEditor::BaseTextEditor *edit = qobject_cast(editor->widget()); - QTextCursor tc(edit->textCursor()); - tc.setPosition(pos); - static CPlusPlus::TokenUnderCursor tokenUnderCursor; - const SimpleToken tk = tokenUnderCursor(tc); - if (tk.isComment() || tk.isLiteral()) { - if (kind) - *kind = T_EOF_SYMBOL; - return pos; - } + if (start == pos) + return start; + + TextEditor::BaseTextEditor *edit = qobject_cast(editor->widget()); + QTextCursor tc(edit->textCursor()); + tc.setPosition(pos); + + static CPlusPlus::TokenUnderCursor tokenUnderCursor; + const SimpleToken tk = tokenUnderCursor(tc); + + if (k == T_DOXY_COMMENT && tk.isNot(T_DOXY_COMMENT)) { + k = T_EOF_SYMBOL; + start = pos; } + else if (tk.is(T_COMMENT) || tk.isLiteral()) { + k = T_EOF_SYMBOL; + start = pos; + } + + if (kind) + *kind = k; + return start; } @@ -457,15 +465,31 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) ExpressionUnderCursor expressionUnderCursor; QString expression; + + if (m_completionOperator == T_DOXY_COMMENT) { + for (int i = 1; i < T_DOXY_LAST_TAG; ++i) { + TextEditor::CompletionItem item(this); + item.m_text.append(QString::fromLatin1(doxygenTagSpell(i))); + m_completions.append(item); + } + + return m_startPosition; + } + + if (m_completionOperator) { QTextCursor tc(edit->document()); tc.setPosition(endOfExpression); + expression = expressionUnderCursor(tc); + if (m_completionOperator == T_LPAREN) { if (expression.endsWith(QLatin1String("SIGNAL"))) m_completionOperator = T_SIGNAL; + else if (expression.endsWith(QLatin1String("SLOT"))) m_completionOperator = T_SLOT; + else if (editor->position() != endOfOperator) { // We don't want a function completion when the cursor isn't at the opening brace expression.clear(); diff --git a/src/plugins/cppeditor/cppdoxygen.cpp b/src/plugins/cpptools/cppdoxygen.cpp similarity index 95% rename from src/plugins/cppeditor/cppdoxygen.cpp rename to src/plugins/cpptools/cppdoxygen.cpp index 21ea204d832..5f003157145 100644 --- a/src/plugins/cppeditor/cppdoxygen.cpp +++ b/src/plugins/cpptools/cppdoxygen.cpp @@ -34,20 +34,138 @@ #include #include "cppdoxygen.h" -using namespace CppEditor::Internal; +using namespace CppTools; /* - -~ -@ -$ -\ -# -f[ -f] -f$ - + TODO: + ~ + @ + $ + \ + # + f[ + f] + f$ */ + +static const char *doxy_token_spell[] = { + "identifier", + + "arg", + "attention", + "author", + "callgraph", + "code", + "dot", + "else", + "endcode", + "endcond", + "enddot", + "endhtmlonly", + "endif", + "endlatexonly", + "endlink", + "endmanonly", + "endverbatim", + "endxmlonly", + "hideinitializer", + "htmlonly", + "interface", + "internal", + "invariant", + "latexonly", + "li", + "manonly", + "n", + "nosubgrouping", + "note", + "only", + "post", + "pre", + "remarks", + "return", + "returns", + "sa", + "see", + "showinitializer", + "since", + "test", + "todo", + "verbatim", + "warning", + "xmlonly", + + "a", + "addtogroup", + "anchor", + "b", + "c", + "class", + "cond", + "copydoc", + "def", + "dontinclude", + "dotfile", + "e", + "elseif", + "em", + "enum", + "example", + "exception", + "exceptions", + "file", + "htmlinclude", + "if", + "ifnot", + "include", + "link", + "namespace", + "p", + "package", + "ref", + "relates", + "relatesalso", + "retval", + "throw", + "throws", + "verbinclude", + "version", + "xrefitem", + + "param", + + "image", + + "defgroup", + "page", + "paragraph", + "section", + "struct", + "subsection", + "subsubsection", + "union", + "weakgroup", + + "addindex", + "brief", + "bug", + "date", + "deprecated", + "fn", + "ingroup", + "line", + "mainpage", + "name", + "overload", + "par", + "short", + "skip", + "skipline", + "typedef", + "until", + "var" +}; + static inline int classify1(const QChar *s) { if (s[0].unicode() == 'a') { return T_DOXY_A; @@ -1490,7 +1608,10 @@ static inline int classify15(const QChar *s) { return T_DOXY_IDENTIFIER; } -int CppEditor::Internal::classifyDoxygen(const QChar *s, int n) { +const char *CppTools::doxygenTagSpell(int index) +{ return doxy_token_spell[index]; } + +int CppTools::classifyDoxygenTag(const QChar *s, int n) { switch (n) { case 1: return classify1(s); case 2: return classify2(s); diff --git a/src/plugins/cppeditor/cppdoxygen.h b/src/plugins/cpptools/cppdoxygen.h similarity index 94% rename from src/plugins/cppeditor/cppdoxygen.h rename to src/plugins/cpptools/cppdoxygen.h index 61c8e9da0cc..9c70420f519 100644 --- a/src/plugins/cppeditor/cppdoxygen.h +++ b/src/plugins/cpptools/cppdoxygen.h @@ -30,8 +30,10 @@ ** version 1.3, included in the file GPL_EXCEPTION.txt in this package. ** ***************************************************************************/ -namespace CppEditor { -namespace Internal { + +#include "cpptools_global.h" + +namespace CppTools { enum DoxygenReservedWord { T_DOXY_IDENTIFIER = 0, @@ -150,11 +152,12 @@ enum DoxygenReservedWord { T_DOXY_UNTIL, T_DOXY_VAR, + T_DOXY_LAST_TAG + }; -int classifyDoxygen(const QChar *s, int n); +CPPTOOLS_EXPORT int classifyDoxygenTag(const QChar *s, int n); +CPPTOOLS_EXPORT const char *doxygenTagSpell(int index); - -} // namespace Internal } // namespace CppEditor::Internal diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro index f8259c9031c..21298bef073 100644 --- a/src/plugins/cpptools/cpptools.pro +++ b/src/plugins/cpptools/cpptools.pro @@ -19,7 +19,8 @@ HEADERS += completionsettingspage.h \ cpptoolsconstants.h \ cpptoolseditorsupport.h \ cpptoolsplugin.h \ - searchsymbols.h + searchsymbols.h \ + cppdoxygen.h SOURCES += completionsettingspage.cpp \ cppclassesfilter.cpp \ @@ -29,6 +30,7 @@ SOURCES += completionsettingspage.cpp \ cppquickopenfilter.cpp \ cpptoolseditorsupport.cpp \ cpptoolsplugin.cpp \ - searchsymbols.cpp + searchsymbols.cpp \ + cppdoxygen.cpp FORMS += completionsettingspage.ui diff --git a/src/plugins/cpptools/cpptools_global.h b/src/plugins/cpptools/cpptools_global.h index 1793c738769..0b71d7b0f7c 100644 --- a/src/plugins/cpptools/cpptools_global.h +++ b/src/plugins/cpptools/cpptools_global.h @@ -34,10 +34,12 @@ #ifndef CPPTOOLS_GLOBAL_H #define CPPTOOLS_GLOBAL_H +#include + #if defined(CPPTOOLS_LIBRARY) # define CPPTOOLS_EXPORT Q_DECL_EXPORT #else # define CPPTOOLS_EXPORT Q_DECL_IMPORT #endif - + #endif // CPPTOOLS_GLOBAL_H From 5f7ab722b0b2faeba6ae2e29fb6d9faeeef7309d Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 12:57:16 +0100 Subject: [PATCH 09/21] Use the std keyword icon for doxygen tags. --- src/plugins/cpptools/cppcodecompletion.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 65802dd61b9..6f0dc63305c 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -470,6 +470,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) for (int i = 1; i < T_DOXY_LAST_TAG; ++i) { TextEditor::CompletionItem item(this); item.m_text.append(QString::fromLatin1(doxygenTagSpell(i))); + item.m_icon = m_icons.keywordIcon(); m_completions.append(item); } From e67b2453c8996be3d1cdbdac5744d4028600f60c Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 13:52:24 +0100 Subject: [PATCH 10/21] Added support for some qdoc tags. --- src/plugins/cpptools/cppdoxygen.cpp | 173 ++++++++++++++++++++++++++-- src/plugins/cpptools/cppdoxygen.h | 16 +++ 2 files changed, 182 insertions(+), 7 deletions(-) diff --git a/src/plugins/cpptools/cppdoxygen.cpp b/src/plugins/cpptools/cppdoxygen.cpp index 5f003157145..c98441a2492 100644 --- a/src/plugins/cpptools/cppdoxygen.cpp +++ b/src/plugins/cpptools/cppdoxygen.cpp @@ -163,9 +163,28 @@ static const char *doxy_token_spell[] = { "skipline", "typedef", "until", - "var" + "var", + + // qdoc + "endlist", + "endtable", + "header", + "i", + "l", + "list", + "mainclass", + "newcode", + "o", + "oldcode", + "property", + "row", + "section1", + "table" }; +const char *CppTools::doxygenTagSpell(int index) +{ return doxy_token_spell[index]; } + static inline int classify1(const QChar *s) { if (s[0].unicode() == 'a') { return T_DOXY_A; @@ -179,9 +198,18 @@ static inline int classify1(const QChar *s) { else if (s[0].unicode() == 'e') { return T_DOXY_E; } + else if (s[0].unicode() == 'i') { + return T_DOXY_I; + } + else if (s[0].unicode() == 'l') { + return T_DOXY_L; + } else if (s[0].unicode() == 'n') { return T_DOXY_N; } + else if (s[0].unicode() == 'o') { + return T_DOXY_O; + } else if (s[0].unicode() == 'p') { return T_DOXY_P; } @@ -262,6 +290,11 @@ static inline int classify3(const QChar *s) { return T_DOXY_REF; } } + else if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'w') { + return T_DOXY_ROW; + } + } } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'e') { @@ -339,6 +372,11 @@ static inline int classify4(const QChar *s) { return T_DOXY_LINK; } } + else if (s[2].unicode() == 's') { + if (s[3].unicode() == 't') { + return T_DOXY_LIST; + } + } } } else if (s[0].unicode() == 'n') { @@ -496,7 +534,16 @@ static inline int classify5(const QChar *s) { } } else if (s[0].unicode() == 't') { - if (s[1].unicode() == 'h') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'b') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'e') { + return T_DOXY_TABLE; + } + } + } + } + else if (s[1].unicode() == 'h') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'w') { @@ -576,6 +623,19 @@ static inline int classify6(const QChar *s) { } } } + else if (s[0].unicode() == 'h') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'd') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'r') { + return T_DOXY_HEADER; + } + } + } + } + } + } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 't') { @@ -680,6 +740,11 @@ static inline int classify7(const QChar *s) { return T_DOXY_ENDLINK; } } + else if (s[5].unicode() == 's') { + if (s[6].unicode() == 't') { + return T_DOXY_ENDLIST; + } + } } } } @@ -739,6 +804,36 @@ static inline int classify7(const QChar *s) { } } } + else if (s[0].unicode() == 'n') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'w') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + return T_DOXY_NEWCODE; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'o') { + if (s[1].unicode() == 'l') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + return T_DOXY_OLDCODE; + } + } + } + } + } + } + } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'c') { @@ -904,6 +999,23 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'e') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'b') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'e') { + return T_DOXY_ENDTABLE; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'h') { if (s[1].unicode() == 't') { if (s[2].unicode() == 'm') { @@ -972,8 +1084,40 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'y') { + return T_DOXY_PROPERTY; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 's') { - if (s[1].unicode() == 'k') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'n') { + if (s[7].unicode() == '1') { + return T_DOXY_SECTION1; + } + } + } + } + } + } + } + else if (s[1].unicode() == 'k') { if (s[2].unicode() == 'i') { if (s[3].unicode() == 'p') { if (s[4].unicode() == 'l') { @@ -1137,6 +1281,25 @@ static inline int classify9(const QChar *s) { } } } + else if (s[0].unicode() == 'm') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 'c') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 's') { + if (s[8].unicode() == 's') { + return T_DOXY_MAINCLASS; + } + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'm') { @@ -1608,9 +1771,6 @@ static inline int classify15(const QChar *s) { return T_DOXY_IDENTIFIER; } -const char *CppTools::doxygenTagSpell(int index) -{ return doxy_token_spell[index]; } - int CppTools::classifyDoxygenTag(const QChar *s, int n) { switch (n) { case 1: return classify1(s); @@ -1630,4 +1790,3 @@ int CppTools::classifyDoxygenTag(const QChar *s, int n) { default: return T_DOXY_IDENTIFIER; } // switch } - diff --git a/src/plugins/cpptools/cppdoxygen.h b/src/plugins/cpptools/cppdoxygen.h index 9c70420f519..70eff7c3a85 100644 --- a/src/plugins/cpptools/cppdoxygen.h +++ b/src/plugins/cpptools/cppdoxygen.h @@ -152,6 +152,22 @@ enum DoxygenReservedWord { T_DOXY_UNTIL, T_DOXY_VAR, + // qdoc + T_DOXY_ENDLIST, + T_DOXY_ENDTABLE, + T_DOXY_HEADER, + T_DOXY_I, + T_DOXY_L, + T_DOXY_LIST, + T_DOXY_MAINCLASS, + T_DOXY_NEWCODE, + T_DOXY_O, + T_DOXY_OLDCODE, + T_DOXY_PROPERTY, + T_DOXY_ROW, + T_DOXY_SECTION1, + T_DOXY_TABLE, + T_DOXY_LAST_TAG }; From 954c5ee62325791a816c871b7177da1404f528dc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Feb 2009 13:33:11 +0100 Subject: [PATCH 11/21] more reliable startup breakpoint handling instead of picking "random" known entry point symbols, ask the debugger for the actual entry point. this also removes the "one instruction after the first one" hack, as it seems fairly pointless. NOTE: this does *not* work with the 2005 version of apple gdb. --- src/plugins/debugger/gdbengine.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index c26cf86d2bf..ff4d4eb0606 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -234,15 +234,6 @@ static bool isLeavableFunction(const QString &funcName, const QString &fileName) return false; } -static QString startSymbolName() -{ -#ifdef Q_OS_WIN - return "WinMainCRTStartup"; -#else - return "_start"; -#endif -} - /////////////////////////////////////////////////////////////////////// // @@ -1653,7 +1644,7 @@ bool GdbEngine::startDebugger() if (!q->m_processArgs.isEmpty()) sendCommand("-exec-arguments " + q->m_processArgs.join(" ")); sendCommand("set auto-solib-add off"); - sendCommand("x/2i " + startSymbolName(), GdbStart); + sendCommand("info target", GdbStart); } // set all to "pending" @@ -1676,14 +1667,14 @@ void GdbEngine::continueInferior() void GdbEngine::handleStart(const GdbResultRecord &response) { if (response.resultClass == GdbResultDone) { - // stdout:&"x/2i _start\n" - // stdout:~"0x404540 <_start>:\txor %ebp,%ebp\n" - // stdout:~"0x404542 <_start+2>:\tmov %rdx,%r9\n" + // [some leading stdout here] + // stdout:&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n" + // [some trailing stdout here] QString msg = response.data.findChild("consolestreamoutput").data(); - QRegExp needle("0x([0-9a-f]+) <" + startSymbolName() + "\\+.*>:"); + QRegExp needle("\\bEntry point: (0x[0-9a-f]+)\\b"); if (needle.indexIn(msg) != -1) { //debugMessage("STREAM: " + msg + " " + needle.cap(1)); - sendCommand("tbreak *0x" + needle.cap(1)); + sendCommand("tbreak *" + needle.cap(1)); m_waitingForFirstBreakpointToBeHit = true; qq->notifyInferiorRunningRequested(); sendCommand("-exec-run"); @@ -1691,7 +1682,7 @@ void GdbEngine::handleStart(const GdbResultRecord &response) debugMessage("PARSING START ADDRESS FAILED: " + msg); } } else if (response.resultClass == GdbResultError) { - debugMessage("PARSING START ADDRESS FAILED: " + response.toString()); + debugMessage("FETCHING START ADDRESS FAILED: " + response.toString()); } } From 2047426bf8ec51f2fd0576db6600110fa36c2eaa Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 14:03:00 +0100 Subject: [PATCH 12/21] Added .qdoc extension to the cppeditor's mime types. --- src/plugins/cppeditor/CppEditor.mimetypes.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/cppeditor/CppEditor.mimetypes.xml b/src/plugins/cppeditor/CppEditor.mimetypes.xml index 04046a28477..05e3da804c9 100644 --- a/src/plugins/cppeditor/CppEditor.mimetypes.xml +++ b/src/plugins/cppeditor/CppEditor.mimetypes.xml @@ -43,6 +43,7 @@ + From 48739839e4e260a7d3024e2de406c6656e75360a Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 20 Feb 2009 14:55:28 +0100 Subject: [PATCH 13/21] Improved qdoc support. --- src/plugins/cpptools/cppdoxygen.cpp | 1413 ++++++++++++++++++++++++++- src/plugins/cpptools/cppdoxygen.h | 349 ++++--- 2 files changed, 1602 insertions(+), 160 deletions(-) diff --git a/src/plugins/cpptools/cppdoxygen.cpp b/src/plugins/cpptools/cppdoxygen.cpp index c98441a2492..886889c7c7f 100644 --- a/src/plugins/cpptools/cppdoxygen.cpp +++ b/src/plugins/cpptools/cppdoxygen.cpp @@ -50,7 +50,6 @@ using namespace CppTools; static const char *doxy_token_spell[] = { "identifier", - "arg", "attention", "author", @@ -94,7 +93,6 @@ static const char *doxy_token_spell[] = { "verbatim", "warning", "xmlonly", - "a", "addtogroup", "anchor", @@ -131,11 +129,8 @@ static const char *doxy_token_spell[] = { "verbinclude", "version", "xrefitem", - "param", - "image", - "defgroup", "page", "paragraph", @@ -145,7 +140,6 @@ static const char *doxy_token_spell[] = { "subsubsection", "union", "weakgroup", - "addindex", "brief", "bug", @@ -164,22 +158,111 @@ static const char *doxy_token_spell[] = { "typedef", "until", "var", - - // qdoc + "abstract", + "badcode", + "basename", + "bold", + "caption", + "chapter", + "codeline", + "dots", + "endabstract", + "endchapter", + "endfootnote", + "endlegalese", "endlist", + "endomit", + "endpart", + "endquotation", + "endraw", + "endsection1", + "endsection2", + "endsection3", + "endsection4", + "endsidebar", "endtable", + "expire", + "footnote", + "generatelist", + "granularity", "header", "i", + "index", + "inlineimage", + "keyword", "l", + "legalese", "list", - "mainclass", + "meta", "newcode", "o", "oldcode", - "property", + "omit", + "omitvalue", + "part", + "printline", + "printto", + "printuntil", + "quotation", + "quotefile", + "quotefromfile", + "quotefunction", + "raw", "row", "section1", - "table" + "section2", + "section3", + "section4", + "sidebar", + "skipto", + "skipuntil", + "snippet", + "sub", + "sup", + "table", + "tableofcontents", + "target", + "tt", + "underline", + "unicode", + "value", + "contentspage", + "externalpage", + "group", + "headerfile", + "indexpage", + "inheaderfile", + "macro", + "module", + "nextpage", + "previouspage", + "property", + "reimp", + "service", + "startpage", + "variable", + "compat", + "inmodule", + "mainclass", + "nonreentrant", + "obsolete", + "preliminary", + "inpublicgroup", + "reentrant", + "subtitle", + "threadsafe", + "title", + "corelib", + "uitools", + "gui", + "network", + "opengl", + "qt3support", + "svg", + "sql", + "qtestlib", + "webkit", + "xml" }; const char *CppTools::doxygenTagSpell(int index) @@ -242,6 +325,11 @@ static inline int classify2(const QChar *s) { return T_DOXY_SA; } } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 't') { + return T_DOXY_TT; + } + } return T_DOXY_IDENTIFIER; } @@ -272,6 +360,13 @@ static inline int classify3(const QChar *s) { } } } + else if (s[0].unicode() == 'g') { + if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'i') { + return T_DOXY_GUI; + } + } + } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'r') { @@ -285,7 +380,12 @@ static inline int classify3(const QChar *s) { } } else if (s[0].unicode() == 'r') { - if (s[1].unicode() == 'e') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'w') { + return T_DOXY_RAW; + } + } + else if (s[1].unicode() == 'e') { if (s[2].unicode() == 'f') { return T_DOXY_REF; } @@ -302,6 +402,24 @@ static inline int classify3(const QChar *s) { return T_DOXY_SEE; } } + else if (s[1].unicode() == 'q') { + if (s[2].unicode() == 'l') { + return T_DOXY_SQL; + } + } + else if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'b') { + return T_DOXY_SUB; + } + else if (s[2].unicode() == 'p') { + return T_DOXY_SUP; + } + } + else if (s[1].unicode() == 'v') { + if (s[2].unicode() == 'g') { + return T_DOXY_SVG; + } + } } else if (s[0].unicode() == 'v') { if (s[1].unicode() == 'a') { @@ -310,11 +428,27 @@ static inline int classify3(const QChar *s) { } } } + else if (s[0].unicode() == 'x') { + if (s[1].unicode() == 'm') { + if (s[2].unicode() == 'l') { + return T_DOXY_XML; + } + } + } return T_DOXY_IDENTIFIER; } static inline int classify4(const QChar *s) { - if (s[0].unicode() == 'c') { + if (s[0].unicode() == 'b') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'd') { + return T_DOXY_BOLD; + } + } + } + } + else if (s[0].unicode() == 'c') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'e') { @@ -336,6 +470,13 @@ static inline int classify4(const QChar *s) { } } } + else if (s[1].unicode() == 'o') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 's') { + return T_DOXY_DOTS; + } + } + } } else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'l') { @@ -379,6 +520,15 @@ static inline int classify4(const QChar *s) { } } } + else if (s[0].unicode() == 'm') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'a') { + return T_DOXY_META; + } + } + } + } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'm') { @@ -396,7 +546,14 @@ static inline int classify4(const QChar *s) { } } else if (s[0].unicode() == 'o') { - if (s[1].unicode() == 'n') { + if (s[1].unicode() == 'm') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 't') { + return T_DOXY_OMIT; + } + } + } + else if (s[1].unicode() == 'n') { if (s[2].unicode() == 'l') { if (s[3].unicode() == 'y') { return T_DOXY_ONLY; @@ -411,6 +568,11 @@ static inline int classify4(const QChar *s) { return T_DOXY_PAGE; } } + else if (s[2].unicode() == 'r') { + if (s[3].unicode() == 't') { + return T_DOXY_PART; + } + } } else if (s[1].unicode() == 'o') { if (s[2].unicode() == 's') { @@ -482,6 +644,17 @@ static inline int classify5(const QChar *s) { } } } + else if (s[0].unicode() == 'g') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'p') { + return T_DOXY_GROUP; + } + } + } + } + } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'f') { if (s[2].unicode() == 'n') { @@ -501,6 +674,26 @@ static inline int classify5(const QChar *s) { } } } + else if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'x') { + return T_DOXY_INDEX; + } + } + } + } + } + else if (s[0].unicode() == 'm') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'c') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 'o') { + return T_DOXY_MACRO; + } + } + } + } } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { @@ -513,6 +706,17 @@ static inline int classify5(const QChar *s) { } } } + else if (s[0].unicode() == 'r') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'm') { + if (s[4].unicode() == 'p') { + return T_DOXY_REIMP; + } + } + } + } + } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'h') { if (s[2].unicode() == 'o') { @@ -552,6 +756,15 @@ static inline int classify5(const QChar *s) { } } } + else if (s[1].unicode() == 'i') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'e') { + return T_DOXY_TITLE; + } + } + } + } } else if (s[0].unicode() == 'u') { if (s[1].unicode() == 'n') { @@ -571,6 +784,17 @@ static inline int classify5(const QChar *s) { } } } + else if (s[0].unicode() == 'v') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'e') { + return T_DOXY_VALUE; + } + } + } + } + } return T_DOXY_IDENTIFIER; } @@ -599,6 +823,19 @@ static inline int classify6(const QChar *s) { } } } + else if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 't') { + return T_DOXY_COMPAT; + } + } + } + } + } + } else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'l') { if (s[2].unicode() == 's') { @@ -620,6 +857,24 @@ static inline int classify6(const QChar *s) { } } } + else if (s[3].unicode() == 'r') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'w') { + return T_DOXY_ENDRAW; + } + } + } + } + } + else if (s[1].unicode() == 'x') { + if (s[2].unicode() == 'p') { + if (s[3].unicode() == 'i') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'e') { + return T_DOXY_EXPIRE; + } + } + } } } } @@ -636,6 +891,32 @@ static inline int classify6(const QChar *s) { } } } + else if (s[0].unicode() == 'm') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'e') { + return T_DOXY_MODULE; + } + } + } + } + } + } + else if (s[0].unicode() == 'o') { + if (s[1].unicode() == 'p') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 'g') { + if (s[5].unicode() == 'l') { + return T_DOXY_OPENGL; + } + } + } + } + } + } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 't') { @@ -657,7 +938,18 @@ static inline int classify6(const QChar *s) { } } else if (s[0].unicode() == 's') { - if (s[1].unicode() == 't') { + if (s[1].unicode() == 'k') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'o') { + return T_DOXY_SKIPTO; + } + } + } + } + } + else if (s[1].unicode() == 't') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'u') { if (s[4].unicode() == 'c') { @@ -670,7 +962,18 @@ static inline int classify6(const QChar *s) { } } else if (s[0].unicode() == 't') { - if (s[1].unicode() == 'h') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'g') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 't') { + return T_DOXY_TARGET; + } + } + } + } + } + else if (s[1].unicode() == 'h') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'o') { if (s[4].unicode() == 'w') { @@ -682,12 +985,66 @@ static inline int classify6(const QChar *s) { } } } + else if (s[0].unicode() == 'w') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'b') { + if (s[3].unicode() == 'k') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 't') { + return T_DOXY_WEBKIT; + } + } + } + } + } + } return T_DOXY_IDENTIFIER; } static inline int classify7(const QChar *s) { - if (s[0].unicode() == 'c') { - if (s[1].unicode() == 'o') { + if (s[0].unicode() == 'b') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + return T_DOXY_BADCODE; + } + } + } + } + } + } + } + else if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'p') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'n') { + return T_DOXY_CAPTION; + } + } + } + } + } + } + else if (s[1].unicode() == 'h') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 'r') { + return T_DOXY_CHAPTER; + } + } + } + } + } + } + else if (s[1].unicode() == 'o') { if (s[2].unicode() == 'p') { if (s[3].unicode() == 'y') { if (s[4].unicode() == 'd') { @@ -699,6 +1056,17 @@ static inline int classify7(const QChar *s) { } } } + else if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'i') { + if (s[6].unicode() == 'b') { + return T_DOXY_CORELIB; + } + } + } + } + } } } else if (s[0].unicode() == 'd') { @@ -747,6 +1115,24 @@ static inline int classify7(const QChar *s) { } } } + else if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'm') { + if (s[5].unicode() == 'i') { + if (s[6].unicode() == 't') { + return T_DOXY_ENDOMIT; + } + } + } + } + else if (s[3].unicode() == 'p') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 't') { + return T_DOXY_ENDPART; + } + } + } + } } } else if (s[1].unicode() == 'x') { @@ -789,6 +1175,21 @@ static inline int classify7(const QChar *s) { } } } + else if (s[0].unicode() == 'k') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'y') { + if (s[3].unicode() == 'w') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'd') { + return T_DOXY_KEYWORD; + } + } + } + } + } + } + } else if (s[0].unicode() == 'm') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'n') { @@ -806,7 +1207,18 @@ static inline int classify7(const QChar *s) { } else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'e') { - if (s[2].unicode() == 'w') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'w') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'k') { + return T_DOXY_NETWORK; + } + } + } + } + } + else if (s[2].unicode() == 'w') { if (s[3].unicode() == 'c') { if (s[4].unicode() == 'o') { if (s[5].unicode() == 'd') { @@ -848,6 +1260,19 @@ static inline int classify7(const QChar *s) { } } } + else if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'o') { + return T_DOXY_PRINTTO; + } + } + } + } + } + } } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { @@ -899,6 +1324,43 @@ static inline int classify7(const QChar *s) { } } } + else if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'v') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'c') { + if (s[6].unicode() == 'e') { + return T_DOXY_SERVICE; + } + } + } + } + } + } + else if (s[1].unicode() == 'i') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'b') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'r') { + return T_DOXY_SIDEBAR; + } + } + } + } + } + } + else if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 'p') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 't') { + return T_DOXY_SNIPPET; + } + } + } + } + } } } else if (s[0].unicode() == 't') { @@ -916,6 +1378,34 @@ static inline int classify7(const QChar *s) { } } } + else if (s[0].unicode() == 'u') { + if (s[1].unicode() == 'i') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 's') { + return T_DOXY_UITOOLS; + } + } + } + } + } + } + else if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + return T_DOXY_UNICODE; + } + } + } + } + } + } + } else if (s[0].unicode() == 'v') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'r') { @@ -966,7 +1456,22 @@ static inline int classify7(const QChar *s) { static inline int classify8(const QChar *s) { if (s[0].unicode() == 'a') { - if (s[1].unicode() == 'd') { + if (s[1].unicode() == 'b') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'c') { + if (s[7].unicode() == 't') { + return T_DOXY_ABSTRACT; + } + } + } + } + } + } + } + else if (s[1].unicode() == 'd') { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'i') { if (s[4].unicode() == 'n') { @@ -982,6 +1487,40 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'b') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'm') { + if (s[7].unicode() == 'e') { + return T_DOXY_BASENAME; + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'i') { + if (s[6].unicode() == 'n') { + if (s[7].unicode() == 'e') { + return T_DOXY_CODELINE; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'd') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'f') { @@ -1016,6 +1555,23 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'f') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'e') { + return T_DOXY_FOOTNOTE; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'h') { if (s[1].unicode() == 't') { if (s[2].unicode() == 'm') { @@ -1035,7 +1591,20 @@ static inline int classify8(const QChar *s) { } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { - if (s[2].unicode() == 't') { + if (s[2].unicode() == 'm') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'd') { + if (s[5].unicode() == 'u') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'e') { + return T_DOXY_INMODULE; + } + } + } + } + } + } + else if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'n') { @@ -1050,6 +1619,23 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'l') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'g') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 's') { + if (s[7].unicode() == 'e') { + return T_DOXY_LEGALESE; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'm') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'i') { @@ -1067,8 +1653,40 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'n') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'x') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'p') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'g') { + if (s[7].unicode() == 'e') { + return T_DOXY_NEXTPAGE; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'o') { - if (s[1].unicode() == 'v') { + if (s[1].unicode() == 'b') { + if (s[2].unicode() == 's') { + if (s[3].unicode() == 'o') { + if (s[4].unicode() == 'l') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'e') { + return T_DOXY_OBSOLETE; + } + } + } + } + } + } + } + else if (s[1].unicode() == 'v') { if (s[2].unicode() == 'e') { if (s[3].unicode() == 'r') { if (s[4].unicode() == 'l') { @@ -1101,6 +1719,23 @@ static inline int classify8(const QChar *s) { } } } + else if (s[0].unicode() == 'q') { + if (s[1].unicode() == 't') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 's') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'b') { + return T_DOXY_QTESTLIB; + } + } + } + } + } + } + } + } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'c') { @@ -1111,6 +1746,15 @@ static inline int classify8(const QChar *s) { if (s[7].unicode() == '1') { return T_DOXY_SECTION1; } + else if (s[7].unicode() == '2') { + return T_DOXY_SECTION2; + } + else if (s[7].unicode() == '3') { + return T_DOXY_SECTION3; + } + else if (s[7].unicode() == '4') { + return T_DOXY_SECTION4; + } } } } @@ -1132,9 +1776,39 @@ static inline int classify8(const QChar *s) { } } } + else if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'b') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'e') { + return T_DOXY_SUBTITLE; + } + } + } + } + } + } + } } else if (s[0].unicode() == 'v') { - if (s[1].unicode() == 'e') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'i') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'b') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'e') { + return T_DOXY_VARIABLE; + } + } + } + } + } + } + } + else if (s[1].unicode() == 'e') { if (s[2].unicode() == 'r') { if (s[3].unicode() == 'b') { if (s[4].unicode() == 'a') { @@ -1230,7 +1904,22 @@ static inline int classify9(const QChar *s) { } else if (s[0].unicode() == 'i') { if (s[1].unicode() == 'n') { - if (s[2].unicode() == 't') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'x') { + if (s[5].unicode() == 'p') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'g') { + if (s[8].unicode() == 'e') { + return T_DOXY_INDEXPAGE; + } + } + } + } + } + } + } + else if (s[2].unicode() == 't') { if (s[3].unicode() == 'e') { if (s[4].unicode() == 'r') { if (s[5].unicode() == 'f') { @@ -1319,6 +2008,25 @@ static inline int classify9(const QChar *s) { } } } + else if (s[0].unicode() == 'o') { + if (s[1].unicode() == 'm') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'v') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'l') { + if (s[7].unicode() == 'u') { + if (s[8].unicode() == 'e') { + return T_DOXY_OMITVALUE; + } + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'p') { if (s[1].unicode() == 'a') { if (s[2].unicode() == 'r') { @@ -1337,6 +2045,127 @@ static inline int classify9(const QChar *s) { } } } + else if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'e') { + return T_DOXY_PRINTLINE; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'q') { + if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 't') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'n') { + return T_DOXY_QUOTATION; + } + } + } + } + } + else if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'f') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'e') { + return T_DOXY_QUOTEFILE; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'r') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 't') { + return T_DOXY_REENTRANT; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 's') { + if (s[1].unicode() == 'k') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'p') { + if (s[4].unicode() == 'u') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'i') { + if (s[8].unicode() == 'l') { + return T_DOXY_SKIPUNTIL; + } + } + } + } + } + } + } + } + else if (s[1].unicode() == 't') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'p') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'g') { + if (s[8].unicode() == 'e') { + return T_DOXY_STARTPAGE; + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'u') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'd') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'e') { + return T_DOXY_UNDERLINE; + } + } + } + } + } + } + } + } } else if (s[0].unicode() == 'w') { if (s[1].unicode() == 'e') { @@ -1406,7 +2235,22 @@ static inline int classify10(const QChar *s) { else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 'd') { - if (s[3].unicode() == 'm') { + if (s[3].unicode() == 'c') { + if (s[4].unicode() == 'h') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 'p') { + if (s[7].unicode() == 't') { + if (s[8].unicode() == 'e') { + if (s[9].unicode() == 'r') { + return T_DOXY_ENDCHAPTER; + } + } + } + } + } + } + } + else if (s[3].unicode() == 'm') { if (s[4].unicode() == 'a') { if (s[5].unicode() == 'n') { if (s[6].unicode() == 'o') { @@ -1421,6 +2265,21 @@ static inline int classify10(const QChar *s) { } } } + else if (s[3].unicode() == 's') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + if (s[7].unicode() == 'b') { + if (s[8].unicode() == 'a') { + if (s[9].unicode() == 'r') { + return T_DOXY_ENDSIDEBAR; + } + } + } + } + } + } + } else if (s[3].unicode() == 'x') { if (s[4].unicode() == 'm') { if (s[5].unicode() == 'l') { @@ -1458,6 +2317,69 @@ static inline int classify10(const QChar *s) { } } } + else if (s[0].unicode() == 'h') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'd') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'r') { + if (s[6].unicode() == 'f') { + if (s[7].unicode() == 'i') { + if (s[8].unicode() == 'l') { + if (s[9].unicode() == 'e') { + return T_DOXY_HEADERFILE; + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'i') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 't') { + if (s[5].unicode() == 'u') { + if (s[6].unicode() == 'n') { + if (s[7].unicode() == 't') { + if (s[8].unicode() == 'i') { + if (s[9].unicode() == 'l') { + return T_DOXY_PRINTUNTIL; + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'q') { + if (s[1].unicode() == 't') { + if (s[2].unicode() == '3') { + if (s[3].unicode() == 's') { + if (s[4].unicode() == 'u') { + if (s[5].unicode() == 'p') { + if (s[6].unicode() == 'p') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'r') { + if (s[9].unicode() == 't') { + return T_DOXY_QT3SUPPORT; + } + } + } + } + } + } + } + } + } + } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'u') { if (s[2].unicode() == 'b') { @@ -1479,6 +2401,27 @@ static inline int classify10(const QChar *s) { } } } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 'h') { + if (s[2].unicode() == 'r') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 's') { + if (s[7].unicode() == 'a') { + if (s[8].unicode() == 'f') { + if (s[9].unicode() == 'e') { + return T_DOXY_THREADSAFE; + } + } + } + } + } + } + } + } + } + } return T_DOXY_IDENTIFIER; } @@ -1509,7 +2452,41 @@ static inline int classify11(const QChar *s) { else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 'd') { - if (s[3].unicode() == 'h') { + if (s[3].unicode() == 'a') { + if (s[4].unicode() == 'b') { + if (s[5].unicode() == 's') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'r') { + if (s[8].unicode() == 'a') { + if (s[9].unicode() == 'c') { + if (s[10].unicode() == 't') { + return T_DOXY_ENDABSTRACT; + } + } + } + } + } + } + } + } + else if (s[3].unicode() == 'f') { + if (s[4].unicode() == 'o') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'o') { + if (s[9].unicode() == 't') { + if (s[10].unicode() == 'e') { + return T_DOXY_ENDFOOTNOTE; + } + } + } + } + } + } + } + } + else if (s[3].unicode() == 'h') { if (s[4].unicode() == 't') { if (s[5].unicode() == 'm') { if (s[6].unicode() == 'l') { @@ -1526,6 +2503,49 @@ static inline int classify11(const QChar *s) { } } } + else if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'g') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'e') { + if (s[9].unicode() == 's') { + if (s[10].unicode() == 'e') { + return T_DOXY_ENDLEGALESE; + } + } + } + } + } + } + } + } + else if (s[3].unicode() == 's') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'c') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'i') { + if (s[8].unicode() == 'o') { + if (s[9].unicode() == 'n') { + if (s[10].unicode() == '1') { + return T_DOXY_ENDSECTION1; + } + else if (s[10].unicode() == '2') { + return T_DOXY_ENDSECTION2; + } + else if (s[10].unicode() == '3') { + return T_DOXY_ENDSECTION3; + } + else if (s[10].unicode() == '4') { + return T_DOXY_ENDSECTION4; + } + } + } + } + } + } + } + } else if (s[3].unicode() == 'v') { if (s[4].unicode() == 'e') { if (s[5].unicode() == 'r') { @@ -1546,6 +2566,29 @@ static inline int classify11(const QChar *s) { } } } + else if (s[0].unicode() == 'g') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'a') { + if (s[3].unicode() == 'n') { + if (s[4].unicode() == 'u') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'r') { + if (s[8].unicode() == 'i') { + if (s[9].unicode() == 't') { + if (s[10].unicode() == 'y') { + return T_DOXY_GRANULARITY; + } + } + } + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'h') { if (s[1].unicode() == 't') { if (s[2].unicode() == 'm') { @@ -1569,6 +2612,52 @@ static inline int classify11(const QChar *s) { } } } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'l') { + if (s[3].unicode() == 'i') { + if (s[4].unicode() == 'n') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'm') { + if (s[8].unicode() == 'a') { + if (s[9].unicode() == 'g') { + if (s[10].unicode() == 'e') { + return T_DOXY_INLINEIMAGE; + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'm') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'a') { + if (s[9].unicode() == 'r') { + if (s[10].unicode() == 'y') { + return T_DOXY_PRELIMINARY; + } + } + } + } + } + } + } + } + } + } + } else if (s[0].unicode() == 'r') { if (s[1].unicode() == 'e') { if (s[2].unicode() == 'l') { @@ -1619,7 +2708,32 @@ static inline int classify11(const QChar *s) { } static inline int classify12(const QChar *s) { - if (s[0].unicode() == 'e') { + if (s[0].unicode() == 'c') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 's') { + if (s[8].unicode() == 'p') { + if (s[9].unicode() == 'a') { + if (s[10].unicode() == 'g') { + if (s[11].unicode() == 'e') { + return T_DOXY_CONTENTSPAGE; + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'e') { if (s[1].unicode() == 'n') { if (s[2].unicode() == 'd') { if (s[3].unicode() == 'l') { @@ -1641,6 +2755,148 @@ static inline int classify12(const QChar *s) { } } } + else if (s[3].unicode() == 'q') { + if (s[4].unicode() == 'u') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'a') { + if (s[8].unicode() == 't') { + if (s[9].unicode() == 'i') { + if (s[10].unicode() == 'o') { + if (s[11].unicode() == 'n') { + return T_DOXY_ENDQUOTATION; + } + } + } + } + } + } + } + } + } + } + } + else if (s[1].unicode() == 'x') { + if (s[2].unicode() == 't') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'n') { + if (s[6].unicode() == 'a') { + if (s[7].unicode() == 'l') { + if (s[8].unicode() == 'p') { + if (s[9].unicode() == 'a') { + if (s[10].unicode() == 'g') { + if (s[11].unicode() == 'e') { + return T_DOXY_EXTERNALPAGE; + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'g') { + if (s[1].unicode() == 'e') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'r') { + if (s[5].unicode() == 'a') { + if (s[6].unicode() == 't') { + if (s[7].unicode() == 'e') { + if (s[8].unicode() == 'l') { + if (s[9].unicode() == 'i') { + if (s[10].unicode() == 's') { + if (s[11].unicode() == 't') { + return T_DOXY_GENERATELIST; + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'h') { + if (s[3].unicode() == 'e') { + if (s[4].unicode() == 'a') { + if (s[5].unicode() == 'd') { + if (s[6].unicode() == 'e') { + if (s[7].unicode() == 'r') { + if (s[8].unicode() == 'f') { + if (s[9].unicode() == 'i') { + if (s[10].unicode() == 'l') { + if (s[11].unicode() == 'e') { + return T_DOXY_INHEADERFILE; + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'n') { + if (s[1].unicode() == 'o') { + if (s[2].unicode() == 'n') { + if (s[3].unicode() == 'r') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'e') { + if (s[6].unicode() == 'n') { + if (s[7].unicode() == 't') { + if (s[8].unicode() == 'r') { + if (s[9].unicode() == 'a') { + if (s[10].unicode() == 'n') { + if (s[11].unicode() == 't') { + return T_DOXY_NONREENTRANT; + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'p') { + if (s[1].unicode() == 'r') { + if (s[2].unicode() == 'e') { + if (s[3].unicode() == 'v') { + if (s[4].unicode() == 'i') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'u') { + if (s[7].unicode() == 's') { + if (s[8].unicode() == 'p') { + if (s[9].unicode() == 'a') { + if (s[10].unicode() == 'g') { + if (s[11].unicode() == 'e') { + return T_DOXY_PREVIOUSPAGE; + } + } + } + } + } + } + } + } + } } } } @@ -1648,7 +2904,34 @@ static inline int classify12(const QChar *s) { } static inline int classify13(const QChar *s) { - if (s[0].unicode() == 'n') { + if (s[0].unicode() == 'i') { + if (s[1].unicode() == 'n') { + if (s[2].unicode() == 'p') { + if (s[3].unicode() == 'u') { + if (s[4].unicode() == 'b') { + if (s[5].unicode() == 'l') { + if (s[6].unicode() == 'i') { + if (s[7].unicode() == 'c') { + if (s[8].unicode() == 'g') { + if (s[9].unicode() == 'r') { + if (s[10].unicode() == 'o') { + if (s[11].unicode() == 'u') { + if (s[12].unicode() == 'p') { + return T_DOXY_INPUBLICGROUP; + } + } + } + } + } + } + } + } + } + } + } + } + } + else if (s[0].unicode() == 'n') { if (s[1].unicode() == 'o') { if (s[2].unicode() == 's') { if (s[3].unicode() == 'u') { @@ -1675,6 +2958,48 @@ static inline int classify13(const QChar *s) { } } } + else if (s[0].unicode() == 'q') { + if (s[1].unicode() == 'u') { + if (s[2].unicode() == 'o') { + if (s[3].unicode() == 't') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'f') { + if (s[6].unicode() == 'r') { + if (s[7].unicode() == 'o') { + if (s[8].unicode() == 'm') { + if (s[9].unicode() == 'f') { + if (s[10].unicode() == 'i') { + if (s[11].unicode() == 'l') { + if (s[12].unicode() == 'e') { + return T_DOXY_QUOTEFROMFILE; + } + } + } + } + } + } + } + else if (s[6].unicode() == 'u') { + if (s[7].unicode() == 'n') { + if (s[8].unicode() == 'c') { + if (s[9].unicode() == 't') { + if (s[10].unicode() == 'i') { + if (s[11].unicode() == 'o') { + if (s[12].unicode() == 'n') { + return T_DOXY_QUOTEFUNCTION; + } + } + } + } + } + } + } + } + } + } + } + } + } else if (s[0].unicode() == 's') { if (s[1].unicode() == 'u') { if (s[2].unicode() == 'b') { @@ -1768,6 +3093,37 @@ static inline int classify15(const QChar *s) { } } } + else if (s[0].unicode() == 't') { + if (s[1].unicode() == 'a') { + if (s[2].unicode() == 'b') { + if (s[3].unicode() == 'l') { + if (s[4].unicode() == 'e') { + if (s[5].unicode() == 'o') { + if (s[6].unicode() == 'f') { + if (s[7].unicode() == 'c') { + if (s[8].unicode() == 'o') { + if (s[9].unicode() == 'n') { + if (s[10].unicode() == 't') { + if (s[11].unicode() == 'e') { + if (s[12].unicode() == 'n') { + if (s[13].unicode() == 't') { + if (s[14].unicode() == 's') { + return T_DOXY_TABLEOFCONTENTS; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } return T_DOXY_IDENTIFIER; } @@ -1790,3 +3146,4 @@ int CppTools::classifyDoxygenTag(const QChar *s, int n) { default: return T_DOXY_IDENTIFIER; } // switch } + diff --git a/src/plugins/cpptools/cppdoxygen.h b/src/plugins/cpptools/cppdoxygen.h index 70eff7c3a85..841c0f9bf44 100644 --- a/src/plugins/cpptools/cppdoxygen.h +++ b/src/plugins/cpptools/cppdoxygen.h @@ -36,144 +36,229 @@ namespace CppTools { enum DoxygenReservedWord { - T_DOXY_IDENTIFIER = 0, + T_DOXY_IDENTIFIER, + T_DOXY_ARG, + T_DOXY_ATTENTION, + T_DOXY_AUTHOR, + T_DOXY_CALLGRAPH, + T_DOXY_CODE, + T_DOXY_DOT, + T_DOXY_ELSE, + T_DOXY_ENDCODE, + T_DOXY_ENDCOND, + T_DOXY_ENDDOT, + T_DOXY_ENDHTMLONLY, + T_DOXY_ENDIF, + T_DOXY_ENDLATEXONLY, + T_DOXY_ENDLINK, + T_DOXY_ENDMANONLY, + T_DOXY_ENDVERBATIM, + T_DOXY_ENDXMLONLY, + T_DOXY_HIDEINITIALIZER, + T_DOXY_HTMLONLY, + T_DOXY_INTERFACE, + T_DOXY_INTERNAL, + T_DOXY_INVARIANT, + T_DOXY_LATEXONLY, + T_DOXY_LI, + T_DOXY_MANONLY, + T_DOXY_N, + T_DOXY_NOSUBGROUPING, + T_DOXY_NOTE, + T_DOXY_ONLY, + T_DOXY_POST, + T_DOXY_PRE, + T_DOXY_REMARKS, + T_DOXY_RETURN, + T_DOXY_RETURNS, + T_DOXY_SA, + T_DOXY_SEE, + T_DOXY_SHOWINITIALIZER, + T_DOXY_SINCE, + T_DOXY_TEST, + T_DOXY_TODO, + T_DOXY_VERBATIM, + T_DOXY_WARNING, + T_DOXY_XMLONLY, + T_DOXY_A, + T_DOXY_ADDTOGROUP, + T_DOXY_ANCHOR, + T_DOXY_B, + T_DOXY_C, + T_DOXY_CLASS, + T_DOXY_COND, + T_DOXY_COPYDOC, + T_DOXY_DEF, + T_DOXY_DONTINCLUDE, + T_DOXY_DOTFILE, + T_DOXY_E, + T_DOXY_ELSEIF, + T_DOXY_EM, + T_DOXY_ENUM, + T_DOXY_EXAMPLE, + T_DOXY_EXCEPTION, + T_DOXY_EXCEPTIONS, + T_DOXY_FILE, + T_DOXY_HTMLINCLUDE, + T_DOXY_IF, + T_DOXY_IFNOT, + T_DOXY_INCLUDE, + T_DOXY_LINK, + T_DOXY_NAMESPACE, + T_DOXY_P, + T_DOXY_PACKAGE, + T_DOXY_REF, + T_DOXY_RELATES, + T_DOXY_RELATESALSO, + T_DOXY_RETVAL, + T_DOXY_THROW, + T_DOXY_THROWS, + T_DOXY_VERBINCLUDE, + T_DOXY_VERSION, + T_DOXY_XREFITEM, + T_DOXY_PARAM, + T_DOXY_IMAGE, + T_DOXY_DEFGROUP, + T_DOXY_PAGE, + T_DOXY_PARAGRAPH, + T_DOXY_SECTION, + T_DOXY_STRUCT, + T_DOXY_SUBSECTION, + T_DOXY_SUBSUBSECTION, + T_DOXY_UNION, + T_DOXY_WEAKGROUP, + T_DOXY_ADDINDEX, + T_DOXY_BRIEF, + T_DOXY_BUG, + T_DOXY_DATE, + T_DOXY_DEPRECATED, + T_DOXY_FN, + T_DOXY_INGROUP, + T_DOXY_LINE, + T_DOXY_MAINPAGE, + T_DOXY_NAME, + T_DOXY_OVERLOAD, + T_DOXY_PAR, + T_DOXY_SHORT, + T_DOXY_SKIP, + T_DOXY_SKIPLINE, + T_DOXY_TYPEDEF, + T_DOXY_UNTIL, + T_DOXY_VAR, - T_DOXY_ARG, - T_DOXY_ATTENTION, - T_DOXY_AUTHOR, - T_DOXY_CALLGRAPH, - T_DOXY_CODE, - T_DOXY_DOT, - T_DOXY_ELSE, - T_DOXY_ENDCODE, - T_DOXY_ENDCOND, - T_DOXY_ENDDOT, - T_DOXY_ENDHTMLONLY, - T_DOXY_ENDIF, - T_DOXY_ENDLATEXONLY, - T_DOXY_ENDLINK, - T_DOXY_ENDMANONLY, - T_DOXY_ENDVERBATIM, - T_DOXY_ENDXMLONLY, - T_DOXY_HIDEINITIALIZER, - T_DOXY_HTMLONLY, - T_DOXY_INTERFACE, - T_DOXY_INTERNAL, - T_DOXY_INVARIANT, - T_DOXY_LATEXONLY, - T_DOXY_LI, - T_DOXY_MANONLY, - T_DOXY_N, - T_DOXY_NOSUBGROUPING, - T_DOXY_NOTE, - T_DOXY_ONLY, - T_DOXY_POST, - T_DOXY_PRE, - T_DOXY_REMARKS, - T_DOXY_RETURN, - T_DOXY_RETURNS, - T_DOXY_SA, - T_DOXY_SEE, - T_DOXY_SHOWINITIALIZER, - T_DOXY_SINCE, - T_DOXY_TEST, - T_DOXY_TODO, - T_DOXY_VERBATIM, - T_DOXY_WARNING, - T_DOXY_XMLONLY, + T_FIRST_QDOC_TAG, - T_DOXY_A, - T_DOXY_ADDTOGROUP, - T_DOXY_ANCHOR, - T_DOXY_B, - T_DOXY_C, - T_DOXY_CLASS, - T_DOXY_COND, - T_DOXY_COPYDOC, - T_DOXY_DEF, - T_DOXY_DONTINCLUDE, - T_DOXY_DOTFILE, - T_DOXY_E, - T_DOXY_ELSEIF, - T_DOXY_EM, - T_DOXY_ENUM, - T_DOXY_EXAMPLE, - T_DOXY_EXCEPTION, - T_DOXY_EXCEPTIONS, - T_DOXY_FILE, - T_DOXY_HTMLINCLUDE, - T_DOXY_IF, - T_DOXY_IFNOT, - T_DOXY_INCLUDE, - T_DOXY_LINK, - T_DOXY_NAMESPACE, - T_DOXY_P, - T_DOXY_PACKAGE, - T_DOXY_REF, - T_DOXY_RELATES, - T_DOXY_RELATESALSO, - T_DOXY_RETVAL, - T_DOXY_THROW, - T_DOXY_THROWS, - T_DOXY_VERBINCLUDE, - T_DOXY_VERSION, - T_DOXY_XREFITEM, - - T_DOXY_PARAM, - - T_DOXY_IMAGE, - - T_DOXY_DEFGROUP, - T_DOXY_PAGE, - T_DOXY_PARAGRAPH, - T_DOXY_SECTION, - T_DOXY_STRUCT, - T_DOXY_SUBSECTION, - T_DOXY_SUBSUBSECTION, - T_DOXY_UNION, - T_DOXY_WEAKGROUP, - - T_DOXY_ADDINDEX, - T_DOXY_BRIEF, - T_DOXY_BUG, - T_DOXY_DATE, - T_DOXY_DEPRECATED, - T_DOXY_FN, - T_DOXY_INGROUP, - T_DOXY_LINE, - T_DOXY_MAINPAGE, - T_DOXY_NAME, - T_DOXY_OVERLOAD, - T_DOXY_PAR, - T_DOXY_SHORT, - T_DOXY_SKIP, - T_DOXY_SKIPLINE, - T_DOXY_TYPEDEF, - T_DOXY_UNTIL, - T_DOXY_VAR, - - // qdoc - T_DOXY_ENDLIST, - T_DOXY_ENDTABLE, - T_DOXY_HEADER, - T_DOXY_I, - T_DOXY_L, - T_DOXY_LIST, - T_DOXY_MAINCLASS, - T_DOXY_NEWCODE, - T_DOXY_O, - T_DOXY_OLDCODE, - T_DOXY_PROPERTY, - T_DOXY_ROW, - T_DOXY_SECTION1, - T_DOXY_TABLE, - - T_DOXY_LAST_TAG + T_DOXY_ABSTRACT = T_FIRST_QDOC_TAG, + T_DOXY_BADCODE, + T_DOXY_BASENAME, + T_DOXY_BOLD, + T_DOXY_CAPTION, + T_DOXY_CHAPTER, + T_DOXY_CODELINE, + T_DOXY_DOTS, + T_DOXY_ENDABSTRACT, + T_DOXY_ENDCHAPTER, + T_DOXY_ENDFOOTNOTE, + T_DOXY_ENDLEGALESE, + T_DOXY_ENDLIST, + T_DOXY_ENDOMIT, + T_DOXY_ENDPART, + T_DOXY_ENDQUOTATION, + T_DOXY_ENDRAW, + T_DOXY_ENDSECTION1, + T_DOXY_ENDSECTION2, + T_DOXY_ENDSECTION3, + T_DOXY_ENDSECTION4, + T_DOXY_ENDSIDEBAR, + T_DOXY_ENDTABLE, + T_DOXY_EXPIRE, + T_DOXY_FOOTNOTE, + T_DOXY_GENERATELIST, + T_DOXY_GRANULARITY, + T_DOXY_HEADER, + T_DOXY_I, + T_DOXY_INDEX, + T_DOXY_INLINEIMAGE, + T_DOXY_KEYWORD, + T_DOXY_L, + T_DOXY_LEGALESE, + T_DOXY_LIST, + T_DOXY_META, + T_DOXY_NEWCODE, + T_DOXY_O, + T_DOXY_OLDCODE, + T_DOXY_OMIT, + T_DOXY_OMITVALUE, + T_DOXY_PART, + T_DOXY_PRINTLINE, + T_DOXY_PRINTTO, + T_DOXY_PRINTUNTIL, + T_DOXY_QUOTATION, + T_DOXY_QUOTEFILE, + T_DOXY_QUOTEFROMFILE, + T_DOXY_QUOTEFUNCTION, + T_DOXY_RAW, + T_DOXY_ROW, + T_DOXY_SECTION1, + T_DOXY_SECTION2, + T_DOXY_SECTION3, + T_DOXY_SECTION4, + T_DOXY_SIDEBAR, + T_DOXY_SKIPTO, + T_DOXY_SKIPUNTIL, + T_DOXY_SNIPPET, + T_DOXY_SUB, + T_DOXY_SUP, + T_DOXY_TABLE, + T_DOXY_TABLEOFCONTENTS, + T_DOXY_TARGET, + T_DOXY_TT, + T_DOXY_UNDERLINE, + T_DOXY_UNICODE, + T_DOXY_VALUE, + T_DOXY_CONTENTSPAGE, + T_DOXY_EXTERNALPAGE, + T_DOXY_GROUP, + T_DOXY_HEADERFILE, + T_DOXY_INDEXPAGE, + T_DOXY_INHEADERFILE, + T_DOXY_MACRO, + T_DOXY_MODULE, + T_DOXY_NEXTPAGE, + T_DOXY_PREVIOUSPAGE, + T_DOXY_PROPERTY, + T_DOXY_REIMP, + T_DOXY_SERVICE, + T_DOXY_STARTPAGE, + T_DOXY_VARIABLE, + T_DOXY_COMPAT, + T_DOXY_INMODULE, + T_DOXY_MAINCLASS, + T_DOXY_NONREENTRANT, + T_DOXY_OBSOLETE, + T_DOXY_PRELIMINARY, + T_DOXY_INPUBLICGROUP, + T_DOXY_REENTRANT, + T_DOXY_SUBTITLE, + T_DOXY_THREADSAFE, + T_DOXY_TITLE, + T_DOXY_CORELIB, + T_DOXY_UITOOLS, + T_DOXY_GUI, + T_DOXY_NETWORK, + T_DOXY_OPENGL, + T_DOXY_QT3SUPPORT, + T_DOXY_SVG, + T_DOXY_SQL, + T_DOXY_QTESTLIB, + T_DOXY_WEBKIT, + T_DOXY_XML, + T_DOXY_LAST_TAG }; CPPTOOLS_EXPORT int classifyDoxygenTag(const QChar *s, int n); CPPTOOLS_EXPORT const char *doxygenTagSpell(int index); -} // namespace CppEditor::Internal +} // namespace ::CppTools From 7959460ffb7b5aa3931bc4493e7871e972a514a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Feb 2009 14:56:36 +0100 Subject: [PATCH 14/21] Start experimental VS debugger support --- src/plugins/debugger/cdbdebugengine.cpp | 37 ++++++++++++++----- src/plugins/debugger/cdbdebugengine.h | 10 +++-- .../debugger/cdbdebugeventcallback.cpp | 36 +++++++++--------- src/plugins/debugger/cdbdebugeventcallback.h | 2 +- src/plugins/debugger/cdbdebugoutput.cpp | 10 ++--- src/plugins/debugger/debugger.pro | 19 ++++++++-- src/plugins/debugger/debuggermanager.cpp | 7 +++- src/plugins/debugger/debuggermanager.h | 7 ++-- 8 files changed, 83 insertions(+), 45 deletions(-) diff --git a/src/plugins/debugger/cdbdebugengine.cpp b/src/plugins/debugger/cdbdebugengine.cpp index f7e8c6cb560..486ac253cc3 100644 --- a/src/plugins/debugger/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdbdebugengine.cpp @@ -11,12 +11,11 @@ #include #define DBGHELP_TRANSLATE_TCHAR -#include +#include using namespace Debugger; using namespace Debugger::Internal; - CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) : IDebuggerEngine(parent), m_hDebuggeeProcess(0), @@ -84,7 +83,7 @@ void CdbDebugEngine::shutdown() exitDebugger(); } -void CdbDebugEngine::setToolTipExpression(const QPoint &pos, const QString &exp) +void CdbDebugEngine::setToolTipExpression(const QPoint & /*pos*/, const QString & /*exp*/) { } @@ -110,7 +109,7 @@ bool CdbDebugEngine::startDebugger() m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); //m_pDebugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH); - if (q->startMode() == q->attachExternal) { + if (q->startMode() == DebuggerManager::AttachExternal) { qWarning("CdbDebugEngine: attach to process not yet implemented!"); } else { hr = m_pDebugClient->CreateProcess2Wide(NULL, @@ -225,11 +224,6 @@ void CdbDebugEngine::continueInferior() qq->notifyInferiorRunning(); } -void CdbDebugEngine::runInferior() -{ - continueInferior(); -} - void CdbDebugEngine::interruptInferior() { //TODO: better use IDebugControl::SetInterrupt? @@ -244,18 +238,25 @@ void CdbDebugEngine::interruptInferior() void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber) { + Q_UNUSED(fileName) + Q_UNUSED(lineNumber) } void CdbDebugEngine::runToFunctionExec(const QString &functionName) { + Q_UNUSED(functionName) } void CdbDebugEngine::jumpToLineExec(const QString &fileName, int lineNumber) { + Q_UNUSED(fileName) + Q_UNUSED(lineNumber) } void CdbDebugEngine::assignValueInDebugger(const QString &expr, const QString &value) { + Q_UNUSED(expr) + Q_UNUSED(value) } void CdbDebugEngine::executeDebuggerCommand(const QString &/*command*/) @@ -352,6 +353,7 @@ void CdbDebugEngine::reloadModules() void CdbDebugEngine::loadSymbols(const QString &moduleName) { + Q_UNUSED(moduleName) } void CdbDebugEngine::loadAllSymbols() @@ -506,11 +508,12 @@ void CdbDebugEngine::updateStackTrace() void CdbDebugEngine::handleDebugOutput(const char* szOutputString) { - qq->showApplicationOutput("app-dbgoutput", QString::fromLocal8Bit(szOutputString)); + qq->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); } void CdbDebugEngine::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) { + Q_UNUSED(pBP) qDebug() << "CdbDebugEngine::handleBreakpointEvent()"; } @@ -518,3 +521,17 @@ IDebuggerEngine *createWinEngine(DebuggerManager *parent) { return new CdbDebugEngine(parent); } + +void CdbDebugEngine::setDebugDumpers(bool on) +{ + Q_UNUSED(on) +} + +void CdbDebugEngine::setUseCustomDumpers(bool on) +{ + Q_UNUSED(on) +} + +void CdbDebugEngine::reloadSourceFiles() +{ +} diff --git a/src/plugins/debugger/cdbdebugengine.h b/src/plugins/debugger/cdbdebugengine.h index c78b6585ae3..bea545596de 100644 --- a/src/plugins/debugger/cdbdebugengine.h +++ b/src/plugins/debugger/cdbdebugengine.h @@ -5,8 +5,6 @@ #include "cdbdebugeventcallback.h" #include "cdbdebugoutput.h" -#include - namespace Debugger { namespace Internal { @@ -32,8 +30,7 @@ public: virtual void stepIExec(); virtual void nextIExec(); - virtual void continueInferior(); - virtual void runInferior(); + virtual void continueInferior(); virtual void interruptInferior(); virtual void runToLineExec(const QString &fileName, int lineNumber); @@ -58,6 +55,11 @@ public: virtual void reloadRegisters(); + virtual void setDebugDumpers(bool on); + virtual void setUseCustomDumpers(bool on); + + virtual void reloadSourceFiles(); + protected: void timerEvent(QTimerEvent*); diff --git a/src/plugins/debugger/cdbdebugeventcallback.cpp b/src/plugins/debugger/cdbdebugeventcallback.cpp index b9d01198b39..893b8d9ab55 100644 --- a/src/plugins/debugger/cdbdebugeventcallback.cpp +++ b/src/plugins/debugger/cdbdebugeventcallback.cpp @@ -1,5 +1,5 @@ #include "cdbdebugeventcallback.h" -#include "cdbcdebugengine.h" +#include "cdbdebugengine.h" #include "debuggermanager.h" #include @@ -7,7 +7,7 @@ namespace Debugger { namespace Internal { -STDMETHODIMP MSVCDebugEventCallback::QueryInterface( +STDMETHODIMP CdbDebugEventCallback::QueryInterface( THIS_ IN REFIID InterfaceId, OUT PVOID* Interface) @@ -27,21 +27,21 @@ STDMETHODIMP MSVCDebugEventCallback::QueryInterface( } } -STDMETHODIMP_(ULONG) MSVCDebugEventCallback::AddRef(THIS) +STDMETHODIMP_(ULONG) CdbDebugEventCallback::AddRef(THIS) { // This class is designed to be static so // there's no true refcount. return 1; } -STDMETHODIMP_(ULONG) MSVCDebugEventCallback::Release(THIS) +STDMETHODIMP_(ULONG) CdbDebugEventCallback::Release(THIS) { // This class is designed to be static so // there's no true refcount. return 0; } -STDMETHODIMP MSVCDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) +STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) { *mask = DEBUG_EVENT_CREATE_PROCESS | DEBUG_EVENT_EXIT_PROCESS //| DEBUG_EVENT_CREATE_THREAD | DEBUG_EVENT_EXIT_THREAD @@ -51,14 +51,14 @@ STDMETHODIMP MSVCDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) +STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) { qDebug() << "MSVCDebugEventCallback::Breakpoint"; m_pEngine->handleBreakpointEvent(Bp); return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::Exception( +STDMETHODIMP CdbDebugEventCallback::Exception( THIS_ __in PEXCEPTION_RECORD64 Exception, __in ULONG FirstChance @@ -68,7 +68,7 @@ STDMETHODIMP MSVCDebugEventCallback::Exception( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::CreateThread( +STDMETHODIMP CdbDebugEventCallback::CreateThread( THIS_ __in ULONG64 Handle, __in ULONG64 DataOffset, @@ -82,7 +82,7 @@ STDMETHODIMP MSVCDebugEventCallback::CreateThread( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ExitThread( +STDMETHODIMP CdbDebugEventCallback::ExitThread( THIS_ __in ULONG ExitCode ) @@ -90,7 +90,7 @@ STDMETHODIMP MSVCDebugEventCallback::ExitThread( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::CreateProcess( +STDMETHODIMP CdbDebugEventCallback::CreateProcess( THIS_ __in ULONG64 ImageFileHandle, __in ULONG64 Handle, @@ -120,7 +120,7 @@ STDMETHODIMP MSVCDebugEventCallback::CreateProcess( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ExitProcess( +STDMETHODIMP CdbDebugEventCallback::ExitProcess( THIS_ __in ULONG ExitCode ) @@ -132,7 +132,7 @@ STDMETHODIMP MSVCDebugEventCallback::ExitProcess( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::LoadModule( +STDMETHODIMP CdbDebugEventCallback::LoadModule( THIS_ __in ULONG64 ImageFileHandle, __in ULONG64 BaseOffset, @@ -146,7 +146,7 @@ STDMETHODIMP MSVCDebugEventCallback::LoadModule( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::UnloadModule( +STDMETHODIMP CdbDebugEventCallback::UnloadModule( THIS_ __in_opt PCSTR ImageBaseName, __in ULONG64 BaseOffset @@ -155,7 +155,7 @@ STDMETHODIMP MSVCDebugEventCallback::UnloadModule( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::SystemError( +STDMETHODIMP CdbDebugEventCallback::SystemError( THIS_ __in ULONG Error, __in ULONG Level @@ -164,7 +164,7 @@ STDMETHODIMP MSVCDebugEventCallback::SystemError( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::SessionStatus( +STDMETHODIMP CdbDebugEventCallback::SessionStatus( THIS_ __in ULONG Status ) @@ -172,7 +172,7 @@ STDMETHODIMP MSVCDebugEventCallback::SessionStatus( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ChangeDebuggeeState( +STDMETHODIMP CdbDebugEventCallback::ChangeDebuggeeState( THIS_ __in ULONG Flags, __in ULONG64 Argument @@ -181,7 +181,7 @@ STDMETHODIMP MSVCDebugEventCallback::ChangeDebuggeeState( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ChangeEngineState( +STDMETHODIMP CdbDebugEventCallback::ChangeEngineState( THIS_ __in ULONG Flags, __in ULONG64 Argument @@ -190,7 +190,7 @@ STDMETHODIMP MSVCDebugEventCallback::ChangeEngineState( return S_OK; } -STDMETHODIMP MSVCDebugEventCallback::ChangeSymbolState( +STDMETHODIMP CdbDebugEventCallback::ChangeSymbolState( THIS_ __in ULONG Flags, __in ULONG64 Argument diff --git a/src/plugins/debugger/cdbdebugeventcallback.h b/src/plugins/debugger/cdbdebugeventcallback.h index c28ee87e48f..f9fa3e11c32 100644 --- a/src/plugins/debugger/cdbdebugeventcallback.h +++ b/src/plugins/debugger/cdbdebugeventcallback.h @@ -2,7 +2,7 @@ #define DEBUGGER_CDBDEBUGEVENTCALLBACK_H #include -#include +#include namespace Debugger { namespace Internal { diff --git a/src/plugins/debugger/cdbdebugoutput.cpp b/src/plugins/debugger/cdbdebugoutput.cpp index 135e78c28d5..94bc33cd254 100644 --- a/src/plugins/debugger/cdbdebugoutput.cpp +++ b/src/plugins/debugger/cdbdebugoutput.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "cdbdebugoutput.h" #include "cdbdebugengine.h" @@ -7,7 +7,7 @@ namespace Debugger { namespace Internal { -STDMETHODIMP MSVCDebugOutput::QueryInterface( +STDMETHODIMP CdbDebugOutput::QueryInterface( THIS_ IN REFIID InterfaceId, OUT PVOID* Interface @@ -28,21 +28,21 @@ STDMETHODIMP MSVCDebugOutput::QueryInterface( } } -STDMETHODIMP_(ULONG) MSVCDebugOutput::AddRef(THIS) +STDMETHODIMP_(ULONG) CdbDebugOutput::AddRef(THIS) { // This class is designed to be static so // there's no true refcount. return 1; } -STDMETHODIMP_(ULONG) MSVCDebugOutput::Release(THIS) +STDMETHODIMP_(ULONG) CdbDebugOutput::Release(THIS) { // This class is designed to be static so // there's no true refcount. return 0; } -STDMETHODIMP MSVCDebugOutput::Output( +STDMETHODIMP CdbDebugOutput::Output( THIS_ IN ULONG mask, IN PCSTR text diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 0d1b11e1888..fe5a0ce428d 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -85,7 +85,20 @@ HEADERS += $$PWD/modeltest.h DEFINES += USE_MODEL_TEST=1 } -false { +win32 { +# ---- Detect Debugging Tools For Windows + +CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk" + +exists ($$CDB_PATH) { +message("Experimental: Adding support for $$CDB_PATH") + +DEFINES+=CDB_ENABLED + +CDB_PLATFORM=i386 + +INCLUDEPATH+=$$CDB_PATH +CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM HEADERS += \ cdbdebugengine.h \ @@ -97,7 +110,7 @@ SOURCES += \ cdbdebugeventcallback.cpp \ cdbdebugoutput.cpp -LIBS += dbgeng.lib +LIBS += -L$$CDB_LIBPATH Dbghelp.lib dbgeng.lib } - +} diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 0bc4b47c5c3..89bb091bf59 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -132,7 +132,12 @@ static IDebuggerEngine *winEngine = 0; static IDebuggerEngine *scriptEngine = 0; extern IDebuggerEngine *createGdbEngine(DebuggerManager *parent); -extern IDebuggerEngine *createWinEngine(DebuggerManager *) { return 0; } +extern IDebuggerEngine *createWinEngine(DebuggerManager *) +#ifdef CDB_ENABLED +; +#else +{ return 0; } +#endif extern IDebuggerEngine *createScriptEngine(DebuggerManager *parent); DebuggerManager::DebuggerManager() diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 18d5475e728..0c7ae0e0bd0 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -110,7 +110,7 @@ enum DebuggerStatus class IDebuggerEngine; class GdbEngine; class ScriptEngine; -class WinEngine; +class CdbDebugEngine; // The construct below is not nice but enforces a bit of order. The // DebuggerManager interfaces a lots of thing: The DebuggerPlugin, @@ -131,10 +131,11 @@ public: private: // This is the part of the interface that's exclusively seen by the - // debugger engines. + // debugger enginesfriend class GdbEngine;. friend class GdbEngine; + friend class CdbDebugEngine; + friend class CdbDebugEventCallback; friend class ScriptEngine; - friend class WinEngine; // called from the engines after successful startup virtual void notifyInferiorStopRequested() = 0; From d9bc54ed75e14ba19ec00387bb24f78580904d01 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Feb 2009 15:40:51 +0100 Subject: [PATCH 15/21] Moved CDB support into separate directory and enable via config switch --- src/plugins/debugger/cdb/cdb.pri | 33 +++++++++++++++++++ .../debugger/{ => cdb}/cdbdebugengine.cpp | 0 .../debugger/{ => cdb}/cdbdebugengine.h | 0 .../{ => cdb}/cdbdebugeventcallback.cpp | 0 .../{ => cdb}/cdbdebugeventcallback.h | 0 .../debugger/{ => cdb}/cdbdebugoutput.cpp | 0 .../debugger/{ => cdb}/cdbdebugoutput.h | 0 src/plugins/debugger/debugger.pro | 30 +---------------- 8 files changed, 34 insertions(+), 29 deletions(-) create mode 100644 src/plugins/debugger/cdb/cdb.pri rename src/plugins/debugger/{ => cdb}/cdbdebugengine.cpp (100%) rename src/plugins/debugger/{ => cdb}/cdbdebugengine.h (100%) rename src/plugins/debugger/{ => cdb}/cdbdebugeventcallback.cpp (100%) rename src/plugins/debugger/{ => cdb}/cdbdebugeventcallback.h (100%) rename src/plugins/debugger/{ => cdb}/cdbdebugoutput.cpp (100%) rename src/plugins/debugger/{ => cdb}/cdbdebugoutput.h (100%) diff --git a/src/plugins/debugger/cdb/cdb.pri b/src/plugins/debugger/cdb/cdb.pri new file mode 100644 index 00000000000..31b6313aa1b --- /dev/null +++ b/src/plugins/debugger/cdb/cdb.pri @@ -0,0 +1,33 @@ +win32 { +# ---- Detect Debugging Tools For Windows + +CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk" + +exists ($$CDB_PATH) { +message("Experimental: Adding support for $$CDB_PATH") + +DEFINES+=CDB_ENABLED + +CDB_PLATFORM=i386 + +INCLUDEPATH*=$$CDB_PATH +INCLUDEPATH*=$$PWD + +CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM + +HEADERS += \ + $$PWD/cdbdebugengine.h \ + $$PWD/cdbdebugeventcallback.h \ + $$PWD/cdbdebugoutput.h + +SOURCES += \ + $$PWD/cdbdebugengine.cpp \ + $$PWD/cdbdebugeventcallback.cpp \ + $$PWD/cdbdebugoutput.cpp + +LIBS += -L$$CDB_LIBPATH Dbghelp.lib dbgeng.lib + +} else { + error("Debugging Tools for Windows could not be found in $$CDB_PATH") +} +} diff --git a/src/plugins/debugger/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp similarity index 100% rename from src/plugins/debugger/cdbdebugengine.cpp rename to src/plugins/debugger/cdb/cdbdebugengine.cpp diff --git a/src/plugins/debugger/cdbdebugengine.h b/src/plugins/debugger/cdb/cdbdebugengine.h similarity index 100% rename from src/plugins/debugger/cdbdebugengine.h rename to src/plugins/debugger/cdb/cdbdebugengine.h diff --git a/src/plugins/debugger/cdbdebugeventcallback.cpp b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp similarity index 100% rename from src/plugins/debugger/cdbdebugeventcallback.cpp rename to src/plugins/debugger/cdb/cdbdebugeventcallback.cpp diff --git a/src/plugins/debugger/cdbdebugeventcallback.h b/src/plugins/debugger/cdb/cdbdebugeventcallback.h similarity index 100% rename from src/plugins/debugger/cdbdebugeventcallback.h rename to src/plugins/debugger/cdb/cdbdebugeventcallback.h diff --git a/src/plugins/debugger/cdbdebugoutput.cpp b/src/plugins/debugger/cdb/cdbdebugoutput.cpp similarity index 100% rename from src/plugins/debugger/cdbdebugoutput.cpp rename to src/plugins/debugger/cdb/cdbdebugoutput.cpp diff --git a/src/plugins/debugger/cdbdebugoutput.h b/src/plugins/debugger/cdb/cdbdebugoutput.h similarity index 100% rename from src/plugins/debugger/cdbdebugoutput.h rename to src/plugins/debugger/cdb/cdbdebugoutput.h diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index fe5a0ce428d..f17533ee5d3 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -85,32 +85,4 @@ HEADERS += $$PWD/modeltest.h DEFINES += USE_MODEL_TEST=1 } -win32 { -# ---- Detect Debugging Tools For Windows - -CDB_PATH="$$(ProgramFiles)/Debugging Tools For Windows/sdk" - -exists ($$CDB_PATH) { -message("Experimental: Adding support for $$CDB_PATH") - -DEFINES+=CDB_ENABLED - -CDB_PLATFORM=i386 - -INCLUDEPATH+=$$CDB_PATH -CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM - -HEADERS += \ - cdbdebugengine.h \ - cdbdebugeventcallback.h \ - cdbdebugoutput.h - -SOURCES += \ - cdbdebugengine.cpp \ - cdbdebugeventcallback.cpp \ - cdbdebugoutput.cpp - -LIBS += -L$$CDB_LIBPATH Dbghelp.lib dbgeng.lib - -} -} +CONFIG(cdbdebugger):include(cdb\cdb.pri) From c5d600b1d64e22525757c0fd833e4612e6385fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 20 Feb 2009 16:34:48 +0100 Subject: [PATCH 16/21] Fixed highlighting of comment closing element */ Was taking the wrong state, causing it to appear in Doxygen style instead of as a normal comment. Fix by Roberto Raggi --- src/shared/cplusplus/Lexer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/cplusplus/Lexer.cpp b/src/shared/cplusplus/Lexer.cpp index 4d0b2b6e800..abb0adacd86 100644 --- a/src/shared/cplusplus/Lexer.cpp +++ b/src/shared/cplusplus/Lexer.cpp @@ -197,6 +197,8 @@ void Lexer::scan_helper(Token *tok) tok->offset = _currentChar - _firstChar; if (_state == State_MultiLineComment || _state == State_MultiLineDoxyComment) { + const int originalState = _state; + if (! _yychar) { tok->kind = T_EOF_SYMBOL; return; @@ -218,9 +220,8 @@ void Lexer::scan_helper(Token *tok) if (! _scanCommentTokens) goto _Lagain; - else if (_state == State_MultiLineComment) + else if (originalState == State_MultiLineComment) tok->kind = T_COMMENT; - else tok->kind = T_DOXY_COMMENT; return; // done From fe4a3f354d67fd8a7a79b10da768c6581d397fc0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Feb 2009 17:07:00 +0100 Subject: [PATCH 17/21] Added private header for engine --- src/plugins/debugger/cdb/cdb.pri | 1 + src/plugins/debugger/cdb/cdbdebugengine.cpp | 158 +++++++++++------- src/plugins/debugger/cdb/cdbdebugengine.h | 64 ++++--- src/plugins/debugger/cdb/cdbdebugengine_p.h | 81 +++++++++ .../debugger/cdb/cdbdebugeventcallback.cpp | 54 ++++-- .../debugger/cdb/cdbdebugeventcallback.h | 33 ++++ src/plugins/debugger/cdb/cdbdebugoutput.cpp | 36 +++- src/plugins/debugger/cdb/cdbdebugoutput.h | 33 ++++ src/plugins/debugger/debuggermanager.h | 5 +- 9 files changed, 368 insertions(+), 97 deletions(-) create mode 100644 src/plugins/debugger/cdb/cdbdebugengine_p.h diff --git a/src/plugins/debugger/cdb/cdb.pri b/src/plugins/debugger/cdb/cdb.pri index 31b6313aa1b..8a098aa54b2 100644 --- a/src/plugins/debugger/cdb/cdb.pri +++ b/src/plugins/debugger/cdb/cdb.pri @@ -17,6 +17,7 @@ CDB_LIBPATH=$$CDB_PATH/lib/$$CDB_PLATFORM HEADERS += \ $$PWD/cdbdebugengine.h \ + $$PWD/cdbdebugengine_p.h \ $$PWD/cdbdebugeventcallback.h \ $$PWD/cdbdebugoutput.h diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 486ac253cc3..2d4f8b29c8a 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -1,4 +1,38 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + #include "cdbdebugengine.h" +#include "cdbdebugengine_p.h" #include "debuggermanager.h" #include "breakhandler.h" @@ -16,15 +50,14 @@ using namespace Debugger; using namespace Debugger::Internal; -CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) - : IDebuggerEngine(parent), +CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEngine* engine) : m_hDebuggeeProcess(0), m_hDebuggeeThread(0), - //m_hDebuggeeImage(0), m_bIgnoreNextDebugEvent(false), m_watchTimer(-1), - m_debugEventCallBack(this), - m_debugOutputCallBack(this) + m_debugEventCallBack(engine), + m_debugOutputCallBack(engine), + m_engine(engine) { q = parent; qq = parent->engineInterface(); @@ -50,7 +83,7 @@ CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) } } -CdbDebugEngine::~CdbDebugEngine() +CdbDebugEnginePrivate::~CdbDebugEnginePrivate() { if (m_pDebugClient) m_pDebugClient->Release(); @@ -64,17 +97,29 @@ CdbDebugEngine::~CdbDebugEngine() m_pDebugRegisters->Release(); } +CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) + : IDebuggerEngine(parent), + m_d(new CdbDebugEnginePrivate(parent, this)) + +{ +} + +CdbDebugEngine::~CdbDebugEngine() +{ + delete m_d; +} + void CdbDebugEngine::startWatchTimer() { - if (m_watchTimer == -1) - m_watchTimer = startTimer(0); + if (m_d->m_watchTimer == -1) + m_d->m_watchTimer = startTimer(0); } void CdbDebugEngine::killWatchTimer() { - if (m_watchTimer != -1) { - killTimer(m_watchTimer); - m_watchTimer = -1; + if (m_d->m_watchTimer != -1) { + killTimer(m_d->m_watchTimer); + m_d->m_watchTimer = -1; } } @@ -89,7 +134,7 @@ void CdbDebugEngine::setToolTipExpression(const QPoint & /*pos*/, const QString bool CdbDebugEngine::startDebugger() { - q->showStatusMessage("Starting Debugger", -1); + m_d->q->showStatusMessage("Starting Debugger", -1); //if (!q->m_workingDir.isEmpty()) // m_gdbProc.setWorkingDirectory(q->m_workingDir); @@ -102,17 +147,17 @@ bool CdbDebugEngine::startDebugger() HRESULT hr; - QString filename(q->m_executable); + QString filename(m_d->q->m_executable); QFileInfo fi(filename); - m_pDebugSymbols->AppendImagePathWide(fi.absolutePath().replace('/','\\').utf16()); + m_d->m_pDebugSymbols->AppendImagePathWide(fi.absolutePath().replace('/','\\').utf16()); //m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); - m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); + m_d->m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); //m_pDebugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH); - if (q->startMode() == DebuggerManager::AttachExternal) { + if (m_d->q->startMode() == DebuggerManager::AttachExternal) { qWarning("CdbDebugEngine: attach to process not yet implemented!"); } else { - hr = m_pDebugClient->CreateProcess2Wide(NULL, + hr = m_d->m_pDebugClient->CreateProcess2Wide(NULL, const_cast(filename.utf16()), &dbgopts, sizeof(dbgopts), @@ -120,19 +165,19 @@ bool CdbDebugEngine::startDebugger() NULL); // TODO: think about setting the environment if (FAILED(hr)) { //qWarning("CreateProcess2Wide failed"); - qq->notifyInferiorExited(); + m_d->qq->notifyInferiorExited(); return false; } } - q->showStatusMessage(tr("Debugger Running"), -1); + m_d->q->showStatusMessage(tr("Debugger Running"), -1); startWatchTimer(); return true; } void CdbDebugEngine::exitDebugger() { - m_pDebugClient->TerminateCurrentProcess(); + m_d->m_pDebugClient->TerminateCurrentProcess(); killWatchTimer(); } @@ -145,15 +190,15 @@ void CdbDebugEngine::stepExec() //qDebug() << "CdbDebugEngine::stepExec()"; //m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); HRESULT hr; - hr = m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_INTO); - m_bIgnoreNextDebugEvent = true; + hr = m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_INTO); + m_d->m_bIgnoreNextDebugEvent = true; startWatchTimer(); } void CdbDebugEngine::stepOutExec() { //qDebug() << "CdbDebugEngine::stepOutExec()"; - StackHandler* sh = qq->stackHandler(); + StackHandler* sh = m_d->qq->stackHandler(); const int idx = sh->currentIndex() + 1; QList stackframes = sh->frames(); if (idx < 0 || idx >= stackframes.size()) { @@ -170,7 +215,7 @@ void CdbDebugEngine::stepOutExec() } IDebugBreakpoint2* pBP; - HRESULT hr = m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); + HRESULT hr = m_d->m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); if (FAILED(hr) || !pBP) { qWarning("stepOutExec: cannot create temporary breakpoint"); return; @@ -195,7 +240,7 @@ void CdbDebugEngine::nextExec() { //qDebug() << "CdbDebugEngine::nextExec()"; HRESULT hr; - hr = m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_OVER); + hr = m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_OVER); startWatchTimer(); } @@ -206,34 +251,34 @@ void CdbDebugEngine::stepIExec() void CdbDebugEngine::nextIExec() { - m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); + m_d->m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); startWatchTimer(); } void CdbDebugEngine::continueInferior() { killWatchTimer(); - q->resetLocation(); + m_d->q->resetLocation(); ULONG executionStatus; - HRESULT hr = m_pDebugControl->GetExecutionStatus(&executionStatus); + HRESULT hr = m_d->m_pDebugControl->GetExecutionStatus(&executionStatus); if (SUCCEEDED(hr) && executionStatus != DEBUG_STATUS_GO) - m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_GO); + m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_GO); startWatchTimer(); - qq->notifyInferiorRunning(); + m_d->qq->notifyInferiorRunning(); } void CdbDebugEngine::interruptInferior() { //TODO: better use IDebugControl::SetInterrupt? - if (!m_hDebuggeeProcess) + if (!m_d->m_hDebuggeeProcess) return; - if (!DebugBreakProcess(m_hDebuggeeProcess)) { + if (!DebugBreakProcess(m_d->m_hDebuggeeProcess)) { qWarning("DebugBreakProcess failed."); return; } - qq->notifyInferiorStopped(); + m_d->qq->notifyInferiorStopped(); } void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber) @@ -265,11 +310,11 @@ void CdbDebugEngine::executeDebuggerCommand(const QString &/*command*/) void CdbDebugEngine::activateFrame(int frameIndex) { - if (q->status() != DebuggerInferiorStopped) + if (m_d->q->status() != DebuggerInferiorStopped) return; - StackHandler *stackHandler = qq->stackHandler(); - int oldIndex = stackHandler->currentIndex(); + StackHandler *stackHandler = m_d->qq->stackHandler(); + const int oldIndex = stackHandler->currentIndex(); //qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex // << stackHandler->currentIndex(); @@ -282,9 +327,9 @@ void CdbDebugEngine::activateFrame(int frameIndex) const StackFrame &frame = stackHandler->currentFrame(); - bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable(); + const bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable(); if (usable) - q->gotoLocation(frame.file, frame.line, true); + m_d->q->gotoLocation(frame.file, frame.line, true); else qDebug() << "FULL NAME NOT USABLE: " << frame.file; } @@ -292,23 +337,23 @@ void CdbDebugEngine::activateFrame(int frameIndex) void CdbDebugEngine::selectThread(int index) { //reset location arrow - q->resetLocation(); + m_d->q->resetLocation(); - ThreadsHandler *threadsHandler = qq->threadsHandler(); + ThreadsHandler *threadsHandler = m_d->qq->threadsHandler(); threadsHandler->setCurrentThread(index); - m_currentThreadId = index; - updateStackTrace(); + m_d->m_currentThreadId = index; + m_d->updateStackTrace(); } void CdbDebugEngine::attemptBreakpointSynchronization() { - BreakHandler *handler = qq->breakHandler(); + BreakHandler *handler = m_d->qq->breakHandler(); //qDebug() << "attemptBreakpointSynchronization"; for (int i=0; i < handler->size(); ++i) { BreakpointData* breakpoint = handler->at(i); if (breakpoint->pending) { IDebugBreakpoint2* pBP = 0; - HRESULT hr = m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); + HRESULT hr = m_d->m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); if (FAILED(hr) || !pBP) { qWarning("m_pDebugControl->AddBreakpoint2 failed"); continue; @@ -366,22 +411,22 @@ void CdbDebugEngine::reloadRegisters() void CdbDebugEngine::timerEvent(QTimerEvent* te) { - if (te->timerId() != m_watchTimer) + if (te->timerId() != m_d->m_watchTimer) return; HRESULT hr; - hr = m_pDebugControl->WaitForEvent(0, 1); + hr = m_d->m_pDebugControl->WaitForEvent(0, 1); switch (hr) { case S_OK: //qDebug() << "WaitForEvent S_OK"; killWatchTimer(); - handleDebugEvent(); + m_d->handleDebugEvent(); break; case S_FALSE: //qDebug() << "S_FALSE"; break; case E_PENDING: - qDebug() << "S_PENDING"; + qDebug() << "E_PENDING"; break; case E_UNEXPECTED: killWatchTimer(); @@ -389,15 +434,13 @@ void CdbDebugEngine::timerEvent(QTimerEvent* te) case E_FAIL: qDebug() << "E_FAIL"; break; - //default: - // qDebug() << "asser welljuh, schuddnt heppn"; } } -void CdbDebugEngine::handleDebugEvent() +void CdbDebugEnginePrivate::handleDebugEvent() { if (m_bIgnoreNextDebugEvent) { - startWatchTimer(); + m_engine->startWatchTimer(); m_bIgnoreNextDebugEvent = false; } else { qq->notifyInferiorStopped(); @@ -417,7 +460,7 @@ void CdbDebugEngine::handleDebugEvent() //} } -void CdbDebugEngine::updateThreadList() +void CdbDebugEnginePrivate::updateThreadList() { ThreadsHandler* th = qq->threadsHandler(); QList threads; @@ -438,11 +481,10 @@ void CdbDebugEngine::updateThreadList() th->setThreads(threads); } -void CdbDebugEngine::updateStackTrace() +void CdbDebugEnginePrivate::updateStackTrace() { //qDebug() << "updateStackTrace()"; - HRESULT hr; - hr = m_pDebugSystemObjects->SetCurrentThreadId(m_currentThreadId); + HRESULT hr = m_pDebugSystemObjects->SetCurrentThreadId(m_currentThreadId); //ULONG64 frameOffset, instructionOffset, stackOffset; //if (FAILED(m_pDebugRegisters->GetFrameOffset2(DEBUG_REGSRC_DEBUGGEE, &frameOffset)) || @@ -506,12 +548,12 @@ void CdbDebugEngine::updateStackTrace() //m_pDebugControl->OutputStackTrace(DEBUG_OUTCTL_THIS_CLIENT, frames, numFramesFilled, DEBUG_STACK_SOURCE_LINE); } -void CdbDebugEngine::handleDebugOutput(const char* szOutputString) +void CdbDebugEnginePrivate::handleDebugOutput(const char* szOutputString) { qq->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); } -void CdbDebugEngine::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) +void CdbDebugEnginePrivate::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) { Q_UNUSED(pBP) qDebug() << "CdbDebugEngine::handleBreakpointEvent()"; diff --git a/src/plugins/debugger/cdb/cdbdebugengine.h b/src/plugins/debugger/cdb/cdbdebugengine.h index bea545596de..aee16bfc38d 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.h +++ b/src/plugins/debugger/cdb/cdbdebugengine.h @@ -1,15 +1,48 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + #ifndef DEBUGGER_CDBENGINE_H #define DEBUGGER_CDBENGINE_H #include "idebuggerengine.h" -#include "cdbdebugeventcallback.h" -#include "cdbdebugoutput.h" namespace Debugger { namespace Internal { class DebuggerManager; -class IDebuggerManagerAccessForEngines; +class CdbDebugEventCallback; +class CdbDebugOutput; +struct CdbDebugEnginePrivate; class CdbDebugEngine : public IDebuggerEngine { @@ -66,31 +99,10 @@ protected: private: void startWatchTimer(); void killWatchTimer(); - bool isDebuggeeRunning() const { return m_watchTimer != -1; } - void handleDebugEvent(); - void updateThreadList(); - void updateStackTrace(); - void handleDebugOutput(const char* szOutputString); - void handleBreakpointEvent(PDEBUG_BREAKPOINT pBP); -private: - HANDLE m_hDebuggeeProcess; - HANDLE m_hDebuggeeThread; - int m_currentThreadId; - bool m_bIgnoreNextDebugEvent; - - int m_watchTimer; - IDebugClient5* m_pDebugClient; - IDebugControl4* m_pDebugControl; - IDebugSystemObjects4* m_pDebugSystemObjects; - IDebugSymbols3* m_pDebugSymbols; - IDebugRegisters2* m_pDebugRegisters; - CdbDebugEventCallback m_debugEventCallBack; - CdbDebugOutput m_debugOutputCallBack; - - DebuggerManager *q; - IDebuggerManagerAccessForEngines *qq; + CdbDebugEnginePrivate *m_d; + friend struct CdbDebugEnginePrivate; friend class CdbDebugEventCallback; friend class CdbDebugOutput; }; diff --git a/src/plugins/debugger/cdb/cdbdebugengine_p.h b/src/plugins/debugger/cdb/cdbdebugengine_p.h new file mode 100644 index 00000000000..e470ca70409 --- /dev/null +++ b/src/plugins/debugger/cdb/cdbdebugengine_p.h @@ -0,0 +1,81 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#ifndef DEBUGGER_CDBENGINEPRIVATE_H +#define DEBUGGER_CDBENGINEPRIVATE_H + +#include "cdbdebugengine.h" +#include "cdbdebugeventcallback.h" +#include "cdbdebugoutput.h" + +namespace Debugger { +namespace Internal { + +class DebuggerManager; +class IDebuggerManagerAccessForEngines; + +struct CdbDebugEnginePrivate +{ + explicit CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEngine* engine); + ~CdbDebugEnginePrivate(); + + bool isDebuggeeRunning() const { return m_watchTimer != -1; } + void handleDebugEvent(); + void updateThreadList(); + void updateStackTrace(); + void handleDebugOutput(const char* szOutputString); + void handleBreakpointEvent(PDEBUG_BREAKPOINT pBP); + + HANDLE m_hDebuggeeProcess; + HANDLE m_hDebuggeeThread; + int m_currentThreadId; + bool m_bIgnoreNextDebugEvent; + + int m_watchTimer; + IDebugClient5* m_pDebugClient; + IDebugControl4* m_pDebugControl; + IDebugSystemObjects4* m_pDebugSystemObjects; + IDebugSymbols3* m_pDebugSymbols; + IDebugRegisters2* m_pDebugRegisters; + CdbDebugEventCallback m_debugEventCallBack; + CdbDebugOutput m_debugOutputCallBack; + + CdbDebugEngine* m_engine; + DebuggerManager *q; + IDebuggerManagerAccessForEngines *qq; +}; + +} // namespace Internal +} // namespace Debugger + +#endif // DEBUGGER_CDBENGINEPRIVATE_H diff --git a/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp index 893b8d9ab55..0c4d29469dc 100644 --- a/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp +++ b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp @@ -1,5 +1,39 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + #include "cdbdebugeventcallback.h" #include "cdbdebugengine.h" +#include "cdbdebugengine_p.h" #include "debuggermanager.h" #include @@ -54,7 +88,7 @@ STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) { qDebug() << "MSVCDebugEventCallback::Breakpoint"; - m_pEngine->handleBreakpointEvent(Bp); + m_pEngine->m_d->handleBreakpointEvent(Bp); return S_OK; } @@ -105,16 +139,16 @@ STDMETHODIMP CdbDebugEventCallback::CreateProcess( __in ULONG64 StartOffset ) { - m_pEngine->m_hDebuggeeProcess = (HANDLE)Handle; - m_pEngine->m_hDebuggeeThread = (HANDLE)InitialThreadHandle; + m_pEngine->m_d->m_hDebuggeeProcess = (HANDLE)Handle; + m_pEngine->m_d->m_hDebuggeeThread = (HANDLE)InitialThreadHandle; //m_pEngine->qq->notifyStartupFinished(); - m_pEngine->qq->notifyInferiorRunning(); + m_pEngine->m_d->qq->notifyInferiorRunning(); ULONG currentThreadId; - if (SUCCEEDED(m_pEngine->m_pDebugSystemObjects->GetThreadIdByHandle(InitialThreadHandle, ¤tThreadId))) - m_pEngine->m_currentThreadId = currentThreadId; + if (SUCCEEDED(m_pEngine->m_d->m_pDebugSystemObjects->GetThreadIdByHandle(InitialThreadHandle, ¤tThreadId))) + m_pEngine->m_d->m_currentThreadId = currentThreadId; else - m_pEngine->m_currentThreadId = 0; + m_pEngine->m_d->m_currentThreadId = 0; m_pEngine->attemptBreakpointSynchronization(); return S_OK; @@ -126,9 +160,9 @@ STDMETHODIMP CdbDebugEventCallback::ExitProcess( ) { UNREFERENCED_PARAMETER(ExitCode); - m_pEngine->m_hDebuggeeProcess = 0; - m_pEngine->m_hDebuggeeThread = 0; - m_pEngine->qq->notifyInferiorExited(); + m_pEngine->m_d->m_hDebuggeeProcess = 0; + m_pEngine->m_d->m_hDebuggeeThread = 0; + m_pEngine->m_d->qq->notifyInferiorExited(); return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbdebugeventcallback.h b/src/plugins/debugger/cdb/cdbdebugeventcallback.h index f9fa3e11c32..25b2faf3fa3 100644 --- a/src/plugins/debugger/cdb/cdbdebugeventcallback.h +++ b/src/plugins/debugger/cdb/cdbdebugeventcallback.h @@ -1,3 +1,36 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + #ifndef DEBUGGER_CDBDEBUGEVENTCALLBACK_H #define DEBUGGER_CDBDEBUGEVENTCALLBACK_H diff --git a/src/plugins/debugger/cdb/cdbdebugoutput.cpp b/src/plugins/debugger/cdb/cdbdebugoutput.cpp index 94bc33cd254..b342ff03d85 100644 --- a/src/plugins/debugger/cdb/cdbdebugoutput.cpp +++ b/src/plugins/debugger/cdb/cdbdebugoutput.cpp @@ -1,8 +1,42 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + #include #include #include "cdbdebugoutput.h" #include "cdbdebugengine.h" +#include "cdbdebugengine_p.h" namespace Debugger { namespace Internal { @@ -49,7 +83,7 @@ STDMETHODIMP CdbDebugOutput::Output( ) { UNREFERENCED_PARAMETER(mask); - m_pEngine->handleDebugOutput(text); + m_pEngine->m_d->handleDebugOutput(text); return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbdebugoutput.h b/src/plugins/debugger/cdb/cdbdebugoutput.h index 273c8afcf10..b51fa6ee215 100644 --- a/src/plugins/debugger/cdb/cdbdebugoutput.h +++ b/src/plugins/debugger/cdb/cdbdebugoutput.h @@ -1,3 +1,36 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + #ifndef DEBUGGER_CDBOUTPUT_H #define DEBUGGER_CDBOUTPUT_H diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 0c7ae0e0bd0..7b0cbc75bef 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -106,11 +106,11 @@ enum DebuggerStatus DebuggerInferiorStopped, // Debuggee stopped }; - class IDebuggerEngine; class GdbEngine; class ScriptEngine; class CdbDebugEngine; +struct CdbDebugEnginePrivate; // The construct below is not nice but enforces a bit of order. The // DebuggerManager interfaces a lots of thing: The DebuggerPlugin, @@ -131,11 +131,12 @@ public: private: // This is the part of the interface that's exclusively seen by the - // debugger enginesfriend class GdbEngine;. + // debugger engines friend class GdbEngine; friend class CdbDebugEngine; friend class CdbDebugEventCallback; friend class ScriptEngine; + friend struct CdbDebugEnginePrivate; // called from the engines after successful startup virtual void notifyInferiorStopRequested() = 0; From c8bdd0bee4325ff50216fc39da2c9dfa8219cb56 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 23 Feb 2009 09:53:26 +0100 Subject: [PATCH 18/21] Skip __complex__, __imag__ and __real__ --- src/plugins/cpptools/cppmodelmanager.cpp | 4 ++++ tests/manual/binding/c++ | 1 - tests/manual/binding/conf.c++ | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 5c837db64d2..8964d1385ba 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -140,6 +140,10 @@ static const char pp_configuration[] = "#define restrict\n" "#define __restrict\n" + "#define __complex__\n" + "#define __imag__\n" + "#define __real__\n" + // ### add macros for win32 "#define __cdecl\n" "#define QT_WA(x) x\n" diff --git a/tests/manual/binding/c++ b/tests/manual/binding/c++ index dcdbeef64de..79ec597fcb1 100755 --- a/tests/manual/binding/c++ +++ b/tests/manual/binding/c++ @@ -5,4 +5,3 @@ echo "Generating $t" ${CPP-gcc} -xc++ -E -include $me/conf.c++ $* > $t echo "Parsing $t" $me/cplusplus0 $t - diff --git a/tests/manual/binding/conf.c++ b/tests/manual/binding/conf.c++ index c179f979272..c966da060a8 100644 --- a/tests/manual/binding/conf.c++ +++ b/tests/manual/binding/conf.c++ @@ -6,3 +6,6 @@ #define restrict #define __restrict #define __weak +#define __complex__ +#define __imag__ +#define __real__ From 1c063f6953fe61c078e665a4774ef04623cee95d Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 23 Feb 2009 12:49:56 +0100 Subject: [PATCH 19/21] Alternative implementation of the indexer. It is a little bit slower, but I'm going to make it faster. Unfortunately the refactoring of the indexer is kind of necessary. I need to merge the new binding pass. --- .../cplusplus/PreprocessorEnvironment.cpp | 24 ++++ src/libs/cplusplus/PreprocessorEnvironment.h | 4 + src/plugins/cpptools/cppmodelmanager.cpp | 113 ++++++++++++------ 3 files changed, 105 insertions(+), 36 deletions(-) diff --git a/src/libs/cplusplus/PreprocessorEnvironment.cpp b/src/libs/cplusplus/PreprocessorEnvironment.cpp index 930e4b3a6c7..5d52e6e53f4 100644 --- a/src/libs/cplusplus/PreprocessorEnvironment.cpp +++ b/src/libs/cplusplus/PreprocessorEnvironment.cpp @@ -117,6 +117,13 @@ Macro *Environment::bind(const Macro &__macro) return m; } +void Environment::addMacros(const QList ¯os) +{ + foreach (const Macro ¯o, macros) { + bind(macro); + } +} + Macro *Environment::remove(const QByteArray &name) { Macro macro; @@ -127,6 +134,23 @@ Macro *Environment::remove(const QByteArray &name) return bind(macro); } +void Environment::reset() +{ + if (_macros) { + qDeleteAll(firstMacro(), lastMacro()); + free(_macros); + } + + if (_hash) + free(_hash); + + _macros = 0; + _allocated_macros = 0; + _macro_count = -1; + _hash = 0; + _hash_count = 401; +} + bool Environment::isBuiltinMacro(const QByteArray &s) const { if (s.length() != 8) diff --git a/src/libs/cplusplus/PreprocessorEnvironment.h b/src/libs/cplusplus/PreprocessorEnvironment.h index 7f712cd49cc..9e0163cfb66 100644 --- a/src/libs/cplusplus/PreprocessorEnvironment.h +++ b/src/libs/cplusplus/PreprocessorEnvironment.h @@ -56,6 +56,7 @@ #include "CPlusPlusForwardDeclarations.h" #include +#include #include namespace CPlusPlus { @@ -89,6 +90,9 @@ public: Macro **lastMacro() { return _macros + _macro_count + 1; } + void reset(); + void addMacros(const QList ¯os); + private: static unsigned hashCode(const QByteArray &s); void rehash(); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 8964d1385ba..3cbabb8fddc 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -171,6 +172,8 @@ public: void run(QString &fileName); void operator()(QString &fileName); + void resetEnvironment(); + public: // attributes Snapshot snapshot; @@ -230,6 +233,9 @@ void CppPreprocessor::setProjectFiles(const QStringList &files) void CppPreprocessor::run(QString &fileName) { sourceNeeded(fileName, IncludeGlobal, /*line = */ 0); } +void CppPreprocessor::resetEnvironment() +{ env.reset(); } + void CppPreprocessor::operator()(QString &fileName) { run(fileName); } @@ -390,7 +396,7 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet *process processed->insert(fn); - foreach (Document::Include incl, doc->includes()) { + foreach (const Document::Include &incl, doc->includes()) { QString includedFile = incl.fileName(); if (Document::Ptr includedDoc = snapshot.value(includedFile)) @@ -399,9 +405,7 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet *process run(includedFile); } - foreach (const Macro macro, doc->definedMacros()) { - env.bind(macro); - } + env.addMacros(doc->definedMacros()); } void CppPreprocessor::startSkippingBlocks(unsigned offset) @@ -428,55 +432,57 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, if (m_currentDoc) { m_currentDoc->addIncludeFile(fileName, line); + if (contents.isEmpty() && ! QFileInfo(fileName).isAbsolute()) { QString msg; + msg += fileName; msg += QLatin1String(": No such file or directory"); + Document::DiagnosticMessage d(Document::DiagnosticMessage::Warning, m_currentDoc->fileName(), env.currentLine, /*column = */ 0, msg); + m_currentDoc->addDiagnosticMessage(d); + //qWarning() << "file not found:" << fileName << m_currentDoc->fileName() << env.current_line; } } - if (! contents.isEmpty()) { - Document::Ptr cachedDoc = snapshot.value(fileName); - if (cachedDoc && m_currentDoc) { - mergeEnvironment(cachedDoc); - } else { - Document::Ptr previousDoc = switchDocument(Document::create(fileName)); + //qDebug() << "parse file:" << fileName << "contents:" << contents.size(); - const QByteArray previousFile = env.currentFile; - const unsigned previousLine = env.currentLine; + Document::Ptr doc = snapshot.value(fileName); + if (doc) { + mergeEnvironment(doc); + return; + } - TranslationUnit *unit = m_currentDoc->translationUnit(); - env.currentFile = QByteArray(unit->fileName(), unit->fileNameLength()); + doc = Document::create(fileName); - QByteArray preprocessedCode; - m_proc(contents, &preprocessedCode); - //qDebug() << preprocessedCode; + Document::Ptr previousDoc = switchDocument(doc); - env.currentFile = previousFile; - env.currentLine = previousLine; + QByteArray preprocessedCode; + m_proc(fileName.toUtf8(), contents, &preprocessedCode); - m_currentDoc->setSource(preprocessedCode); - m_currentDoc->parse(); + doc->setSource(preprocessedCode); + + doc->parse(); + doc->check(); #if defined(QTCREATOR_WITH_DUMP_AST) && defined(Q_CC_GNU) DumpAST dump(m_currentDoc->control()); dump(m_currentDoc->translationUnit()->ast()); #endif - m_currentDoc->check(); - m_currentDoc->releaseTranslationUnit(); // release the AST and the token stream. + doc->releaseTranslationUnit(); - if (m_modelManager) - m_modelManager->emitDocumentUpdated(m_currentDoc); - (void) switchDocument(previousDoc); - } - } + snapshot[fileName] = doc; + + if (m_modelManager) + m_modelManager->emitDocumentUpdated(m_currentDoc); // ### TODO: compress + + (void) switchDocument(previousDoc); } Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) @@ -741,7 +747,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc) QList blockRanges; - foreach (const Document::Block block, doc->skippedBlocks()) { + foreach (const Document::Block &block, doc->skippedBlocks()) { blockRanges.append(TextEditor::BaseTextEditor::BlockRange(block.begin(), block.end())); } ed->setIfdefedOutBlocks(blockRanges); @@ -754,7 +760,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc) macroFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); QTextCursor c = ed->textCursor(); - foreach (const Document::Block block, doc->macroUses()) { + foreach (const Document::MacroUse &block, doc->macroUses()) { QTextEdit::ExtraSelection sel; sel.cursor = c; sel.cursor.setPosition(block.begin()); @@ -775,7 +781,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc) warningFormat.setUnderlineColor(Qt::darkYellow); QSet lines; - foreach (const Document::DiagnosticMessage m, doc->diagnosticMessages()) { + foreach (const Document::DiagnosticMessage &m, doc->diagnosticMessages()) { if (m.fileName() != fileName) continue; else if (lines.contains(m.line())) @@ -803,7 +809,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc) } QList todo; - foreach (Editor e, todo) { + foreach (const Editor &e, todo) { if (e.widget != ed) todo.append(e); } @@ -826,7 +832,7 @@ void CppModelManager::postEditorUpdate() void CppModelManager::updateEditorSelections() { - foreach (Editor ed, m_todo) { + foreach (const Editor &ed, m_todo) { if (! ed.widget) continue; @@ -876,20 +882,38 @@ void CppModelManager::parse(QFutureInterface &future, if (files.isEmpty()) return; - foreach (QString file, files) { + Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase(); + QStringList headers, sources; + Core::MimeType cSourceTy = db->findByType(QLatin1String("text/x-csrc")); + Core::MimeType cppSourceTy = db->findByType(QLatin1String("text/x-c++src")); + + foreach (const QString &file, files) { + const QFileInfo fileInfo(file); + + if (cSourceTy.matchesFile(fileInfo) || cppSourceTy.matchesFile(fileInfo)) + sources.append(file); + + else + headers.append(file); + } + + foreach (const QString &file, files) { preproc->snapshot.remove(file); } + files = sources; + files += headers; + // Change the priority of the background parser thread to idle. QThread::currentThread()->setPriority(QThread::IdlePriority); future.setProgressRange(0, files.size()); QString conf = QLatin1String(pp_configuration_file); - (void) preproc->run(conf); - const int STEP = 10; + bool processingHeaders = false; + for (int i = 0; i < files.size(); ++i) { if (future.isPaused()) future.waitForResume(); @@ -905,8 +929,25 @@ void CppModelManager::parse(QFutureInterface &future, #endif QString fileName = files.at(i); + + bool isSourceFile = false; + if (cppSourceTy.matchesFile(fileName) || cSourceTy.matchesFile(fileName)) + isSourceFile = true; + + if (isSourceFile) + (void) preproc->run(conf); + + else if (! processingHeaders) { + (void) preproc->run(conf); + + processingHeaders = true; + } + preproc->run(fileName); + if (isSourceFile) + preproc->resetEnvironment(); + if (! (i % STEP)) // Yields execution of the current thread. QThread::yieldCurrentThread(); From 49cadd0e054f8e90f8da26742655fccf54bbc1f6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 23 Feb 2009 14:46:46 +0100 Subject: [PATCH 20/21] Clean up code --- src/plugins/debugger/cdb/cdbdebugengine.cpp | 187 ++++++++++++------ src/plugins/debugger/cdb/cdbdebugengine_p.h | 7 +- .../debugger/cdb/cdbdebugeventcallback.cpp | 73 +++++-- .../debugger/cdb/cdbdebugeventcallback.h | 6 +- src/plugins/debugger/cdb/cdbdebugoutput.cpp | 14 +- src/plugins/debugger/cdb/cdbdebugoutput.h | 7 +- 6 files changed, 209 insertions(+), 85 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 2d4f8b29c8a..7fa9afca716 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -40,9 +40,10 @@ #include -#include -#include -#include +#include +#include +#include +#include #define DBGHELP_TRANSLATE_TCHAR #include @@ -57,11 +58,10 @@ CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent, CdbDebugEn m_watchTimer(-1), m_debugEventCallBack(engine), m_debugOutputCallBack(engine), - m_engine(engine) + m_engine(engine), + m_debuggerManager(parent), + m_debuggerManagerAccess(parent->engineInterface()) { - q = parent; - qq = parent->engineInterface(); - HRESULT hr; hr = DebugCreate( __uuidof(IDebugClient5), reinterpret_cast(&m_pDebugClient)); if (FAILED(hr)) m_pDebugClient = 0; @@ -100,7 +100,6 @@ CdbDebugEnginePrivate::~CdbDebugEnginePrivate() CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) : IDebuggerEngine(parent), m_d(new CdbDebugEnginePrivate(parent, this)) - { } @@ -134,7 +133,7 @@ void CdbDebugEngine::setToolTipExpression(const QPoint & /*pos*/, const QString bool CdbDebugEngine::startDebugger() { - m_d->q->showStatusMessage("Starting Debugger", -1); + m_d->m_debuggerManager->showStatusMessage("Starting Debugger", -1); //if (!q->m_workingDir.isEmpty()) // m_gdbProc.setWorkingDirectory(q->m_workingDir); @@ -145,19 +144,21 @@ bool CdbDebugEngine::startDebugger() memset(&dbgopts, 0, sizeof(dbgopts)); dbgopts.CreateFlags = DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS; - HRESULT hr; + const QString filename(m_d->m_debuggerManager->m_executable); + if (debugCDB) + qDebug() << Q_FUNC_INFO <q->m_executable); - QFileInfo fi(filename); - m_d->m_pDebugSymbols->AppendImagePathWide(fi.absolutePath().replace('/','\\').utf16()); + const QFileInfo fi(filename); + m_d->m_pDebugSymbols->AppendImagePathWide(QDir::toNativeSeparators(fi.absolutePath()).utf16()); //m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); m_d->m_pDebugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS); //m_pDebugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH); - if (m_d->q->startMode() == DebuggerManager::AttachExternal) { + if (m_d->m_debuggerManager->startMode() == DebuggerManager::AttachExternal) { qWarning("CdbDebugEngine: attach to process not yet implemented!"); + return false; } else { - hr = m_d->m_pDebugClient->CreateProcess2Wide(NULL, + HRESULT hr = m_d->m_pDebugClient->CreateProcess2Wide(NULL, const_cast(filename.utf16()), &dbgopts, sizeof(dbgopts), @@ -165,18 +166,21 @@ bool CdbDebugEngine::startDebugger() NULL); // TODO: think about setting the environment if (FAILED(hr)) { //qWarning("CreateProcess2Wide failed"); - m_d->qq->notifyInferiorExited(); + m_d->m_debuggerManagerAccess->notifyInferiorExited(); return false; } } - m_d->q->showStatusMessage(tr("Debugger Running"), -1); + m_d->m_debuggerManager->showStatusMessage(tr("Debugger Running"), -1); startWatchTimer(); return true; } void CdbDebugEngine::exitDebugger() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; + m_d->m_pDebugClient->TerminateCurrentProcess(); killWatchTimer(); } @@ -187,7 +191,9 @@ void CdbDebugEngine::updateWatchModel() void CdbDebugEngine::stepExec() { - //qDebug() << "CdbDebugEngine::stepExec()"; + if (debugCDB) + qDebug() << Q_FUNC_INFO; + //m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); HRESULT hr; hr = m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_INTO); @@ -197,8 +203,10 @@ void CdbDebugEngine::stepExec() void CdbDebugEngine::stepOutExec() { - //qDebug() << "CdbDebugEngine::stepOutExec()"; - StackHandler* sh = m_d->qq->stackHandler(); + if (debugCDB) + qDebug() << Q_FUNC_INFO; + + StackHandler* sh = m_d->m_debuggerManagerAccess->stackHandler(); const int idx = sh->currentIndex() + 1; QList stackframes = sh->frames(); if (idx < 0 || idx >= stackframes.size()) { @@ -238,7 +246,9 @@ void CdbDebugEngine::stepOutExec() void CdbDebugEngine::nextExec() { - //qDebug() << "CdbDebugEngine::nextExec()"; + if (debugCDB) + qDebug() << Q_FUNC_INFO; + HRESULT hr; hr = m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_STEP_OVER); startWatchTimer(); @@ -251,14 +261,20 @@ void CdbDebugEngine::stepIExec() void CdbDebugEngine::nextIExec() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; + m_d->m_pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT, "p", 0); startWatchTimer(); } void CdbDebugEngine::continueInferior() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; + killWatchTimer(); - m_d->q->resetLocation(); + m_d->m_debuggerManager->resetLocation(); ULONG executionStatus; HRESULT hr = m_d->m_pDebugControl->GetExecutionStatus(&executionStatus); @@ -266,11 +282,14 @@ void CdbDebugEngine::continueInferior() m_d->m_pDebugControl->SetExecutionStatus(DEBUG_STATUS_GO); startWatchTimer(); - m_d->qq->notifyInferiorRunning(); + m_d->m_debuggerManagerAccess->notifyInferiorRunning(); } void CdbDebugEngine::interruptInferior() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; + //TODO: better use IDebugControl::SetInterrupt? if (!m_d->m_hDebuggeeProcess) return; @@ -278,42 +297,48 @@ void CdbDebugEngine::interruptInferior() qWarning("DebugBreakProcess failed."); return; } - m_d->qq->notifyInferiorStopped(); + m_d->m_debuggerManagerAccess->notifyInferiorStopped(); } void CdbDebugEngine::runToLineExec(const QString &fileName, int lineNumber) { - Q_UNUSED(fileName) - Q_UNUSED(lineNumber) + if (debugCDB) + qDebug() << Q_FUNC_INFO << fileName << lineNumber; } void CdbDebugEngine::runToFunctionExec(const QString &functionName) { - Q_UNUSED(functionName) + if (debugCDB) + qDebug() << Q_FUNC_INFO << functionName; } void CdbDebugEngine::jumpToLineExec(const QString &fileName, int lineNumber) { - Q_UNUSED(fileName) - Q_UNUSED(lineNumber) + if (debugCDB) + qDebug() << Q_FUNC_INFO << fileName << lineNumber; } void CdbDebugEngine::assignValueInDebugger(const QString &expr, const QString &value) { - Q_UNUSED(expr) - Q_UNUSED(value) + if (debugCDB) + qDebug() << Q_FUNC_INFO << expr << value; } -void CdbDebugEngine::executeDebuggerCommand(const QString &/*command*/) +void CdbDebugEngine::executeDebuggerCommand(const QString &command) { + if (debugCDB) + qDebug() << Q_FUNC_INFO << command; } void CdbDebugEngine::activateFrame(int frameIndex) { - if (m_d->q->status() != DebuggerInferiorStopped) + if (debugCDB) + qDebug() << Q_FUNC_INFO << frameIndex; + + if (m_d->m_debuggerManager->status() != DebuggerInferiorStopped) return; - StackHandler *stackHandler = m_d->qq->stackHandler(); + StackHandler *stackHandler = m_d->m_debuggerManagerAccess->stackHandler(); const int oldIndex = stackHandler->currentIndex(); //qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex // << stackHandler->currentIndex(); @@ -329,40 +354,61 @@ void CdbDebugEngine::activateFrame(int frameIndex) const bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable(); if (usable) - m_d->q->gotoLocation(frame.file, frame.line, true); + m_d->m_debuggerManager->gotoLocation(frame.file, frame.line, true); else qDebug() << "FULL NAME NOT USABLE: " << frame.file; } void CdbDebugEngine::selectThread(int index) { - //reset location arrow - m_d->q->resetLocation(); + if (debugCDB) + qDebug() << Q_FUNC_INFO << index; - ThreadsHandler *threadsHandler = m_d->qq->threadsHandler(); + //reset location arrow + m_d->m_debuggerManager->resetLocation(); + + ThreadsHandler *threadsHandler = m_d->m_debuggerManagerAccess->threadsHandler(); threadsHandler->setCurrentThread(index); m_d->m_currentThreadId = index; m_d->updateStackTrace(); } +static inline QString breakPointExpression(const QString &fileName, const QString &lineNumber) +{ + QString str; + str += QLatin1Char('`'); + str += QDir::toNativeSeparators(fileName); + str += QLatin1Char(':'); + str += lineNumber; + str += QLatin1Char('`'); + return str; +} + void CdbDebugEngine::attemptBreakpointSynchronization() { - BreakHandler *handler = m_d->qq->breakHandler(); - //qDebug() << "attemptBreakpointSynchronization"; + if (debugCDB) + qDebug() << Q_FUNC_INFO; + + if (!m_d->m_hDebuggeeProcess) { + qWarning("attemptBreakpointSynchronization() called while debugger is not running"); + return; + } + + BreakHandler *handler = m_d->m_debuggerManagerAccess->breakHandler(); for (int i=0; i < handler->size(); ++i) { BreakpointData* breakpoint = handler->at(i); if (breakpoint->pending) { + const QString expr = breakPointExpression(breakpoint->fileName, breakpoint->lineNumber); IDebugBreakpoint2* pBP = 0; HRESULT hr = m_d->m_pDebugControl->AddBreakpoint2(DEBUG_BREAKPOINT_CODE, DEBUG_ANY_ID, &pBP); if (FAILED(hr) || !pBP) { - qWarning("m_pDebugControl->AddBreakpoint2 failed"); + qWarning("m_pDebugControl->AddBreakpoint2 %s failed.", qPrintable(expr)); continue; } - QString str = '`' + breakpoint->fileName + ':' + breakpoint->lineNumber + '`'; - hr = pBP->SetOffsetExpressionWide(str.utf16()); + hr = pBP->SetOffsetExpressionWide(expr.utf16()); if (FAILED(hr)) { - qWarning("SetOffsetExpressionWide failed"); + qWarning("SetOffsetExpressionWide %s failed", qPrintable(expr)); continue; } @@ -398,11 +444,14 @@ void CdbDebugEngine::reloadModules() void CdbDebugEngine::loadSymbols(const QString &moduleName) { - Q_UNUSED(moduleName) + if (debugCDB) + qDebug() << Q_FUNC_INFO << moduleName; } void CdbDebugEngine::loadAllSymbols() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; } void CdbDebugEngine::reloadRegisters() @@ -410,40 +459,53 @@ void CdbDebugEngine::reloadRegisters() } void CdbDebugEngine::timerEvent(QTimerEvent* te) -{ +{ if (te->timerId() != m_d->m_watchTimer) return; + if (debugCDB > 1) + qDebug() << Q_FUNC_INFO; + HRESULT hr; hr = m_d->m_pDebugControl->WaitForEvent(0, 1); switch (hr) { case S_OK: - //qDebug() << "WaitForEvent S_OK"; + if (debugCDB > 1) + qDebug() << "WaitForEvent S_OK"; + killWatchTimer(); m_d->handleDebugEvent(); break; case S_FALSE: - //qDebug() << "S_FALSE"; + if (debugCDB > 1) + qDebug() << "WaitForEvent S_FALSE"; break; case E_PENDING: - qDebug() << "E_PENDING"; + if (debugCDB > 1) + qDebug() << "WaitForEvent E_PENDING"; break; case E_UNEXPECTED: + if (debugCDB > 1) + qDebug() << "WaitForEvent E_UNEXPECTED"; killWatchTimer(); break; case E_FAIL: - qDebug() << "E_FAIL"; + if (debugCDB > 1) + qDebug() << "WaitForEvent E_FAIL"; break; } } void CdbDebugEnginePrivate::handleDebugEvent() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; + if (m_bIgnoreNextDebugEvent) { m_engine->startWatchTimer(); m_bIgnoreNextDebugEvent = false; } else { - qq->notifyInferiorStopped(); + m_debuggerManagerAccess->notifyInferiorStopped(); updateThreadList(); updateStackTrace(); } @@ -462,7 +524,10 @@ void CdbDebugEnginePrivate::handleDebugEvent() void CdbDebugEnginePrivate::updateThreadList() { - ThreadsHandler* th = qq->threadsHandler(); + if (debugCDB) + qDebug() << Q_FUNC_INFO; + + ThreadsHandler* th = m_debuggerManagerAccess->threadsHandler(); QList threads; HRESULT hr; @@ -483,6 +548,9 @@ void CdbDebugEnginePrivate::updateThreadList() void CdbDebugEnginePrivate::updateStackTrace() { + if (debugCDB) + qDebug() << Q_FUNC_INFO; + //qDebug() << "updateStackTrace()"; HRESULT hr = m_pDebugSystemObjects->SetCurrentThreadId(m_currentThreadId); @@ -510,7 +578,7 @@ void CdbDebugEnginePrivate::updateStackTrace() StackFrame frame; frame.line = 0; frame.level = i; - frame.address = QString("0x%1").arg(frames[i].InstructionOffset, 0, 16); + frame.address = QString::fromLatin1("0x%1").arg(frames[i].InstructionOffset, 0, 16); m_pDebugSymbols->GetNameByOffsetWide(frames[i].InstructionOffset, wszBuf, MAX_PATH, 0, 0); frame.function = QString::fromUtf16(wszBuf); @@ -526,15 +594,15 @@ void CdbDebugEnginePrivate::updateStackTrace() stackFrames.append(frame); } - qq->stackHandler()->setFrames(stackFrames); + m_debuggerManagerAccess->stackHandler()->setFrames(stackFrames); // find the first usable frame and select it for (int i=0; i < stackFrames.count(); ++i) { const StackFrame &frame = stackFrames.at(i); - bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable(); + const bool usable = !frame.file.isEmpty() && QFileInfo(frame.file).isReadable(); if (usable) { - qq->stackHandler()->setCurrentIndex(i); - q->gotoLocation(frame.file, frame.line, true); + m_debuggerManagerAccess->stackHandler()->setCurrentIndex(i); + m_debuggerManager->gotoLocation(frame.file, frame.line, true); break; } } @@ -550,13 +618,14 @@ void CdbDebugEnginePrivate::updateStackTrace() void CdbDebugEnginePrivate::handleDebugOutput(const char* szOutputString) { - qq->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); + m_debuggerManagerAccess->showApplicationOutput(QString::fromLocal8Bit(szOutputString)); } void CdbDebugEnginePrivate::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP) { Q_UNUSED(pBP) - qDebug() << "CdbDebugEngine::handleBreakpointEvent()"; + if (debugCDB) + qDebug() << Q_FUNC_INFO; } IDebuggerEngine *createWinEngine(DebuggerManager *parent) diff --git a/src/plugins/debugger/cdb/cdbdebugengine_p.h b/src/plugins/debugger/cdb/cdbdebugengine_p.h index e470ca70409..db3a19e0a8b 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine_p.h +++ b/src/plugins/debugger/cdb/cdbdebugengine_p.h @@ -34,7 +34,6 @@ #ifndef DEBUGGER_CDBENGINEPRIVATE_H #define DEBUGGER_CDBENGINEPRIVATE_H -#include "cdbdebugengine.h" #include "cdbdebugeventcallback.h" #include "cdbdebugoutput.h" @@ -71,10 +70,12 @@ struct CdbDebugEnginePrivate CdbDebugOutput m_debugOutputCallBack; CdbDebugEngine* m_engine; - DebuggerManager *q; - IDebuggerManagerAccessForEngines *qq; + DebuggerManager *m_debuggerManager; + IDebuggerManagerAccessForEngines *m_debuggerManagerAccess; }; +enum { debugCDB = 0 }; + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp index 0c4d29469dc..94135d2d75f 100644 --- a/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp +++ b/src/plugins/debugger/cdb/cdbdebugeventcallback.cpp @@ -41,6 +41,11 @@ namespace Debugger { namespace Internal { +CdbDebugEventCallback::CdbDebugEventCallback(CdbDebugEngine* dbg) : + m_pEngine(dbg) +{ +} + STDMETHODIMP CdbDebugEventCallback::QueryInterface( THIS_ IN REFIID InterfaceId, @@ -49,14 +54,11 @@ STDMETHODIMP CdbDebugEventCallback::QueryInterface( *Interface = NULL; if (IsEqualIID(InterfaceId, __uuidof(IUnknown)) || - IsEqualIID(InterfaceId, __uuidof(IDebugOutputCallbacks))) - { + IsEqualIID(InterfaceId, __uuidof(IDebugOutputCallbacks))) { *Interface = (IDebugOutputCallbacks *)this; AddRef(); return S_OK; - } - else - { + } else { return E_NOINTERFACE; } } @@ -87,7 +89,8 @@ STDMETHODIMP CdbDebugEventCallback::GetInterestMask(THIS_ __out PULONG mask) STDMETHODIMP CdbDebugEventCallback::Breakpoint(THIS_ __in PDEBUG_BREAKPOINT Bp) { - qDebug() << "MSVCDebugEventCallback::Breakpoint"; + if (debugCDB) + qDebug() << Q_FUNC_INFO; m_pEngine->m_d->handleBreakpointEvent(Bp); return S_OK; } @@ -98,7 +101,9 @@ STDMETHODIMP CdbDebugEventCallback::Exception( __in ULONG FirstChance ) { - qDebug() << "MSVCDebugEventCallback::Exception"; + Q_UNUSED(Exception) + if (debugCDB) + qDebug() << Q_FUNC_INFO << FirstChance; return S_OK; } @@ -109,6 +114,12 @@ STDMETHODIMP CdbDebugEventCallback::CreateThread( __in ULONG64 StartOffset ) { + Q_UNUSED(Handle) + Q_UNUSED(DataOffset) + Q_UNUSED(StartOffset) + + if (debugCDB) + qDebug() << Q_FUNC_INFO; //Debugger::ThreadInfo ti; //ti.handle = Handle; //ti.dataOffset = DataOffset; @@ -121,6 +132,9 @@ STDMETHODIMP CdbDebugEventCallback::ExitThread( __in ULONG ExitCode ) { + if (debugCDB) + qDebug() << Q_FUNC_INFO << ExitCode; + return S_OK; } @@ -139,10 +153,21 @@ STDMETHODIMP CdbDebugEventCallback::CreateProcess( __in ULONG64 StartOffset ) { + Q_UNUSED(ImageFileHandle) + Q_UNUSED(BaseOffset) + Q_UNUSED(ModuleSize) + Q_UNUSED(ModuleName) + Q_UNUSED(ImageName) + Q_UNUSED(CheckSum) + Q_UNUSED(TimeDateStamp) + Q_UNUSED(ThreadDataOffset) + Q_UNUSED(StartOffset) + if (debugCDB) + qDebug() << Q_FUNC_INFO << ModuleName; + m_pEngine->m_d->m_hDebuggeeProcess = (HANDLE)Handle; m_pEngine->m_d->m_hDebuggeeThread = (HANDLE)InitialThreadHandle; - //m_pEngine->qq->notifyStartupFinished(); - m_pEngine->m_d->qq->notifyInferiorRunning(); + m_pEngine->m_d->m_debuggerManagerAccess->notifyInferiorRunning(); ULONG currentThreadId; if (SUCCEEDED(m_pEngine->m_d->m_pDebugSystemObjects->GetThreadIdByHandle(InitialThreadHandle, ¤tThreadId))) @@ -159,10 +184,12 @@ STDMETHODIMP CdbDebugEventCallback::ExitProcess( __in ULONG ExitCode ) { - UNREFERENCED_PARAMETER(ExitCode); + if (debugCDB) + qDebug() << Q_FUNC_INFO << ExitCode; + m_pEngine->m_d->m_hDebuggeeProcess = 0; m_pEngine->m_d->m_hDebuggeeThread = 0; - m_pEngine->m_d->qq->notifyInferiorExited(); + m_pEngine->m_d->m_debuggerManagerAccess->notifyInferiorExited(); return S_OK; } @@ -177,6 +204,16 @@ STDMETHODIMP CdbDebugEventCallback::LoadModule( __in ULONG TimeDateStamp ) { + Q_UNUSED(ImageFileHandle) + Q_UNUSED(BaseOffset) + Q_UNUSED(ModuleSize) + Q_UNUSED(ModuleName) + Q_UNUSED(ImageName) + Q_UNUSED(CheckSum) + Q_UNUSED(TimeDateStamp) + if (debugCDB) + qDebug() << Q_FUNC_INFO << ModuleName; + return S_OK; } @@ -186,6 +223,11 @@ STDMETHODIMP CdbDebugEventCallback::UnloadModule( __in ULONG64 BaseOffset ) { + Q_UNUSED(ImageBaseName) + Q_UNUSED(BaseOffset) + if (debugCDB) + qDebug() << Q_FUNC_INFO << ImageBaseName; + return S_OK; } @@ -195,6 +237,8 @@ STDMETHODIMP CdbDebugEventCallback::SystemError( __in ULONG Level ) { + if (debugCDB) + qDebug() << Q_FUNC_INFO << Error << Level; return S_OK; } @@ -203,6 +247,7 @@ STDMETHODIMP CdbDebugEventCallback::SessionStatus( __in ULONG Status ) { + Q_UNUSED(Status) return S_OK; } @@ -212,6 +257,8 @@ STDMETHODIMP CdbDebugEventCallback::ChangeDebuggeeState( __in ULONG64 Argument ) { + Q_UNUSED(Flags) + Q_UNUSED(Argument) return S_OK; } @@ -221,6 +268,8 @@ STDMETHODIMP CdbDebugEventCallback::ChangeEngineState( __in ULONG64 Argument ) { + Q_UNUSED(Flags) + Q_UNUSED(Argument) return S_OK; } @@ -230,6 +279,8 @@ STDMETHODIMP CdbDebugEventCallback::ChangeSymbolState( __in ULONG64 Argument ) { + Q_UNUSED(Flags) + Q_UNUSED(Argument) return S_OK; } diff --git a/src/plugins/debugger/cdb/cdbdebugeventcallback.h b/src/plugins/debugger/cdb/cdbdebugeventcallback.h index 25b2faf3fa3..1a1fdbe0ec5 100644 --- a/src/plugins/debugger/cdb/cdbdebugeventcallback.h +++ b/src/plugins/debugger/cdb/cdbdebugeventcallback.h @@ -45,9 +45,7 @@ class CdbDebugEngine; class CdbDebugEventCallback : public IDebugEventCallbacks { public: - CdbDebugEventCallback(CdbDebugEngine* dbg) - : m_pEngine(dbg) - {} + explicit CdbDebugEventCallback(CdbDebugEngine* dbg); // IUnknown. STDMETHOD(QueryInterface)( @@ -158,7 +156,7 @@ public: ); private: - CdbDebugEngine* m_pEngine; + CdbDebugEngine *m_pEngine; }; } // namespace Internal diff --git a/src/plugins/debugger/cdb/cdbdebugoutput.cpp b/src/plugins/debugger/cdb/cdbdebugoutput.cpp index b342ff03d85..4fa10b2ab53 100644 --- a/src/plugins/debugger/cdb/cdbdebugoutput.cpp +++ b/src/plugins/debugger/cdb/cdbdebugoutput.cpp @@ -31,16 +31,22 @@ ** ***************************************************************************/ -#include -#include #include "cdbdebugoutput.h" #include "cdbdebugengine.h" #include "cdbdebugengine_p.h" +#include +#include + namespace Debugger { namespace Internal { +CdbDebugOutput::CdbDebugOutput(CdbDebugEngine* engine) : + m_pEngine(engine) +{ +} + STDMETHODIMP CdbDebugOutput::QueryInterface( THIS_ IN REFIID InterfaceId, @@ -55,9 +61,7 @@ STDMETHODIMP CdbDebugOutput::QueryInterface( *Interface = (IDebugOutputCallbacks *)this; AddRef(); return S_OK; - } - else - { + } else { return E_NOINTERFACE; } } diff --git a/src/plugins/debugger/cdb/cdbdebugoutput.h b/src/plugins/debugger/cdb/cdbdebugoutput.h index b51fa6ee215..010e8769baa 100644 --- a/src/plugins/debugger/cdb/cdbdebugoutput.h +++ b/src/plugins/debugger/cdb/cdbdebugoutput.h @@ -34,6 +34,9 @@ #ifndef DEBUGGER_CDBOUTPUT_H #define DEBUGGER_CDBOUTPUT_H +#include +#include + namespace Debugger { namespace Internal { @@ -42,9 +45,7 @@ class CdbDebugEngine; class CdbDebugOutput : public IDebugOutputCallbacks { public: - CdbDebugOutput(CdbDebugEngine* engine) - : m_pEngine(engine) - {} + explicit CdbDebugOutput(CdbDebugEngine* engine); // IUnknown. STDMETHOD(QueryInterface)( From e330d9666855fe8cc87eba203d851b2fe4c18eec Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 23 Feb 2009 15:57:37 +0100 Subject: [PATCH 21/21] Better values for the progress bar. --- src/plugins/cpptools/cppmodelmanager.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 3cbabb8fddc..c23b0c3204a 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -169,11 +169,16 @@ public: void setIncludePaths(const QStringList &includePaths); void setFrameworkPaths(const QStringList &frameworkPaths); void setProjectFiles(const QStringList &files); + void setTodo(const QStringList &files); + void run(QString &fileName); void operator()(QString &fileName); void resetEnvironment(); + const QSet &todo() const + { return m_todo; } + public: // attributes Snapshot snapshot; @@ -207,6 +212,7 @@ private: QStringList m_frameworkPaths; QSet m_included; CPlusPlus::Document::Ptr m_currentDoc; + QSet m_todo; }; } // namespace Internal @@ -230,6 +236,9 @@ void CppPreprocessor::setFrameworkPaths(const QStringList &frameworkPaths) void CppPreprocessor::setProjectFiles(const QStringList &files) { m_projectFiles = files; } +void CppPreprocessor::setTodo(const QStringList &files) +{ m_todo = QSet::fromList(files); } + void CppPreprocessor::run(QString &fileName) { sourceNeeded(fileName, IncludeGlobal, /*line = */ 0); } @@ -447,6 +456,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, m_currentDoc->addDiagnosticMessage(d); //qWarning() << "file not found:" << fileName << m_currentDoc->fileName() << env.current_line; + return; } } @@ -483,6 +493,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, m_modelManager->emitDocumentUpdated(m_currentDoc); // ### TODO: compress (void) switchDocument(previousDoc); + m_todo.remove(fileName); } Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) @@ -904,6 +915,8 @@ void CppModelManager::parse(QFutureInterface &future, files = sources; files += headers; + preproc->setTodo(files); + // Change the priority of the background parser thread to idle. QThread::currentThread()->setPriority(QThread::IdlePriority); @@ -921,8 +934,6 @@ void CppModelManager::parse(QFutureInterface &future, if (future.isCanceled()) break; - future.setProgressValue(i); - #ifdef CPPTOOLS_DEBUG_PARSING_TIME QTime tm; tm.start(); @@ -945,6 +956,8 @@ void CppModelManager::parse(QFutureInterface &future, preproc->run(fileName); + future.setProgressValue(files.size() - preproc->todo().size()); + if (isSourceFile) preproc->resetEnvironment();