From 0b4b3698b29436b299d4e4a315d610bc1ab98acb Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 19 Aug 2018 16:10:55 +0200 Subject: Bug 691689 - Line numbers for examples --- doc/commands.doc | 77 ++++++----- qtools/CMakeLists.txt | 1 + qtools/qcstringlist.cpp | 192 ++++++++++++++++++++++++++ qtools/qcstringlist.h | 47 +++++++ src/commentscan.l | 349 +++++++++++++++++++++++++---------------------- src/docparser.cpp | 27 +++- src/doctokenizer.h | 1 + src/doctokenizer.l | 17 +++ src/doxygen.cpp | 11 +- src/entry.h | 15 +- src/fortrancode.l | 18 +-- src/pagedef.cpp | 11 ++ src/pagedef.h | 3 + src/qhp.cpp | 12 +- src/tagreader.cpp | 58 ++++---- src/tclscanner.l | 119 ++++++++-------- src/vhdlcode.l | 31 ++--- src/vhdldocgen.cpp | 68 ++++----- src/vhdljjparser.cpp | 14 +- src/vhdljjparser.h | 3 +- vhdlparser/VhdlParser.cc | 6 +- vhdlparser/vhdlparser.jj | 6 +- 22 files changed, 709 insertions(+), 377 deletions(-) create mode 100644 qtools/qcstringlist.cpp create mode 100644 qtools/qcstringlist.h diff --git a/doc/commands.doc b/doc/commands.doc index 6c680ee..2e51d79 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -442,14 +442,15 @@ Structural indicators \endlatexonly


-\section cmdexample \\example +\section cmdexample \\example[{lineno}] \addindex \\example Indicates that a comment block contains documentation for a source code - example. The name of the source file is \. The text of - this file will be included in the documentation, just after the - documentation contained in the comment block. All examples are placed - in a list. The source code is scanned for documented members and classes. + example. The name of the source file is \. + The contents of this file will be included in the documentation, just after the + documentation contained in the comment block. + You can add option `{lineno}` to enable line numbers for the example if desired. + All examples are placed in a list. The source code is scanned for documented members and classes. If any are found, the names are cross-referenced with the documentation. Source files or directories can be specified using the \ref cfg_example_path "EXAMPLE_PATH" @@ -2151,16 +2152,12 @@ Commands for displaying examples for the corresponding \mbox{\LaTeX} documentation that is generated by doxygen. \endlatexonly - Alternatively, the \ref cmdsnippet "\\snippet" command can be used to - include only a fragment of a source file. For this to work the - fragment has to be marked. - \sa sections \ref cmdline "\\line", \ref cmdskip "\\skip", \ref cmdskipline "\\skipline", \ref cmduntil "\\until", and \ref cmdinclude "\\include".


-\section cmdinclude \\include +\section cmdinclude[{lineno|doc}] \\include \addindex \\include This command can be used to include a source file as a block of code. @@ -2194,8 +2191,20 @@ Commands for displaying examples \note Doxygen's special commands do not work inside blocks of code. It is allowed to nest C-style comments inside a code block though. + You can add option `{lineno}` to enable line numbers for the included code if desired. + + You can add option `{doc}` to treat the file as documentation rather than code. + + \note Some that when using the `{doc}` option, + commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with + this command due to the moment of parsing. + + \note The included documentation should not have comment signs in it as they will appear + in the documentation as well. + \sa sections \ref cmdexample "\\example", \ref cmddontinclude "\\dontinclude", - \ref cmdverbatim "\\verbatim" and \ref cmdincludedoc "\\includedoc". + \ref cmdverbatim "\\verbatim", \ref cmdincludedoc "\\includedoc", and + \ref cmdsnippet "\\snippet".
\section cmdincludelineno \\includelineno @@ -2204,21 +2213,14 @@ Commands for displaying examples This command works the same way as \ref cmdinclude "\\include", but will add line numbers to the included file. - \sa sections \ref cmdinclude "\\include" and \ref cmdsnippetlineno "\\snippetlineno". + \sa sections \ref cmdinclude "\\include{lineno}".
\section cmdincludedoc \\includedoc \addindex \\includedoc - This command works the same way as \ref cmdinclude "\\include", but it will include - the content of the file as if it were at the place where this command is called. - The result is that the content is parsed by doxygen and placed in the documentation. - - \note Some commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with - this command due to the moment of parsing. - - \note The included documentation should not have comment signs in it as they will appear - in the documentation as well. + This command is obsolete and is still supported for backward compatibility reasons, + it works the same way as \ref cmdinclude "\\include{doc}" \sa section \ref cmdinclude "\\include". @@ -2278,7 +2280,7 @@ Commands for displaying examples See section \ref cmddontinclude "\\dontinclude" for an example.
-\section cmdsnippet \\snippet ( block_id ) +\section cmdsnippet \\snippet[{lineno|doc}] ( block_id ) \addindex \\snippet Where the \ref cmdinclude "\\include" command can be used to include @@ -2321,34 +2323,37 @@ Commands for displaying examples Note also that the [block_id] markers should appear exactly twice in the source file. + You can add option `{lineno}` to enable line numbers for the snippet if desired. + + You can add option `{doc}` to treat the file as documentation rather than code. + + \note Some that when using the `{doc}` option, + commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with + this command due to the moment of parsing. + + \note The included documentation should not have comment signs in it as they will appear + in the documentation as well. + see section \ref cmddontinclude "\\dontinclude" for an alternative way to include fragments of a source file that does not require markers. - \sa section \ref cmdsnippetdoc "\\snippetdoc" and \ref cmdsnippetlineno "\\snippetlineno".
\section cmdsnippetlineno \\snippetlineno ( block_id ) \addindex \\snippetlineno - This command works the same way as \ref cmdsnippet "\\snippet", but will add line - numbers to the included snippet. + This command is obsolete and is still supported for backward compatibility reasons, + it works the same way as \ref cmdsnippet "\\snippet{lineno}" - \sa sections \ref cmdsnippet "\\snippet" and \ref cmdincludelineno "\\includelineno". + \sa sections \ref cmdsnippet "\\snippet{lineno}"
\section cmdsnippetdoc \\snippetdoc ( block_id ) \addindex \\snippetdoc - This command works the same way as \ref cmdsnippet "\\snippet", but it will include - the content of the file between the `block-id`s as if it were at the place where this command is called. - The result is that the content is parsed by doxygen and placed in the documentation. - - \note Some commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with - this command due to the moment of parsing. - - \note The included documentation should not have comment signs in it as they will appear - in the documentation as well. + This command is obsolete and is still supported for backward compatibility reasons, + it works the same way as \ref cmdsnippet "\\snippet{doc}" - \sa section \ref cmdsnippet "\\snippet" and \ref cmdincludedoc "\\includedoc". + \sa section \ref cmdsnippet "\\snippet{doc}" and \ref cmdinclude "\\include{doc}".
\section cmduntil \\until ( pattern ) diff --git a/qtools/CMakeLists.txt b/qtools/CMakeLists.txt index 17f8eb4..cc64de1 100644 --- a/qtools/CMakeLists.txt +++ b/qtools/CMakeLists.txt @@ -22,6 +22,7 @@ qstring.cpp qtextstream.cpp qtextcodec.cpp qstringlist.cpp +qcstringlist.cpp qxml.cpp qmap.cpp qthread.cpp diff --git a/qtools/qcstringlist.cpp b/qtools/qcstringlist.cpp new file mode 100644 index 0000000..5725971 --- /dev/null +++ b/qtools/qcstringlist.cpp @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 1997-2018 by Dimitri van Heesch. +** +** Permission to use, copy, modify, and distribute this software and its +** documentation under the terms of the GNU General Public License is hereby +** granted. No representations are made about the suitability of this software +** for any purpose. It is provided "as is" without express or implied warranty. +** See the GNU General Public License for more details. +** +** Implementation of QCStringList +** +**********************************************************************/ + +#include "qcstringlist.h" + +#include "qstrlist.h" +#include "qdatastream.h" +#include "qtl.h" + +/*! + Splits the string \a str using \a sep as separator. Returns the + list of strings. If \a allowEmptyEntries is TRUE, also empty + entries are inserted into the list, else not. So if you have + a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e' + would be returned if \a allowEmptyEntries is FALSE, but + a list containing 'abc', '', 'd', 'e' and '' would be returned if + \a allowEmptyEntries is TRUE. + If \a str doesn't contain \a sep, a stringlist + with one item, which is the same as \a str, is returned. + + \sa join() +*/ + +QCStringList QCStringList::split( char sep, const QCString &str, bool allowEmptyEntries ) +{ + char cs[2] = { sep, '\0' }; + return split( cs, str, allowEmptyEntries ); +} + +/*! + Splits the string \a str using \a sep as separator. Returns the + list of strings. If \a allowEmptyEntries is TRUE, also empty + entries are inserted into the list, else not. So if you have + a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e' + would be returned if \a allowEmptyEntries is FALSE, but + a list containing 'abc', '', 'd', 'e' and '' would be returned if + \a allowEmptyEntries is TRUE. + If \a str doesn't contain \a sep, a stringlist + with one item, which is the same as \a str, is returned. + + \sa join() +*/ + +QCStringList QCStringList::split( const QCString &sep, const QCString &str, bool allowEmptyEntries ) +{ + QCStringList lst; + + int j = 0; + int i = str.find( sep, j ); + + while ( i != -1 ) { + if ( str.mid( j, i - j ).length() > 0 ) + lst << str.mid( j, i - j ); + else if ( allowEmptyEntries ) + lst << QCString(); + j = i + sep.length(); + i = str.find( sep, j ); + } + + int l = str.length() - 1; + if ( str.mid( j, l - j + 1 ).length() > 0 ) + lst << str.mid( j, l - j + 1 ); + else if ( allowEmptyEntries ) + lst << QCString(); + + return lst; +} + +/*! + Splits the string \a str using the regular expression \a sep as separator. Returns the + list of strings. If \a allowEmptyEntries is TRUE, also empty + entries are inserted into the list, else not. So if you have + a string 'abc..d.e.', a list which contains 'abc', 'd', and 'e' + would be returned if \a allowEmptyEntries is FALSE, but + a list containing 'abc', '', 'd', 'e' and '' would be returned if + \a allowEmptyEntries is TRUE. + If \a str doesn't contain \a sep, a stringlist + with one item, which is the same as \a str, is returned. + + \sa join() +*/ + +QCStringList QCStringList::split( const QRegExp &sep, const QCString &str, bool allowEmptyEntries ) +{ + QCStringList lst; + + int j = 0; + int len = 0; + int i = sep.match( str.data(), j, &len ); + + while ( i != -1 ) { + if ( str.mid( j, i - j ).length() > 0 ) + lst << str.mid( j, i - j ); + else if ( allowEmptyEntries ) + lst << QCString(); + j = i + len; + i = sep.match( str.data(), j, &len ); + } + + int l = str.length() - 1; + if ( str.mid( j, l - j + 1 ).length() > 0 ) + lst << str.mid( j, l - j + 1 ); + else if ( allowEmptyEntries ) + lst << QCString(); + + return lst; +} + +/*! + Returns a list of all strings containing the substring \a str. + + If \a cs is TRUE, the grep is done case sensitively, else not. +*/ + +QCStringList QCStringList::grep( const QCString &str, bool cs ) const +{ + QCStringList res; + for ( QCStringList::ConstIterator it = begin(); it != end(); ++it ) + if ( (*it).contains( str, cs ) ) + res << *it; + + return res; +} + +/*! + Returns a list of all strings containing a substring that matches + the regular expression \a expr. +*/ + +QCStringList QCStringList::grep( const QRegExp &expr ) const +{ + QCStringList res; + for ( QCStringList::ConstIterator it = begin(); it != end(); ++it ) + if ( (*it).contains( expr ) ) + res << *it; + + return res; +} + +/*! + Joins the stringlist into a single string with each element + separated by \a sep. + + \sa split() +*/ +QCString QCStringList::join( const QCString &sep ) const +{ + QCString res; + bool alredy = FALSE; + for ( QCStringList::ConstIterator it = begin(); it != end(); ++it ) { + if ( alredy ) + res += sep; + alredy = TRUE; + res += *it; + } + + return res; +} + +Q_EXPORT QDataStream &operator>>( QDataStream & s, QCStringList& l ) +{ + return s >> (QValueList&)l; +} + +Q_EXPORT QDataStream &operator<<( QDataStream & s, const QCStringList& l ) +{ + return s << (const QValueList&)l; +} + +/*! + Converts from a QStrList (ASCII) to a QCStringList (Unicode). +*/ +QCStringList QCStringList::fromStrList(const QStrList& ascii) +{ + QCStringList res; + const char * s; + for ( QStrListIterator it(ascii); (s=it.current()); ++it ) + res << s; + return res; +} + diff --git a/qtools/qcstringlist.h b/qtools/qcstringlist.h new file mode 100644 index 0000000..604a196 --- /dev/null +++ b/qtools/qcstringlist.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 1997-2018 by Dimitri van Heesch. +** +** Permission to use, copy, modify, and distribute this software and its +** documentation under the terms of the GNU General Public License is hereby +** granted. No representations are made about the suitability of this software +** for any purpose. It is provided "as is" without express or implied warranty. +** See the GNU General Public License for more details. +** +** Note: this is a variant of the qstringlist.h but for QCString's +** +**********************************************************************/ +#ifndef QCSTRINGLIST_H +#define QCSTRINGLIST_H + +#include "qvaluelist.h" +#include "qcstring.h" +#include "qregexp.h" + +class QStrList; +class QDataStream; + +class QCStringList : public QValueList +{ +public: + QCStringList() { } + QCStringList( const QCStringList& l ) : QValueList(l) { } + QCStringList( const QValueList& l ) : QValueList(l) { } + QCStringList( const QCString& i ) { append(i); } + QCStringList( const char* i ) { append(i); } + + static QCStringList fromStrList(const QStrList&); + + static QCStringList split( const QCString &sep, const QCString &str, bool allowEmptyEntries = FALSE ); + static QCStringList split( char sep, const QCString &str, bool allowEmptyEntries = FALSE ); + static QCStringList split( const QRegExp &sep, const QCString &str, bool allowEmptyEntries = FALSE ); + QCString join( const QCString &sep ) const; + + QCStringList grep( const QCString &str, bool cs = TRUE ) const; + QCStringList grep( const QRegExp &expr ) const; +}; + +extern Q_EXPORT QDataStream &operator>>( QDataStream &, QCStringList& ); +extern Q_EXPORT QDataStream &operator<<( QDataStream &, const QCStringList& ); + +#endif // QCSTRINGLIST_H diff --git a/src/commentscan.l b/src/commentscan.l index e40d80f..39b0edc 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -30,8 +30,7 @@ #include #include #include -#include - +#include #include "scanner.h" #include "entry.h" #include "doxygen.h" @@ -55,81 +54,81 @@ #define YY_NO_UNISTD_H 1 // forward declarations -static bool handleBrief(const QCString &, const QCString &); -static bool handleFn(const QCString &, const QCString &); -static bool handleDef(const QCString &, const QCString &); -static bool handleOverload(const QCString &, const QCString &); -static bool handleEnum(const QCString &, const QCString &); -static bool handleDefGroup(const QCString &, const QCString &); -static bool handleAddToGroup(const QCString &, const QCString &); -static bool handleWeakGroup(const QCString &, const QCString &); -static bool handleNamespace(const QCString &, const QCString &); -static bool handlePackage(const QCString &, const QCString &); -static bool handleClass(const QCString &, const QCString &); -static bool handleHeaderFile(const QCString &, const QCString &); -static bool handleProtocol(const QCString &, const QCString &); -static bool handleCategory(const QCString &, const QCString &); -static bool handleUnion(const QCString &, const QCString &); -static bool handleStruct(const QCString &, const QCString &); -static bool handleInterface(const QCString &, const QCString &); -static bool handleIdlException(const QCString &, const QCString &); -static bool handlePage(const QCString &, const QCString &); -static bool handleMainpage(const QCString &, const QCString &); -static bool handleFile(const QCString &, const QCString &); -static bool handleDir(const QCString &, const QCString &); -static bool handleExample(const QCString &, const QCString &); -static bool handleDetails(const QCString &, const QCString &); -static bool handleName(const QCString &, const QCString &); -static bool handleTodo(const QCString &, const QCString &); -static bool handleTest(const QCString &, const QCString &); -static bool handleBug(const QCString &, const QCString &); -static bool handleSubpage(const QCString &s, const QCString &); -static bool handleDeprecated(const QCString &, const QCString &); -static bool handleXRefItem(const QCString &, const QCString &); -static bool handleRelated(const QCString &, const QCString &); -static bool handleRelatedAlso(const QCString &, const QCString &); -static bool handleMemberOf(const QCString &, const QCString &); -static bool handleRefItem(const QCString &, const QCString &); -static bool handleSection(const QCString &, const QCString &); -static bool handleAnchor(const QCString &, const QCString &); -static bool handleCite(const QCString &, const QCString &); -static bool handleFormatBlock(const QCString &, const QCString &); -static bool handleAddIndex(const QCString &, const QCString &); -static bool handleIf(const QCString &, const QCString &); -static bool handleIfNot(const QCString &, const QCString &); -static bool handleElseIf(const QCString &, const QCString &); -static bool handleElse(const QCString &, const QCString &); -static bool handleEndIf(const QCString &, const QCString &); -static bool handleIngroup(const QCString &, const QCString &); -static bool handleNoSubGrouping(const QCString &, const QCString &); -static bool handleShowInitializer(const QCString &, const QCString &); -static bool handleHideInitializer(const QCString &, const QCString &); -static bool handleCallgraph(const QCString &, const QCString &); -static bool handleHideCallgraph(const QCString &, const QCString &); -static bool handleCallergraph(const QCString &, const QCString &); -static bool handleHideCallergraph(const QCString &, const QCString &); -static bool handleInternal(const QCString &, const QCString &); -static bool handleLineBr(const QCString &, const QCString &); -static bool handleStatic(const QCString &, const QCString &); -static bool handlePure(const QCString &, const QCString &); -static bool handlePrivate(const QCString &, const QCString &); -static bool handlePrivateSection(const QCString &, const QCString &); -static bool handleProtected(const QCString &, const QCString &); -static bool handleProtectedSection(const QCString &, const QCString &); -static bool handlePublic(const QCString &s, const QCString &); -static bool handlePublicSection(const QCString &s, const QCString &); -static bool handleToc(const QCString &s, const QCString &); -static bool handleInherit(const QCString &, const QCString &); -static bool handleExtends(const QCString &, const QCString &); -static bool handleCopyDoc(const QCString &, const QCString &); -static bool handleCopyBrief(const QCString &, const QCString &); -static bool handleCopyDetails(const QCString &, const QCString &); -static bool handleParBlock(const QCString &, const QCString &); -static bool handleEndParBlock(const QCString &, const QCString &); -static bool handleParam(const QCString &, const QCString &); -static bool handleRetval(const QCString &, const QCString &); - -typedef bool (*DocCmdFunc)(const QCString &name, const QCString &opt); +static bool handleBrief(const QCString &, const QCStringList &); +static bool handleFn(const QCString &, const QCStringList &); +static bool handleDef(const QCString &, const QCStringList &); +static bool handleOverload(const QCString &, const QCStringList &); +static bool handleEnum(const QCString &, const QCStringList &); +static bool handleDefGroup(const QCString &, const QCStringList &); +static bool handleAddToGroup(const QCString &, const QCStringList &); +static bool handleWeakGroup(const QCString &, const QCStringList &); +static bool handleNamespace(const QCString &, const QCStringList &); +static bool handlePackage(const QCString &, const QCStringList &); +static bool handleClass(const QCString &, const QCStringList &); +static bool handleHeaderFile(const QCString &, const QCStringList &); +static bool handleProtocol(const QCString &, const QCStringList &); +static bool handleCategory(const QCString &, const QCStringList &); +static bool handleUnion(const QCString &, const QCStringList &); +static bool handleStruct(const QCString &, const QCStringList &); +static bool handleInterface(const QCString &, const QCStringList &); +static bool handleIdlException(const QCString &, const QCStringList &); +static bool handlePage(const QCString &, const QCStringList &); +static bool handleMainpage(const QCString &, const QCStringList &); +static bool handleFile(const QCString &, const QCStringList &); +static bool handleDir(const QCString &, const QCStringList &); +static bool handleExample(const QCString &, const QCStringList &); +static bool handleDetails(const QCString &, const QCStringList &); +static bool handleName(const QCString &, const QCStringList &); +static bool handleTodo(const QCString &, const QCStringList &); +static bool handleTest(const QCString &, const QCStringList &); +static bool handleBug(const QCString &, const QCStringList &); +static bool handleSubpage(const QCString &s, const QCStringList &); +static bool handleDeprecated(const QCString &, const QCStringList &); +static bool handleXRefItem(const QCString &, const QCStringList &); +static bool handleRelated(const QCString &, const QCStringList &); +static bool handleRelatedAlso(const QCString &, const QCStringList &); +static bool handleMemberOf(const QCString &, const QCStringList &); +static bool handleRefItem(const QCString &, const QCStringList &); +static bool handleSection(const QCString &, const QCStringList &); +static bool handleAnchor(const QCString &, const QCStringList &); +static bool handleCite(const QCString &, const QCStringList &); +static bool handleFormatBlock(const QCString &, const QCStringList &); +static bool handleAddIndex(const QCString &, const QCStringList &); +static bool handleIf(const QCString &, const QCStringList &); +static bool handleIfNot(const QCString &, const QCStringList &); +static bool handleElseIf(const QCString &, const QCStringList &); +static bool handleElse(const QCString &, const QCStringList &); +static bool handleEndIf(const QCString &, const QCStringList &); +static bool handleIngroup(const QCString &, const QCStringList &); +static bool handleNoSubGrouping(const QCString &, const QCStringList &); +static bool handleShowInitializer(const QCString &, const QCStringList &); +static bool handleHideInitializer(const QCString &, const QCStringList &); +static bool handleCallgraph(const QCString &, const QCStringList &); +static bool handleHideCallgraph(const QCString &, const QCStringList &); +static bool handleCallergraph(const QCString &, const QCStringList &); +static bool handleHideCallergraph(const QCString &, const QCStringList &); +static bool handleInternal(const QCString &, const QCStringList &); +static bool handleLineBr(const QCString &, const QCStringList &); +static bool handleStatic(const QCString &, const QCStringList &); +static bool handlePure(const QCString &, const QCStringList &); +static bool handlePrivate(const QCString &, const QCStringList &); +static bool handlePrivateSection(const QCString &, const QCStringList &); +static bool handleProtected(const QCString &, const QCStringList &); +static bool handleProtectedSection(const QCString &, const QCStringList &); +static bool handlePublic(const QCString &s, const QCStringList &); +static bool handlePublicSection(const QCString &s, const QCStringList &); +static bool handleToc(const QCString &s, const QCStringList &); +static bool handleInherit(const QCString &, const QCStringList &); +static bool handleExtends(const QCString &, const QCStringList &); +static bool handleCopyDoc(const QCString &, const QCStringList &); +static bool handleCopyBrief(const QCString &, const QCStringList &); +static bool handleCopyDetails(const QCString &, const QCStringList &); +static bool handleParBlock(const QCString &, const QCStringList &); +static bool handleEndParBlock(const QCString &, const QCStringList &); +static bool handleParam(const QCString &, const QCStringList &); +static bool handleRetval(const QCString &, const QCStringList &); + +typedef bool (*DocCmdFunc)(const QCString &name, const QCStringList &optList); struct DocCmdMap { @@ -1106,16 +1105,18 @@ RCSTAG "$"{ID}":"[^\n$]+"$" // the {B}* in the front was added for bug620924 QCString fullMatch = QCString(yytext); int idx = fullMatch.find('{'); + int idxEnd = fullMatch.find("}",idx+1); QCString cmdName; - QCString optName; - if (idx == -1) + QCStringList optList; + if (idx == -1) // no options { cmdName = QCString(yytext).stripWhiteSpace().data()+1; // to remove {CMD} } - else + else // options present { cmdName = fullMatch.left(idx).stripWhiteSpace().data()+1; // to remove {CMD} - optName = fullMatch.right(fullMatch.length() - idx).stripWhiteSpace().data(); + QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); + optList = QCStringList::split(',',optStr); } DocCmdMapper::Cmd *cmdPtr = DocCmdMapper::map(cmdName); if (cmdPtr) // special action is required @@ -1130,7 +1131,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" setOutput(OutputDoc); } //if (i>0) addOutput(QCString(yytext).left(i)); // removed for bug 689341 - if (cmdPtr->func && cmdPtr->func(cmdName, optName)) + if (cmdPtr->func && cmdPtr->func(cmdName, optList)) { // implicit split of the comment block into two // entries. Restart the next block at the start @@ -2293,14 +2294,14 @@ RCSTAG "$"{ID}":"[^\n$]+"$" //---------------------------------------------------------------------------- -static bool handleBrief(const QCString &, const QCString &) +static bool handleBrief(const QCString &, const QCStringList &) { //printf("handleBrief\n"); setOutput(OutputBrief); return FALSE; } -static bool handleFn(const QCString &, const QCString &) +static bool handleFn(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::MEMBERDOC_SEC); functionProto.resize(0); @@ -2309,7 +2310,7 @@ static bool handleFn(const QCString &, const QCString &) return stop; } -static bool handleDef(const QCString &, const QCString &) +static bool handleDef(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::DEFINEDOC_SEC); functionProto.resize(0); @@ -2317,21 +2318,21 @@ static bool handleDef(const QCString &, const QCString &) return stop; } -static bool handleOverload(const QCString &, const QCString &) +static bool handleOverload(const QCString &, const QCStringList &) { functionProto.resize(0); BEGIN(OverloadParam); return FALSE; } -static bool handleEnum(const QCString &, const QCString &) +static bool handleEnum(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::ENUMDOC_SEC); BEGIN(EnumDocArg1); return stop; } -static bool handleDefGroup(const QCString &, const QCString &) +static bool handleDefGroup(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::GROUPDOC_SEC); current->groupDocType = Entry::GROUPDOC_NORMAL; @@ -2339,7 +2340,7 @@ static bool handleDefGroup(const QCString &, const QCString &) return stop; } -static bool handleAddToGroup(const QCString &, const QCString &) +static bool handleAddToGroup(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::GROUPDOC_SEC); current->groupDocType = Entry::GROUPDOC_ADD; @@ -2347,7 +2348,7 @@ static bool handleAddToGroup(const QCString &, const QCString &) return stop; } -static bool handleWeakGroup(const QCString &, const QCString &) +static bool handleWeakGroup(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::GROUPDOC_SEC); current->groupDocType = Entry::GROUPDOC_WEAK; @@ -2355,83 +2356,83 @@ static bool handleWeakGroup(const QCString &, const QCString &) return stop; } -static bool handleNamespace(const QCString &, const QCString &) +static bool handleNamespace(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::NAMESPACEDOC_SEC); BEGIN( NameSpaceDocArg1 ); return stop; } -static bool handlePackage(const QCString &, const QCString &) +static bool handlePackage(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::PACKAGEDOC_SEC); BEGIN( PackageDocArg1 ); return stop; } -static bool handleClass(const QCString &, const QCString &) +static bool handleClass(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::CLASSDOC_SEC); BEGIN( ClassDocArg1 ); return stop; } -static bool handleHeaderFile(const QCString &, const QCString &) +static bool handleHeaderFile(const QCString &, const QCStringList &) { BEGIN( ClassDocArg2 ); return FALSE; } -static bool handleProtocol(const QCString &, const QCString &) +static bool handleProtocol(const QCString &, const QCStringList &) { // Obj-C protocol bool stop=makeStructuralIndicator(Entry::PROTOCOLDOC_SEC); BEGIN( ClassDocArg1 ); return stop; } -static bool handleCategory(const QCString &, const QCString &) +static bool handleCategory(const QCString &, const QCStringList &) { // Obj-C category bool stop=makeStructuralIndicator(Entry::CATEGORYDOC_SEC); BEGIN( CategoryDocArg1 ); return stop; } -static bool handleUnion(const QCString &, const QCString &) +static bool handleUnion(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::UNIONDOC_SEC); BEGIN( ClassDocArg1 ); return stop; } -static bool handleStruct(const QCString &, const QCString &) +static bool handleStruct(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::STRUCTDOC_SEC); BEGIN( ClassDocArg1 ); return stop; } -static bool handleInterface(const QCString &, const QCString &) +static bool handleInterface(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::INTERFACEDOC_SEC); BEGIN( ClassDocArg1 ); return stop; } -static bool handleIdlException(const QCString &, const QCString &) +static bool handleIdlException(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::EXCEPTIONDOC_SEC); BEGIN( ClassDocArg1 ); return stop; } -static bool handlePage(const QCString &, const QCString &) +static bool handlePage(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::PAGEDOC_SEC); BEGIN( PageDocArg1 ); return stop; } -static bool handleMainpage(const QCString &, const QCString &) +static bool handleMainpage(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::MAINPAGEDOC_SEC); if (!stop) @@ -2442,7 +2443,7 @@ static bool handleMainpage(const QCString &, const QCString &) return stop; } -static bool handleFile(const QCString &, const QCString &) +static bool handleFile(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::FILEDOC_SEC); if (!stop) @@ -2453,7 +2454,7 @@ static bool handleFile(const QCString &, const QCString &) return stop; } -static bool handleParam(const QCString &, const QCString &) +static bool handleParam(const QCString &, const QCStringList &) { // we need process param and retval arguments to escape leading underscores in case of // markdown processing, see bug775493 @@ -2462,14 +2463,14 @@ static bool handleParam(const QCString &, const QCString &) return FALSE; } -static bool handleRetval(const QCString &, const QCString &) +static bool handleRetval(const QCString &, const QCStringList &) { addOutput("@retval "); BEGIN( ParamArg1 ); return FALSE; } -static bool handleDir(const QCString &, const QCString &) +static bool handleDir(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::DIRDOC_SEC); if (!stop) current->name = yyFileName; @@ -2477,15 +2478,30 @@ static bool handleDir(const QCString &, const QCString &) return stop; } -static bool handleExample(const QCString &, const QCString &) +static bool handleExample(const QCString &cmd, const QCStringList &optList) { - bool stop=makeStructuralIndicator(Entry::EXAMPLE_SEC); + Entry::Sections section=Entry::EXAMPLE_SEC; + QCStringList::ConstIterator it; + for ( it = optList.begin(); it != optList.end(); ++it ) + { + QCString opt = (*it).stripWhiteSpace().lower(); + if (opt=="lineno") + { + section=Entry::EXAMPLE_LINENO_SEC; + } + else + { + warn(yyFileName,yyLineNr, + "unsupported option '%s' for command '\\%s'",qPrint(opt),qPrint(cmd)); + } + } + bool stop=makeStructuralIndicator(section); if (!stop) current->name = yyFileName; BEGIN( FileDocArg1 ); return stop; } -static bool handleDetails(const QCString &, const QCString &) +static bool handleDetails(const QCString &, const QCStringList &) { if (inContext!=OutputBrief) { @@ -2496,7 +2512,7 @@ static bool handleDetails(const QCString &, const QCString &) return FALSE; } -static bool handleName(const QCString &, const QCString &) +static bool handleName(const QCString &, const QCStringList &) { bool stop=makeStructuralIndicator(Entry::MEMBERGRP_SEC); if (!stop) @@ -2511,7 +2527,7 @@ static bool handleName(const QCString &, const QCString &) return stop; } -static bool handleTodo(const QCString &, const QCString &) +static bool handleTodo(const QCString &, const QCStringList &) { newXRefKind = XRef_Todo; setOutput(OutputXRef); @@ -2519,7 +2535,7 @@ static bool handleTodo(const QCString &, const QCString &) return FALSE; } -static bool handleTest(const QCString &, const QCString &) +static bool handleTest(const QCString &, const QCStringList &) { newXRefKind = XRef_Test; setOutput(OutputXRef); @@ -2527,7 +2543,7 @@ static bool handleTest(const QCString &, const QCString &) return FALSE; } -static bool handleBug(const QCString &, const QCString &) +static bool handleBug(const QCString &, const QCStringList &) { newXRefKind = XRef_Bug; setOutput(OutputXRef); @@ -2535,7 +2551,7 @@ static bool handleBug(const QCString &, const QCString &) return FALSE; } -static bool handleDeprecated(const QCString &, const QCString &) +static bool handleDeprecated(const QCString &, const QCStringList &) { newXRefKind = XRef_Deprecated; setOutput(OutputXRef); @@ -2543,14 +2559,14 @@ static bool handleDeprecated(const QCString &, const QCString &) return FALSE; } -static bool handleXRefItem(const QCString &, const QCString &) +static bool handleXRefItem(const QCString &, const QCStringList &) { newXRefKind = XRef_Item; BEGIN(XRefItemParam1); return FALSE; } -static bool handleParBlock(const QCString &, const QCString &) +static bool handleParBlock(const QCString &, const QCStringList &) { if (g_insideParBlock) { @@ -2567,7 +2583,7 @@ static bool handleParBlock(const QCString &, const QCString &) return FALSE; } -static bool handleEndParBlock(const QCString &, const QCString &) +static bool handleEndParBlock(const QCString &, const QCStringList &) { if (!g_insideParBlock) { @@ -2580,7 +2596,7 @@ static bool handleEndParBlock(const QCString &, const QCString &) return FALSE; } -static bool handleRelated(const QCString &, const QCString &) +static bool handleRelated(const QCString &, const QCStringList &) { if (!current->relates.isEmpty()) { @@ -2592,7 +2608,7 @@ static bool handleRelated(const QCString &, const QCString &) return FALSE; } -static bool handleRelatedAlso(const QCString &, const QCString &) +static bool handleRelatedAlso(const QCString &, const QCStringList &) { if (!current->relates.isEmpty()) { @@ -2604,7 +2620,7 @@ static bool handleRelatedAlso(const QCString &, const QCString &) return FALSE; } -static bool handleMemberOf(const QCString &, const QCString &) +static bool handleMemberOf(const QCString &, const QCStringList &) { if (!current->relates.isEmpty()) { @@ -2616,14 +2632,14 @@ static bool handleMemberOf(const QCString &, const QCString &) return FALSE; } -static bool handleRefItem(const QCString &, const QCString &) +static bool handleRefItem(const QCString &, const QCStringList &) { addOutput("@refitem "); BEGIN(LineParam); return FALSE; } -static bool handleSection(const QCString &s, const QCString &) +static bool handleSection(const QCString &s, const QCStringList &) { setOutput(OutputDoc); addOutput("@"+s+" "); @@ -2635,7 +2651,7 @@ static bool handleSection(const QCString &s, const QCString &) return FALSE; } -static bool handleSubpage(const QCString &s, const QCString &) +static bool handleSubpage(const QCString &s, const QCStringList &) { if (current->section!=Entry::EMPTY_SEC && current->section!=Entry::PAGEDOC_SEC && @@ -2655,14 +2671,14 @@ static bool handleSubpage(const QCString &s, const QCString &) return FALSE; } -static bool handleAnchor(const QCString &s, const QCString &) +static bool handleAnchor(const QCString &s, const QCStringList &) { addOutput("@"+s+" "); BEGIN(AnchorLabel); return FALSE; } -static bool handleCite(const QCString &s, const QCString &) +static bool handleCite(const QCString &s, const QCStringList &) { if (!g_spaceBeforeCmd.isEmpty()) { @@ -2674,9 +2690,16 @@ static bool handleCite(const QCString &s, const QCString &) return FALSE; } -static bool handleFormatBlock(const QCString &s, const QCString &opt) +static bool handleFormatBlock(const QCString &s, const QCStringList &optList) { - addOutput("@"+s+" "+opt); + if (optList.isEmpty()) + { + addOutput("@"+s+" "); + } + else + { + addOutput("@"+s+"{"+optList.join(",")+"} "); + } //printf("handleFormatBlock(%s) with option(%s)\n",s.data(),opt.data()); blockName=s; g_commentCount=0; @@ -2684,14 +2707,14 @@ static bool handleFormatBlock(const QCString &s, const QCString &opt) return FALSE; } -static bool handleAddIndex(const QCString &, const QCString &) +static bool handleAddIndex(const QCString &, const QCStringList &) { addOutput("@addindex "); BEGIN(LineParam); return FALSE; } -static bool handleIf(const QCString &, const QCString &) +static bool handleIf(const QCString &, const QCStringList &) { enabledSectionFound=FALSE; guardType = Guard_If; @@ -2700,7 +2723,7 @@ static bool handleIf(const QCString &, const QCString &) return FALSE; } -static bool handleIfNot(const QCString &, const QCString &) +static bool handleIfNot(const QCString &, const QCStringList &) { enabledSectionFound=FALSE; guardType = Guard_IfNot; @@ -2709,7 +2732,7 @@ static bool handleIfNot(const QCString &, const QCString &) return FALSE; } -static bool handleElseIf(const QCString &, const QCString &) +static bool handleElseIf(const QCString &, const QCStringList &) { if (guards.isEmpty()) { @@ -2724,7 +2747,7 @@ static bool handleElseIf(const QCString &, const QCString &) return FALSE; } -static bool handleElse(const QCString &, const QCString &) +static bool handleElse(const QCString &, const QCStringList &) { if (guards.isEmpty()) { @@ -2738,7 +2761,7 @@ static bool handleElse(const QCString &, const QCString &) return FALSE; } -static bool handleEndIf(const QCString &, const QCString &) +static bool handleEndIf(const QCString &, const QCStringList &) { if (guards.isEmpty()) { @@ -2759,56 +2782,56 @@ static bool handleEndIf(const QCString &, const QCString &) return FALSE; } -static bool handleIngroup(const QCString &, const QCString &) +static bool handleIngroup(const QCString &, const QCStringList &) { inGroupParamFound=FALSE; BEGIN( InGroupParam ); return FALSE; } -static bool handleNoSubGrouping(const QCString &, const QCString &) +static bool handleNoSubGrouping(const QCString &, const QCStringList &) { current->subGrouping = FALSE; return FALSE; } -static bool handleShowInitializer(const QCString &, const QCString &) +static bool handleShowInitializer(const QCString &, const QCStringList &) { current->initLines = 100000; // ON return FALSE; } -static bool handleHideInitializer(const QCString &, const QCString &) +static bool handleHideInitializer(const QCString &, const QCStringList &) { current->initLines = 0; // OFF return FALSE; } -static bool handleCallgraph(const QCString &, const QCString &) +static bool handleCallgraph(const QCString &, const QCStringList &) { current->callGraph = TRUE; // ON return FALSE; } -static bool handleHideCallgraph(const QCString &, const QCString &) +static bool handleHideCallgraph(const QCString &, const QCStringList &) { current->callGraph = FALSE; // OFF return FALSE; } -static bool handleCallergraph(const QCString &, const QCString &) +static bool handleCallergraph(const QCString &, const QCStringList &) { current->callerGraph = TRUE; // ON return FALSE; } -static bool handleHideCallergraph(const QCString &, const QCString &) +static bool handleHideCallergraph(const QCString &, const QCStringList &) { current->callerGraph = FALSE; // OFF return FALSE; } -static bool handleInternal(const QCString &, const QCString &) +static bool handleInternal(const QCString &, const QCStringList &) { if (!Config_getBool(INTERNAL_DOCS)) { @@ -2830,74 +2853,71 @@ static bool handleInternal(const QCString &, const QCString &) return FALSE; } -static bool handleLineBr(const QCString &, const QCString &) +static bool handleLineBr(const QCString &, const QCStringList &) { addOutput('\n'); return FALSE; } -static bool handleStatic(const QCString &, const QCString &) +static bool handleStatic(const QCString &, const QCStringList &) { endBrief(); current->stat = TRUE; return FALSE; } -static bool handlePure(const QCString &, const QCString &) +static bool handlePure(const QCString &, const QCStringList &) { endBrief(); current->virt = Pure; return FALSE; } -static bool handlePrivate(const QCString &, const QCString &) +static bool handlePrivate(const QCString &, const QCStringList &) { current->protection = Private; return FALSE; } -static bool handlePrivateSection(const QCString &, const QCString &) +static bool handlePrivateSection(const QCString &, const QCStringList &) { current->protection = protection = Private; return FALSE; } -static bool handleProtected(const QCString &, const QCString &) +static bool handleProtected(const QCString &, const QCStringList &) { current->protection = Protected; return FALSE; } -static bool handleProtectedSection(const QCString &, const QCString &) +static bool handleProtectedSection(const QCString &, const QCStringList &) { current->protection = protection = Protected ; return FALSE; } -static bool handlePublic(const QCString &, const QCString &) +static bool handlePublic(const QCString &, const QCStringList &) { current->protection = Public; return FALSE; } -static bool handlePublicSection(const QCString &, const QCString &) +static bool handlePublicSection(const QCString &, const QCStringList &) { current->protection = protection = Public; return FALSE; } -static bool handleToc(const QCString &, const QCString &opt) +static bool handleToc(const QCString &, const QCStringList &optList) { if (current->section==Entry::PAGEDOC_SEC || current->section==Entry::MAINPAGEDOC_SEC) { - QString optName = opt.stripWhiteSpace(); // to be sure - optName = optName.left(optName.length() - 1).right(optName.length() - 2); - QStringList optList=QStringList::split(",",optName,FALSE); - QStringList::Iterator it; + QCStringList::ConstIterator it; for ( it = optList.begin(); it != optList.end(); ++it ) { - QString opt = (*it).stripWhiteSpace().lower(); + QCString opt = (*it).stripWhiteSpace().lower(); char dum; int level = 5; int i = opt.find(':'); @@ -2929,7 +2949,10 @@ static bool handleToc(const QCString &, const QCString &opt) { current->localToc.enableXml(level); } - else warn(yyFileName,yyLineNr,"Unknown option specified with \\tableofcontents: `%s'", (*it).stripWhiteSpace().data()); + else + { + warn(yyFileName,yyLineNr,"Unknown option specified with \\tableofcontents: `%s'", (*it).stripWhiteSpace().data()); + } } } if (current->localToc.nothingEnabled()) @@ -2940,19 +2963,19 @@ static bool handleToc(const QCString &, const QCString &opt) return FALSE; } -static bool handleInherit(const QCString &, const QCString &) +static bool handleInherit(const QCString &, const QCStringList &) { BEGIN(InheritParam); return FALSE; } -static bool handleExtends(const QCString &, const QCString &) +static bool handleExtends(const QCString &, const QCStringList &) { BEGIN(ExtendsParam); return FALSE; } -static bool handleCopyBrief(const QCString &, const QCString &) +static bool handleCopyBrief(const QCString &, const QCStringList &) { if (current->brief.isEmpty() && current->doc.isEmpty()) { // if we don't have a brief or detailed description yet, @@ -2969,7 +2992,7 @@ static bool handleCopyBrief(const QCString &, const QCString &) return FALSE; } -static bool handleCopyDetails(const QCString &, const QCString &) +static bool handleCopyDetails(const QCString &, const QCStringList &) { setOutput(OutputDoc); if (!g_spaceBeforeCmd.isEmpty()) @@ -2981,7 +3004,7 @@ static bool handleCopyDetails(const QCString &, const QCString &) return FALSE; } -static bool handleCopyDoc(const QCString &, const QCString &) +static bool handleCopyDoc(const QCString &, const QCStringList &) { setOutput(OutputBrief); if (!g_spaceBeforeCmd.isEmpty()) diff --git a/src/docparser.cpp b/src/docparser.cpp index 0cb4ea3..681c5e0 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "doxygen.h" #include "debug.h" @@ -5197,7 +5198,31 @@ void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t) { DBG(("handleInclude(%s)\n",qPrint(cmdName))); int tok=doctokenizerYYlex(); - if (tok!=TK_WHITESPACE) + if (tok==TK_WORD && g_token->name=="{") + { + doctokenizerYYsetStateOptions(); + tok=doctokenizerYYlex(); + doctokenizerYYsetStatePara(); + QCStringList optList=QCStringList::split(",",g_token->name); + if (t==DocInclude::Include && optList.contains("lineno")) + { + t = DocInclude::IncWithLines; + } + else if (t==DocInclude::Snippet && optList.contains("lineno")) + { + t = DocInclude::SnipWithLines; + } + else if (t==DocInclude::Include && optList.contains("doc")) + { + t = DocInclude::IncludeDoc; + } + else if (t==DocInclude::Snippet && optList.contains("doc")) + { + t = DocInclude::SnippetDoc; + } + tok=doctokenizerYYlex(); + } + else if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command", qPrint(cmdName)); diff --git a/src/doctokenizer.h b/src/doctokenizer.h index eb39906..b3b9fa5 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -163,5 +163,6 @@ void doctokenizerYYendAutoList(); void doctokenizerYYsetStatePlantUML(); void doctokenizerYYsetStateSetScope(); void doctokenizerYYsetStatePlantUMLOpt(); +void doctokenizerYYsetStateOptions(); #endif diff --git a/src/doctokenizer.l b/src/doctokenizer.l index e6b8865..a162fb3 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -447,6 +447,7 @@ REFWORD_NOCV {LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} %x St_Snippet %x St_SetScope %x St_SetScopeEnd +%x St_Options %x St_Sections %s St_SecLabel1 @@ -1147,6 +1148,16 @@ REFWORD_NOCV {LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->chars=yytext; return TK_WHITESPACE; } +{ID} { + g_token->name+=yytext; + } +{WS}*","{WS}* +{WS} { /* option separator */ + g_token->name+=","; + } +"}" { + return TK_WORD; + } {FILEMASK} { g_token->name = yytext; return TK_WORD; @@ -1509,6 +1520,12 @@ void doctokenizerYYsetStateSetScope() BEGIN(St_SetScope); } +void doctokenizerYYsetStateOptions() +{ + g_token->name=""; + BEGIN(St_Options); +} + void doctokenizerYYcleanup() { yy_delete_buffer( YY_CURRENT_BUFFER ); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 68b49c2..5eda16a 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8926,7 +8926,7 @@ static void generatePageDocs() static void buildExampleList(EntryNav *rootNav) { - if (rootNav->section()==Entry::EXAMPLE_SEC && !rootNav->name().isEmpty()) + if ((rootNav->section()==Entry::EXAMPLE_SEC || rootNav->section()==Entry::EXAMPLE_LINENO_SEC) && !rootNav->name().isEmpty()) { rootNav->loadEntry(g_storage); Entry *root = rootNav->entry(); @@ -8947,7 +8947,7 @@ static void buildExampleList(EntryNav *rootNav) pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE)); pd->addSectionsToDefinition(root->anchors); pd->setLanguage(root->lang); - //pi->addSections(root->anchors); + pd->setShowLineNo(rootNav->section()==Entry::EXAMPLE_LINENO_SEC); Doxygen::exampleSDict->inSort(root->name,pd); //we don't add example to groups @@ -8996,11 +8996,16 @@ static void generateExampleDocs() g_outputList->docify(pd->name()); endTitle(*g_outputList,n,0); g_outputList->startContents(); + QCString lineNoOptStr; + if (pd->showLineNo()) + { + lineNoOptStr="{lineno}"; + } g_outputList->generateDoc(pd->docFile(), // file pd->docLine(), // startLine pd, // context 0, // memberDef - pd->documentation()+"\n\n\\include "+pd->name(), // docs + pd->documentation()+"\n\n\\include"+lineNoOptStr+" "+pd->name(), // docs TRUE, // index words TRUE, // is example pd->name() diff --git a/src/entry.h b/src/entry.h index fac3831..739b128 100644 --- a/src/entry.h +++ b/src/entry.h @@ -91,14 +91,14 @@ class Entry ENUMDOC_SEC = 0x01000000, ENUM_SEC = 0x02000000, - EMPTY_SEC = 0x03000000, - PAGEDOC_SEC = 0x04000000, + EMPTY_SEC = 0x03000000, + PAGEDOC_SEC = 0x04000000, VARIABLE_SEC = 0x05000000, FUNCTION_SEC = 0x06000000, TYPEDEF_SEC = 0x07000000, - MEMBERDOC_SEC = 0x08000000, + MEMBERDOC_SEC = 0x08000000, OVERLOADDOC_SEC = 0x09000000, - EXAMPLE_SEC = 0x0a000000, + EXAMPLE_SEC = 0x0a000000, VARIABLEDOC_SEC = 0x0b000000, FILEDOC_SEC = 0x0c000000, DEFINEDOC_SEC = 0x0d000000, @@ -112,9 +112,10 @@ class Entry PACKAGE_SEC = 0x15000000, PACKAGEDOC_SEC = 0x16000000, OBJCIMPL_SEC = 0x17000000, - DIRDOC_SEC = 0x18000000 - ,EXPORTED_INTERFACE_SEC = 0x19000000 - ,INCLUDED_SERVICE_SEC = 0x1A000000 + DIRDOC_SEC = 0x18000000, + EXPORTED_INTERFACE_SEC = 0x19000000, + INCLUDED_SERVICE_SEC = 0x1A000000, + EXAMPLE_LINENO_SEC = 0x1B000000, }; // class specifiers (add new items to the end) diff --git a/src/fortrancode.l b/src/fortrancode.l index 3c1829d..3014dc3 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include "entry.h" #include "doxygen.h" #include "message.h" @@ -86,7 +86,7 @@ class UseEntry { public: QCString module; // just for debug - QStringList onlyNames; /* entries of the ONLY-part */ + QCStringList onlyNames; /* entries of the ONLY-part */ }; /** @@ -105,7 +105,7 @@ class UseSDict : public SDict class Scope { public: - QStringList useNames; //!< contains names of used modules + QCStringList useNames; //!< contains names of used modules QDict localVars; //!< contains names of local variables Scope() : localVars(7, FALSE /*caseSensitive*/) {} @@ -122,7 +122,7 @@ static QCString currentClass=0; //!< name of the current enclosing static UseSDict *useMembers= new UseSDict; //!< info about used modules static UseEntry *useEntry = 0; //!< current use statement info static QList scopeStack; -// static QStringList *currentUseNames= new QStringList; //! contains names of used modules of current program unit +// static QCStringList *currentUseNames= new QCStringList; //! contains names of used modules of current program unit static QCString str=""; //!> contents of fortran string static CodeOutputInterface * g_code; @@ -478,7 +478,7 @@ static bool getFortranDefs(const QCString &memberName, const QCString &moduleNam if (ue) { // check if only-list exists and if current entry exists is this list - QStringList &only= ue->onlyNames; + QCStringList &only= ue->onlyNames; if (only.isEmpty()) { //cout << " found in module " << moduleName << " entry " << memberName << endl; @@ -486,10 +486,10 @@ static bool getFortranDefs(const QCString &memberName, const QCString &moduleNam } else { - for ( QStringList::Iterator it = only.begin(); it != only.end(); ++it) + for ( QCStringList::Iterator it = only.begin(); it != only.end(); ++it) { //cout << " search in only: " << moduleName << ":: " << memberName << "==" << (*it)<< endl; - if (memberName == (*it).utf8()) + if (memberName == *it) { return TRUE; // found in ONLY-part of use list } @@ -632,9 +632,9 @@ static void endScope() Scope *scope = scopeStack.getLast(); scopeStack.removeLast(); - for ( QStringList::Iterator it = scope->useNames.begin(); it != scope->useNames.end(); ++it) + for ( QCStringList::Iterator it = scope->useNames.begin(); it != scope->useNames.end(); ++it) { - useMembers->remove((*it).utf8()); + useMembers->remove(*it); } delete scope; } diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 4721306..d2c3f68 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -35,6 +35,7 @@ PageDef::PageDef(const char *f,int l,const char *n, m_pageScope = 0; m_nestingLevel = 0; m_fileName = ::convertNameToFile(n,FALSE,TRUE); + m_showLineNo = FALSE; } PageDef::~PageDef() @@ -329,3 +330,13 @@ void PageDef::setLocalToc(const LocalToc <) { m_localToc = lt; } + +void PageDef::setShowLineNo(bool b) +{ + m_showLineNo = b; +} + +bool PageDef::showLineNo() const +{ + return m_showLineNo; +} diff --git a/src/pagedef.h b/src/pagedef.h index 27316cb..a0c3acb 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -35,6 +35,7 @@ class PageDef : public Definition // setters void setFileName(const char *name); void setLocalToc(const LocalToc &tl); + void setShowLineNo(bool); // getters DefType definitionType() const { return TypePage; } @@ -63,6 +64,7 @@ class PageDef : public Definition void setPageScope(Definition *d){ m_pageScope = d; } Definition *getPageScope() const { return m_pageScope; } QCString displayName(bool=TRUE) const { return !m_title.isEmpty() ? m_title : Definition::name(); } + bool showLineNo() const; void writeDocumentation(OutputList &ol); void writeTagFile(FTextStream &); @@ -76,6 +78,7 @@ class PageDef : public Definition Definition *m_pageScope; int m_nestingLevel; LocalToc m_localToc; + bool m_showLineNo; }; class PageSDict : public SDict diff --git a/src/qhp.cpp b/src/qhp.cpp index e7c8d10..6ce6b06 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -23,7 +23,7 @@ #include "doxygen.h" #include "filedef.h" -#include +#include #include #include @@ -101,10 +101,10 @@ void Qhp::initialize() { "name", filterName, 0 }; m_doc.open("customFilter", tagAttributes); - QStringList customFilterAttributes = QStringList::split(QChar(' '), Config_getString(QHP_CUST_FILTER_ATTRS)); + QCStringList customFilterAttributes = QCStringList::split(' ', Config_getString(QHP_CUST_FILTER_ATTRS)); for (int i = 0; i < (int)customFilterAttributes.count(); i++) { - m_doc.openCloseContent("filterAttribute", customFilterAttributes[i].utf8()); + m_doc.openCloseContent("filterAttribute", customFilterAttributes[i]); } m_doc.close("customFilter"); } @@ -112,15 +112,15 @@ void Qhp::initialize() m_doc.open("filterSection"); // Add section attributes - QStringList sectionFilterAttributes = QStringList::split(QChar(' '), + QCStringList sectionFilterAttributes = QCStringList::split(' ', Config_getString(QHP_SECT_FILTER_ATTRS)); - if (!sectionFilterAttributes.contains(QString("doxygen"))) + if (!sectionFilterAttributes.contains("doxygen")) { sectionFilterAttributes << "doxygen"; } for (int i = 0; i < (int)sectionFilterAttributes.count(); i++) { - m_doc.openCloseContent("filterAttribute", sectionFilterAttributes[i].utf8()); + m_doc.openCloseContent("filterAttribute", sectionFilterAttributes[i]); } m_toc.open("toc"); diff --git a/src/tagreader.cpp b/src/tagreader.cpp index dfa8511..cf64a35 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "entry.h" #include "classdef.h" @@ -105,7 +105,7 @@ class TagClassInfo QList *bases; QList members; QList *templateArguments; - QStringList classList; + QCStringList classList; Kind kind; bool isObjC; }; @@ -118,8 +118,8 @@ class TagNamespaceInfo QCString name; QCString filename; QCString clangId; - QStringList classList; - QStringList namespaceList; + QCStringList classList; + QCStringList namespaceList; TagAnchorInfoList docAnchors; QList members; }; @@ -133,7 +133,7 @@ class TagPackageInfo QCString filename; TagAnchorInfoList docAnchors; QList members; - QStringList classList; + QCStringList classList; }; /** Container for include info that can be read from a tagfile */ @@ -157,8 +157,8 @@ class TagFileInfo QCString filename; TagAnchorInfoList docAnchors; QList members; - QStringList classList; - QStringList namespaceList; + QCStringList classList; + QCStringList namespaceList; QList includes; }; @@ -172,12 +172,12 @@ class TagGroupInfo QCString filename; TagAnchorInfoList docAnchors; QList members; - QStringList subgroupList; - QStringList classList; - QStringList namespaceList; - QStringList fileList; - QStringList pageList; - QStringList dirList; + QCStringList subgroupList; + QCStringList classList; + QCStringList namespaceList; + QCStringList fileList; + QCStringList pageList; + QCStringList dirList; }; /** Container for page specific info that can be read from a tagfile */ @@ -197,8 +197,8 @@ class TagDirInfo QCString name; QCString filename; QCString path; - QStringList subdirList; - QStringList fileList; + QCStringList subdirList; + QCStringList fileList; TagAnchorInfoList docAnchors; }; @@ -1009,11 +1009,11 @@ void TagFileParser::dump() { msg("namespace `%s'\n",nd->name.data()); msg(" filename `%s'\n",nd->filename.data()); - QStringList::Iterator it; + QCStringList::Iterator it; for ( it = nd->classList.begin(); it != nd->classList.end(); ++it ) { - msg( " class: %s \n", (*it).latin1() ); + msg( " class: %s \n", (*it).data() ); } QListIterator mci(nd->members); @@ -1034,16 +1034,16 @@ void TagFileParser::dump() { msg("file `%s'\n",fd->name.data()); msg(" filename `%s'\n",fd->filename.data()); - QStringList::Iterator it; + QCStringList::Iterator it; for ( it = fd->namespaceList.begin(); it != fd->namespaceList.end(); ++it ) { - msg( " namespace: %s \n", (*it).latin1() ); + msg( " namespace: %s \n", (*it).data() ); } for ( it = fd->classList.begin(); it != fd->classList.end(); ++it ) { - msg( " class: %s \n", (*it).latin1() ); + msg( " class: %s \n", (*it).data() ); } QListIterator mci(fd->members); @@ -1072,31 +1072,31 @@ void TagFileParser::dump() { msg("group `%s'\n",gd->name.data()); msg(" filename `%s'\n",gd->filename.data()); - QStringList::Iterator it; + QCStringList::Iterator it; for ( it = gd->namespaceList.begin(); it != gd->namespaceList.end(); ++it ) { - msg( " namespace: %s \n", (*it).latin1() ); + msg( " namespace: %s \n", (*it).data() ); } for ( it = gd->classList.begin(); it != gd->classList.end(); ++it ) { - msg( " class: %s \n", (*it).latin1() ); + msg( " class: %s \n", (*it).data() ); } for ( it = gd->fileList.begin(); it != gd->fileList.end(); ++it ) { - msg( " file: %s \n", (*it).latin1() ); + msg( " file: %s \n", (*it).data() ); } for ( it = gd->subgroupList.begin(); it != gd->subgroupList.end(); ++it ) { - msg( " subgroup: %s \n", (*it).latin1() ); + msg( " subgroup: %s \n", (*it).data() ); } for ( it = gd->pageList.begin(); it != gd->pageList.end(); ++it ) { - msg( " page: %s \n", (*it).latin1() ); + msg( " page: %s \n", (*it).data() ); } QListIterator mci(gd->members); @@ -1126,16 +1126,16 @@ void TagFileParser::dump() { msg("dir `%s'\n",dd->name.data()); msg(" path `%s'\n",dd->path.data()); - QStringList::Iterator it; + QCStringList::Iterator it; for ( it = dd->fileList.begin(); it != dd->fileList.end(); ++it ) { - msg( " file: %s \n", (*it).latin1() ); + msg( " file: %s \n", (*it).data() ); } for ( it = dd->subdirList.begin(); it != dd->subdirList.end(); ++it ) { - msg( " subdir: %s \n", (*it).latin1() ); + msg( " subdir: %s \n", (*it).data() ); } } } diff --git a/src/tclscanner.l b/src/tclscanner.l index 56d2e3d..7ca5ade 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -369,7 +369,7 @@ int Tcl_SplitList( } // END of tclUtil.c -void tcl_split_list(QString &str, QStringList &list) +void tcl_split_list(QCString &str, QCStringList &list) { int argc; const char **argv; @@ -383,17 +383,20 @@ void tcl_split_list(QString &str, QStringList &list) { str=str.mid(1,str.length()-2); } - if (Tcl_SplitList(str.ascii(),&argc,&argv) != TCL_OK) + if (!str.isEmpty()) { - list.append(str); - } - else - { - for (int i = 0; i < argc; i++) + if (Tcl_SplitList(str,&argc,&argv) != TCL_OK) { - list.append(argv[i]); + list.append(str); + } + else + { + for (int i = 0; i < argc; i++) + { + list.append(argv[i]); + } + ckfree((char *) argv); } - ckfree((char *) argv); } } @@ -409,7 +412,7 @@ typedef struct Entry *entry_cl; // if set contain the current class Entry *entry_scan; // current scan entry Protection protection; // current protections state - QStringList after; // option/value list (options: NULL comment keyword script) + QCStringList after; // option/value list (options: NULL comment keyword script) } tcl_scan; //* Structure containing all internal global variables. @@ -446,7 +449,7 @@ static struct Entry* entry_file; // entry of current file Entry* entry_current; // currently used entry Entry* entry_inside; // contain entry of current scan context - QStringList list_commandwords; // list of command words + QCStringList list_commandwords; // list of command words QList scan; // stack of scan contexts QAsciiDict ns; // all read namespace entries QAsciiDict cl; // all read class entries @@ -602,7 +605,7 @@ Entry* tcl_entry_class(const QCString cl) // @return 1 if keyword and 0 otherwise static int tcl_keyword(QCString str) { - static QStringList myList; + static QCStringList myList; static int myInit=1; if (myInit) { @@ -639,7 +642,7 @@ static int tcl_keyword(QCString str) myList <<"tkerror"<<"tkwait"<<"tk_bisque"<<"tk_focusNext"<<"tk_focusPrev"<<"tk_focusFollowsMouse"<<"tk_popup"<<"tk_setPalette"<<"tk_textCut"<<"tk_TextCopy"<<"tk_textPaste"<<"chooseColor"<<"tk_chooseColor"<<"tk_chooseDirectory"<<"tk_dialog"<<"tk_getOpenFile"<<"tkDialog"<<"tk_getSaveFile"<<"tk_messageBox"; myList <<"winfo"<<"wm"; myList <<"button"<<"canvas"<<"checkbutton"<<"entry"<<"frame"<<"image"<<"label"<<"labelframe"<<"listbox"<<"menu"<<"menubutton"<<"message"<<"panedwindow"<<"radiobutton"<<"scale"<<"scrollbar"<<"spinbox"<<"toplevel"; - myList.sort(); + //myList.sort(); myInit=0; } str=str.stripWhiteSpace(); @@ -727,7 +730,7 @@ static void tcl_codify(const char *s,const char *str) static void tcl_codify(const char *s,const QString &str) { if (tcl.code==NULL) return; - tcl_codify(s,str.utf8()); + tcl_codify(s,str); } //! Codify 'str' with special font class 's'. @@ -740,7 +743,7 @@ static void tcl_codify(const char *s,const QCString &str) static void tcl_codify_cmd(const char *s,int i) { - tcl_codify(s,(*tcl.list_commandwords.at(i)).utf8()); + tcl_codify(s,(*tcl.list_commandwords.at(i))); } //! codify a string token // @@ -1193,7 +1196,7 @@ tcl_inf("line=%d\n",myScan->line1); myStart=i; break; } - tcl_codify(myScan->after[i].utf8(),myScan->after[i+1].utf8()); + tcl_codify(myScan->after[i],myScan->after[i+1]); } yy_delete_buffer(myScan->buffer_state); yy_pop_state(); @@ -1608,12 +1611,12 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment); } //! Parse given \c arglist . -static void tcl_command_ARGLIST(QString &arglist) +static void tcl_command_ARGLIST(QCString &arglist) { D Argument *myArg; - QStringList myArgs; - QString myArglist=""; + QCStringList myArgs; + QCString myArglist=""; if (!tcl.entry_current->argList) { @@ -1622,14 +1625,14 @@ D tcl_split_list(arglist,myArgs); for (uint i=0;iname= (*myArgs1.at(0)).utf8(); - myArg->defval= (*myArgs1.at(1)).utf8(); + myArg->name= (*myArgs1.at(0)); + myArg->defval= (*myArgs1.at(1)); if (myArg->defval.isEmpty()) { myArg->defval = " "; @@ -1638,13 +1641,13 @@ D } else { - myArg->name= (*myArgs.at(i)).utf8(); - myArglist += QString(myArg->name) + " "; + myArg->name= (*myArgs.at(i)); + myArglist += myArg->name + " "; } tcl.entry_current->argList->append(myArg); } arglist = myArglist; - tcl.entry_current->args = arglist.utf8(); + tcl.entry_current->args = arglist; } //! Create link. @@ -1763,7 +1766,7 @@ static void tcl_codify_link(QCString name) //! scan general argument for brackets // -// parses (*tcl.list_commandwords.at(i)).utf8() and checks for brackets. +// parses (*tcl.list_commandwords.at(i)) and checks for brackets. // Starts a new scan context if needed (*myScan==0 and brackets found). // Returns NULL or the created scan context. // @@ -1773,7 +1776,7 @@ static tcl_scan *tcl_command_ARG(tcl_scan *myScan, unsigned int i, bool ignoreOu bool insideQuotes=false; unsigned int insideBrackets=0; unsigned int insideBraces=0; - myName = (*tcl.list_commandwords.at(i)).utf8(); + myName = (*tcl.list_commandwords.at(i)); if (i%2 != 0) { // handle white space @@ -1861,7 +1864,7 @@ D // Example: eval [list set] [list NotInvoked] [Invoked NotInvoked] for (unsigned int i = 1; i < tcl.list_commandwords.count(); i++) { - myString += (*tcl.list_commandwords.at(i)).utf8(); + myString += (*tcl.list_commandwords.at(i)); } myScan = tcl_scan_start('?', myString, myScan->ns, myScan->entry_cl, myScan->entry_fn); @@ -1882,7 +1885,7 @@ D unsigned int lastOptionIndex = 0; for (i = 2; ins,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName); + tcl_name_SnippetAware(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); if (myNs.length()) { myEntryNs = tcl_entry_namespace(myNs); @@ -2165,7 +2168,7 @@ D tcl_codify_cmd(NULL,3); tcl_codify_cmd(NULL,4); tcl_codify_cmd(NULL,5); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); if (myNs.length()) { myEntryCl = tcl_entry_class(myNs); @@ -2205,7 +2208,7 @@ D tcl_codify_cmd(NULL,1); tcl_codify_cmd(NULL,2); tcl_codify_cmd(NULL,3); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)),myNs,myName); if (myNs.length()) { myEntryCl = tcl_entry_class(myNs); @@ -2240,7 +2243,7 @@ D tcl_codify_cmd("keyword",0); tcl_codify_cmd(NULL,1); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)),myNs,myName); if (myNs.length()) { myEntryCl = tcl_entry_class(myNs); @@ -2278,7 +2281,7 @@ D tcl_codify_cmd(NULL,3); tcl_codify_cmd(NULL,4); tcl_codify_cmd(NULL,5); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)),myNs,myName); if (myNs.length()) { myName = myNs+"::"+myName; @@ -2291,12 +2294,12 @@ D tcl.entry_main->addSubEntry(tcl.entry_current); tcl.ns.insert(myName,tcl.entry_current); //myEntryNs = tcl.entry_current; - myStr = (*tcl.list_commandwords.at(6)).utf8(); + myStr = (*tcl.list_commandwords.at(6)); if (tcl.list_commandwords.count() > 7) { for (uint i=7;ins,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); if (myNs.length()) { myName = myNs+"::"+myName; @@ -2347,7 +2350,7 @@ D tcl_codify_cmd("NULL",3); tcl_codify_cmd("NULL",4); tcl_codify_cmd("NULL",5); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)),myNs,myName); if (myNs.length()) { myName = myNs+"::"+myName; @@ -2377,13 +2380,13 @@ D tcl_codify_cmd(NULL,1); tcl_codify_cmd("NULL",2); tcl_codify_cmd("NULL",3); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); if (myNs.length()) { myName = myNs+"::"+myName; } myEntryCl = tcl_entry_class(myName); - myStr = (*tcl.list_commandwords.at(4)).utf8(); + myStr = (*tcl.list_commandwords.at(4)); // // special cases first // oo::define classname method methodname args script @@ -2400,7 +2403,7 @@ D } Entry *myEntry; QCString myMethod; - tcl_name(myScan->ns,(*tcl.list_commandwords.at(n==11?6:4)).utf8(),myNs,myMethod); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(n==11?6:4)),myNs,myMethod); // code snippet taken from tcl_command_METHOD()/tcl_command_CONSTRUCTOR tcl.fn.remove(myMethod); tcl.entry_current->section = Entry::FUNCTION_SEC; @@ -2434,7 +2437,7 @@ D { for (uint i=5;ins,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName); + tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); if (myNs.length()) {// qualified variables go into namespace myEntry = tcl_entry_namespace(myNs); @@ -2535,7 +2538,7 @@ tcl_inf("->\n"); yy_pop_state(); // check command - QCString myStr = (*tcl.list_commandwords.at(0)).utf8(); + QCString myStr = (*tcl.list_commandwords.at(0)); tcl_scan *myScanBackup=tcl.scan.at(0); int myLevel = 0; Protection myProt = tcl.protection; @@ -2580,7 +2583,7 @@ tcl_inf("->\n"); myProt = tcl.protection; goto command_end; } - myStr = (*tcl.list_commandwords.at(0)).utf8(); + myStr = (*tcl.list_commandwords.at(0)); // remove leading "::" and apply TCL_SUBST if (myStr.left(2)=="::") myStr = myStr.mid(2); if (tcl.config_subst.contains(myStr)) @@ -2624,7 +2627,7 @@ tcl_inf("->\n"); } if (myStr=="namespace") { - if ((*tcl.list_commandwords.at(2)).utf8()=="eval") + if ((*tcl.list_commandwords.at(2))=="eval") { if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;} tcl_command_NAMESPACE(); @@ -2647,7 +2650,7 @@ tcl_inf("->\n"); } if (myStr=="oo::class") { - if ((*tcl.list_commandwords.at(2)).utf8()=="create") + if ((*tcl.list_commandwords.at(2))=="create") { if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} tcl_command_OO_CLASS(); @@ -2687,7 +2690,7 @@ tcl_inf("->\n"); { for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2) { - tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)).utf8(),Public,Normal)); + tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)),Public,Normal)); } } goto command_end; @@ -2731,12 +2734,12 @@ if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN? */ if (myStr=="if" && tcl.list_commandwords.count() > 4) { - QStringList myType; + QCStringList myType; myType << "keyword" << "NULL" << "expr" << "NULL"; char myState='x';// last word: e'x'pr 't'hen 'b'ody 'e'lse else'i'f.. for (unsigned int i = 4; i < tcl.list_commandwords.count(); i = i + 2) { - QCString myStr=(*tcl.list_commandwords.at(i)).utf8(); + QCString myStr=(*tcl.list_commandwords.at(i)); if (myState=='x') { if (myStr=="then") @@ -2797,7 +2800,7 @@ if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN? tcl_command_OTHER(); goto command_end; command_warn:// print warning message because of wrong used syntax - tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").ascii()); + tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").data()); tcl_command_OTHER(); command_end:// add remaining text to current context if (!myText.isEmpty()) diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 618258f..68dcafb 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include "entry.h" #include "doxygen.h" @@ -138,8 +138,8 @@ static bool checkVhdlString(QCString &name) int len=name.length(); if (name.at(0)=='"' && name.at(len-1)=='"' && len > 2) { - QStringList qrl=QStringList::split(regg,name,FALSE); - if (VhdlDocGen::isNumber(qrl[0].utf8())) + QCStringList qrl=QCStringList::split(regg,name); + if (VhdlDocGen::isNumber(qrl[0])) { g_code->codify("\""); startFontClass("vhdllogic"); @@ -691,8 +691,8 @@ static void writeFuncProto() codifyLines(g_FuncProto.data(),g_CurrClass.data()); return; } - QStringList qlist=QStringList::split(name,g_FuncProto,FALSE); - QCString temp=qlist[0].utf8(); + QCStringList qlist=QCStringList::split(name,g_FuncProto); + QCString temp=qlist[0]; codifyLines(temp.data(),g_CurrClass.data()); g_FuncProto.stripPrefix(temp.data()); temp.resize(0); @@ -831,11 +831,11 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI QCString tt(vhdlcodeYYtext); VhdlDocGen::deleteAllChars(tt,','); QRegExp r("=>"); - QStringList ql=QStringList::split(r,tt,FALSE); + QCStringList ql=QCStringList::split(r,tt); if (ql.count()>=2) { unsigned int index=0; - QCString t1=ql[0].utf8(); + QCString t1=ql[0]; char cc=t1.at(index); while (cc==' ' || cc=='\t') { @@ -866,7 +866,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } codifyLines("=>"); index=0; - QCString s2=ql[1].utf8(); + QCString s2=ql[1]; t1=s2; cc=t1.at(index); while (cc==' ' || cc=='\t') @@ -959,7 +959,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI tt=tt.lower(); VhdlDocGen::deleteAllChars(tt,';'); tt.stripWhiteSpace(); - QStringList ql=QStringList::split(regg,tt,FALSE); + QCStringList ql=QCStringList::split(regg,tt); int index=ql.findIndex(QCString("if"))+1; index+=ql.findIndex(QCString("case"))+1; index+=ql.findIndex(QCString("loop"))+1; @@ -1168,13 +1168,12 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI [^:;]* { //found package QCString temp(vhdlcodeYYtext); - QStringList strl=QStringList::split(".",temp,FALSE); - + QCStringList strl=QCStringList::split(".",temp); if (strl.count()>2) { - QCString s1=strl[0].utf8(); - QCString s2=strl[1].utf8(); - QCString s3=strl[2].utf8(); + QCString s1=strl[0]; + QCString s2=strl[1]; + QCString s3=strl[2]; s1.append("."); s3.prepend("."); codifyLines(s1.data(),g_CurrClass.data()); @@ -1297,8 +1296,8 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI ^{B}*("package "){BN}*("body"){BN}*{FUNCNAME} { // found package body QCString ss(vhdlcodeYYtext); QCString temp=VhdlDocGen::getIndexWord(vhdlcodeYYtext,2); - QStringList ql=QStringList::split(temp,ss,FALSE); - QCString ll=ql[0].utf8(); + QCStringList ql=QCStringList::split(temp,ss); + QCString ll=ql[0]; codifyLines(ll.data(),g_CurrClass.data()); temp=temp.stripWhiteSpace(); temp.prepend("_"); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 007c45f..287565b 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include /* --------------------------------------------------------------- */ @@ -299,10 +299,10 @@ static QCString formatBriefNote(const QCString &brief,ClassDef * cd) int k=cd->briefLine(); - QStringList qsl=QStringList::split(ep,brief); + QCStringList qsl=QCStringList::split(ep,brief); for(uint j=0;jdata()); @@ -1075,8 +1075,8 @@ void VhdlDocGen::findAllArchitectures(QList& qll,const ClassDef *cd) QCString jj=citer->className(); if (cd != citer && jj.contains('-')!=-1) { - QStringList ql=QStringList::split("-",jj,FALSE); - QCString temp=ql[1].utf8(); + QCStringList ql=QCStringList::split("-",jj); + QCString temp=ql[1]; if (qstricmp(cd->className(),temp)==0) { QCString *cl=new QCString(jj); @@ -1095,10 +1095,10 @@ ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd) for ( ; (citer=cli.current()) ; ++cli ) { QCString jj=citer->name(); - QStringList ql=QStringList::split(":",jj,FALSE); + QCStringList ql=QCStringList::split(":",jj); if (ql.count()>1) { - if (ql[0].utf8()==nn ) + if (ql[0]==nn ) { return citer; } @@ -1211,15 +1211,15 @@ void VhdlDocGen::parseFuncProto(const char* text,QList& qlist, QCString VhdlDocGen::getIndexWord(const char* c,int index) { - QStringList ql; + QCStringList ql; QCString temp(c); QRegExp reg("[\\s:|]"); - ql=QStringList::split(reg,temp,FALSE); + ql=QCStringList::split(reg,temp); if (ql.count() > (unsigned int)index) { - return ql[index].utf8(); + return ql[index]; } return ""; @@ -2678,11 +2678,11 @@ QCString VhdlDocGen::parseForConfig(QCString & entity,QCString & arch) if (!entity.contains(":")) return ""; QRegExp exp("[:()\\s]"); - QStringList ql=QStringList::split(exp,entity,FALSE); + QCStringList ql=QCStringList::split(exp,entity); //int ii=ql.findIndex(ent); assert(ql.count()>=2); - label = ql[0].utf8(); - entity = ql[1].utf8(); + label = ql[0]; + entity = ql[1]; if ((index=entity.findRev("."))>=0) { entity.remove(0,index+1); @@ -2690,8 +2690,8 @@ QCString VhdlDocGen::parseForConfig(QCString & entity,QCString & arch) if (ql.count()==3) { - arch= ql[2].utf8(); - ql=QStringList::split(exp,arch,FALSE); + arch= ql[2]; + ql=QCStringList::split(exp,arch); if (ql.count()>1) // expression { arch=""; @@ -2708,16 +2708,16 @@ QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) QRegExp exp("[()\\s]"); QCString label=""; - QStringList ql=QStringList::split(exp,entity,FALSE); + QCStringList ql=QCStringList::split(exp,entity); if (ql.contains("open")) { return "open"; } - label=ql[0].utf8(); + label=ql[0]; - entity = ql[1].utf8(); + entity = ql[1]; if ((index=entity.findRev("."))>=0) { entity.remove(0,index+1); @@ -2725,7 +2725,7 @@ QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) if (ql.count()==3) { - arch=ql[2].utf8(); + arch=ql[2]; } return label; } @@ -2843,7 +2843,7 @@ void assignBinding(VhdlConfNode * conf) QCString inst1=VhdlDocGen::getIndexWord(archy.data(),0).lower(); QCString comp=VhdlDocGen::getIndexWord(archy.data(),1).lower(); - QStringList ql=QStringList::split(",",inst1); + QCStringList ql=QCStringList::split(",",inst1); for (uint j=0;jtype+":"+cur->name; } @@ -3029,11 +3029,11 @@ ferr: void VhdlDocGen::writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef) { - QStringList ql=QStringList::split("#",largs,FALSE); + QCStringList ql=QCStringList::split("#",largs,FALSE); uint len=ql.count(); for(uint i=0;i1) ol.lineBreak(); } @@ -3046,14 +3046,14 @@ void VhdlDocGen::writeRecUnitDocu( QCString largs) { - QStringList ql=QStringList::split("#",largs,FALSE); + QCStringList ql=QCStringList::split("#",largs); uint len=ql.count(); ol.startParameterList(TRUE); bool first=TRUE; for(uint i=0;i #include -#include +#include #include "vhdljjparser.h" #include "vhdlcode.h" #include "vhdldocgen.h" @@ -381,11 +381,11 @@ void VhdlParser::addVhdlType(const char *n,int startLine,int section, spec= VhdlDocGen::GENERIC; } - QStringList ql=QStringList::split(",",name,FALSE); + QCStringList ql=QCStringList::split(",",name); for (uint u=0;uname=ql[u].utf8(); + current->name=ql[u]; current->startLine=startLine; current->bodyLine=startLine; current->section=section; @@ -442,11 +442,11 @@ void VhdlParser::createFunction(const char *imp,uint64 spec,const char *fn) VhdlDocGen::deleteAllChars(current->args,' '); if (!fname.isEmpty()) { - QStringList q1=QStringList::split(",",fname); + QCStringList q1=QCStringList::split(",",fname); for (uint ii=0;iiname=q1[ii].utf8(); + arg->name=q1[ii]; current->argList->append(arg); } } @@ -540,12 +540,12 @@ void VhdlParser::addProto(const char *s1,const char *s2,const char *s3, { (void)s5; // avoid unused warning QCString name=s2; - QStringList ql=QStringList::split(",",name,FALSE); + QCStringList ql=QCStringList::split(",",name); for (uint u=0;uname=ql[u].utf8(); + arg->name=ql[u]; if (s3) { arg->type=s3; diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index a0851d7..3a2ed61 100644 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -14,7 +15,6 @@ #include "types.h" #include "entry.h" #include "vhdldocgen.h" -#include "qstringlist.h" #include "vhdlcode.h" #include "memberlist.h" #include "config.h" @@ -30,7 +30,6 @@ class ClassSDict; class FileStorage; class ClassDef; class MemberDef; -class QStringList; struct VhdlConfNode; diff --git a/vhdlparser/VhdlParser.cc b/vhdlparser/VhdlParser.cc index a3de14a..4cf8ec0 100644 --- a/vhdlparser/VhdlParser.cc +++ b/vhdlparser/VhdlParser.cc @@ -10398,11 +10398,11 @@ s+=",";s+=s1; jj_consume_token(SEMI_T); } -QStringList ql1=QStringList::split(",",s,FALSE); +QCStringList ql1=QCStringList::split(",",s); for (uint j=0;j s=selected_name()( s1=selected_name(){s+=",";s+=s1;})* { - QStringList ql1=QStringList::split(",",s,FALSE); + QCStringList ql1=QCStringList::split(",",s); for (uint j=0;j