diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-08-11 20:15:10 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-08-11 20:15:10 (GMT) |
commit | 17e35fd285d98df3c7fe59ee8805152726c3572e (patch) | |
tree | 9e4492a0b5642a047896b46030df4d8a97e2f4f8 | |
parent | 5d63a37e7097d6a0467da4895296688abd366b0a (diff) | |
download | Doxygen-17e35fd285d98df3c7fe59ee8805152726c3572e.zip Doxygen-17e35fd285d98df3c7fe59ee8805152726c3572e.tar.gz Doxygen-17e35fd285d98df3c7fe59ee8805152726c3572e.tar.bz2 |
Release-1.2.17-20020811
54 files changed, 2389 insertions, 926 deletions
@@ -1,6 +1,6 @@ -DOXYGEN Version 1.2.17-20020804 +DOXYGEN Version 1.2.17-20020811 Please read the installation section of the manual for instructions. -------- -Dimitri van Heesch (04 August 2002) +Dimitri van Heesch (11 August 2002) @@ -1,4 +1,4 @@ -DOXYGEN Version 1.2.17_20020804 +DOXYGEN Version 1.2.17_20020811 Please read INSTALL for compilation instructions. @@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives. Enjoy, -Dimitri van Heesch (dimitri@stack.nl) (04 August 2002) +Dimitri van Heesch (dimitri@stack.nl) (11 August 2002) @@ -1 +1 @@ -1.2.17-20020804 +1.2.17-20020811 diff --git a/doc/arch.doc b/doc/arch.doc index 1851d31..71b9ff5 100644 --- a/doc/arch.doc +++ b/doc/arch.doc @@ -58,7 +58,7 @@ of macros. This is to allow macro names to appear in the type of function parameters for instance. Another difference is that the preprocessor parses, but not actually includes -code when it encounters a #include (with the exception of #include +code when it encounters a \#include (with the exception of \#include found inside { ... } blocks). The reasons behind this deviation from the standard is to prevent feeding multiple definitions of the same functions/classes to doxygen's parser. If all source files would @@ -67,7 +67,7 @@ definitions (and their documentation) would be present in each translation unit. The preprocessor is written using \c flex and can be found in -\c src/pre.l. For condition blocks (#if) evaluation of constant expressions +\c src/pre.l. For condition blocks (\#if) evaluation of constant expressions is needed. For this a \c yacc based parser is used, which can be found in \c src/constexp.y and \c src/constexp.l. diff --git a/doc/autolink.doc b/doc/autolink.doc index c7f9ba7..3bb0e9a 100644 --- a/doc/autolink.doc +++ b/doc/autolink.doc @@ -62,7 +62,7 @@ <li><tt>(\<className\>"::")<sup>n</sup>\<functionName\>"()"</tt> <li><tt>(\<className\>"::")<sup>n</sup>\<functionName\></tt> </ol> - where n>0. + where n\>0. \par Note 1: The patterns above should not contain spaces, tabs or newlines. diff --git a/doc/commands.doc b/doc/commands.doc index 0a6a352..33456bb 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -90,6 +90,7 @@ documentation: \refitem cmdline \\line \refitem cmdlink \\link \refitem cmdmainpage \\mainpage +\refitem cmdn \\n \refitem cmdname \\name \refitem cmdnamespace \\namespace \refitem cmdnosubgrouping \\nosubgrouping @@ -205,7 +206,7 @@ doxygen. Unrecognized commands are treated as normal text. \addindex \\def Indicates that a comment block contains documentation for a - \c #define macro. + \c \#define macro. \par Example: \verbinclude define.h @@ -1627,6 +1628,13 @@ ALIASES = "english=\if english" \ Equivalent to \ref cmdarg "\\arg" <hr> +\section cmdn \n + + \addindex \\n + Forces a new line. Equivalent to \<br\> and inspired by + the printf function. + +<hr> \section cmdp \p <word> \addindex \\p diff --git a/doc/faq.doc b/doc/faq.doc index 98199eb..4f7ce54 100644 --- a/doc/faq.doc +++ b/doc/faq.doc @@ -104,7 +104,7 @@ You can document your class like To make doxygen put <br><br> <code> -#include \<path/include.h\> +\#include \<path/include.h\> </code> in the documentation of the class MyClassName regardless of the name of the actual @@ -192,15 +192,15 @@ remove the % and keep the word unlinked. This error happens when doxygen lexical scanner has a rules that matches more than 16K input character in one go. I've seen this happening -on a very large generated file (>16K lines), where the built-in preprocessor -converted it into an empty file (with >16K of newlines). Another case +on a very large generated file (\>16K lines), where the built-in preprocessor +converted it into an empty file (with \>16K of newlines). Another case where this might happen is if you have lines in your code with more than 16K characters. If you have ran into such a case and want me to fix it, you should send me a code fragment that triggers the message. -<li><b>How did doxygen get it's name?</b> +<li><b>How did doxygen get its name?</b> Doxygen got its name from playing with the words documentation and generator. diff --git a/doc/htmlcmds.doc b/doc/htmlcmds.doc index 7f79852..96b22f5 100644 --- a/doc/htmlcmds.doc +++ b/doc/htmlcmds.doc @@ -23,73 +23,73 @@ documentation. Note that all attributes of a HTML tag are ignored <ul> <li><tt>\<A HREF="..."\></tt> Starts a HTML hyper-link (HTML only). <li><tt>\<A NAME="..."\></tt> Starts an named anchor (HTML only). -<li><tt>\</A></tt> Ends a link or anchor (HTML only). -<li><tt>\<B></tt> Starts a piece of text displayed in a bold font. -<li><tt>\</B></tt> Ends a <tt>\<B\></tt> section. -<li><tt>\<BODY></tt> Does not generate any output. -<li><tt>\</BODY></tt> Does not generate any output. -<li><tt>\<BR></tt> Forces a line break. -<li><tt>\<CENTER></tt> starts a section of centered text. -<li><tt>\</CENTER></tt> ends a section of centered text. -<li><tt>\<CAPTION></tt> Starts a caption. Use within a table only. -<li><tt>\</CAPTION></tt> Ends a caption. Use within a table only. -<li><tt>\<CODE></tt> Starts a piece of text displayed in a typewriter font. -<li><tt>\</CODE></tt> End a <tt>\<CODE\></tt> section. -<li><tt>\<DD></tt> Starts an item description. -<li><tt>\<DFN></tt> Starts a piece of text displayed in a typewriter font. -<li><tt>\</DFN></tt> Ends a <tt>\<DFN\></tt> section. -<li><tt>\<DL></tt> Starts a description list. -<li><tt>\</DL></tt> Ends a description list. -<li><tt>\<DT></tt> Starts an item title. -<li><tt>\</DT></tt> Ends an item title. -<li><tt>\<EM></tt> Starts a piece of text displayed in an italic font. -<li><tt>\</EM></tt> Ends a <tt>\<EM\></tt> section. -<li><tt>\<FORM></tt> Does not generate any output. -<li><tt>\</FORM></tt> Does not generate any output. -<li><tt>\<HR></tt> Writes a horizontal ruler. -<li><tt>\<H1></tt> Starts an unnumbered section. -<li><tt>\</H1></tt> Ends an unnumberd section. -<li><tt>\<H2></tt> Starts an unnumbered subsection. -<li><tt>\</H2></tt> Ends an unnumbered subsection. -<li><tt>\<H3></tt> Starts an unnumbered subsubsection. -<li><tt>\</H3></tt> Ends an unnumbered subsubsection. -<li><tt>\<I></tt> Starts a piece of text displayed in an italic font. -<li><tt>\<INPUT></tt> Does not generate any output. -<li><tt>\</I></tt> Ends a <tt>\<I\></tt> section. -<li><tt>\<IMG></tt> This command is written with attributes to the HTML output only. -<li><tt>\<LI></tt> Starts a new list item. -<li><tt>\</LI></tt> Ends a list item. -<li><tt>\<META></tt> Does not generate any output. -<li><tt>\<MULTICOL></tt> ignored by doxygen. -<li><tt>\</MUTLICOL></tt> ignored by doxygen. -<li><tt>\<OL></tt> Starts a numbered item list. -<li><tt>\</OL></tt> Ends a numbered item list. -<li><tt>\<P></tt> Starts a new paragraph. -<li><tt>\</P></tt> Ends a paragraph. -<li><tt>\<PRE></tt> Starts a preformatted fragment. -<li><tt>\</PRE></tt> Ends a preformatted fragment. -<li><tt>\<SMALL></tt> Starts a section of text displayed in a smaller font. -<li><tt>\</SMALL></tt> Ends a <tt>\<SMALL\></tt> section. -<li><tt>\<STRONG></tt> Starts a section of bold text. -<li><tt>\</STRONG></tt> Ends a section of bold text. -<li><tt>\<SUB></tt> Starts a piece of text displayed in subscript. -<li><tt>\</SUB></tt> Ends a <tt>\<SUB\></tt> section. -<li><tt>\<SUP></tt> Starts a piece of text displayed in superscript. -<li><tt>\</SUP></tt> Ends a <tt>\</SUP\></tt> section. -<li><tt>\<TABLE></tt> starts a table. -<li><tt>\</TABLE></tt> ends a table. -<li><tt>\<TD></tt> Starts a new table data element. -<li><tt>\</TD></tt> Ends a table data element. -<li><tt>\<TR></tt> Starts a new table row. -<li><tt>\</TR></tt> Ends a table row. -<li><tt>\<TT></tt> Starts a piece of text displayed in a typewriter font. -<li><tt>\</TT></tt> Ends a <tt>\<TT\></tt> section. -<li><tt>\<KBD></tt> Starts a piece of text displayed in a typewriter font. -<li><tt>\</KBD></tt> Ends a <tt>\<KBD\></tt> section. -<li><tt>\<UL></tt> Starts an unnumbered item list. -<li><tt>\</UL></tt> Ends an unnumbered item list. -<li><tt>\<VAR></tt> Starts a piece of text displayed in an italic font. -<li><tt>\</VAR></tt> Ends a <tt>\</VAR\></tt> section. +<li><tt>\</A\></tt> Ends a link or anchor (HTML only). +<li><tt>\<B\></tt> Starts a piece of text displayed in a bold font. +<li><tt>\</B\></tt> Ends a <tt>\<B\></tt> section. +<li><tt>\<BODY\></tt> Does not generate any output. +<li><tt>\</BODY\></tt> Does not generate any output. +<li><tt>\<BR\></tt> Forces a line break. +<li><tt>\<CENTER\></tt> starts a section of centered text. +<li><tt>\</CENTER\></tt> ends a section of centered text. +<li><tt>\<CAPTION\></tt> Starts a caption. Use within a table only. +<li><tt>\</CAPTION\></tt> Ends a caption. Use within a table only. +<li><tt>\<CODE\></tt> Starts a piece of text displayed in a typewriter font. +<li><tt>\</CODE\></tt> End a <tt>\<CODE\></tt> section. +<li><tt>\<DD\></tt> Starts an item description. +<li><tt>\<DFN\></tt> Starts a piece of text displayed in a typewriter font. +<li><tt>\</DFN\></tt> Ends a <tt>\<DFN\></tt> section. +<li><tt>\<DL\></tt> Starts a description list. +<li><tt>\</DL\></tt> Ends a description list. +<li><tt>\<DT\></tt> Starts an item title. +<li><tt>\</DT\></tt> Ends an item title. +<li><tt>\<EM\></tt> Starts a piece of text displayed in an italic font. +<li><tt>\</EM\></tt> Ends a <tt>\<EM\></tt> section. +<li><tt>\<FORM\></tt> Does not generate any output. +<li><tt>\</FORM\></tt> Does not generate any output. +<li><tt>\<HR\></tt> Writes a horizontal ruler. +<li><tt>\<H1\></tt> Starts an unnumbered section. +<li><tt>\</H1\></tt> Ends an unnumberd section. +<li><tt>\<H2\></tt> Starts an unnumbered subsection. +<li><tt>\</H2\></tt> Ends an unnumbered subsection. +<li><tt>\<H3\></tt> Starts an unnumbered subsubsection. +<li><tt>\</H3\></tt> Ends an unnumbered subsubsection. +<li><tt>\<I\></tt> Starts a piece of text displayed in an italic font. +<li><tt>\<INPUT\></tt> Does not generate any output. +<li><tt>\</I\></tt> Ends a <tt>\<I\></tt> section. +<li><tt>\<IMG\></tt> This command is written with attributes to the HTML output only. +<li><tt>\<LI\></tt> Starts a new list item. +<li><tt>\</LI\></tt> Ends a list item. +<li><tt>\<META\></tt> Does not generate any output. +<li><tt>\<MULTICOL\></tt> ignored by doxygen. +<li><tt>\</MUTLICOL\></tt> ignored by doxygen. +<li><tt>\<OL\></tt> Starts a numbered item list. +<li><tt>\</OL\></tt> Ends a numbered item list. +<li><tt>\<P\></tt> Starts a new paragraph. +<li><tt>\</P\></tt> Ends a paragraph. +<li><tt>\<PRE\></tt> Starts a preformatted fragment. +<li><tt>\</PRE\></tt> Ends a preformatted fragment. +<li><tt>\<SMALL\></tt> Starts a section of text displayed in a smaller font. +<li><tt>\</SMALL\></tt> Ends a <tt>\<SMALL\></tt> section. +<li><tt>\<STRONG\></tt> Starts a section of bold text. +<li><tt>\</STRONG\></tt> Ends a section of bold text. +<li><tt>\<SUB\></tt> Starts a piece of text displayed in subscript. +<li><tt>\</SUB\></tt> Ends a <tt>\<SUB\></tt> section. +<li><tt>\<SUP\></tt> Starts a piece of text displayed in superscript. +<li><tt>\</SUP\></tt> Ends a <tt>\</SUP\></tt> section. +<li><tt>\<TABLE\></tt> starts a table. +<li><tt>\</TABLE\></tt> ends a table. +<li><tt>\<TD\></tt> Starts a new table data element. +<li><tt>\</TD\></tt> Ends a table data element. +<li><tt>\<TR\></tt> Starts a new table row. +<li><tt>\</TR\></tt> Ends a table row. +<li><tt>\<TT\></tt> Starts a piece of text displayed in a typewriter font. +<li><tt>\</TT\></tt> Ends a <tt>\<TT\></tt> section. +<li><tt>\<KBD\></tt> Starts a piece of text displayed in a typewriter font. +<li><tt>\</KBD\></tt> Ends a <tt>\<KBD\></tt> section. +<li><tt>\<UL\></tt> Starts an unnumbered item list. +<li><tt>\</UL\></tt> Ends an unnumbered item list. +<li><tt>\<VAR\></tt> Starts a piece of text displayed in an italic font. +<li><tt>\</VAR\></tt> Ends a <tt>\</VAR\></tt> section. </ul> The special HTML character entities that are recognized by Doxygen: diff --git a/doc/install.doc b/doc/install.doc index 96a1056..fe7fd55 100644 --- a/doc/install.doc +++ b/doc/install.doc @@ -181,8 +181,9 @@ Compilation is now done by performing the following steps: directory manually to some <code>bin</code> directory in your search path. This is sufficient to use doxygen. - \note You need the GNU install tool for this to work. Other - install tools may put the binaries in the wrong directory! + \note You need the GNU install tool for this to work (it is part of + the fileutils package). Other install tools may put the binaries in + the wrong directory! If you have a RPM or DEP package, then please follow the standard installation procedure that is required for these packages. diff --git a/doc/language.doc b/doc/language.doc index 42b1195..f850044 100644 --- a/doc/language.doc +++ b/doc/language.doc @@ -25,7 +25,7 @@ Doxygen has built-in support for multiple languages. This means that the text fragments that doxygen generates can be produced in languages other than English (the default) at configuration time. -Currently (version 1.2.14-20020317), 27 languages +Currently (version 1.2.17-20020804), 27 languages are supported (sorted alphabetically): Brazilian Portuguese, Chinese, Chinese Traditional, Croatian, Czech, Danish, Dutch, English, Finnish, French, @@ -133,7 +133,7 @@ when the translator was updated. <TD>Italian</TD> <TD>Alessandro Falappa<br>Ahmed Aldo Faisal</TD> <TD>alessandro@NOSPAM.falappa.net<br>aaf23@NOSPAM.cam.ac.uk</TD> - <TD>1.2.17</TD> + <TD>up-to-date</TD> </TR> <TR BGCOLOR="#ffffff"> <TD>Japanese</TD> @@ -175,7 +175,7 @@ when the translator was updated. <TD>Russian</TD> <TD>Alexandr Chelpanov</TD> <TD>cav@NOSPAM.cryptopro.ru</TD> - <TD>1.2.17</TD> + <TD>up-to-date</TD> </TR> <TR BGCOLOR="#ffffff"> <TD>Serbian</TD> @@ -252,7 +252,7 @@ when the translator was updated. \hline Hungarian & F\"{o}ldv\'{a}ri Gy\"{o}rgy & {\tt foldvari@diatronltd.com} & 1.2.1 \\ \hline - Italian & Alessandro Falappa & {\tt alessandro@falappa.net} & 1.2.17 \\ + Italian & Alessandro Falappa & {\tt alessandro@falappa.net} & up-to-date \\ & Ahmed Aldo Faisal & {\tt aaf23@cam.ac.uk} & \\ \hline Japanese & Ryunosuke Sato & {\tt puyo@mint.freemail.ne.jp} & 1.2.17 \\ @@ -269,7 +269,7 @@ when the translator was updated. \hline Romanian & Alexandru Iosup & {\tt aiosup@yahoo.com} & 1.2.16 \\ \hline - Russian & Alexandr Chelpanov & {\tt cav@cryptopro.ru} & 1.2.17 \\ + Russian & Alexandr Chelpanov & {\tt cav@cryptopro.ru} & up-to-date \\ \hline Serbian & Dejan Milosavljevic & {\tt dmilos@email.com} & 1.2.16 \\ \hline @@ -315,8 +315,8 @@ Just follow these steps: defines which language translators will be compiled into doxygen executable. It is a kind of configuration file. If you are sure that you do not need some of the languages, you can remove (comment out) - definitions of symbols for the languages, or you can say \c #undef - instead of \c #define for them. + definitions of symbols for the languages, or you can say \c \#undef + instead of \c \#define for them. <li>Edit language.cpp: Add a \verbatim @@ -346,7 +346,7 @@ Just follow these steps: <li>Edit <code>translator_xx.h</code>: <ul> <li>Rename <code>TRANSLATOR_EN_H</code> to <code>TRANSLATOR_XX_H</code> - twice (i.e. in the \c #ifndef and \c #define preprocessor commands at + twice (i.e. in the \c \#ifndef and \c \#define preprocessor commands at the beginning of the file). <li>Rename TranslatorEnglish to TranslatorYourLanguage <li>In the member <code>idLanguage()</code> change "english" into the diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec index a41a72c..efa0314 100644 --- a/packages/rpm/doxygen.spec +++ b/packages/rpm/doxygen.spec @@ -1,6 +1,6 @@ Summary: A documentation system for C/C++. Name: doxygen -Version: 1.2.17_20020804 +Version: 1.2.17_20020811 Release: 1 Epoch: 1 Source0: ftp://ftp.stack.nl/pub/users/dimitri/%{name}-%{version}.src.tar.gz diff --git a/src/classdef.cpp b/src/classdef.cpp index eb0f199..d8be5e5 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -39,7 +39,10 @@ static QCString stripExtension(const char *fName) { QCString result=fName; - if (result.right(htmlFileExtensionLength)==htmlFileExtension) result=result.left(result.length()-htmlFileExtensionLength); + if (result.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension) + { + result=result.left(result.length()-Doxygen::htmlFileExtension.length()); + } return result; } @@ -853,7 +856,7 @@ void ClassDef::writeDocumentation(OutputList &ol) Doxygen::tagFile << " <compound kind=\"" << compoundTypeString(); Doxygen::tagFile << "\">" << endl; Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; - Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << htmlFileExtension << "</filename>" << endl; + Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; if (m_tempArgs) { ArgumentListIterator ali(*m_tempArgs); @@ -993,7 +996,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.writeString("<center><font size=\"2\">["); - ol.startHtmlLink("graph_legend"+htmlFileExtension); + ol.startHtmlLink("graph_legend"+Doxygen::htmlFileExtension); ol.docify(theTranslator->trLegend()); ol.endHtmlLink(); ol.writeString("]</font></center>"); @@ -1028,7 +1031,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.writeString("<center><font size=\"2\">["); - ol.startHtmlLink("graph_legend"+htmlFileExtension); + ol.startHtmlLink("graph_legend"+Doxygen::htmlFileExtension); ol.docify(theTranslator->trLegend()); ol.endHtmlLink(); ol.writeString("]</font></center>"); diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index eb7c25a..b2aedcf 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -86,7 +86,8 @@ CommandMap cmdMap[] = { "verbinclude", CMD_VERBINCLUDE }, { "version", CMD_VERSION }, { "warning", CMD_WARNING }, - { "authors", CMD_AUTHOR }, + { "author", CMD_AUTHOR }, + { "authors", CMD_AUTHORS }, { "throws", CMD_EXCEPTION }, { "\\", CMD_BSLASH }, { "@", CMD_AT }, @@ -97,6 +98,7 @@ CommandMap cmdMap[] = { "#", CMD_HASH }, { "%", CMD_PERCENT }, { "~", CMD_LANGSWITCH }, + { "_internalref", CMD_INTERNALREF }, { 0, 0 } }; diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 09a8e92..e9dd096 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -31,73 +31,75 @@ const int SIMPLESECT_BIT = 0x1000; enum CommandType { - CMD_UNKNOWN=0, - CMD_ADDINDEX=1, /* DocIndex, word as arg */ - CMD_ANCHOR=2, - CMD_ATTENTION=3 | SIMPLESECT_BIT, - CMD_AUTHOR=4 | SIMPLESECT_BIT, - CMD_BOLD=5, - CMD_BUG=6 | SIMPLESECT_BIT, - CMD_CODE=7, - CMD_COPYDOC=8, /* reference yields subtree */ - CMD_DATE=9 | SIMPLESECT_BIT, - CMD_DEPRECATED=10 | SIMPLESECT_BIT, - CMD_DONTINCLUDE=11, /* file name */ - CMD_DOTFILE=12, /* file name */ - CMD_EMPHASIS =13, - CMD_ENDCODE=14, - CMD_ENDHTMLONLY=15, - CMD_ENDLATEXONLY=16, - CMD_ENDLINK=17, - CMD_ENDVERBATIM=18 , - CMD_EXCEPTION=19 | SIMPLESECT_BIT, - CMD_HTMLINCLUDE=20 , - CMD_HTMLONLY=21 , - CMD_IMAGE=22 , /* some number of arguments */ - CMD_INCLUDE=23 , - CMD_INTERNAL=24 , /* node, with sub paragraphs? */ - CMD_INVARIANT=25| SIMPLESECT_BIT , - CMD_LATEXONLY=26 , - CMD_LI=27 , - CMD_LINE=28 , - CMD_LINK=29 , /* argument + "text", TODO {@link...} */ - CMD_NOTE=30 | SIMPLESECT_BIT , - CMD_PAR=31 | SIMPLESECT_BIT , - CMD_PARAM=32 | SIMPLESECT_BIT, - CMD_POST=33 | SIMPLESECT_BIT, - CMD_PRE=34 | SIMPLESECT_BIT , - CMD_REF=35 , - CMD_SECREFITEM=36 , - CMD_REMARK=37 | SIMPLESECT_BIT , - CMD_RETURN=38 | SIMPLESECT_BIT , - CMD_RETVAL=39 | SIMPLESECT_BIT, - CMD_SA=40 | SIMPLESECT_BIT , - CMD_SECTION=41 , - CMD_SINCE=42 | SIMPLESECT_BIT, - CMD_SKIP=43 , - CMD_SKIPLINE=44 , - CMD_STARTCODE=45, - CMD_JAVALINK=46, - CMD_TEST=47 | SIMPLESECT_BIT, - CMD_TODO=48 | SIMPLESECT_BIT, - CMD_UNTIL=49 , - CMD_VERBATIM=50 , - CMD_VERBINCLUDE=51 , - CMD_VERSION=52 | SIMPLESECT_BIT, - CMD_WARNING=53 | SIMPLESECT_BIT , - CMD_BSLASH=54 , - CMD_AT=55 , - CMD_LESS=56 , - CMD_GREATER=57 , - CMD_AMP=58 , - CMD_DOLLAR=59 , - CMD_HASH=60 , - CMD_PERCENT=61, - CMD_LINEBREAK=62, - CMD_FORMULA=63, - CMD_SECREFLIST=64, - CMD_ENDSECREFLIST=65, - CMD_LANGSWITCH=66 + CMD_UNKNOWN = 0, + CMD_ADDINDEX = 1, + CMD_ANCHOR = 2, + CMD_ATTENTION = 3 | SIMPLESECT_BIT, + CMD_AUTHOR = 4 | SIMPLESECT_BIT, + CMD_BOLD = 5, + CMD_BUG = 6 | SIMPLESECT_BIT, + CMD_CODE = 7, + CMD_COPYDOC = 8, + CMD_DATE = 9 | SIMPLESECT_BIT, + CMD_DEPRECATED = 10 | SIMPLESECT_BIT, + CMD_DONTINCLUDE = 11, + CMD_DOTFILE = 12, + CMD_EMPHASIS = 13, + CMD_ENDCODE = 14, + CMD_ENDHTMLONLY = 15, + CMD_ENDLATEXONLY = 16, + CMD_ENDLINK = 17, + CMD_ENDVERBATIM = 18, + CMD_EXCEPTION = 19 | SIMPLESECT_BIT, + CMD_HTMLINCLUDE = 20, + CMD_HTMLONLY = 21, + CMD_IMAGE = 22, + CMD_INCLUDE = 23, + CMD_INTERNAL = 24, + CMD_INVARIANT = 25 | SIMPLESECT_BIT , + CMD_LATEXONLY = 26, + CMD_LI = 27, + CMD_LINE = 28, + CMD_LINK = 29, + CMD_NOTE = 30 | SIMPLESECT_BIT , + CMD_PAR = 31 | SIMPLESECT_BIT , + CMD_PARAM = 32 | SIMPLESECT_BIT, + CMD_POST = 33 | SIMPLESECT_BIT, + CMD_PRE = 34 | SIMPLESECT_BIT , + CMD_REF = 35, + CMD_SECREFITEM = 36, + CMD_REMARK = 37 | SIMPLESECT_BIT , + CMD_RETURN = 38 | SIMPLESECT_BIT , + CMD_RETVAL = 39 | SIMPLESECT_BIT, + CMD_SA = 40 | SIMPLESECT_BIT , + CMD_SECTION = 41, + CMD_SINCE = 42 | SIMPLESECT_BIT, + CMD_SKIP = 43, + CMD_SKIPLINE = 44, + CMD_STARTCODE = 45, + CMD_JAVALINK = 46, + CMD_TEST = 47 | SIMPLESECT_BIT, + CMD_TODO = 48 | SIMPLESECT_BIT, + CMD_UNTIL = 49, + CMD_VERBATIM = 50, + CMD_VERBINCLUDE = 51, + CMD_VERSION = 52 | SIMPLESECT_BIT, + CMD_WARNING = 53 | SIMPLESECT_BIT , + CMD_BSLASH = 54, + CMD_AT = 55, + CMD_LESS = 56, + CMD_GREATER = 57, + CMD_AMP = 58, + CMD_DOLLAR = 59, + CMD_HASH = 60, + CMD_PERCENT = 61, + CMD_LINEBREAK = 62, + CMD_FORMULA = 63, + CMD_SECREFLIST = 64, + CMD_ENDSECREFLIST= 65, + CMD_LANGSWITCH = 66, + CMD_AUTHORS = 67 | SIMPLESECT_BIT, + CMD_INTERNALREF = 68 }; enum HtmlTagType @@ -21,11 +21,11 @@ #include "qtbc.h" #include <stdio.h> -class OutputDocInterface; +class BaseCodeDocInterface; class FileDef; class MemberDef; -extern void parseCode(OutputDocInterface &,const char *,const QCString &, +extern void parseCode(BaseCodeDocInterface &,const char *,const QCString &, bool ,const char *,FileDef *fd=0, int startLine=-1,int endLine=-1,bool inlineFragment=FALSE); extern void initParseCodeContext(); @@ -48,7 +48,7 @@ * statics */ -static OutputDocInterface * g_code; +static BaseCodeDocInterface * g_code; static ClassSDict g_codeClassSDict(17); static ClassDef *g_curClassDef; @@ -414,7 +414,7 @@ static void codifyLines(char *text) * line numbers for each line. If \a text contains newlines, the link will be * split into multiple links with the same destination, one for each line. */ -static void writeMultiLineCodeLink(OutputDocInterface &ol, +static void writeMultiLineCodeLink(BaseCodeDocInterface &ol, const char *ref,const char *file, const char *anchor,const char *text) { @@ -610,7 +610,7 @@ static void addDocCrossReference(MemberDef *src,MemberDef *dst) } -static void generateClassOrGlobalLink(OutputDocInterface &ol,char *clName,int *clNameLen=0) +static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,int *clNameLen=0) { int i=0; if (*clName=='~') // correct for matching negated values i.s.o. destructors. @@ -642,11 +642,7 @@ static void generateClassOrGlobalLink(OutputDocInterface &ol,char *clName,int *c // g_exampleFile.data()); if (cd->addExample(anchor,g_exampleName,g_exampleFile)) { - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Latex); - ol.disable(OutputGenerator::RTF); - ol.writeAnchor(0,anchor); - ol.popGeneratorState(); + ol.writeCodeAnchor(anchor); g_anchorCount++; } } @@ -681,7 +677,8 @@ static void generateClassOrGlobalLink(OutputDocInterface &ol,char *clName,int *c } static bool getLink(const char *className, - const char *memberName,OutputDocInterface &result, + const char *memberName, + BaseCodeDocInterface &ol, const char *text=0) { MemberDef *md; @@ -704,13 +701,7 @@ static bool getLink(const char *className, // g_exampleFile.data()); if (md->addExample(anchor,g_exampleName,g_exampleFile)) { - //bool latexEnabled = result.isEnabled(OutputGenerator::Latex); - result.pushGeneratorState(); - //if (latexEnabled) result.disable(OutputGenerator::Latex); - result.disable(OutputGenerator::Latex); - result.writeAnchor(0,anchor); - result.popGeneratorState(); - //if (latexEnabled) result.enable(OutputGenerator::Latex); + ol.writeCodeAnchor(anchor); g_anchorCount++; } } @@ -733,7 +724,7 @@ static bool getLink(const char *className, } //printf("d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getOutputFileBase().data(),d->name().data(),md->name().data()); - writeMultiLineCodeLink(result,d->getReference(),d->getOutputFileBase(), + writeMultiLineCodeLink(ol,d->getReference(),d->getOutputFileBase(), md->getBodyAnchor(),text ? text : memberName); return TRUE; } @@ -741,7 +732,7 @@ static bool getLink(const char *className, return FALSE; } -static bool generateClassMemberLink(OutputDocInterface &ol,ClassDef *mcd,const char *memName) +static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const char *memName) { if (mcd) { @@ -764,10 +755,7 @@ static bool generateClassMemberLink(OutputDocInterface &ol,ClassDef *mcd,const c // g_exampleFile.data()); if (xmd->addExample(anchor,g_exampleName,g_exampleFile)) { - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Latex); - ol.writeAnchor(0,anchor); - ol.popGeneratorState(); + ol.writeCodeAnchor(anchor); g_anchorCount++; } } @@ -799,7 +787,7 @@ static bool generateClassMemberLink(OutputDocInterface &ol,ClassDef *mcd,const c return FALSE; } -static void generateMemberLink(OutputDocInterface &ol,const QCString &varName, +static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName, char *memName) { //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n", @@ -812,23 +800,17 @@ static void generateMemberLink(OutputDocInterface &ol,const QCString &varName, if (vcd) { //printf("Class found!\n"); - OutputDocInterface *result = ol.clone(); - if (getLink(vcd->name(),memName,*result)) + if (getLink(vcd->name(),memName,ol)) { //printf("Found result!\n"); - ol.append(result); - delete result; return; } BaseClassListIterator bcli(*vcd->baseClasses()); for ( ; bcli.current() ; ++bcli) { - OutputDocInterface *result = ol.clone(); - if (getLink(bcli.current()->classDef->name(),memName,*result)) + if (getLink(bcli.current()->classDef->name(),memName,ol)) { //printf("Found result!\n"); - ol.append(result); - delete result; return; } } @@ -896,9 +878,8 @@ static void generateMemberLink(OutputDocInterface &ol,const QCString &varName, return; } -static void generateFunctionLink(OutputDocInterface &ol,char *funcName) +static void generateFunctionLink(BaseCodeDocInterface &ol,char *funcName) { - OutputDocInterface *result = ol.clone(); //CodeClassDef *ccd=0; ClassDef *ccd=0; QCString locScope=g_classScope.copy(); @@ -924,24 +905,16 @@ static void generateFunctionLink(OutputDocInterface &ol,char *funcName) BaseClassListIterator bcli(*ccd->baseClasses()); for ( ; bcli.current() ; ++bcli) { - if (getLink(bcli.current()->classDef->name(),locFunc,*result,funcName)) + if (getLink(bcli.current()->classDef->name(),locFunc,ol,funcName)) { - ol.append(result); - delete result; return; } } } - if (getLink(locScope,locFunc,*result,funcName)) + if (!getLink(locScope,locFunc,ol,funcName)) { - ol.append(result); - } - else - { - //codifyLines(funcName); generateClassOrGlobalLink(ol,funcName); } - delete result; return; } @@ -2008,12 +1981,12 @@ void initParseCodeContext() g_anchorCount = 0; } -void parseCode(OutputDocInterface &od,const char *className,const QCString &s, +void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s, bool exBlock, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment) { if (s.isEmpty()) return; - g_code = od.clone(); + g_code = &od; g_inputString = s; g_inputPosition = 0; g_currentFontClass = 0; @@ -2060,8 +2033,6 @@ void parseCode(OutputDocInterface &od,const char *className,const QCString &s, endFontClass(); g_code->endCodeLine(); } - od.append(g_code); - delete g_code; return; } diff --git a/src/definition.cpp b/src/definition.cpp index 5d5ca03..1e7652b 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -408,6 +408,9 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, name.prepend(scope+"::"); } } + if (md->isFunction() || md->isSlot() || + md->isPrototype() || md->isSignal() + ) name+="()"; Definition *d = md->getOuterScope(); if (d==Doxygen::globalScope) d=md->getBodyDef(); if (md->getStartBodyLine()!=-1 && md->getBodyDef()) @@ -447,7 +450,6 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, { ol.docify(name); } - if (md->isFunction() || md->isSlot() || md->isPrototype() || md->isSignal()) ol.docify("()"); } index=newIndex+matchLen; } diff --git a/src/diagram.cpp b/src/diagram.cpp index 3e9eb33..a2891c0 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -166,7 +166,7 @@ static void writeMapArea(QTextStream &t,ClassDef *cd,int x,int y,int w,int h) { if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/"; } - t << cd->getOutputFileBase() << htmlFileExtension << "\" "; + t << cd->getOutputFileBase() << Doxygen::htmlFileExtension << "\" "; t << "alt=\"" << cd->displayName(); t << "\" shape=\"rect\" coords=\"" << x << "," << y << ","; t << (x+w) << "," << (y+h) << "\">" << endl; @@ -1,4 +1,4 @@ -/***************************************************************************** +/**************************************************************************** * * * @@ -31,7 +31,6 @@ #include <qregexp.h> // new experimental parser -#include "docparser.h" #include "debug.h" #include "doc.h" @@ -446,7 +445,10 @@ static QCString stripKnownExtensions(const char *text) { QCString result=text; if (result.right(4)==".tex") result=result.left(result.length()-4); - else if (result.right(htmlFileExtensionLength)==htmlFileExtension) result=result.left(result.length()-htmlFileExtensionLength); + else if (result.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension) + { + result=result.left(result.length()-Doxygen::htmlFileExtension.length()); + } //printf("%s stripKnowExtensions(%s)\n",result.data(),text); return result; } @@ -1928,9 +1930,9 @@ LINKMASK [a-z_A-Z0-9:#.,~&*/\[\]<>()\-\+]+({B}*("const"|"volatile"))? internalRefAnchor.resize(0); BEGIN(DocInternalRef); } -<DocInternalRef>[A-Z_a-z0-9.:\-\+]+ { +<DocInternalRef>[A-Z_a-z0-9.:#\-\+]+ { internalRefFile=yytext; - int i = internalRefFile.find(':'); + int i = internalRefFile.find('#'); if (i!=-1) { internalRefAnchor=internalRefFile.right(internalRefFile.length()-i-1); @@ -2947,7 +2949,7 @@ void parseDoc(OutputDocInterface &od,const char *fileName,int startLine, if (Debug::isFlagSet(Debug::Validate)) { - validatingParseDoc(fileName,startLine,docStr); + od.parseDoc(fileName,startLine,clName,md,docStr); } strcpy(yyFileName,fileName); diff --git a/src/docparser.cpp b/src/docparser.cpp index a34f652..da1d808 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -27,6 +27,8 @@ #include "doxygen.h" #include "debug.h" +#include "util.h" +#include "page.h" #include "docparser.h" #include "doctokenizer.h" @@ -38,9 +40,67 @@ //--------------------------------------------------------------------------- +static QCString g_context; +static bool g_inSeeBlock; +static bool g_insideHtmlLink; static QStack<DocNode> g_nodeStack; static QStack<DocStyleChange> g_styleStack; +struct DocParserContext +{ + QCString context; + bool inSeeBlock; + bool insideHtmlLink; + QStack<DocNode> nodeStack; + QStack<DocStyleChange> styleStack; +}; + +static QStack<DocParserContext> g_parserStack; + +//--------------------------------------------------------------------------- + +static void docParserPushContext() +{ + doctokenizerYYpushContext(); + DocParserContext *ctx = new DocParserContext; + ctx->context = g_context; + ctx->inSeeBlock = g_inSeeBlock; + ctx->insideHtmlLink = g_insideHtmlLink; + ctx->nodeStack = g_nodeStack; + ctx->styleStack = g_styleStack; + g_parserStack.push(ctx); +} + +static void docParserPopContext() +{ + DocParserContext *ctx = g_parserStack.pop(); + g_context = ctx->context; + g_inSeeBlock = ctx->inSeeBlock; + g_insideHtmlLink = ctx->insideHtmlLink; + g_nodeStack = ctx->nodeStack; + g_styleStack = ctx->styleStack; + delete ctx; + doctokenizerYYpopContext(); +} + +//--------------------------------------------------------------------------- + +static QCString stripKnownExtensions(const char *text) +{ + QCString result=text; + if (result.right(4)==".tex") + { + result=result.left(result.length()-4); + } + else if (result.right(Doxygen::htmlFileExtension.length())== + Doxygen::htmlFileExtension) + { + result=result.left(result.length()-Doxygen::htmlFileExtension.length()); + } + return result; +} + + //--------------------------------------------------------------------------- /*! Returns TRUE iff node n is a child of a preformatted node */ @@ -185,7 +245,7 @@ static void handlePendingStyleCommands(DocNode *parent,QList<DocNode> &children) DocStyleChange *sc = g_styleStack.top(); while (sc && sc->position()>=g_nodeStack.count()) { // there are unclosed style modifiers in the paragraph - const char *cmd; + const char *cmd=""; switch (sc->style()) { case DocStyleChange::Bold: cmd = "b"; break; @@ -205,6 +265,39 @@ static void handlePendingStyleCommands(DocNode *parent,QList<DocNode> &children) } } +static void handleLinkedWord(DocNode *parent,QList<DocNode> &children) +{ + Definition *compound=0; + MemberDef *member=0; + if (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member)) + { + if (member) // member link + { + children.append(new + DocLinkedWord(parent,g_token->name, + compound->getReference(), + compound->getOutputFileBase(), + member->anchor() + ) + ); + } + else // compound link + { + children.append(new + DocLinkedWord(parent,g_token->name, + compound->getReference(), + compound->getOutputFileBase(), + "" + ) + ); + } + } + else // normal word + { + children.append(new DocWord(parent,g_token->name)); + } +} + /* Helper function that deals with the most common tokens allowed in * title like sections. * @param parent Parent node, owner of the children list passed as @@ -220,7 +313,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children handleWord) { DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno)); - if (tok==TK_WORD || tok==TK_SYMBOL || tok==TK_URL || + if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL || tok==TK_COMMAND || tok==TK_HTMLTAG ) { @@ -285,7 +378,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children { doctokenizerYYsetStateHtmlOnly(); int retval = doctokenizerYYlex(); - children.append(new DocVerbatim(parent,g_token->verb,DocVerbatim::HtmlOnly)); + children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::HtmlOnly)); if (retval==0) printf("Error: htmlonly section ended without end marker at line %d\n", doctokenizerYYlineno); doctokenizerYYsetStatePara(); @@ -295,7 +388,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children { doctokenizerYYsetStateLatexOnly(); int retval = doctokenizerYYlex(); - children.append(new DocVerbatim(parent,g_token->verb,DocVerbatim::LatexOnly)); + children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::LatexOnly)); if (retval==0) printf("Error: latexonly section ended without end marker at line %d\n", doctokenizerYYlineno); doctokenizerYYsetStatePara(); @@ -307,6 +400,57 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children children.append(form); } break; + case CMD_ANCHOR: + { + int tok=doctokenizerYYlex(); + if (tok!=TK_WHITESPACE) + { + printf("Error: expected whitespace after %s command at line %d\n", + tokenName.data(),doctokenizerYYlineno); + break; + } + tok=doctokenizerYYlex(); + if (tok==0) + { + printf("Error: unexpected end of comment block at line %d while parsing the " + "argument of command %s\n",doctokenizerYYlineno, tokenName.data()); + break; + } + else if (tok!=TK_WORD && tok!=TK_LNKWORD) + { + printf("Error: unexpected token %s as the argument of %s at line %d.\n", + tokToString(tok),tokenName.data(),doctokenizerYYlineno); + break; + } + DocAnchor *anchor = new DocAnchor(parent,g_token->name); + children.append(anchor); + } + break; + case CMD_INTERNALREF: + { + int tok=doctokenizerYYlex(); + if (tok!=TK_WHITESPACE) + { + printf("Error: expected whitespace after %s command at line %d\n", + tokenName.data(),doctokenizerYYlineno); + break; + } + doctokenizerYYsetStateInternalRef(); + tok=doctokenizerYYlex(); // get the reference id + DocInternalRef *ref=0; + if (tok!=TK_WORD && tok!=TK_LNKWORD) + { + printf("Error: unexpected token %s as the argument of %s at line %d.\n", + tokToString(tok),tokenName.data(),doctokenizerYYlineno); + doctokenizerYYsetStatePara(); + break; + } + ref = new DocInternalRef(parent,g_token->name); + children.append(ref); + ref->parse(); + doctokenizerYYsetStatePara(); + } + break; default: return FALSE; } @@ -413,9 +557,19 @@ handlepara: children.append(new DocWhiteSpace(parent,g_token->chars)); } break; + case TK_LNKWORD: + if (handleWord) + { + handleLinkedWord(parent,children); + } + else + return FALSE; + break; case TK_WORD: if (handleWord) + { children.append(new DocWord(parent,g_token->name)); + } else return FALSE; break; @@ -483,6 +637,77 @@ DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName,char *letter) //--------------------------------------------------------------------------- +static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, + const QCString &doc) +{ + int retval = RetVal_OK; + + doctokenizerYYinit(doc); + + // first parse any number of paragraphs + bool isFirst=FALSE; + DocPara *lastPar=0; + do + { + DocPara *par = new DocPara(parent); + if (isFirst) { par->markFirst(); isFirst=FALSE; } + retval=par->parse(); + if (!par->isEmpty()) + { + children.append(par); + lastPar=par; + } + } while (retval==TK_NEWPARA); + if (lastPar) lastPar->markLast(); + + return retval; +} + +//--------------------------------------------------------------------------- + +void DocXRefItem::parse() +{ + QCString listName; + switch(m_type) + { + case Bug: listName="bug"; break; + case Test: listName="test"; break; + case Todo: listName="todo"; break; + case Deprecated: listName="deprecated"; break; + } + RefList *refList = Doxygen::specialLists->find(listName); + if (Config_getBool(refList->optionName())) // list is enabled + { + RefItem *item = refList->getRefItem(m_id); + ASSERT(item!=0); + + m_file = refList->listName(); + m_anchor = item->listAnchor; + m_title = refList->sectionTitle(); + + docParserPushContext(); + internalValidatingParseDoc(this,m_children,item->text); + docParserPopContext(); + } +} + +//--------------------------------------------------------------------------- + +DocFormula::DocFormula(DocNode *parent,int id) : + m_parent(parent) +{ + QCString formCmd; + formCmd.sprintf("\\form#%d",id); + Formula *formula=Doxygen::formulaNameDict[formCmd]; + if (formula) + { + m_name.sprintf("form_%d",formula->getId()); + m_text = formula->getFormulaText(); + } +} + +//--------------------------------------------------------------------------- + int DocLanguage::parse() { int retval; @@ -490,13 +715,17 @@ int DocLanguage::parse() g_nodeStack.push(this); // parse one or more paragraphs + bool isFirst=TRUE; + DocPara *par=0; do { - DocPara *par = new DocPara(this); + par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } m_children.append(par); retval=par->parse(); } while (retval==TK_NEWPARA); + if (par) par->markLast(); DBG(("DocLanguage::parse() end\n")); DocNode *n = g_nodeStack.pop(); @@ -568,7 +797,7 @@ void DocSecRefList::parse() break; } tok=doctokenizerYYlex(); - if (tok!=TK_WORD) + if (tok!=TK_WORD && tok!=TK_LNKWORD) { printf("Error: unexpected token %s as the argument of \\refitem at line %d.\n", tokToString(tok),doctokenizerYYlineno); @@ -603,10 +832,98 @@ endsecreflist: ASSERT(n==this); } +//--------------------------------------------------------------------------- + +DocInternalRef::DocInternalRef(DocNode *parent,const QCString &ref) + : m_parent(parent) +{ + int i=ref.find('#'); + if (i!=-1) + { + m_anchor = ref.right(ref.length()-i-1); + m_file = ref.left(i); + } + else + { + m_file = ref; + } +} +void DocInternalRef::parse() +{ + g_nodeStack.push(this); + DBG(("DocInternalRef::parse() start\n")); + + int tok; + while ((tok=doctokenizerYYlex())) + { + if (!defaultHandleToken(this,tok,m_children)) + { + switch (tok) + { + case TK_COMMAND: + printf("Error: Illegal command %s as part of a \\ref at line %d\n", + g_token->name.data(),doctokenizerYYlineno); + break; + case TK_SYMBOL: + printf("Error: Unsupported symbol %s found at line %d\n", + g_token->name.data(),doctokenizerYYlineno); + break; + default: + printf("Error: Unexpected token %s at line %d\n", + g_token->name.data(),doctokenizerYYlineno); + break; + } + } + } + + handlePendingStyleCommands(this,m_children); + DBG(("DocInternalRef::parse() end\n")); + DocNode *n=g_nodeStack.pop(); + ASSERT(n==this); +} //--------------------------------------------------------------------------- +DocRef::DocRef(DocNode *parent,const QCString &target) : + m_parent(parent), m_refToSection(FALSE), m_refToAnchor(FALSE) +{ + Definition *compound = 0; + MemberDef *member = 0; + ASSERT(!target.isEmpty()); + SectionInfo *sec = Doxygen::sectionDict[target]; + if (sec) // ref to section or anchor + { + m_text = sec->title; + if (m_text.isEmpty()) m_text = sec->label; + + m_ref = sec->ref; + m_file = stripKnownExtensions(sec->fileName); + m_anchor = sec->label; + m_refToAnchor = sec->type==SectionInfo::Anchor; + m_refToSection = sec->type!=SectionInfo::Anchor; + } + else if (resolveRef(g_context,target,TRUE,&compound,&member)) + { + if (member) // ref to member + { + m_file = compound->getOutputFileBase(); + m_ref = compound->getReference(); + m_anchor = member->anchor(); + } + else // ref to compound + { + m_file = compound->getOutputFileBase(); + m_ref = compound->getReference(); + } + } + else // oops, bogus target + { + printf("Error: unable to resolve reference to `%s' for \\ref command at line %d\n", + target.data(),doctokenizerYYlineno); + } +} + void DocRef::parse() { g_nodeStack.push(this); @@ -643,6 +960,33 @@ void DocRef::parse() //--------------------------------------------------------------------------- +DocLink::DocLink(DocNode *parent,const QCString &target) : + m_parent(parent) +{ + Definition *compound; + PageInfo *page; + if (resolveLink(g_context,stripKnownExtensions(target),g_inSeeBlock, + &compound,&page,m_anchor)) + { + if (compound) + { + m_file = compound->getOutputFileBase(); + m_ref = compound->getReference(); + } + else if (page) + { + m_file = page->getOutputFileBase(); + m_ref = page->getReference(); + } + } + else // oops, bogus target + { + printf("Error: unable to resolve link to `%s' for \\link command at line %d\n", + target.data(),doctokenizerYYlineno); + } +} + + QCString DocLink::parse(bool isJavaLink) { QCString result; @@ -944,16 +1288,24 @@ int DocInternal::parse() DBG(("DocInternal::parse() start\n")); // first parse any number of paragraphs + bool isFirst=FALSE; + DocPara *lastPar=0; do { DocPara *par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) m_children.append(par); + if (!par->isEmpty()) + { + m_children.append(par); + lastPar=par; + } if (retval==TK_LISTITEM) { printf("Error: Invalid list item found at line %d!\n",doctokenizerYYlineno); } } while (retval!=0 && retval!=RetVal_Section); + if (lastPar) lastPar->markLast(); // then parse any number of level1 sections while (retval==RetVal_Section) @@ -1094,13 +1446,17 @@ int DocHtmlCell::parse() DBG(("DocHtmlCell::parse() start\n")); // parse one or more paragraphs + bool isFirst=FALSE; + DocPara *par=0; do { - DocPara *par = new DocPara(this); + par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } m_children.append(par); retval=par->parse(); } while (retval==TK_NEWPARA); + if (par) par->markLast(); DBG(("DocHtmlCell::parse() end\n")); DocNode *n=g_nodeStack.pop(); @@ -1311,13 +1667,17 @@ int DocHtmlDescData::parse() g_nodeStack.push(this); DBG(("DocHtmlDescData::parse() start\n")); + bool isFirst=FALSE; + DocPara *par=0; do { - DocPara *par = new DocPara(this); + par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } m_children.append(par); retval=par->parse(); } while (retval==TK_NEWPARA); + if (par) par->markLast(); DBG(("DocHtmlDescData::parse() end\n")); DocNode *n=g_nodeStack.pop(); @@ -1404,13 +1764,17 @@ int DocHtmlPre::parse() int rv; g_nodeStack.push(this); + bool isFirst=FALSE; + DocPara *par=0; do { - DocPara *par = new DocPara(this); + par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } m_children.append(par); rv=par->parse(); } while (rv==TK_NEWPARA); + if (par) par->markLast(); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); @@ -1426,13 +1790,17 @@ int DocHtmlListItem::parse() g_nodeStack.push(this); // parse one or more paragraphs + bool isFirst=FALSE; + DocPara *par=0; do { - DocPara *par = new DocPara(this); + par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } m_children.append(par); retval=par->parse(); } while (retval==TK_NEWPARA); + if (par) par->markLast(); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); @@ -1506,6 +1874,8 @@ int DocSimpleListItem::parse() { g_nodeStack.push(this); int rv=m_paragraph->parse(); + m_paragraph->markFirst(); + m_paragraph->markLast(); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); return rv; @@ -1535,6 +1905,8 @@ int DocAutoListItem::parse() int retval = RetVal_OK; g_nodeStack.push(this); retval=m_paragraph->parse(); + m_paragraph->markFirst(); + m_paragraph->markLast(); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); return retval; @@ -1602,24 +1974,23 @@ void DocTitle::parse() //-------------------------------------------------------------------------- DocSimpleSect::DocSimpleSect(DocNode *parent,Type t) : - m_parent(parent), m_type(t) + m_parent(parent), m_type(t) { - m_paragraph = new DocPara(this); - //m_params.setAutoDelete(TRUE); - m_title = 0; + m_title=0; } -DocSimpleSect::~DocSimpleSect() +DocSimpleSect::~DocSimpleSect() { - delete m_paragraph; - delete m_title; + delete m_title; } void DocSimpleSect::accept(DocVisitor *v) { v->visitPre(this); if (m_title) m_title->accept(v); - m_paragraph->accept(v); + QListIterator<DocNode> cli(m_children); + DocNode *n; + for (cli.toFirst();(n=cli.current());++cli) n->accept(v); v->visitPost(this); } @@ -1635,34 +2006,38 @@ int DocSimpleSect::parse(bool userTitle) m_title->parse(); } - int retval = m_paragraph->parse(); + // add new paragraph as child + DocPara *par = new DocPara(this); + if (m_children.isEmpty()) + { + par->markFirst(); + } + else + { + ASSERT(m_children.last()->kind()==DocNode::Kind_Para); + ((DocPara *)m_children.last())->markLast(FALSE); + } + par->markLast(); + m_children.append(par); + + // parse the contents of the paragraph + int retval = par->parse(); DBG(("DocSimpleSect::parse() end retval=%d\n",retval)); - DocNode *n = g_nodeStack.pop(); + DocNode *n=g_nodeStack.pop(); ASSERT(n==this); return retval; // 0==EOF, TK_NEWPARA, TK_LISTITEM, TK_ENDLIST, RetVal_SimpleSec } -void DocSimpleSect::addParam(const QCString &name) -{ - m_params.append(name); -} - //-------------------------------------------------------------------------- -int DocPara::handleSimpleSection(DocSimpleSect::Type t) +int DocParamList::parse(const QCString &cmdName) { - DocSimpleSect *ss=new DocSimpleSect(this,t); - m_children.append(ss); - int rv = ss->parse(t==DocSimpleSect::User); - return (rv!=TK_NEWPARA) ? rv : RetVal_OK; -} + int retval=RetVal_OK; + DBG(("DocParamList::parse() start\n")); + g_nodeStack.push(this); -int DocPara::handleParamSection(const QCString &cmdName,DocSimpleSect::Type t) -{ int tok=doctokenizerYYlex(); - DocSimpleSect *ss=new DocSimpleSect(this,t); - m_children.append(ss); if (tok!=TK_WHITESPACE) { printf("Error: expected whitespace after %s command at line %d\n", @@ -1670,12 +2045,12 @@ int DocPara::handleParamSection(const QCString &cmdName,DocSimpleSect::Type t) } doctokenizerYYsetStateParam(); tok=doctokenizerYYlex(); - doctokenizerYYsetStatePara(); while (tok==TK_WORD) /* there is a parameter name */ { - ss->addParam(g_token->name); + m_params.append(g_token->name); tok=doctokenizerYYlex(); } + doctokenizerYYsetStatePara(); if (tok==0) /* premature end of comment block */ { printf("Error: unexpected end of comment block at line %d while parsing the " @@ -1683,71 +2058,75 @@ int DocPara::handleParamSection(const QCString &cmdName,DocSimpleSect::Type t) return 0; } ASSERT(tok==TK_WHITESPACE); - int rv = ss->parse(FALSE); - return (rv!=TK_NEWPARA) ? rv : RetVal_OK; + + retval = m_paragraph->parse(); + m_paragraph->markFirst(); + m_paragraph->markLast(); + + DBG(("DocParamList::parse() end retval=%d\n",retval)); + DocNode *n=g_nodeStack.pop(); + ASSERT(n==this); + return retval; } -#if 0 -int DocPara::handleStyleArgument(const QCString &cmdName) +//-------------------------------------------------------------------------- + +int DocParamSect::parse(const QCString &cmdName) { - int tok=doctokenizerYYlex(); - if (tok!=TK_WHITESPACE) + int retval=RetVal_OK; + DBG(("DocParamSect::parse() start\n")); + g_nodeStack.push(this); + + DocParamList *pl = new DocParamList(this); + m_children.append(pl); + retval = pl->parse(cmdName); + + DBG(("DocParamSect::parse() end retval=%d\n",retval)); + DocNode *n=g_nodeStack.pop(); + ASSERT(n==this); + return retval; +} + +//-------------------------------------------------------------------------- + +int DocPara::handleSimpleSection(DocSimpleSect::Type t) +{ + DocSimpleSect *ss=0; + if (!m_children.isEmpty() && // previous element + m_children.last()->kind()==Kind_SimpleSect && // was a simple sect + ((DocSimpleSect *)m_children.last())->type()==t) // of same type { - printf("Error: expected whitespace after %s command at line %d\n", - cmdName.data(),doctokenizerYYlineno); - return; + // append to previous section + ss=(DocSimpleSect *)m_children.last(); } - while ((tok=doctokenizerYYlex()) && tok!=TK_WHITESPACE && tok!=TK_NEWPARA) + else // start new section { - if (!defaultHandleToken(this,tok,m_children)) - { - switch (tok) - { - case TK_COMMAND: - printf("Error: Illegal command \\%s as the argument of a \\%s command at line %d\n", - g_token->name.data(),cmdName.data(),doctokenizerYYlineno); - break; - case TK_SYMBOL: - printf("Error: Unsupported symbol %s found at line %d\n", - g_token->name.data(),doctokenizerYYlineno); - break; - default: - printf("Error: Unexpected token %s at line %d\n", - g_token->name.data(),doctokenizerYYlineno); - break; - } - } + ss=new DocSimpleSect(this,t); + m_children.append(ss); } - return tok==TK_NEWPARA ? TK_NEWPARA : RetVal_OK; -} - -void DocPara::handleStyleEnter(DocStyleChange::Style s) -{ - DBG(("HandleStyleEnter\n")); - DocStyleChange *sc= new DocStyleChange(this,g_nodeStack.count(),s,TRUE); - m_children.append(sc); - g_styleStack.push(sc); + int rv = ss->parse(t==DocSimpleSect::User); + return (rv!=TK_NEWPARA) ? rv : RetVal_OK; } -void DocPara::handleStyleLeave(DocStyleChange::Style s,const char *tagName) +int DocPara::handleParamSection(const QCString &cmdName,DocParamSect::Type t) { - DBG(("HandleStyleLeave\n")); - if (g_styleStack.isEmpty() || // no style change - g_styleStack.top()->style()!=s || // wrong style change - g_styleStack.top()->position()!=g_nodeStack.count() // wrong position - ) + DocParamSect *ps=0; + + if (!m_children.isEmpty() && // previous element + m_children.last()->kind()==Kind_ParamSect && // was a param sect + ((DocParamSect *)m_children.last())->type()==t) // of same type { - printf("Error: found </%s> tag at line %d without matching <%s> in the same paragraph\n", - tagName,doctokenizerYYlineno,tagName); + // append to previous section + ps=(DocParamSect *)m_children.last(); } - else // end the section + else // start new section { - DocStyleChange *sc= new DocStyleChange(this,g_nodeStack.count(),s,FALSE); - m_children.append(sc); - g_styleStack.pop(); + ps=new DocParamSect(this,t); + m_children.append(ps); } + int rv=ps->parse(cmdName); + return (rv!=TK_NEWPARA) ? rv : RetVal_OK; } -#endif int DocPara::handleXRefItem(DocXRefItem::Type t) { @@ -1757,7 +2136,9 @@ int DocPara::handleXRefItem(DocXRefItem::Type t) retval=doctokenizerYYlex(); if (retval!=0) { - m_children.append(new DocXRefItem(this,g_token->id,t)); + DocXRefItem *ref = new DocXRefItem(this,g_token->id,t); + m_children.append(ref); + ref->parse(); } doctokenizerYYsetStatePara(); return retval; @@ -1801,7 +2182,7 @@ void DocPara::handleImage(const QCString &cmdName) return; } tok=doctokenizerYYlex(); - if (tok!=TK_WORD) + if (tok!=TK_WORD && tok!=TK_LNKWORD) { printf("Error: unexpected token %s as the argument of %s at line %d.\n", tokToString(tok),cmdName.data(),doctokenizerYYlineno); @@ -1937,7 +2318,7 @@ int DocPara::handleLanguageSwitch() retval = tok; goto endlang; } - else if (tok==TK_WORD) + else if (tok==TK_WORD || tok==TK_LNKWORD) { DocLanguage *dl = new DocLanguage(this,g_token->name); m_children.append(dl); @@ -2037,7 +2418,9 @@ int DocPara::handleCommand(const QCString &cmdName) m_children.append(new DocSymbol(this,DocSymbol::Percent)); break; case CMD_SA: + g_inSeeBlock=TRUE; retval = handleSimpleSection(DocSimpleSect::See); + g_inSeeBlock=FALSE; break; case CMD_RETURN: retval = handleSimpleSection(DocSimpleSect::Return); @@ -2045,6 +2428,9 @@ int DocPara::handleCommand(const QCString &cmdName) case CMD_AUTHOR: retval = handleSimpleSection(DocSimpleSect::Author); break; + case CMD_AUTHORS: + retval = handleSimpleSection(DocSimpleSect::Authors); + break; case CMD_VERSION: retval = handleSimpleSection(DocSimpleSect::Version); break; @@ -2102,7 +2488,7 @@ int DocPara::handleCommand(const QCString &cmdName) "argument of command %s\n",doctokenizerYYlineno, cmdName.data()); break; } - else if (tok!=TK_WORD) + else if (tok!=TK_WORD && tok!=TK_LNKWORD) { printf("Error: unexpected token %s as the argument of %s at line %d.\n", tokToString(tok),cmdName.data(),doctokenizerYYlineno); @@ -2116,7 +2502,7 @@ int DocPara::handleCommand(const QCString &cmdName) { doctokenizerYYsetStateCode(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_token->verb,DocVerbatim::Code)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Code)); if (retval==0) printf("Error: code section ended without end marker at line %d\n", doctokenizerYYlineno); doctokenizerYYsetStatePara(); @@ -2126,7 +2512,7 @@ int DocPara::handleCommand(const QCString &cmdName) { doctokenizerYYsetStateHtmlOnly(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_token->verb,DocVerbatim::HtmlOnly)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::HtmlOnly)); if (retval==0) printf("Error: htmlonly section ended without end marker at line %d\n", doctokenizerYYlineno); doctokenizerYYsetStatePara(); @@ -2136,7 +2522,7 @@ int DocPara::handleCommand(const QCString &cmdName) { doctokenizerYYsetStateLatexOnly(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_token->verb,DocVerbatim::LatexOnly)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::LatexOnly)); if (retval==0) printf("Error: latexonly section ended without end marker at line %d\n", doctokenizerYYlineno); doctokenizerYYsetStatePara(); @@ -2146,7 +2532,7 @@ int DocPara::handleCommand(const QCString &cmdName) { doctokenizerYYsetStateVerbatim(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_token->verb,DocVerbatim::Verbatim)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Verbatim)); if (retval==0) printf("Error: verbatim section ended without end marker at line %d\n", doctokenizerYYlineno); doctokenizerYYsetStatePara(); @@ -2160,13 +2546,13 @@ int DocPara::handleCommand(const QCString &cmdName) printf("Error: unexpected command %s at line %d\n",g_token->name.data(),doctokenizerYYlineno); break; case CMD_PARAM: - retval = handleParamSection(cmdName,DocSimpleSect::Param); + retval = handleParamSection(cmdName,DocParamSect::Param); break; case CMD_RETVAL: - retval = handleParamSection(cmdName,DocSimpleSect::RetVal); + retval = handleParamSection(cmdName,DocParamSect::RetVal); break; case CMD_EXCEPTION: - retval = handleParamSection(cmdName,DocSimpleSect::Exception); + retval = handleParamSection(cmdName,DocParamSect::Exception); break; case CMD_BUG: retval = handleXRefItem(DocXRefItem::Bug); @@ -2202,7 +2588,7 @@ int DocPara::handleCommand(const QCString &cmdName) "argument of command %s\n",doctokenizerYYlineno, cmdName.data()); break; } - else if (tok!=TK_WORD) + else if (tok!=TK_WORD && tok!=TK_LNKWORD) { printf("Error: unexpected token %s as the argument of %s at line %d.\n", tokToString(tok),cmdName.data(),doctokenizerYYlineno); @@ -2238,7 +2624,7 @@ int DocPara::handleCommand(const QCString &cmdName) "argument of command %s\n",doctokenizerYYlineno, cmdName.data()); break; } - else if (tok!=TK_WORD) + else if (tok!=TK_WORD && tok!=TK_LNKWORD) { printf("Error: unexpected token %s as the argument of %s at line %d.\n", tokToString(tok),cmdName.data(),doctokenizerYYlineno); @@ -2309,6 +2695,9 @@ int DocPara::handleCommand(const QCString &cmdName) case CMD_LANGSWITCH: retval = handleLanguageSwitch(); break; + case CMD_INTERNALREF: + printf("Error: unexpected command %s at line %d\n",g_token->name.data(),doctokenizerYYlineno); + break; default: // we should not get here! ASSERT(0); @@ -2322,34 +2711,6 @@ int DocPara::handleCommand(const QCString &cmdName) return retval; } -#if 0 -void DocPara::handlePendingStyleCommands() -{ - if (!g_styleStack.isEmpty()) - { - DocStyleChange *sc = g_styleStack.top(); - while (sc && sc->position()>=g_nodeStack.count()) - { // there are unclosed style modifiers in the paragraph - const char *cmd; - switch (sc->style()) - { - case DocStyleChange::Bold: cmd = "b"; break; - case DocStyleChange::Italic: cmd = "em"; break; - case DocStyleChange::Code: cmd = "code"; break; - case DocStyleChange::Center: cmd = "center"; break; - case DocStyleChange::Small: cmd = "small"; break; - case DocStyleChange::Subscript: cmd = "subscript"; break; - case DocStyleChange::Superscript: cmd = "superscript"; break; - } - printf("Error: end of paragraph at line %d without end of style " - "command </%s>\n",doctokenizerYYlineno,cmd); - m_children.append(new DocStyleChange(this,g_nodeStack.count(),sc->style(),FALSE)); - g_styleStack.pop(); - sc = g_styleStack.top(); - } - } -} -#endif int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tagOptions) { @@ -2483,7 +2844,9 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag { DocHRef *href = new DocHRef(this,opt->value); m_children.append(href); + g_insideHtmlLink=TRUE; retval = href->parse(); + g_insideHtmlLink=FALSE; break; } else // unsupport option for tag a @@ -2689,7 +3052,7 @@ int DocPara::parse() { reparsetoken: DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno)); - if (tok==TK_WORD || tok==TK_SYMBOL || tok==TK_URL || + if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL || tok==TK_COMMAND || tok==TK_HTMLTAG ) { @@ -2701,6 +3064,9 @@ reparsetoken: case TK_WORD: m_children.append(new DocWord(this,g_token->name)); break; + case TK_LNKWORD: + handleLinkedWord(this,m_children); + break; case TK_URL: m_children.append(new DocURL(this,g_token->name)); break; @@ -2708,12 +3074,12 @@ reparsetoken: // prevent leading whitespace and collapse multiple whitespace areas if (insidePRE(this) || // all whitespace is relavant ( // keep only whitespace after words, URL or symbols - !m_children.isEmpty() && - ( + !m_children.isEmpty() /* && + ( m_children.last()->kind()==DocNode::Kind_Word || m_children.last()->kind()==DocNode::Kind_URL || m_children.last()->kind()==DocNode::Kind_Symbol - ) + )*/ ) ) { @@ -2803,7 +3169,13 @@ reparsetoken: // see if we have to start a simple section int cmd = CmdMapper::map(g_token->name); DocNode *n=parent(); - while (n && n->kind()!=DocNode::Kind_SimpleSect) n=n->parent(); + while (n && + n->kind()!=DocNode::Kind_SimpleSect && + n->kind()!=DocNode::Kind_ParamSect + ) + { + n=n->parent(); + } if (cmd&SIMPLESECT_BIT) { if (n // already in a simple section @@ -2880,7 +3252,20 @@ reparsetoken: } break; case TK_SYMBOL: - break; + { + char letter='\0'; + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); + if (s!=DocSymbol::Unknown) + { + m_children.append(new DocSymbol(this,s,letter)); + } + else + { + printf("Error: Unsupported symbol %s found at line %d\n", + g_token->name.data(),doctokenizerYYlineno); + } + break; + } case TK_NEWPARA: retval=TK_NEWPARA; goto endparagraph; @@ -2910,16 +3295,24 @@ int DocSection::parse() g_nodeStack.push(this); // first parse any number of paragraphs + bool isFirst=FALSE; + DocPara *lastPar=0; do { DocPara *par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) m_children.append(par); + if (!par->isEmpty()) + { + m_children.append(par); + lastPar = par; + } if (retval==TK_LISTITEM) { printf("Error: Invalid list item found at line %d!\n",doctokenizerYYlineno); } } while (retval!=0 && retval!=RetVal_Section && retval!=RetVal_Internal); + if (lastPar) lastPar->markLast(); // then parse any number of nested sections while (retval==RetVal_Section) // more sections follow @@ -2958,20 +3351,27 @@ void DocRoot::parse() { g_nodeStack.push(this); doctokenizerYYsetStatePara(); - DocPara *par=0; int retval=0; // first parse any number of paragraphs + bool isFirst=FALSE; + DocPara *lastPar=0; do { - par = new DocPara(this); + DocPara *par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) m_children.append(par); + if (!par->isEmpty()) + { + m_children.append(par); + lastPar = par; + } if (retval==TK_LISTITEM) { printf("Error: Invalid list item found at line %d!\n",doctokenizerYYlineno); } } while (retval!=0 && retval!=RetVal_Section && retval!=RetVal_Internal); + if (lastPar) lastPar->markLast(); // then parse any number of level1 sections while (retval==RetVal_Section) @@ -3004,12 +3404,19 @@ void DocRoot::parse() //-------------------------------------------------------------------------- -void validatingParseDoc(const char *fileName,int startLine,const char *input) +DocNode *validatingParseDoc(const char *fileName,int startLine, + const char *context,const char *input) { //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); - // + printf("========== validating %s at line %d\n",fileName,startLine); g_token = new TokenInfo; + + g_context = context; + g_nodeStack.clear(); + g_styleStack.clear(); + g_inSeeBlock = FALSE; + g_insideHtmlLink = FALSE; doctokenizerYYlineno=startLine; doctokenizerYYinit(input); @@ -3025,13 +3432,13 @@ void validatingParseDoc(const char *fileName,int startLine,const char *input) root->accept(v); } - delete root; - delete g_token; // TODO: These should be called at the end of the program. //doctokenizerYYcleanup(); //CmdMapper::freeInstance(); //HtmlTagMapper::freeInstance(); + + return root; } diff --git a/src/docparser.h b/src/docparser.h index bbe5575..343a9f7 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -26,10 +26,21 @@ #include "docvisitor.h" #include "doctokenizer.h" +class DocNode; + //--------------------------------------------------------------------------- -/*! Main entry point */ -void validatingParseDoc(const char *fileName,int startLine,const char *input); +/*! Main entry point for the documentation parser. + * @param fileName File in which the documentation block is found. + * @param startLine Line at which the documentation block is found. + * @param context Class or namespace in which of the item to which this + * block belongs. + * @param input String representation of the documentation block. + * @returns Root node of the abstract syntax tree. Ownership of the + * pointer is handed over to the caller. + */ +DocNode *validatingParseDoc(const char *fileName,int startLine, + const char *context, const char *input); //--------------------------------------------------------------------------- @@ -37,6 +48,7 @@ void validatingParseDoc(const char *fileName,int startLine,const char *input); class DocNode { public: + /*! Available node types. */ enum Kind { Kind_Root = 0, Kind_Word = 1, Kind_WhiteSpace = 2, @@ -80,12 +92,22 @@ class DocNode Kind_Formula = 40, Kind_SecRefItem = 41, Kind_SecRefList = 42, - Kind_Language = 43 + Kind_Language = 43, + Kind_LinkedWord = 44, + Kind_ParamSect = 45, + Kind_ParamList = 46, + Kind_InternalRef = 47 }; + /*! Destructor. */ virtual ~DocNode() {} + /*! Returns the kind of node. Provides runtime type information */ virtual Kind kind() const = 0; + /*! Returns the parent of this node or 0 for the root node. */ virtual DocNode *parent() const = 0; - virtual void accept(DocVisitor *) = 0; + /*! Acceptor function for node visitors. Part of the visitor pattern. + * @param v Abstract visitor. + */ + virtual void accept(DocVisitor *v) = 0; }; /*! Default accept implementation for compound nodes in the abstract @@ -111,7 +133,6 @@ template<class T> class CompAccept /*! Node representing a word */ -// TODO: check for word starting \# or having () and try to link to them class DocWord : public DocNode { public: @@ -127,6 +148,32 @@ class DocWord : public DocNode QCString m_word; }; +/*! Node representing a word that can be linked to something + */ +class DocLinkedWord : public DocNode +{ + public: + DocLinkedWord(DocNode *parent,const QCString &word, + const QCString &ref,const QCString &file, + const QCString &anchor) : + m_parent(parent), m_word(word), m_ref(ref), + m_file(file), m_anchor(anchor) {} + QCString word() const { return m_word; } + Kind kind() const { return Kind_Word; } + DocNode *parent() const { return m_parent; } + QCString file() const { return m_file; } + QCString ref() const { return m_ref; } + QCString anchor() const { return m_anchor; } + void accept(DocVisitor *v) { v->visit(this); } + + private: + DocNode *m_parent; + QCString m_word; + QCString m_ref; + QCString m_file; + QCString m_anchor; +}; + /*! Node representing an URL (or email address) */ class DocURL : public DocNode { @@ -250,20 +297,24 @@ class DocWhiteSpace : public DocNode }; /*! Verbatim, unparsed text fragment */ +// TODO: parse code class DocVerbatim : public DocNode { public: enum Type { Code, HtmlOnly, LatexOnly, Verbatim }; - DocVerbatim(DocNode *parent,const QCString &text, Type t) : - m_parent(parent), m_text(text), m_type(t) {} + DocVerbatim(DocNode *parent,const QCString &context, + const QCString &text, Type t) : + m_parent(parent), m_context(context), m_text(text), m_type(t) {} Kind kind() const { return Kind_Verbatim; } Type type() const { return m_type; } QCString text() const { return m_text; } + QCString context() const { return m_context; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; + QCString m_context; QCString m_text; Type m_type; }; @@ -327,43 +378,25 @@ class DocIncOperator : public DocNode }; /*! Item of a cross-referenced list */ -// TODO: lookup id and insert parsed documentation -// (second pass to avoid context saving in the scanner?) -class DocXRefItem : public DocNode -{ - public: - enum Type { Bug, Test, Todo, Deprecated }; - DocXRefItem(DocNode *parent,int id,Type t) : - m_parent(parent), m_id(id), m_type(t) {} - Kind kind() const { return Kind_XRefItem; } - Type type() const { return m_type; } - int id() const { return m_id; } - DocNode *parent() const { return m_parent; } - void accept(DocVisitor *v) { v->visit(this); } - - private: - DocNode *m_parent; - int m_id; - Type m_type; -}; - -/*! Item of a cross-referenced list */ class DocFormula : public DocNode { public: - DocFormula(DocNode *parent,int id) : - m_parent(parent), m_id(id) {} + DocFormula(DocNode *parent,int id); Kind kind() const { return Kind_Formula; } - int id() const { return m_id; } + QCString name() const { return m_name; } + QCString text() const { return m_text; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; - int m_id; + QCString m_name; + QCString m_text; }; -/*! Node representing a entry in the index */ +//----------------------------------------------------------------------- + +/*! Node representing a entry in the index. */ class DocIndexEntry : public CompAccept<DocIndexEntry>, public DocNode { public: @@ -411,6 +444,31 @@ class DocTitle : public CompAccept<DocTitle>, public DocNode DocNode *m_parent; }; +/*! Item of a cross-referenced list */ +class DocXRefItem : public CompAccept<DocXRefItem>, public DocNode +{ + public: + enum Type { Bug, Test, Todo, Deprecated }; + DocXRefItem(DocNode *parent,int id,Type t) : + m_parent(parent), m_id(id), m_type(t) {} + Kind kind() const { return Kind_XRefItem; } + Type type() const { return m_type; } + QCString file() const { return m_file; } + QCString anchor() const { return m_anchor; } + QCString title() const { return m_title; } + void parse(); + DocNode *parent() const { return m_parent; } + void accept(DocVisitor *v) { CompAccept<DocXRefItem>::accept(this,v); } + + private: + DocNode *m_parent; + int m_id; + Type m_type; + QCString m_file; + QCString m_anchor; + QCString m_title; +}; + /*! Image */ class DocImage : public CompAccept<DocImage>, public DocNode { @@ -449,67 +507,68 @@ class DocDotFile : public CompAccept<DocDotFile>, public DocNode }; /*! Node representing a link to some item */ -// TODO: resolve link class DocLink : public CompAccept<DocLink>, public DocNode { public: - DocLink(DocNode *parent,const QCString &target) : - m_parent(parent), m_target(target) {} + DocLink(DocNode *parent,const QCString &target); QCString parse(bool); Kind kind() const { return Kind_Link; } - QCString target() const { return m_target; } + QCString file() const { return m_file; } + QCString ref() const { return m_ref; } + QCString anchor() const { return m_anchor; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocLink>::accept(this,v); } private: DocNode *m_parent; - QCString m_target; + QCString m_file; + QCString m_ref; + QCString m_anchor; }; /*! Node representing a reference to some item */ -// TODO: resolve reference class DocRef : public CompAccept<DocRef>, public DocNode { public: - DocRef(DocNode *parent,const QCString &target) : - m_parent(parent), m_target(target) {} + DocRef(DocNode *parent,const QCString &target); void parse(); - Kind kind() const { return Kind_Ref; } - QCString target() const { return m_target; } - DocNode *parent() const { return m_parent; } - void accept(DocVisitor *v) { CompAccept<DocRef>::accept(this,v); } + Kind kind() const { return Kind_Ref; } + QCString file() const { return m_file; } + QCString ref() const { return m_ref; } + QCString anchor() const { return m_anchor; } + QCString targetTitle() const { return m_text; } + DocNode *parent() const { return m_parent; } + bool hasLinkText() const { return !m_children.isEmpty(); } + bool refToAnchor() const { return m_refToAnchor; } + bool refToSection() const { return m_refToSection; } + void accept(DocVisitor *v) { CompAccept<DocRef>::accept(this,v); } private: DocNode * m_parent; - QCString m_target; + bool m_refToSection; + bool m_refToAnchor; + QCString m_file; + QCString m_ref; + QCString m_anchor; + QCString m_text; }; -/*! Simple section */ -class DocSimpleSect : public DocNode +/*! Node representing an internal reference to some item */ +class DocInternalRef : public CompAccept<DocInternalRef>, public DocNode { public: - enum Type - { - Unknown, See, Return, Author, Version, Since, Date, - Note, Warning, Pre, Post, Invar, Remark, Attention, User, - Param, RetVal, Exception - }; - DocSimpleSect(DocNode *parent,Type t); - virtual ~DocSimpleSect(); - int parse(bool userTitle); - Kind kind() const { return Kind_SimpleSect; } - void addParam(const QCString &name); - const QStrList ¶meters() const { return m_params; } - Type sectionType() const { return m_type; } - DocNode *parent() const { return m_parent; } - void accept(DocVisitor *v); + DocInternalRef(DocNode *parent,const QCString &target); + void parse(); + Kind kind() const { return Kind_Ref; } + QCString file() const { return m_file; } + QCString anchor() const { return m_anchor; } + DocNode *parent() const { return m_parent; } + void accept(DocVisitor *v) { CompAccept<DocInternalRef>::accept(this,v); } private: - DocNode * m_parent; - DocPara * m_paragraph; - Type m_type; - DocTitle * m_title; - QStrList m_params; + DocNode * m_parent; + QCString m_file; + QCString m_anchor; }; /*! Language specific node */ @@ -688,26 +747,71 @@ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode Type m_type; }; +/*! Simple section */ +class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode +{ + public: + enum Type + { + Unknown, See, Return, Author, Authors, Version, Since, Date, + Note, Warning, Pre, Post, Invar, Remark, Attention, User + }; + DocSimpleSect(DocNode *parent,Type t); + virtual ~DocSimpleSect(); + int parse(bool userTitle); + Kind kind() const { return Kind_SimpleSect; } + Type type() const { return m_type; } + DocNode *parent() const { return m_parent; } + void accept(DocVisitor *v); + + private: + DocNode * m_parent; + Type m_type; + DocTitle * m_title; +}; + +/*! Parameter section */ +class DocParamSect : public CompAccept<DocParamSect>, public DocNode +{ + public: + enum Type + { + Unknown, Param, RetVal, Exception + }; + DocParamSect(DocNode *parent,Type t) : m_parent(parent), m_type(t) {} + int parse(const QCString &cmdName); + Kind kind() const { return Kind_ParamSect; } + Type type() const { return m_type; } + DocNode *parent() const { return m_parent; } + void accept(DocVisitor *v) { CompAccept<DocParamSect>::accept(this,v); } + + private: + DocNode * m_parent; + Type m_type; +}; + /*! Paragraph in the documentation tree */ class DocPara : public CompAccept<DocPara>, public DocNode { public: - DocPara(DocNode *parent) : m_parent(parent) {} + DocPara(DocNode *parent) : m_parent(parent), + m_isFirst(FALSE), m_isLast(FALSE) {} int parse(); Kind kind() const { return Kind_Para; } DocNode *parent() const { return m_parent; } bool isEmpty() const { return m_children.isEmpty(); } void accept(DocVisitor *v) { CompAccept<DocPara>::accept(this,v); } + void markFirst(bool v=TRUE) { m_isFirst=v; } + void markLast(bool v=TRUE) { m_isLast=v; } + bool isFirst() const { return m_isFirst; } + bool isLast() const { return m_isLast; } int handleCommand(const QCString &cmdName); int handleHtmlStartTag(const QCString &tagName,const QList<Option> &tagOptions); int handleHtmlEndTag(const QCString &tagName); int handleSimpleSection(DocSimpleSect::Type t); int handleXRefItem(DocXRefItem::Type t); - int handleParamSection(const QCString &cmdName,DocSimpleSect::Type t); - //void handleStyleEnter(DocStyleChange::Style t); - //void handleStyleLeave(DocStyleChange::Style t,const char *tagName); - //void handlePendingStyleCommands(); + int handleParamSection(const QCString &cmdName,DocParamSect::Type t); void handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t); void handleImage(const QCString &cmdName); void handleDotFile(const QCString &cmdName); @@ -720,6 +824,33 @@ class DocPara : public CompAccept<DocPara>, public DocNode private: DocNode *m_parent; QCString m_sectionId; + bool m_isFirst; + bool m_isLast; +}; + +/*! Node representing a parameter list. */ +class DocParamList : public DocNode +{ + public: + DocParamList(DocNode *parent) : m_parent(parent) + { m_paragraph=new DocPara(this); } + virtual ~DocParamList() + { delete m_paragraph; } + int parse(const QCString &cmdName); + Kind kind() const { return Kind_ParamList; } + DocNode *parent() const { return m_parent; } + const QStrList ¶meters() { return m_params; } + void accept(DocVisitor *v) + { + v->visitPre(this); + m_paragraph->accept(v); + v->visitPost(this); + } + + private: + DocNode *m_parent; + DocPara *m_paragraph; + QStrList m_params; }; /*! Node representing an item of a auto list */ @@ -728,8 +859,8 @@ class DocAutoListItem : public DocNode public: DocAutoListItem(DocNode *parent) : m_parent(parent) { m_paragraph=new DocPara(this); } - int parse(); virtual ~DocAutoListItem() { delete m_paragraph; } + int parse(); Kind kind() const { return Kind_AutoListItem; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) diff --git a/src/doctokenizer.h b/src/doctokenizer.h index 8e0abee..7bda1b0 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -25,15 +25,16 @@ enum Tokens { TK_WORD = 1, - TK_WHITESPACE = 2, - TK_LISTITEM = 3, - TK_ENDLIST = 4, - TK_COMMAND = 5, - TK_HTMLTAG = 6, - TK_SYMBOL = 7, - TK_NEWPARA = 8, - TK_RCSTAG = 9, - TK_URL = 10, + TK_LNKWORD = 2, + TK_WHITESPACE = 3, + TK_LISTITEM = 4, + TK_ENDLIST = 5, + TK_COMMAND = 6, + TK_HTMLTAG = 7, + TK_SYMBOL = 8, + TK_NEWPARA = 9, + TK_RCSTAG = 10, + TK_URL = 11, RetVal_OK = 0x10000, RetVal_SimpleSec = 0x10001, @@ -123,5 +124,6 @@ void doctokenizerYYsetStateFile(); void doctokenizerYYsetStatePattern(); void doctokenizerYYsetStateLink(); void doctokenizerYYsetStateRef(); +void doctokenizerYYsetStateInternalRef(); #endif diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 31d6d7f..7f43614 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -83,6 +83,7 @@ const char *tokToString(int token) { case 0: return "TK_EOF"; case TK_WORD: return "TK_WORD"; + case TK_LNKWORD: return "TK_LNKWORD"; case TK_WHITESPACE: return "TK_WHITESPACE"; case TK_LISTITEM: return "TK_LISTITEM"; case TK_ENDLIST: return "TK_ENDLIST"; @@ -221,8 +222,20 @@ LINKMASK [^ \t\n\r\\@<&$]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"))? SPCMD1 {CMD}[a-z_A-Z0-9]+ SPCMD2 {CMD}[\\@<>&$#%~] SPCMD3 {CMD}form#[0-9]+ -WORD1 [^ \t\n\r\\@<&$]+ -WORD2 [^ \t\n\r\\@<&$]+"("[^\n)]*")"({BLANK}*("const"|"volatile"))? +TEMPCHAR [a-z_A-Z0-9,: \t\*\&] +FUNCCHAR [a-z_A-Z0-9,:\<\> \t\*\&] +SCOPESEP "::"|"#"|"." +SCOPEPRE {ID}("<"{TEMPCHAR}*">")?{SCOPESEP} +SCOPEMASK {SCOPEPRE}*(~)?{ID} +FUNCARG "("{FUNCCHAR}*")" +OPNEW {BLANK}+"new"({BLANK}*"[]")? +OPDEL {BLANK}+"delete"({BLANK}*"[]")? +OPNORM {OPNEW}|{OPDEL}|"+"|"-"|"*"|"/"|"%"|"^"|"&"|"|"|"~"|"!"|"="|"<"|">"|"+="|"-="|"*="|"/="|"%="|"^="|"&="|"|="|"<<"|">>"|"<<="|">>="|"=="|"!="|"<="|">="|"&&"|"||"|"++"|"--"|","|"->*"|"->"|"[]"|"()" +OPCAST {BLANK}+[^(\r\n.,]+ +OPMASK ({BLANK}*{OPNORM}({FUNCARG}?))|({OPCAST}{FUNCARG}) +LNKWORD1 {SCOPEMASK}({FUNCARG}({BLANK}*("const"|"volatile"))?)? +LNKWORD2 {SCOPEPRE}*"operator"{OPMASK} +WORD [^ \t\n\r\\@<>&$#,.]+ %option noyywrap %option yylineno @@ -241,6 +254,7 @@ WORD2 [^ \t\n\r\\@<&$]+"("[^\n)]*")"({BLANK}*("const"|"volatile"))? %x St_Link %x St_Ref %x St_Ref2 +%x St_IntRef %% /* TODO: \~lang_id */ @@ -330,12 +344,24 @@ WORD2 [^ \t\n\r\\@<&$]+"("[^\n)]*")"({BLANK}*("const"|"volatile"))? g_token->name = yytext; return TK_SYMBOL; } -<St_Para>{WORD1} | /* word, #word, or %word */ -<St_Para>{WORD2} { /* function call */ +<St_Para>{LNKWORD1} | +<St_Para>{LNKWORD2} { + g_token->name = yytext; + return TK_LNKWORD; + } +<St_Para>"."|"," { g_token->name = yytext; return TK_WORD; - /* dummy code to please the compiler, removing this - results in a warning on my machine */ goto find_rule; + } +<St_Para>{WORD} { /* function call */ + g_token->name = yytext; + return TK_WORD; + + /* the following is dummy code to please the + * compiler, removing this results in a warning + * on my machine + */ + goto find_rule; } <St_Para>{BLANK}+ | <St_Para>{BLANK}*\n{BLANK}* { /* white space */ @@ -387,8 +413,7 @@ WORD2 [^ \t\n\r\\@<&$]+"("[^\n)]*")"({BLANK}*("const"|"volatile"))? g_token->name = yytext+1; return TK_COMMAND; } -<St_Title>{WORD1} | -<St_Title>{WORD2} { /* word */ +<St_Title>{WORD} { /* word */ g_token->name = yytext; return TK_WORD; } @@ -417,6 +442,13 @@ WORD2 [^ \t\n\r\\@<&$]+"("[^\n)]*")"({BLANK}*("const"|"volatile"))? unput(*yytext); return 0; } +<St_IntRef>[A-Z_a-z0-9.:#\-\+]+ { + g_token->name = yytext; + return TK_WORD; + } +<St_IntRef>{BLANK}+"\"" { + BEGIN(St_Ref2); + } <St_Ref2>"&"{ID}";" { /* symbol */ g_token->name = yytext; return TK_SYMBOL; @@ -567,6 +599,11 @@ void doctokenizerYYsetStateRef() BEGIN(St_Ref); } +void doctokenizerYYsetStateInternalRef() +{ + BEGIN(St_IntRef); +} + void doctokenizerYYcleanup() { yy_delete_buffer( YY_CURRENT_BUFFER ); diff --git a/src/docvisitor.h b/src/docvisitor.h index d72ef0f..b66161f 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -63,6 +63,10 @@ class DocFormula; class DocSecRefItem; class DocSecRefList; class DocLanguage; +class DocLinkedWord; +class DocParamSect; +class DocParamList; +class DocInternalRef; /*! @brief Abstract visitor that participates in the visitor pattern. */ @@ -76,7 +80,6 @@ class DocVisitor virtual void visit(DocURL *) = 0; virtual void visit(DocStyleChange *) = 0; virtual void visit(DocVerbatim *) = 0; - virtual void visit(DocXRefItem *) = 0; virtual void visit(DocLineBreak *) = 0; virtual void visit(DocHorRuler *) = 0; virtual void visit(DocAnchor *) = 0; @@ -84,6 +87,7 @@ class DocVisitor virtual void visit(DocInclude *) = 0; virtual void visit(DocIncOperator *) = 0; virtual void visit(DocFormula *) = 0; + virtual void visit(DocLinkedWord *) = 0; /*! @name Visitor functions for internal nodes */ virtual void visitPre(DocAutoList *) = 0; @@ -146,6 +150,14 @@ class DocVisitor virtual void visitPost(DocSecRefList *) = 0; virtual void visitPre(DocLanguage *) = 0; virtual void visitPost(DocLanguage *) = 0; + virtual void visitPre(DocParamSect *) = 0; + virtual void visitPost(DocParamSect *) = 0; + virtual void visitPre(DocParamList *) = 0; + virtual void visitPost(DocParamList *) = 0; + virtual void visitPre(DocXRefItem *) = 0; + virtual void visitPost(DocXRefItem *) = 0; + virtual void visitPre(DocInternalRef *) = 0; + virtual void visitPost(DocInternalRef *) = 0; }; #endif diff --git a/src/dot.cpp b/src/dot.cpp index 2e9ca54..252f33e 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -394,7 +394,7 @@ void DotNode::writeBox(QTextStream &t, } else if (!m_url.isEmpty()) { - t << ",URL=\"" << m_url << htmlFileExtension << "\""; + t << ",URL=\"" << m_url << Doxygen::htmlFileExtension << "\""; } t << "];" << endl; } @@ -1718,21 +1718,21 @@ void generateGraphLegend(const char *path) dotText << "{\n"; dotText << " Node9 [shape=\"box\",label=\"Inherited\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",style=\"filled\" fontcolor=\"white\"];\n"; dotText << " Node10 -> Node9 [dir=back,color=\"midnightblue\",fontsize=10,style=\"solid\",fontname=\"Helvetica\"];\n"; - dotText << " Node10 [shape=\"box\",label=\"PublicBase\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classPublicBase" << htmlFileExtension << "\"];\n"; + dotText << " Node10 [shape=\"box\",label=\"PublicBase\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classPublicBase" << Doxygen::htmlFileExtension << "\"];\n"; dotText << " Node11 -> Node10 [dir=back,color=\"midnightblue\",fontsize=10,style=\"solid\",fontname=\"Helvetica\"];\n"; - dotText << " Node11 [shape=\"box\",label=\"Truncated\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"red\",URL=\"$classTruncated" << htmlFileExtension << "\"];\n"; + dotText << " Node11 [shape=\"box\",label=\"Truncated\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"red\",URL=\"$classTruncated" << Doxygen::htmlFileExtension << "\"];\n"; dotText << " Node13 -> Node9 [dir=back,color=\"darkgreen\",fontsize=10,style=\"solid\",fontname=\"Helvetica\"];\n"; - dotText << " Node13 [shape=\"box\",label=\"ProtectedBase\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classProtectedBase" << htmlFileExtension << "\"];\n"; + dotText << " Node13 [shape=\"box\",label=\"ProtectedBase\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classProtectedBase" << Doxygen::htmlFileExtension << "\"];\n"; dotText << " Node14 -> Node9 [dir=back,color=\"firebrick4\",fontsize=10,style=\"solid\",fontname=\"Helvetica\"];\n"; - dotText << " Node14 [shape=\"box\",label=\"PrivateBase\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classPrivateBase" << htmlFileExtension << "\"];\n"; + dotText << " Node14 [shape=\"box\",label=\"PrivateBase\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classPrivateBase" << Doxygen::htmlFileExtension << "\"];\n"; dotText << " Node15 -> Node9 [dir=back,color=\"midnightblue\",fontsize=10,style=\"solid\",fontname=\"Helvetica\"];\n"; dotText << " Node15 [shape=\"box\",label=\"Undocumented\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"grey75\"];\n"; dotText << " Node16 -> Node9 [dir=back,color=\"midnightblue\",fontsize=10,style=\"solid\",fontname=\"Helvetica\"];\n"; - dotText << " Node16 [shape=\"box\",label=\"Templ< int >\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classTempl" << htmlFileExtension << "\"];\n"; + dotText << " Node16 [shape=\"box\",label=\"Templ< int >\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classTempl" << Doxygen::htmlFileExtension << "\"];\n"; dotText << " Node17 -> Node16 [dir=back,color=\"orange\",fontsize=10,style=\"dashed\",label=\"< int >\",fontname=\"Helvetica\"];\n"; - dotText << " Node17 [shape=\"box\",label=\"Templ< T >\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classTempl" << htmlFileExtension << "\"];\n"; + dotText << " Node17 [shape=\"box\",label=\"Templ< T >\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classTempl" << Doxygen::htmlFileExtension << "\"];\n"; dotText << " Node18 -> Node9 [dir=back,color=\"darkorchid3\",fontsize=10,style=\"dashed\",label=\"m_usedClass\",fontname=\"Helvetica\"];\n"; - dotText << " Node18 [shape=\"box\",label=\"Used\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classUsed" << htmlFileExtension << "\"];\n"; + dotText << " Node18 [shape=\"box\",label=\"Used\",fontsize=10,height=0.2,width=0.4,fontname=\"Helvetica\",color=\"black\",URL=\"$classUsed" << Doxygen::htmlFileExtension << "\"];\n"; dotText << "}\n"; dotFile.close(); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 20dedec..95b723d 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -186,8 +186,7 @@ static void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl, const char idMask[] = "[A-Za-z_][A-Za-z_0-9]*"; QCString spaces; -QCString htmlFileExtension; -int htmlFileExtensionLength; +QCString Doxygen::htmlFileExtension; //---------------------------------------------------------------------------- @@ -6059,7 +6058,7 @@ static void generateExampleDocs() for (pdi.toFirst();(pi=pdi.current());++pdi) { msg("Generating docs for example %s...\n",pi->name.data()); - QCString n=convertNameToFile(pi->name+"-example"); + QCString n=pi->fileName; startFile(*outputList,n,n,"Example Documentation"); startTitle(*outputList,n); outputList->docify(pi->name); @@ -6268,9 +6267,9 @@ static void generateSearchIndex() //outputList->generateExternalIndex(); outputList->pushGeneratorState(); outputList->disableAllBut(OutputGenerator::Html); - startFile(*outputList,"header"+htmlFileExtension,0,"Search Engine",TRUE); + startFile(*outputList,"header"+Doxygen::htmlFileExtension,0,"Search Engine",TRUE); outputList->endPlainFile(); - outputList->startPlainFile("footer"+htmlFileExtension); + outputList->startPlainFile("footer"+Doxygen::htmlFileExtension); endFile(*outputList,TRUE); outputList->popGeneratorState(); } @@ -7135,8 +7134,7 @@ void readConfiguration(int argc, char **argv) } /* Set the global html file extension. */ - htmlFileExtension = Config_getString("HTML_FILE_EXTENSION"); - htmlFileExtensionLength = htmlFileExtension.length(); + Doxygen::htmlFileExtension = Config_getString("HTML_FILE_EXTENSION"); /* init the special lists */ Doxygen::specialLists->setAutoDelete(TRUE); diff --git a/src/doxygen.h b/src/doxygen.h index 72d3a80..2938a34 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -51,8 +51,6 @@ class StringDict : public QDict<QCString> }; -extern QCString htmlFileExtension; -extern int htmlFileExtensionLength; extern QCString spaces; /*! \brief This class serves as a namespace for global variables used by doxygen. @@ -94,6 +92,7 @@ class Doxygen static QDict<void> expandAsDefinedDict; static NamespaceDef *globalScope; static QDict<RefList> *specialLists; // array of special lists: todo, test, bug, deprecated ... + static QCString htmlFileExtension; }; void initDoxygen(); diff --git a/src/filedef.cpp b/src/filedef.cpp index c4fd5f4..040e458 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -321,13 +321,6 @@ void FileDef::writeDocumentation(OutputList &ol) ol.enableAll(); } - //ol.disableAllBut(OutputGenerator::Html); - //ol.writeString((QCString)"<p>Interface collaboration diagram for " - // "<a href=\"usage_intf_graph_"+name()+htmlFileExtension+"\">here</a>"); - //ol.writeString((QCString)"<p>Include dependency diagram for "+fn+" can be found "+ - // "<a href=\""+diskname+"_incldep+htmlFileExtension+"\">here</a>."); - //ol.enableAll(); - ol.endTextBlock(); ol.startMemberSections(); diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index e31a3fd..6a60074 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -347,7 +347,7 @@ static void generateFolderTreeViewData() } // Generate alternative index.html as a frame - fileName=Config_getString("HTML_OUTPUT")+"/index"+htmlFileExtension; + fileName=Config_getString("HTML_OUTPUT")+"/index"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { @@ -374,15 +374,15 @@ static void generateFolderTreeViewData() } t << "</title></head>" << endl; t << "<frameset cols=\"" << Config_getInt("TREEVIEW_WIDTH") << ",*\">" << endl; - t << " <frame src=\"tree" << htmlFileExtension << "\" name=\"treefrm\">" << endl; - t << " <frame src=\"main" << htmlFileExtension << "\" name=\"basefrm\">" << endl; + t << " <frame src=\"tree" << Doxygen::htmlFileExtension << "\" name=\"treefrm\">" << endl; + t << " <frame src=\"main" << Doxygen::htmlFileExtension << "\" name=\"basefrm\">" << endl; t << "</frameset>" << endl; t << "</html>" << endl; f.close(); } // Generate tree view frame - fileName=Config_getString("HTML_OUTPUT")+"/tree"+htmlFileExtension; + fileName=Config_getString("HTML_OUTPUT")+"/tree"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { @@ -559,7 +559,7 @@ void FTVHelp::addContentsItem(bool isDir, << name << "\", \"" << tagName << "\", "; if (file) // file optional param { - m_cts << "\"" << tagDir << file << htmlFileExtension << "\"))"; + m_cts << "\"" << tagDir << file << Doxygen::htmlFileExtension << "\"))"; } else { @@ -572,7 +572,7 @@ void FTVHelp::addContentsItem(bool isDir, << name << "\", \"" << tagName << "\", "; if (file) // ref optional param { - m_cts << "\"" << tagDir << file << htmlFileExtension; + m_cts << "\"" << tagDir << file << Doxygen::htmlFileExtension; if (anchor) m_cts << "#" << anchor; m_cts << "\"))"; } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 03f64e0..758af1e 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -403,7 +403,7 @@ void GroupDef::writeDocumentation(OutputList &ol) Doxygen::tagFile << " <compound kind=\"group\">" << endl; Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; Doxygen::tagFile << " <title>" << convertToXML(title) << "</title>" << endl; - Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << htmlFileExtension << "</filename>" << endl; + Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; } ol.startMemberSections(); diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h new file mode 100644 index 0000000..9f0f699 --- /dev/null +++ b/src/htmldocvisitor.h @@ -0,0 +1,627 @@ +/****************************************************************************** + * + * + * + * + * Copyright (C) 1997-2002 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. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef _HTMLDOCVISITOR_H +#define _HTMLDOCVISITOR_H + +#include "docvisitor.h" +#include "docparser.h" +#include "language.h" +#include "doxygen.h" +#include "outputgen.h" +#include "code.h" + +/*! Concrete visitor implementation for pretty printing */ +class HtmlDocVisitor : public DocVisitor +{ + public: + HtmlDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) + : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) {} + + //-------------------------------------- + + void visit(DocWord *w) + { + if (m_hide) return; + filter(w->word()); + } + void visit(DocLinkedWord *w) + { + if (m_hide) return; + startLink(w->ref(),w->file(),w->anchor()); + filter(w->word()); + endLink(); + } + void visit(DocWhiteSpace *w) + { + if (m_hide) return; + if (m_insidePre) + { + m_t << w->chars(); + } + else + { + m_t << " "; + } + } + void visit(DocSymbol *s) + { + if (m_hide) return; + switch(s->symbol()) + { + case DocSymbol::BSlash: m_t << "\\"; break; + case DocSymbol::At: m_t << "@"; break; + case DocSymbol::Less: m_t << "<"; break; + case DocSymbol::Greater: m_t << ">"; break; + case DocSymbol::Amp: m_t << "&"; break; + case DocSymbol::Dollar: m_t << "$"; break; + case DocSymbol::Hash: m_t << "#"; break; + case DocSymbol::Percent: m_t << "%"; break; + case DocSymbol::Copy: m_t << "©"; break; + case DocSymbol::Apos: m_t << "'"; break; + case DocSymbol::Quot: m_t << "\""; break; + case DocSymbol::Uml: m_t << "&" << s->letter() << "uml;"; break; + case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; + case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; + case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; + case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; + case DocSymbol::Szlig: m_t << "ß"; break; + case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedul;"; break; + case DocSymbol::Ring: m_t << "&" << s->letter() << "ring;"; break; + case DocSymbol::Nbsp: m_t << " "; break; + default: + printf("Error: unknown symbol found\n"); + } + } + void visit(DocURL *u) + { + if (m_hide) return; + m_t << "<a href=\"" << u->url() << "\">" << u->url() << "</a> "; + } + void visit(DocLineBreak *) + { + if (m_hide) return; + m_t << "<br>\n"; + } + void visit(DocHorRuler *) + { + if (m_hide) return; + m_t << "<hr>\n"; + } + void visit(DocStyleChange *s) + { + if (m_hide) return; + switch (s->style()) + { + case DocStyleChange::Bold: + if (s->enable()) m_t << "<b>"; else m_t << "</b> "; + break; + case DocStyleChange::Italic: + if (s->enable()) m_t << "<em>"; else m_t << "</em> "; + break; + case DocStyleChange::Code: + if (s->enable()) m_t << "<code>"; else m_t << "</code> "; + break; + case DocStyleChange::Subscript: + if (s->enable()) m_t << "<sub>"; else m_t << "</sub> "; + break; + case DocStyleChange::Superscript: + if (s->enable()) m_t << "<sup>"; else m_t << "</sup> "; + break; + case DocStyleChange::Center: + if (s->enable()) m_t << "<center>"; else m_t << "</center> "; + break; + case DocStyleChange::Small: + if (s->enable()) m_t << "<small>"; else m_t << "</small> "; + break; + } + } + void visit(DocVerbatim *s) + { + if (m_hide) return; + switch(s->type()) + { + case DocVerbatim::Code: // fall though + m_t << "<div class=\"fragment\"><pre>"; + parseCode(m_ci,s->context(),s->text(),FALSE,0); + m_t << "</pre></div>"; + break; + case DocVerbatim::Verbatim: + m_t << "<div class=\"fragment\"><pre>"; + filter(s->text()); + m_t << "</pre></div>"; + break; + case DocVerbatim::HtmlOnly: + m_t << s->text(); + break; + case DocVerbatim::LatexOnly: + /* nothing */ + break; + } + } + void visit(DocAnchor *) + { + if (m_hide) return; + m_t << "<a name=\"%s\"/></a>"; + } + void visit(DocCopy *c) + { + if (m_hide) return; + // TODO + printf("<copy link=\"%s\"/>",c->link().data()); + } + void visit(DocInclude *inc) + { + if (m_hide) return; + // TODO + printf("<include file=\"%s\" type=\"",inc->file().data()); + switch(inc->type()) + { + case DocInclude::Include: printf("include"); break; + case DocInclude::DontInclude: printf("dontinclude"); break; + case DocInclude::HtmlInclude: printf("htmlinclude"); break; + case DocInclude::VerbInclude: printf("verbinclude"); break; + } + printf("\"/>"); + } + void visit(DocIncOperator *op) + { + if (m_hide) return; + // TODO + printf("<incoperator pattern=\"%s\" type=\"",op->pattern().data()); + switch(op->type()) + { + case DocIncOperator::Line: printf("line"); break; + case DocIncOperator::Skip: printf("skip"); break; + case DocIncOperator::SkipLine: printf("skipline"); break; + case DocIncOperator::Until: printf("until"); break; + } + printf("\"/>"); + } + void visit(DocFormula *f) + { + if (m_hide) return; + if (f->text().at(0)=='\\') m_t << "<p><center>" << endl; + m_t << "<img align="; +#if !defined(_WIN32) + m_t << "\"top\""; // assume Unix users use Netscape 4.x which does + // not seem to support align == "middle" :-(( +#else + m_t << "\"middle\""; // assume Windows users use IE or HtmlHelp which on + // displays formulas nicely with align == "middle" +#endif + m_t << " src=\"" << f->name() << ".png\">" << endl; + if (f->text().at(0)=='\\') m_t << "</center><p>" << endl; + } + //-------------------------------------- + + void visitPre(DocAutoList *l) + { + if (l->isEnumList()) + { + m_t << "<ol>\n"; + } + else + { + m_t << "<ul>\n"; + } + } + void visitPost(DocAutoList *l) + { + if (l->isEnumList()) + { + m_t << "</ol>\n"; + } + else + { + m_t << "</ul>\n"; + } + } + void visitPre(DocAutoListItem *) + { + m_t << "<li>"; + } + void visitPost(DocAutoListItem *) + { + m_t << "</li>"; + } + void visitPre(DocPara *) + { + } + void visitPost(DocPara *p) + { + if (!p->isLast() && // omit <p> for last paragraph + !(p->parent() && // and for parameter sections + p->parent()->kind()==DocNode::Kind_ParamSect + ) + ) m_t << "<p>\n"; + } + void visitPre(DocRoot *) + { + m_t << "<hr><h4><font color=\"red\">New parser:</font></h4>\n"; + } + void visitPost(DocRoot *) + { + m_t << "<hr><h4><font color=\"red\">Old parser:</font></h4>\n"; + } + void visitPre(DocSimpleSect *s) + { + m_t << "<dl compact><dt><b>"; + switch(s->type()) + { + case DocSimpleSect::See: + m_t << theTranslator->trSeeAlso(); break; + case DocSimpleSect::Return: + m_t << theTranslator->trReturns(); break; + case DocSimpleSect::Author: + m_t << theTranslator->trAuthor(TRUE,TRUE); break; + case DocSimpleSect::Authors: + m_t << theTranslator->trAuthor(TRUE,FALSE); break; + case DocSimpleSect::Version: + m_t << theTranslator->trVersion(); break; + case DocSimpleSect::Since: + m_t << theTranslator->trSince(); break; + case DocSimpleSect::Date: + m_t << theTranslator->trDate(); break; + case DocSimpleSect::Note: + m_t << theTranslator->trNote(); break; + case DocSimpleSect::Warning: + m_t << theTranslator->trWarning(); break; + case DocSimpleSect::Pre: + m_t << theTranslator->trPrecondition(); break; + case DocSimpleSect::Post: + m_t << theTranslator->trPostcondition(); break; + case DocSimpleSect::Invar: + m_t << theTranslator->trInvariant(); break; + case DocSimpleSect::Remark: + m_t << theTranslator->trRemarks(); break; + case DocSimpleSect::Attention: + m_t << theTranslator->trAttention(); break; + case DocSimpleSect::User: break; + case DocSimpleSect::Unknown: break; + } + m_t << ":"; + + // special case 1: user defined title + if (s->type()!=DocSimpleSect::User) + { + m_t << "</b></dt><dd>"; + } + } + void visitPost(DocSimpleSect *) + { + m_t << "</dd></dl>\n"; + } + void visitPre(DocTitle *) + { + } + void visitPost(DocTitle *) + { + m_t << "</b></dt><dd>"; + } + void visitPre(DocSimpleList *) + { + m_t << "<ul>\n"; + } + void visitPost(DocSimpleList *) + { + m_t << "</ul>\n"; + } + void visitPre(DocSimpleListItem *) + { + m_t << "<li>"; + } + void visitPost(DocSimpleListItem *) + { + m_t << "</li>\n"; + } + void visitPre(DocSection *s) + { + m_t << "<h%d>",s->level(); + } + void visitPost(DocSection *s) + { + m_t << "</h%d>\n",s->level(); + } + void visitPre(DocHtmlList *s) + { + if (s->type()==DocHtmlList::Ordered) + m_t << "<ol>\n"; + else + m_t << "<ul>\n"; + } + void visitPost(DocHtmlList *s) + { + if (s->type()==DocHtmlList::Ordered) + m_t << "</ol>\n"; + else + m_t << "</ul>\n"; + } + void visitPre(DocHtmlListItem *) + { + m_t << "<li>\n"; + } + void visitPost(DocHtmlListItem *) + { + m_t << "</li>\n"; + } + void visitPre(DocHtmlPre *) + { + m_t << "<pre>\n"; + m_insidePre=TRUE; + } + void visitPost(DocHtmlPre *) + { + m_insidePre=FALSE; + m_t << "</pre>\n"; + } + void visitPre(DocHtmlDescList *) + { + m_t << "<dl>\n"; + } + void visitPost(DocHtmlDescList *) + { + m_t << "</dl>\n"; + } + void visitPre(DocHtmlDescTitle *) + { + m_t << "<dt>"; + } + void visitPost(DocHtmlDescTitle *) + { + m_t << "</dt>\n"; + } + void visitPre(DocHtmlDescData *) + { + m_t << "<dd>"; + } + void visitPost(DocHtmlDescData *) + { + m_t << "</dd>\n"; + } + void visitPre(DocHtmlTable *) + { + m_t << "<table border=\"1\" cellspacing=\"3\" cellpadding=\"3\">\n"; + } + void visitPost(DocHtmlTable *) + { + m_t << "</table>\n"; + } + void visitPre(DocHtmlRow *) + { + m_t << "<tr>\n"; + } + void visitPost(DocHtmlRow *) + { + m_t << "</tr>\n"; + } + void visitPre(DocHtmlCell *c) + { + if (c->isHeading()) m_t << "<th>"; else m_t << "<td>"; + } + void visitPost(DocHtmlCell *c) + { + if (c->isHeading()) m_t << "</th>"; else m_t << "</td>"; + } + void visitPre(DocHtmlCaption *) + { + m_t << "<caption align=\"bottom\">"; + } + void visitPost(DocHtmlCaption *) + { + m_t << "</caption>\n"; + } + void visitPre(DocIndexEntry *) + { + m_hide = TRUE; + } + void visitPost(DocIndexEntry *) + { + m_hide = FALSE; + } + void visitPre(DocInternal *) + { + m_t << "<p><b>" << theTranslator->trForInternalUseOnly() << "</b></p>" << endl; + m_t << "<p>" << endl; + } + void visitPost(DocInternal *) + { + m_t << "</p>" << endl; + } + void visitPre(DocHRef *href) + { + m_t << "<a href=\"" << href->url() << "\">"; + } + void visitPost(DocHRef *) + { + m_t << "</a>\n"; + } + void visitPre(DocHtmlHeader *header) + { + m_t << "<h" << header->level() << ">"; + } + void visitPost(DocHtmlHeader *header) + { + m_t << "</h" << header->level() << ">\n"; + } + void visitPre(DocImage *img) + { + m_t << "<img src=\"" << img->name() << "\">\n"; + } + void visitPost(DocImage *) + { + } + void visitPre(DocDotFile *) + { + // TODO + } + void visitPost(DocDotFile *) + { + // TODO + } + void visitPre(DocLink *lnk) + { + startLink(lnk->ref(),lnk->file(),lnk->anchor()); + } + void visitPost(DocLink *) + { + endLink(); + } + void visitPre(DocRef *ref) + { + startLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->hasLinkText()) filter(ref->targetTitle()); + } + void visitPost(DocRef *) + { + endLink(); + } + void visitPre(DocSecRefItem *) + { + // TODO + } + void visitPost(DocSecRefItem *) + { + // TODO + } + void visitPre(DocSecRefList *) + { + // TODO + } + void visitPost(DocSecRefList *) + { + // TODO + } + void visitPre(DocLanguage *) + { + // TODO + } + void visitPost(DocLanguage *) + { + // TODO + } + void visitPre(DocParamSect *s) + { + m_t << "<dl compact><dt><b>"; + switch(s->type()) + { + case DocParamSect::Param: + m_t << theTranslator->trParameters(); break; + case DocParamSect::RetVal: + m_t << theTranslator->trReturnValues(); break; + case DocParamSect::Exception: + m_t << theTranslator->trExceptions(); break; + } + m_t << ":"; + m_t << "</b></dt><dd>" << endl; + m_t << " <table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">" << endl; + } + void visitPost(DocParamSect *) + { + m_t << " </table>" << endl; + m_t << "</dl>" << endl; + } + void visitPre(DocParamList *pl) + { + m_t << " <tr><td valign=top><em>"; + QStrListIterator li(pl->parameters()); + const char *s; + bool first=TRUE; + for (li.toFirst();(s=li.current());++li) + { + if (!first) m_t << ","; else first=FALSE; + m_t << s; + } + m_t << "</em> </td><td>"; + } + void visitPost(DocParamList *) + { + m_t << "</td></tr>" << endl; + } + void visitPre(DocXRefItem *x) + { + m_t << "<dl compact><dt><b><a class=\"el\" href=\"" + << x->file() << Doxygen::htmlFileExtension << "#" << x->anchor() << "\">" + << x->title() << ":</a></b></dt><dd>"; + } + void visitPost(DocXRefItem *) + { + m_t << "</dd></dl>" << endl; + } + void visitPre(DocInternalRef *ref) + { + startLink(0,ref->file(),ref->anchor()); + } + void visitPost(DocInternalRef *) + { + endLink(); + } + + private: + void filter(const char *str) + { + if (str==0) return; + const char *p=str; + char c; + while (*p) + { + c=*p++; + switch(c) + { + case '<': m_t << "<"; break; + case '>': m_t << ">"; break; + case '&': m_t << "&"; break; + default: m_t << c; + } + } + } + + void startLink(const QCString &ref,const QCString &file,const QCString &anchor) + { + QCString *dest; + if (!ref.isEmpty()) // link to entity imported via tag file + { + m_t << "<a class=\"elRef\" "; + m_t << "doxygen=\"" << ref << ":"; + if ((dest=Doxygen::tagDestinationDict[ref])) m_t << *dest << "/"; + m_t << "\" "; + } + else // local link + { + m_t << "<a class=\"el\" "; + } + m_t << "href=\""; + if (!ref.isEmpty()) + { + if ((dest=Doxygen::tagDestinationDict[ref])) m_t << *dest << "/"; + } + if (!file.isEmpty()) m_t << file << Doxygen::htmlFileExtension; + if (!anchor.isEmpty()) m_t << "#" << anchor; + m_t << "\">"; + } + void endLink() + { + m_t << "</a> "; + } + QTextStream &m_t; + BaseCodeDocInterface &m_ci; + bool m_insidePre; + bool m_hide; +}; + +#endif diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index a8291fc..37cd81f 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -30,6 +30,7 @@ #include "dot.h" #include "language.h" #include "htmlhelp.h" +#include "htmldocvisitor.h" // #define GROUP_COLOR "#ff8080" @@ -202,7 +203,10 @@ void HtmlGenerator::startFile(const char *name,const char *, //printf("HtmlGenerator::startFile(%s)\n",name); QCString fileName=name; lastTitle=title; - if (fileName.right(htmlFileExtensionLength)!=htmlFileExtension) fileName+=htmlFileExtension; + if (fileName.right(Doxygen::htmlFileExtension.length())!=Doxygen::htmlFileExtension) + { + fileName+=Doxygen::htmlFileExtension; + } startPlainFile(fileName); if (Config_getBool("GENERATE_HTMLHELP")) { @@ -383,7 +387,7 @@ void HtmlGenerator::writeIndexItem(const char *ref,const char *f, { if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/"; } - if (f) t << f << htmlFileExtension << "\">"; + if (f) t << f << Doxygen::htmlFileExtension << "\">"; } else { @@ -409,7 +413,7 @@ void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, { t << "<li>"; if (path) docify(path); - t << "<a class=\"el\" href=\"" << f << htmlFileExtension << "\">"; + t << "<a class=\"el\" href=\"" << f << Doxygen::htmlFileExtension << "\">"; docify(name); t << "</a> "; //if (Config_getBool("GENERATE_HTMLHELP") && f) @@ -438,7 +442,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, { if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/"; } - if (f) t << f << htmlFileExtension; + if (f) t << f << Doxygen::htmlFileExtension; if (anchor) t << "#" << anchor; t << "\">"; docify(name); @@ -465,7 +469,7 @@ void HtmlGenerator::writeCodeLink(const char *ref,const char *f, { if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/"; } - if (f) t << f << htmlFileExtension; + if (f) t << f << Doxygen::htmlFileExtension; if (anchor) t << "#" << anchor; t << "\">"; docify(name); @@ -476,7 +480,7 @@ void HtmlGenerator::writeCodeLink(const char *ref,const char *f, void HtmlGenerator::startTextLink(const char *f,const char *anchor) { t << "<a href=\""; - if (f) t << f << htmlFileExtension; + if (f) t << f << Doxygen::htmlFileExtension; if (anchor) t << "#" << anchor; t << "\">"; } @@ -547,7 +551,10 @@ void HtmlGenerator::writeSectionRef(const char *ref,const char *name, QCString *dest; //printf("writeSectionRef(%s,%s,%s,%s)\n",ref,name,anchor,title); QCString refName=name; - if (refName.right(htmlFileExtensionLength)!=htmlFileExtension) refName+=htmlFileExtension; + if (refName.right(Doxygen::htmlFileExtension.length())!=Doxygen::htmlFileExtension) + { + refName+=Doxygen::htmlFileExtension; + } t << "<a "; if (ref) { @@ -569,7 +576,10 @@ void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab, const char *title) { QCString refName=name; - if (refName.right(htmlFileExtensionLength)!=htmlFileExtension) refName+=htmlFileExtension; + if (refName.right(Doxygen::htmlFileExtension.length())!=Doxygen::htmlFileExtension) + { + refName+=Doxygen::htmlFileExtension; + } t << "<li><a href=\"" << refName << "#" << lab << "\">"; docify(title); t << "</a>"; @@ -1229,3 +1239,14 @@ void HtmlGenerator::endSectionRefList() t << "</multicol>" << endl; } +void HtmlGenerator::printDoc(DocNode *n) +{ +#ifdef ENABLE_NEW_PARSER + HtmlDocVisitor *visitor = new HtmlDocVisitor(t,*this); + n->accept(visitor); + delete visitor; +#else + n=n; +#endif +} + diff --git a/src/htmlgen.h b/src/htmlgen.h index 6f93ca4..6297fc0 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -43,6 +43,9 @@ class HtmlGenerator : public OutputGenerator void disableIfNot(OutputType o) { if (o!=Html) active=FALSE; } bool isEnabled(OutputType o) { return (o==Html && active); } OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; } + + void printDoc(DocNode *); + //void generateExternalIndex(); void startFile(const char *name,const char *manName, @@ -267,6 +270,9 @@ class HtmlGenerator : public OutputGenerator void startSectionRefList(); void endSectionRefList(); + void writeCodeAnchor(const char *anchor) + { t << "<a name=\"" << anchor << "\"></a>"; } + private: QCString lastTitle; QCString lastFile; diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index 4ca6188..33fdf40 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -178,7 +178,7 @@ void HtmlHelpIndex::writeFields(QTextStream &t) if (level2.isEmpty()) { t << " <LI><OBJECT type=\"text/sitemap\">"; - t << "<param name=\"Local\" value=\"" << f->url << htmlFileExtension; + t << "<param name=\"Local\" value=\"" << f->url << Doxygen::htmlFileExtension; if (!f->anchor.isEmpty()) t << "#" << f->anchor; t << "\">"; t << "<param name=\"Name\" value=\"" << level1 << "\">" @@ -189,7 +189,7 @@ void HtmlHelpIndex::writeFields(QTextStream &t) if (f->link) { t << " <LI><OBJECT type=\"text/sitemap\">"; - t << "<param name=\"Local\" value=\"" << f->url << htmlFileExtension << "\">"; + t << "<param name=\"Local\" value=\"" << f->url << Doxygen::htmlFileExtension << "\">"; t << "<param name=\"Name\" value=\"" << level1 << "\">" "</OBJECT>\n"; } @@ -215,7 +215,7 @@ void HtmlHelpIndex::writeFields(QTextStream &t) if (level2Started) { t << " <LI><OBJECT type=\"text/sitemap\">"; - t << "<param name=\"Local\" value=\"" << f->url << htmlFileExtension; + t << "<param name=\"Local\" value=\"" << f->url << Doxygen::htmlFileExtension; if (!f->anchor.isEmpty()) t << "#" << f->anchor; t << "\">"; t << "<param name=\"Name\" value=\"" << level2 << "\">" @@ -385,8 +385,8 @@ void HtmlHelp::createProjectFile() - QCString indexName="index"+htmlFileExtension; - if (Config_getBool("GENERATE_TREEVIEW")) indexName="main"+htmlFileExtension; + QCString indexName="index"+Doxygen::htmlFileExtension; + if (Config_getBool("GENERATE_TREEVIEW")) indexName="main"+Doxygen::htmlFileExtension; t << "[OPTIONS]\n"; if (!Config_getString("CHM_FILE").isEmpty()) { @@ -500,7 +500,7 @@ void HtmlHelp::addContentsItem(bool isDir, cts << "<param name=\"Name\" value=\"" << name << "\">"; if (ref) // made ref optional param - KPW { - cts << "<param name=\"Local\" value=\"" << ref << htmlFileExtension; + cts << "<param name=\"Local\" value=\"" << ref << Doxygen::htmlFileExtension; if (anchor) cts << "#" << anchor; cts << "\">"; } diff --git a/src/index.cpp b/src/index.cpp index ac20381..69a19ae 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -181,11 +181,11 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) if (!compact) ol.writeListItem(); if (Config_getBool("GENERATE_TREEVIEW")) { - ol.startQuickIndexItem(extLink,"main"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"main"+Doxygen::htmlFileExtension); } else { - ol.startQuickIndexItem(extLink,"index"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"index"+Doxygen::htmlFileExtension); } parseText(ol,theTranslator->trMainPage()); ol.endQuickIndexItem(); @@ -193,21 +193,21 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) //if (documentedPackages>0) //{ // if (!compact) ol.writeListItem(); - // ol.startQuickIndexItem(extLink,"packages"+htmlFileExtension); + // ol.startQuickIndexItem(extLink,"packages"+Doxygen::htmlFileExtension); // parseText(ol,theTranslator->trPackages()); // ol.endQuickIndexItem(); //} if (documentedGroups>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"modules"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"modules"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trModules()); ol.endQuickIndexItem(); } if (documentedNamespaces>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"namespaces"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"namespaces"+Doxygen::htmlFileExtension); if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { parseText(ol,theTranslator->trPackages()); @@ -221,7 +221,7 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) if (hierarchyClasses>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"hierarchy"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"hierarchy"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trClassHierarchy()); ol.endQuickIndexItem(); } @@ -230,68 +230,68 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) if (Config_getBool("ALPHABETICAL_INDEX")) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"classes"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"classes"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trAlphabeticalList()); ol.endQuickIndexItem(); } if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"annotated"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"annotated"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trCompoundList()); ol.endQuickIndexItem(); } if (documentedHtmlFiles>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"files"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"files"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trFileList()); ol.endQuickIndexItem(); } //if (documentedIncludeFiles>0 && Config_getBool("VERBATIM_HEADERS")) //{ // if (!compact) ol.writeListItem(); - // ol.startQuickIndexItem(extLink,"headers"+htmlFileExtension); + // ol.startQuickIndexItem(extLink,"headers"+Doxygen::htmlFileExtension); // parseText(ol,theTranslator->trHeaderFiles()); // ol.endQuickIndexItem(); //} //if (Config_getBool("SOURCE_BROWSER")) //{ // if (!compact) ol.writeListItem(); - // ol.startQuickIndexItem(extLink,"sources"+htmlFileExtension); + // ol.startQuickIndexItem(extLink,"sources"+Doxygen::htmlFileExtension); // parseText(ol,theTranslator->trSources()); // ol.endQuickIndexItem(); //} if (documentedNamespaceMembers>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"namespacemembers"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"namespacemembers"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trNamespaceMembers()); ol.endQuickIndexItem(); } if (documentedMembers>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"functions"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"functions"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trCompoundMembers()); ol.endQuickIndexItem(); } if (documentedFunctions>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"globals"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"globals"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trFileMembers()); ol.endQuickIndexItem(); } if (indexedPages>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"pages"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"pages"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trRelatedPages()); ol.endQuickIndexItem(); } if (Doxygen::exampleSDict->count()>0) { if (!compact) ol.writeListItem(); - ol.startQuickIndexItem(extLink,"examples"+htmlFileExtension); + ol.startQuickIndexItem(extLink,"examples"+Doxygen::htmlFileExtension); parseText(ol,theTranslator->trExamples()); ol.endQuickIndexItem(); } @@ -1430,7 +1430,7 @@ void writeAlphabeticalIndex(OutputList &ol) if (annotatedClasses==0) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - startFile(ol,"classes"+htmlFileExtension,0,"Alphabetical index"); + startFile(ol,"classes"+Doxygen::htmlFileExtension,0,"Alphabetical index"); startTitle(ol,0); parseText(ol,Config_getString("PROJECT_NAME")+" "+theTranslator->trCompoundIndex()); endTitle(ol,0,0); @@ -2065,7 +2065,7 @@ void writeExampleIndex(OutputList &ol) for (pdi.toFirst();(pi=pdi.current());++pdi) { ol.writeListItem(); - QCString n=convertNameToFile(pi->name+"-example"); + QCString n=pi->getOutputFileBase(); if (!pi->title.isEmpty()) { ol.writeObjectLink(0,n,0,pi->title); @@ -2529,11 +2529,11 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd,int level) { if(htmlHelp) { - htmlHelp->addContentsItem(FALSE,convertToHtml(pi->name),convertNameToFile(pi->name+"-example")); + htmlHelp->addContentsItem(FALSE,pi->getReference(),pi->getOutputFileBase()); } if(ftvHelp) { - ftvHelp->addContentsItem(FALSE,pi->getReference(),convertToHtml(pi->name+"-example"),0,convertNameToFile(pi->name)); + ftvHelp->addContentsItem(FALSE,pi->getReference(),pi->getOutputFileBase(),0,pi->name); } pi=++eli; } diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 45e26e7..987538b 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -784,12 +784,12 @@ void LatexGenerator::endIndexSection(IndexSections is) PageInfo *pi=pdi.toFirst(); if (pi) { - t << "\\input{" << convertNameToFile(pi->name+"-example") << "}\n"; + t << "\\input{" << pi->getOutputFileBase() << "}\n"; } for (++pdi;(pi=pdi.current());++pdi) { if (compactLatex) t << "\\input" ; else t << "\\include"; - t << "{" << convertNameToFile(pi->name+"-example") << "}\n"; + t << "{" << pi->getOutputFileBase() << "}\n"; } } break; @@ -803,13 +803,8 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (!pi->getGroupDef() && !pi->isReference()) { - QCString pageName; - if (Config_getBool("CASE_SENSE_NAMES")) - pageName=pi->name.copy(); - else - pageName=pi->name.lower(); if (compactLatex || first) t << "\\input" ; else t << "\\include"; - t << "{" << pageName << "}\n"; + t << "{" << pi->getOutputFileBase() << "}\n"; first=FALSE; } } diff --git a/src/latexgen.h b/src/latexgen.h index 6ce7785..cf36929 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -284,6 +284,8 @@ class LatexGenerator : public OutputGenerator void startSectionRefList(); void endSectionRefList(); + void writeCodeAnchor(const char *) {} + private: void latin2ToLatex(unsigned char); LatexGenerator(const LatexGenerator &); diff --git a/src/mangen.h b/src/mangen.h index d81242a..35439d6 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -251,6 +251,8 @@ class ManGenerator : public OutputGenerator void startSectionRefList() {} void endSectionRefList() {} + void writeCodeAnchor(const char *) {} + private: bool firstCol; bool paragraph; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index a00fcf1..64aeb4c 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1704,7 +1704,7 @@ void MemberDef::addListReference(Definition *d) } //printf("*** addListReference %s todo=%d test=%d bug=%d\n",name().data(),todoId(),testId(),bugId()); addRefItem(specialListItems(),memLabel, - d->getOutputFileBase()+":"+anchor(),memName,argsString()); + d->getOutputFileBase()+"#"+anchor(),memName,argsString()); } MemberList *MemberDef::getSectionList(Definition *d) const diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 48e1814..76854bf 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -239,7 +239,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) { Doxygen::tagFile << " <compound kind=\"namespace\">" << endl; Doxygen::tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; - Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << htmlFileExtension << "</filename>" << endl; + Doxygen::tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; } ol.startTextBlock(); diff --git a/src/outputgen.h b/src/outputgen.h index 6452f3b..7390e45 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -30,6 +30,41 @@ class ClassDiagram; class DotClassGraph; class DotInclDepGraph; class DotGfxHierarchyTable; +class DocNode; +class MemberDef; + +/*! \brief Output interface for code parser. + */ +class BaseCodeDocInterface +{ + public: + /*! Writes an ASCII string to the output. This function should keep + * spaces visible, should break lines at a newline and should convert + * tabs to the right number of spaces. + */ + virtual void codify(const char *s) = 0; + + /*! Writes a link to an object in a code fragment. + * \param ref If this is non-zero, the object is to be found in + * an external documentation file. + * \param file The file in which the object is located. + * \param anchor The anchor uniquely identifying the object within + * the file. + * \param name The text to display as a placeholder for the link. + */ + virtual void writeCodeLink(const char *ref,const char *file, + const char *anchor,const char *name) = 0; + + virtual void writeLineNumber(const char *ref,const char *file, + const char *anchor,int lineNumber) = 0; + virtual void startCodeLine() = 0; + virtual void endCodeLine() = 0; + virtual void startCodeAnchor(const char *label) = 0; + virtual void endCodeAnchor() = 0; + virtual void startFontClass(const char *) = 0; + virtual void endFontClass() = 0; + virtual void writeCodeAnchor(const char *name) = 0; +}; /*! \brief Base Interface used for generating documentation. * @@ -38,7 +73,7 @@ class DotGfxHierarchyTable; * or a list of formats (see OutputList). This interface * contains functions that generate output. */ -class BaseOutputDocInterface +class BaseOutputDocInterface : public BaseCodeDocInterface { public: enum ParamListTypes { Param, RetVal, Exception }; @@ -50,6 +85,10 @@ class BaseOutputDocInterface Examples }; + virtual void parseDoc(const char *,int, const char *,MemberDef *, + const QCString &) + {} + /*! Start of a bullet list: e.g. \c <ul> in html. writeListItem() is * Used for the bullet items. */ @@ -101,16 +140,6 @@ class BaseOutputDocInterface virtual void writeObjectLink(const char *ref,const char *file, const char *anchor, const char *name) = 0; - /*! Writes a link to an object in a code fragment. - * \param ref If this is non-zero, the object is to be found in - * an external documentation file. - * \param file The file in which the object is located. - * \param anchor The anchor uniquely identifying the object within - * the file. - * \param name The text to display as a placeholder for the link. - */ - virtual void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name) = 0; /*! Starts a (link to an) URL found in the documentation. * \param url The URL to link to. @@ -260,14 +289,6 @@ class BaseOutputDocInterface virtual void endPageRef(const char *,const char *) = 0; - virtual void writeLineNumber(const char *ref,const char *file, - const char *anchor,int lineNumber) = 0; - virtual void startCodeLine() = 0; - virtual void endCodeLine() = 0; - virtual void startCodeAnchor(const char *label) = 0; - virtual void endCodeAnchor() = 0; - virtual void startFontClass(const char *) = 0; - virtual void endFontClass() = 0; virtual void startHtmlOnly() = 0; virtual void endHtmlOnly() = 0; @@ -277,11 +298,6 @@ class BaseOutputDocInterface virtual void startSectionRefList() = 0; virtual void endSectionRefList() = 0; - /*! Writes an ASCII string to the output. This function should keep - * spaces visible, should break lines at a newline and should convert - * tabs to the right number of spaces. - */ - virtual void codify(const char *s) = 0; }; @@ -318,6 +334,8 @@ class OutputGenerator : public BaseOutputDocInterface void pushGeneratorState(); void popGeneratorState(); + virtual void printDoc(DocNode *) {} + /////////////////////////////////////////////////////////////// // structural output interface /////////////////////////////////////////////////////////////// diff --git a/src/outputlist.cpp b/src/outputlist.cpp index d0a2114..7374aff 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -27,6 +27,8 @@ #include "config.h" #include "message.h" +#include "docparser.h" + OutputList::OutputList(bool) { //printf("OutputList::OutputList()\n"); @@ -189,6 +191,23 @@ void OutputList::popGeneratorState() } } +void OutputList::parseDoc(const char *fileName,int startLine, + const char * clName,MemberDef * /*md*/, + const QCString &docStr) +{ + DocNode *root = validatingParseDoc(fileName,startLine,clName,docStr); + + OutputGenerator *og=outputs->first(); + while (og) + { + if (og->isEnabled()) og->printDoc(root); + og=outputs->next(); + } + + delete root; +} + + //-------------------------------------------------------------------------- // Create some overloaded definitions of the forall function. // Using template functions here would have made it a little less diff --git a/src/outputlist.h b/src/outputlist.h index 2dc34af..918d373 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -46,6 +46,7 @@ class OutputList : public OutputDocInterface OutputList &operator=(const OutputList &ol); OutputList &operator+=(const OutputList &ol); + void add(const OutputGenerator *); void disableAllBut(OutputGenerator::OutputType o); @@ -57,10 +58,14 @@ class OutputList : public OutputDocInterface void pushGeneratorState(); void popGeneratorState(); + ////////////////////////////////////////////////// // OutputDocInterface implementation ////////////////////////////////////////////////// + void parseDoc(const char *fileName,int startLine, + const char *clName,MemberDef *md,const QCString &docStr); + OutputDocInterface *clone() { return new OutputList(this); @@ -457,6 +462,8 @@ class OutputList : public OutputDocInterface void endSectionRefList() { forall(&OutputGenerator::endSectionRefList); } + void writeCodeAnchor(const char *name) + { forall(&OutputGenerator::writeCodeAnchor,name); } #if 0 void startPlainFile(const char *name) { forall(&OutputGenerator::startPlainFile,name); } @@ -41,8 +41,7 @@ class PageInfo QCString fileName; // functions to get a uniform interface with Definitions - QCString getOutputFileBase() const - { return fileName; } + QCString getOutputFileBase() const { return fileName; } bool isReference() const { return !reference.isEmpty(); } QCString getReference() const { return reference; } diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index f20099a..20595bc 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -34,6 +34,11 @@ class PrintDocVisitor : public DocVisitor indent_leaf(); printf("%s",w->word().data()); } + void visit(DocLinkedWord *w) + { + indent_leaf(); + printf("%s",w->word().data()); + } void visit(DocWhiteSpace *w) { indent_leaf(); @@ -137,11 +142,6 @@ class PrintDocVisitor : public DocVisitor case DocVerbatim::LatexOnly: printf("</latexonly>"); break; } } - void visit(DocXRefItem *x) - { - indent_leaf(); - printf("<xrefitem id=\"%d\"/>",x->id()); - } void visit(DocAnchor *a) { indent_leaf(); @@ -181,7 +181,7 @@ class PrintDocVisitor : public DocVisitor void visit(DocFormula *f) { indent_leaf(); - printf("<formula id=%d/>",f->id()); + printf("<formula name=%s test=%s/>",f->name().data(),f->text().data()); } //-------------------------------------- @@ -244,11 +244,12 @@ class PrintDocVisitor : public DocVisitor { indent_pre(); printf("<simplesect type="); - switch(s->sectionType()) + switch(s->type()) { case DocSimpleSect::See: printf("see"); break; case DocSimpleSect::Return: printf("return"); break; case DocSimpleSect::Author: printf("author"); break; + case DocSimpleSect::Authors: printf("authors"); break; case DocSimpleSect::Version: printf("version"); break; case DocSimpleSect::Since: printf("since"); break; case DocSimpleSect::Date: printf("date"); break; @@ -260,48 +261,6 @@ class PrintDocVisitor : public DocVisitor case DocSimpleSect::Remark: printf("remark"); break; case DocSimpleSect::Attention: printf("attention"); break; case DocSimpleSect::User: printf("user"); break; - case DocSimpleSect::Param: - { - printf("param["); - QStrListIterator li(s->parameters()); - const char *s; - bool first=TRUE; - for (li.toFirst();(s=li.current());++li) - { - if (!first) printf(","); else first=FALSE; - printf("%s",s); - } - printf("]"); - } - break; - case DocSimpleSect::RetVal: - { - printf("retval["); - QStrListIterator li(s->parameters()); - const char *s; - bool first=TRUE; - for (li.toFirst();(s=li.current());++li) - { - if (!first) printf(","); else first=FALSE; - printf("%s",s); - } - printf("]"); - } - break; - case DocSimpleSect::Exception: printf("exception"); break; - { - printf("exception["); - QStrListIterator li(s->parameters()); - const char *s; - bool first=TRUE; - for (li.toFirst();(s=li.current());++li) - { - if (!first) printf(","); else first=FALSE; - printf("%s",s); - } - printf("]"); - } - break; case DocSimpleSect::Unknown: printf("unknown"); break; } printf(">\n"); @@ -517,7 +476,8 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocLink *lnk) { indent_pre(); - printf("<link target=\"%s\">\n",lnk->target().data()); + printf("<link ref=\"%s\" file=\"%s\" anchor=\"%s\">\n", + lnk->ref().data(),lnk->file().data(),lnk->anchor().data()); } void visitPost(DocLink *) { @@ -527,7 +487,12 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocRef *ref) { indent_pre(); - printf("<ref target=\"%s\">\n",ref->target().data()); + printf("<ref ref=\"%s\" file=\"%s\" " + "anchor=\"%s\" targetTitle=\"%s\"" + " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\">\n", + ref->ref().data(),ref->file().data(),ref->anchor().data(), + ref->targetTitle().data(),ref->hasLinkText()?"yes":"no", + ref->refToAnchor()?"yes":"no", ref->refToSection()?"yes":"no"); } void visitPost(DocRef *) { @@ -564,6 +529,61 @@ class PrintDocVisitor : public DocVisitor indent_post(); printf("</language>\n"); } + void visitPre(DocParamList *pl) + { + indent_pre(); + QStrListIterator sli(pl->parameters()); + const char *s; + printf("<parameters>"); + for (sli.toFirst();(s=sli.current());++sli) + { + printf("<param>%s</param>",s); + } + } + void visitPost(DocParamList *) + { + indent_post(); + printf("</parameters>"); + } + void visitPre(DocParamSect *ps) + { + indent_pre(); + printf("<paramsect type="); + switch (ps->type()) + { + case DocParamSect::Param: printf("param"); break; + case DocParamSect::RetVal: printf("retval"); break; + case DocParamSect::Exception: printf("exception"); break; + case DocParamSect::Unknown: printf("unknown"); break; + } + printf(">"); + } + void visitPost(DocParamSect *) + { + indent_post(); + printf("</paramsect>"); + } + void visitPre(DocXRefItem *x) + { + indent_pre(); + printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\"/>", + x->file().data(),x->anchor().data(),x->title().data()); + } + void visitPost(DocXRefItem *) + { + indent_post(); + printf("<xrefitem/>"); + } + void visitPre(DocInternalRef *r) + { + indent_pre(); + printf("<internalref file=%s anchor=%s>\n",r->file().data(),r->anchor().data()); + } + void visitPost(DocInternalRef *) + { + indent_post(); + printf("</internalref>\n"); + } private: // helper functions diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 0dfb1a4..8583856 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -116,6 +116,7 @@ RTFGenerator::RTFGenerator() : OutputGenerator() m_listLevel = 0; m_bstartedBody = FALSE; m_omitParagraph = FALSE; + m_numCols = 0; } RTFGenerator::~RTFGenerator() @@ -129,7 +130,6 @@ void RTFGenerator::append(const OutputGenerator *g) //insideTabbing=insideTabbing || ((RTFGenerator *)g)->insideTabbing; m_listLevel=((RTFGenerator *)g)->m_listLevel; m_omitParagraph=((RTFGenerator *)g)->m_omitParagraph; - m_columnNumbers=((RTFGenerator *)g)->m_columnNumbers; //printf("RTFGenerator::append(%s) insideTabbing=%s\n", g->getContents().data(), // insideTabbing ? "TRUE" : "FALSE" ); } @@ -1336,7 +1336,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << convertNameToFile(pi->name+"-example"); + t << pi->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } for (++pdi;(pi=pdi.current());++pdi) @@ -1344,7 +1344,7 @@ void RTFGenerator::endIndexSection(IndexSections is) t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << convertNameToFile(pi->name+"-example"); + t << pi->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } @@ -1359,14 +1359,9 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (!pi->getGroupDef() && !pi->isReference()) { - QCString pageName; - if (Config_getBool("CASE_SENSE_NAMES")) - pageName=pi->name.copy(); - else - pageName=pi->name.lower(); if (first) t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << pageName; + t << pi->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; first=FALSE; } @@ -1667,8 +1662,8 @@ void RTFGenerator::endSubsubsection() void RTFGenerator::startTable(bool,int colNumbers) { - m_columnNumbers=colNumbers; - t<<"\\par\n"; + m_numCols=colNumbers; + t << "\\par\n"; } void RTFGenerator::endTable(bool hasCaption) @@ -1681,8 +1676,8 @@ void RTFGenerator::endTable(bool hasCaption) void RTFGenerator::startCaption() { endTableRow(); - t<<"\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10"<<endl; - t<<"\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<PAGEWIDTH<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright "<<endl; + t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10" << endl; + t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<PAGEWIDTH<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright " << endl; nextTableColumn(); } @@ -1694,28 +1689,34 @@ void RTFGenerator::endCaption() void RTFGenerator::nextTableRow() { - unsigned long columnWidth=PAGEWIDTH/m_columnNumbers; - t<<"\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10 "<<endl; - for (int i=1;i<=m_columnNumbers;i++) + ASSERT(m_numCols>0 && m_numCols<25); + uint columnWidth=PAGEWIDTH/m_numCols; + t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 " + "\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 " + "\\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 " + "\\trbrdrv\\brdrs\\brdrw10 "<<endl; + for (int i=0;i<m_numCols;i++) { - t<<"\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<i*columnWidth<<endl; + t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " + "\\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb " + "\\cellx" << (i*columnWidth) << endl; } - t<<"\\pard \\widctlpar\\intbl\\adjustright\n{"; + t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; } void RTFGenerator::endTableRow() { - t<<"\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; + t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; } void RTFGenerator::nextTableColumn() { - t<<"{ "; + t << "{ "; } void RTFGenerator::endTableColumn() { - t<<" \\cell }"; + t << " \\cell }"; } void RTFGenerator::startTextLink(const char *f,const char *anchor) diff --git a/src/rtfgen.h b/src/rtfgen.h index 8a41391..54dca5d 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -254,6 +254,8 @@ class RTFGenerator : public OutputGenerator void startSectionRefList() {} void endSectionRefList() {} + void writeCodeAnchor(const char *) {} + static bool preProcessFileInplace(const char *path,const char *name); private: @@ -273,7 +275,7 @@ class RTFGenerator : public OutputGenerator bool m_bstartedBody; // has startbody been called yet? int m_listLevel; // // RTF does not really have a addative indent...manually set list level. bool m_omitParagraph; // should a the next paragraph command be ignored? - int m_columnNumbers; // number of columns in a table + int m_numCols; // number of columns in a table void beginRTFDocument(); void beginRTFChapter(); diff --git a/src/scanner.l b/src/scanner.l index e1930cc..ca13399 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -385,7 +385,7 @@ static void setContext() QCString fileName = yyFileName; insideIDL = fileName.right(4)==".idl"; insideJava = fileName.right(5)==".java"; - insidePHP = fileName.right(4)==".php"; + insidePHP = fileName.right(4)==".php" || fileName.right(4)==".inc"; if ( insidePHP ) { useOverrideCommands = TRUE; @@ -444,15 +444,17 @@ static void addSpecialItem(const char *listName) if (lii) // already found item of same type before { RefItem *item = refList->getRefItem(lii->itemId); + ASSERT(item!=0); item->text += " <p>"; item->text += current->brief; } else // new item { int itemId = refList->addRefItem(); - char anchorLabel[12]; + char anchorLabel[1024]; sprintf(anchorLabel,"_%s%06d",listName,itemId); RefItem *item = refList->getRefItem(itemId); + ASSERT(item!=0); item->text = current->brief.copy(); item->listAnchor = anchorLabel; current->addSpecialListItem(listName,itemId); @@ -3781,15 +3783,15 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <LineDoc,JavaDoc>{CMD}{CMD}"endif"/[^a-z_A-Z0-9] { current->brief+=yytext; } /* conditional commands */ -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"if"{B}+ { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"if"{B}+ { lastIfContext = YY_START; BEGIN(IfGuard); } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"ifnot"{B}+ { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"ifnot"{B}+ { lastIfContext = YY_START; BEGIN(IfNotGuard); } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"if"(\r?)\n | +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"if"(\r?)\n | <IfGuard>\n { warn(yyFileName,yyLineNr,"Missing guard for if statement!"); yyLineNr++; @@ -3850,33 +3852,33 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) yyLineNr++; } <SkipSection>"//"|"*/" -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"elseif"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"elseif"/[^a-z_A-Z0-9] { // previous section enabled => skip now depthIf=1; BEGIN(SkipSection); } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"else"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"else"/[^a-z_A-Z0-9] { // section was enabled => skip now depthIf=1; BEGIN(SkipSection); } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"endif"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc,PageDoc,ExampleDoc>{CMD}"endif"/[^a-z_A-Z0-9] { // section enabled => absorb endif } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc>{CMD}"ingroup"{B}+ { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"ingroup"{B}+ { lastGroupContext = YY_START; lineCount(); BEGIN( GroupName ); } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc>{CMD}"nosubgrouping"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"nosubgrouping"/[^a-z_A-Z0-9] { current->subGrouping = FALSE; } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc>{CMD}"showinitializer"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"showinitializer"/[^a-z_A-Z0-9] { current->initLines = 100000; // ON } -<ClassDoc,LineDoc,Doc,JavaDoc,AfterDoc>{CMD}"hideinitializer"/[^a-z_A-Z0-9] { +<ClassDoc,LineDoc,AfterDocLine,AfterDocBrief,Doc,JavaDoc,AfterDoc>{CMD}"hideinitializer"/[^a-z_A-Z0-9] { current->initLines = 0; // OFF } <GroupName>{ID} { @@ -4478,7 +4480,9 @@ static void parseCompounds(Entry *rt) // set default protection based on the compound type if( ce->section==Entry::CLASS_SEC ) // class { - if (ce->fileName.right(5)==".java" || ce->fileName.right(4)==".php") + if (ce->fileName.right(5)==".java" || + ce->fileName.right(4)==".php" || + ce->fileName.right(4)==".inc") current->protection = protection = Public ; // Actually this should be package scope! else current->protection = protection = Private ; diff --git a/src/translator_it.h b/src/translator_it.h index 9766eb9..7ea9978 100644 --- a/src/translator_it.h +++ b/src/translator_it.h @@ -19,6 +19,7 @@ * * Revision history * + * 2002/08: translated new items used since version 1.2.17 * 2002/07: translated new items used since version 1.2.16 * 2002/06: modified trRelatedPagesDescription() method * correct typo in trInclByDepGraph() method @@ -65,7 +66,7 @@ #ifndef TRANSLATOR_IT_H #define TRANSLATOR_IT_H -class TranslatorItalian : public TranslatorAdapter_1_2_17 +class TranslatorItalian : public Translator { public: @@ -1358,6 +1359,17 @@ class TranslatorItalian : public TranslatorAdapter_1_2_17 return "Sommario"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.2.17 +////////////////////////////////////////////////////////////////////////// + + /*! Used as the header of the list of item that have been + * flagged deprecated + */ + virtual QCString trDeprecatedList() + { + return "Lista degli elementi deprecati"; + } }; #endif diff --git a/src/translator_pl.h b/src/translator_pl.h index 4951a6f..7d16654 100644 --- a/src/translator_pl.h +++ b/src/translator_pl.h @@ -13,7 +13,7 @@ * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * - * Polish translation was updated to version 1.2.16 by + * Polish translation was updated to version 1.2.17 by * Piotr Kaminski (Piotr.Kaminski@ctm.gdynia.pl) */ @@ -22,7 +22,7 @@ #include "translator_adapter.h" -class TranslatorPolish : public TranslatorAdapter_1_2_16 +class TranslatorPolish : public TranslatorAdapter_1_2_17 { public: @@ -82,7 +82,16 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 /*! header that is put before the list of member attributes. */ QCString trMemberDataDocumentation() - { return "Dokumentacja Atrybutów Składowych"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Dokumentacja Pól"; + } + else + { + return "Dokumentacja Atrybutów Składowych"; + } + } /*! this is the text of a link put after brief descriptions. */ QCString trMore() @@ -146,7 +155,16 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 /*! This is put above each page as a link to the list of annotated classes */ QCString trCompoundList() - { return "Lista Klas"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Struktury Danych"; + } + else + { + return "Lista Klas"; + } + } /*! This is put above each page as a link to the list of documented files */ QCString trFileList() @@ -158,11 +176,29 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 /*! This is put above each page as a link to all members of compounds. */ QCString trCompoundMembers() - { return "Składowe Klas"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Pola Danych"; + } + else + { + return "Składowe Klas"; + } + } /*! This is put above each page as a link to all members of files. */ QCString trFileMembers() - { return "Składowe Plików"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Globalne"; + } + else + { + return "Składowe Plików"; + } + } /*! This is put above each page as a link to all related pages. */ QCString trRelatedPages() @@ -193,20 +229,58 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 /*! This is an introduction to the annotated compound list. */ QCString trCompoundListDescription() - { return "Tutaj znajdują się klasy, struktury, " + { + + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Tutaj znajdują się struktury danych wraz z ich krótkimi opisami:"; + } + else + { + return "Tutaj znajdują się klasy, struktury, " "unie i interfejsy wraz z ich krótkimi opisami:"; + } } /*! This is an introduction to the page with all class members. */ QCString trCompoundMembersDescription(bool extractAll) { QCString result="Tutaj znajduje się lista wszystkich "; - if (!extractAll) result+="udokumentowanych "; - result+="składowych wraz z odnośnikami do "; + if (!extractAll) + { + result+="udokumentowanych "; + } + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="pól struktur i unii"; + } + else + { + result+="składowych"; + } + result+=" wraz z odnośnikami do "; if (extractAll) - result+="dokumentacji klas dla każdej składowej:"; + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="dokumentacji struktur/unii dla każdego pola:"; + } + else + { + result+="dokumentacji klas dla każdej składowej:"; + } + } else - result+="klas, do których dana składowa należy:"; + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="struktur/unii, do których dane pole należy:"; + } + else + { + result+="klas, do których dana składowa należy:"; + } + } return result; } @@ -215,11 +289,19 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 { QCString result="Tutaj znajduje się lista wszystkich "; if (!extractAll) result+="udokumentowanych "; - result+="składowych wraz z odnośnikami do "; + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="funkcji, zmiennych, makr, wyliczeń i definicji typów"; + } + else + { + result+="składowych plików"; + } + result+=" wraz z odnośnikami do "; if (extractAll) - result+="dokumentacji plików dla każdej składowej:"; + result+="plików, do których one należą:"; else - result+="plików, do których dana składowa należy:"; + result+="dokumentacji:"; return result; } @@ -268,7 +350,16 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 * annotated compound index. */ QCString trCompoundIndex() - { return "Indeks Klas"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Indeks Struktur Danych"; + } + else + { + return "Indeks Klas"; + } + } /*! This is used in LaTeX as the title of the chapter with the * list of all files. @@ -286,7 +377,16 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 * the documentation of all classes, structs and unions. */ QCString trClassDocumentation() - { return "Dokumentacja Klas"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Dokumentacja Struktur Danych"; + } + else + { + return "Dokumentacja Klas"; + } + } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all files. @@ -402,7 +502,16 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 * the list of links to documented compounds */ QCString trCompounds() - { return "Komponenty"; } + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Struktury Danych"; + } + else + { + return "Komponenty"; + } + } /*! This is used in the documentation of a group before the list of * links to documented files @@ -521,7 +630,7 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 ClassDef::CompoundType compType, bool isTemplate) { - QCString result="Referencje"; + QCString result="Dokumentacja"; if (isTemplate) result+=" Szablonu"; switch(compType) { @@ -538,7 +647,7 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 /*! used as the title of the HTML page of a file */ QCString trFileReference(const char *fileName) { - QCString result="Referencje Pliku "; + QCString result="Dokumentacja Pliku "; result+=fileName; return result; } @@ -546,7 +655,7 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 /*! used as the title of the HTML page of a namespace */ QCString trNamespaceReference(const char *namespaceName) { - QCString result="Referencje Przestrzeni Nazw "; + QCString result="Dokumentacja Przestrzeni Nazw "; result+=namespaceName; return result; } @@ -829,7 +938,14 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 } QCString trPublicAttribs() { - return "Atrybuty Publiczne"; + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Pola Danych"; + } + else + { + return "Atrybuty Publiczne"; + } } QCString trStaticPublicAttribs() { @@ -881,7 +997,7 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 QCString trReferencedBy() { - return "Referencje według"; + return "Odwołania w"; } QCString trRemarks() { @@ -1210,7 +1326,7 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 */ virtual QCString trReferences() { - return "Wskazuje na"; + return "Odwołuje się do"; } @@ -1229,6 +1345,18 @@ class TranslatorPolish : public TranslatorAdapter_1_2_16 return "Implementowany w "+trWriteList(numEntries)+"."; } +////////////////////////////////////////////////////////////////////////// +// new since 1.2.16 +////////////////////////////////////////////////////////////////////////// + + /*! used in RTF documentation as a heading for the Table + * of Contents. + */ + virtual QCString trRTFTableOfContents() + { + return "Spis Treści"; + } + }; #endif diff --git a/src/translator_sr.h b/src/translator_sr.h index 71d66d5..1934084 100644 --- a/src/translator_sr.h +++ b/src/translator_sr.h @@ -20,7 +20,7 @@ // translation by Dejan D. M. Milosavljevic <dmilos@email.com>;<dmilosx@ptt.yu> -class TranslatorSerbian : public TranslatorAdapter_1_2_16 +class TranslatorSerbian : public TranslatorAdapter_1_2_17 { QCString decode(const QCString& sInput) { @@ -98,40 +98,40 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! header that is put before the list of member functions. */ virtual QCString trMemberFunctionDocumentation() - { return "Dokumentacija funkcija članica"; } + { return decode( "Dokumentacija funkcija članica" ); } /*! header that is put before the list of member attributes. */ virtual QCString trMemberDataDocumentation() { if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { - return "Dokumentacija članova"; + return decode( "Dokumentacija članova" ); } else { - return "Documentacija javnoh članova"; + return decode( "Dokumentacija javnih članova" ); } } /*! this is the text of a link put after brief descriptions. */ virtual QCString trMore() - { return "Još..."; } + { return decode( "Još..." ); } /*! put in the class documentation */ virtual QCString trListOfAllMembers() - { return "Spisak svih članova."; } + { return decode( "Spisak svih članova." ); } /*! used as the title of the "list of all members" page of a class */ virtual QCString trMemberList() - { return "Spisak članova"; } + { return decode( "Spisak članova" ); } /*! this is the first part of a sentence that is followed by a class name */ virtual QCString trThisIsTheListOfAllMembers() - { return "Ovo je spisak svih članova "; } + { return decode( "Ovo je spisak svih članova " ); } /*! this is the remainder of the sentence after the class name */ virtual QCString trIncludingInheritedMembers() - { return ", uključujući nasleđene članove."; } + { return decode( ", uključujući nasleđene članove." ); } /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. @@ -193,11 +193,11 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 { if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { - return "Svi članovi struktura"; - } + return decode( "Svi članovi struktura" ); + } else { - return "Svi članovi klasa"; + return decode( "Svi članovi klasa" ); } } @@ -206,29 +206,29 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 { if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { - return "Globalni"; + return decode("Članovi fajla"); } else { - return "Lokalni"; + return decode("Članovi fajla"); } } /*! This is put above each page as a link to all related pages. */ virtual QCString trRelatedPages() - { return "Stranice povezane s ovom"; } + { return decode( "Stranice povezane sa ovom" ); } /*! This is put above each page as a link to all examples. */ virtual QCString trExamples() - { return "Primeri"; } + { return decode( "Primeri" ); } /*! This is put above each page as a link to the search engine. */ virtual QCString trSearch() - { return "Traži"; } + { return decode( "Traži" ); } /*! This is an introduction to the class hierarchy. */ virtual QCString trClassHierarchyDescription() - { return "Stablo nasleđivanja je složeno ""približno po abecedi:"; } + { return decode( "Stablo nasleđivanja je složeno ""približno po abecedi:" ); } /*! This is an introduction to the list with all files. */ virtual QCString trFileListDescription(bool extractAll) @@ -236,7 +236,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 QCString result="Spisak svih "; if (!extractAll) result+="dokumetovanih "; result+="fajlova, sa kratkim opisom:"; - return result; + return decode( result ); } /*! This is an introduction to the annotated compound list. */ @@ -245,11 +245,11 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { - return "Spisak struktura sa kratkim opisom:"; + return decode( "Spisak struktura sa kratkim opisom:" ); } else { - return "Spisak klasa, struktura, unija i interjfejsa sa kratkim opisom:"; + return decode( "Spisak klasa, struktura, unija i interjfejsa sa kratkim opisom:" ); } } @@ -293,7 +293,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 result+="klase koje pripadaju:"; } } - return result; + return decode( result ); } /*! This is an introduction to the page with all file members. */ @@ -359,7 +359,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 * class hierarchy. */ virtual QCString trHierarchicalIndex() - { return "Hijerarhijski sadžraj"; } + { return decode( "Hijerarhijski sadžraj" ); } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index. @@ -423,7 +423,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! This is used in LaTeX as the title of the document */ virtual QCString trReferenceManual() - { return decode("Priručnik"); } + { return decode( "Priručnik" ); } /*! This is used in the documentation of a file as a header before the * list of defines @@ -549,11 +549,11 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! this text is generated when the \\internal command is used. */ virtual QCString trForInternalUseOnly() - { return decode( "Samo za unutrasnju upotrebu." ); } + { return decode( "Samo za unutrašnju upotrebu." ); } /*! this text is generated when the \\reimp command is used. */ virtual QCString trReimplementedForInternalReasons() - { return decode("Preurađeno zbog internih razloga; Nema uticaja na API." ); } + { return decode("Preurađeno zbog unutrašnjih razloga; Nema uticaja na API." ); } /*! this text is generated when the \\warning command is used. */ virtual QCString trWarning() @@ -573,11 +573,11 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! this text is generated when the \\return command is used. */ virtual QCString trReturns() - { return decode( "Vraćenene vrednosti" ); } + { return decode( "Vraćene vrednosti" ); } /*! this text is generated when the \\sa command is used. */ virtual QCString trSeeAlso() - { return "Takođe pogledati"; } + { return decode( "Takođe pogledati" ); } /*! this text is generated when the \\param command is used. */ virtual QCString trParameters() @@ -643,7 +643,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 case ClassDef::Interface: result+="interfejsa "; break; case ClassDef::Exception: result+="izuzetka "; break; } - if (isTemplate) result+="švablona "; + if (isTemplate) result += "šablona "; result += clName; return decode( result ); @@ -652,16 +652,16 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! used as the title of the HTML page of a file */ virtual QCString trFileReference(const char *fileName) { - QCString result=fileName; - result+=" Opis fajla"; + QCString result = "Opis fajla "; + result += fileName; return result; } /*! used as the title of the HTML page of a namespace */ virtual QCString trNamespaceReference(const char *namespaceName) { - QCString result=namespaceName; - result+=" Opis prostora imena"; + QCString result="Opis prostora imena "; + result += namespaceName; return result; } @@ -674,9 +674,9 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 virtual QCString trStaticPublicMembers() { return decode("Zajednički javni članovi"); } virtual QCString trProtectedMembers() - { return decode("Zastićeni članovi"); } + { return decode("Zaštićeni članovi"); } virtual QCString trProtectedSlots() - { return decode("Zastićeni slotovi"); } + { return decode("Zaštićeni slotovi"); } virtual QCString trStaticProtectedMembers() { return decode("Zajednički zaštićeni članovi"); } virtual QCString trPrivateMembers() @@ -757,7 +757,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 result+="dokumentaciju svakog člana prostora imena: "; else result+="prostor imena kojima pripadaju: "; - return result; + return decode( result ); } /*! This is used in LaTeX as the title of the chapter with the * index of all namespaces. @@ -792,16 +792,16 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 bool single) { // here s is one of " Class", " Struct" or " Union" // single is true implies a single file - QCString result=(QCString)"Dokumentacija ove "; + QCString result=(QCString)"Dokumentacija "; switch(compType) { - case ClassDef::Class: result+="klase"; break; - case ClassDef::Struct: result+="strukture"; break; - case ClassDef::Union: result+="unije"; break; - case ClassDef::Interface: result+="interfejsa"; break; - case ClassDef::Exception: result+="izuzetka"; break; + case ClassDef::Class: result+="ove klase"; break; + case ClassDef::Struct: result+="ove strukture"; break; + case ClassDef::Union: result+="ove unije"; break; + case ClassDef::Interface: result+="ovog interfejsa"; break; + case ClassDef::Exception: result+="ovog izuzetka"; break; } - result+=" je napravljen iz "; + result+=" je napravljena iz "; if (single) result+=":"; else result+=":"; return result; } @@ -818,7 +818,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! This is used as the heading text for the retval command. */ virtual QCString trReturnValues() - { return "Vraćena vrednost"; } + { return decode( "Vraćena vrednost" ); } /*! This is in the (quick) index as a link to the main page (index.html) */ @@ -904,7 +904,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! Text shown before a multi-line variable/enum initialization */ virtual QCString trInitialValue() { - return decode("Početna vriednost:"); + return decode( "Početna vriednost:" ); } /*! Text used the source code in the file index */ virtual QCString trCode() @@ -913,15 +913,15 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 } virtual QCString trGraphicalHierarchy() { - return decode("Grafičko prikaz stablo klasa"); + return decode("Grafički prikaz stabla klasa"); } virtual QCString trGotoGraphicalHierarchy() { - return decode("Prikaži grafičko stablo klasa"); + return decode("Prikaži stablo klasa u grafičkom obliku"); } virtual QCString trGotoTextualHierarchy() { - return decode( "Prikaži tekstualno stablo klasa" ); + return decode( "Prikaži stablo klasa u tekstualnom obliku" ); } virtual QCString trPageIndex() { @@ -944,11 +944,11 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 { if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { - return "Član"; + return decode( "Član" ); } else { - return "Javni član"; + return decode( "Javni član" ); } } virtual QCString trStaticPublicAttribs() @@ -973,11 +973,11 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 } virtual QCString trPrivateAttribs() { - return "Privatni članovi"; + return decode( "Privatni članovi" ); } virtual QCString trStaticPrivateAttribs() { - return decode("Zajednički privatni članovi"); + return decode( "Zajednički privatni članovi" ); } ////////////////////////////////////////////////////////////////////////// @@ -1001,7 +1001,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 virtual QCString trReferencedBy() { - return decode( "Korišćno od" ); + return decode( "Korišćeno od" ); } virtual QCString trRemarks() { @@ -1028,7 +1028,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! title of the graph legend page */ virtual QCString trLegendTitle() { - return decode( "Objasnjenje koriscenih simbola" ); + return decode( "Objašnjenje korišćenih simbola" ); } /*! page explaining how the dot graph's should be interpreted * The %A in the text below are to prevent link to classes called "A". @@ -1056,7 +1056,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 "class PrivateBase { };\n\n" "/*! Klasa koja je korišćena od drugih klasa*/\n" "class Used { };\n\n" - "/*! Super klasa koja naslijeđuje/koristi ostale */\n" + "/*! Nadklasa koja nasleđuje/koristi ostale */\n" "class Inherited : public PublicBase,\n" " protected ProtectedBase,\n" " private PrivateBase,\n" @@ -1078,9 +1078,9 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 "<li>Sa crnom ivicom predstavlja dokumentovanu strukturu ili klasu.\n" "<li>Sa sivom icivom predstavlja nedokumentovanu strukturu ili klasu.\n" "<li>Sa crvenom ivicom predstavlja dokumentovanu strukturu ili klasu\n" - "za koju nije prikazan graf naslijeđivanja/korišćenja. Graf je odsečen " + "za koju nije prikazan graf nasleđivanja/korišćenja. Graf je odsečen " "ako ne stane unutar određenih granica." - + "</ul>" "Strelice imaju sledeća značenja:\n" "<ul>\n" "<li>Tamnoplava strelica označava javno nasleđivanje.\n" @@ -1098,7 +1098,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 /*! text for the link to the legend page */ virtual QCString trLegend() { - return decode( "Objačnjenje koričćenih simbola" ); + return decode( "Objašnjenje korišćenih simbola" ); } ////////////////////////////////////////////////////////////////////////// @@ -1367,7 +1367,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 */ virtual QCString trReferences() { - return "Pogledati"; + return "Koristi"; } ////////////////////////////////////////////////////////////////////////// @@ -1379,7 +1379,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 */ virtual QCString trImplementedFromList(int numEntries) { - return "Definiše "+trWriteList(numEntries)+"."; + return decode( "Definiše "+trWriteList(numEntries)+"." ); } /*! used in member documentation blocks to produce a list of @@ -1387,14 +1387,28 @@ class TranslatorSerbian : public TranslatorAdapter_1_2_16 */ virtual QCString trImplementedInList(int numEntries) { - return "Definisano u "+trWriteList(numEntries)+"."; + return "Definisano u " + trWriteList(numEntries) + "." ; } +////////////////////////////////////////////////////////////////////////// +// new since 1.2.16 +////////////////////////////////////////////////////////////////////////// + + /*! used in RTF documentation as a heading for the Table + * of Contents. + */ + virtual QCString trRTFTableOfContents() + { + return decode( "Sadržaj" ); + } + + + }; #endif -// sh - š -// dj - đ +// sh - š - shashavo +// dj - đ - djordje // ch - č - chasha -// cc - ć - vicc -// zz - ž +// cc - ć - cciccifu +// zz - ž - zzaba diff --git a/src/util.cpp b/src/util.cpp index 5b0ed19..5be38ca 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2274,92 +2274,61 @@ static bool isLowerCase(QCString &s) return TRUE; } -/*! - * generate a reference to a class, namespace or member. - * `scName' is the name of the scope that contains the documentation - * string that is returned. - * `name' is the name that we want to link to. - * `name' may have five formats: - * 1) "ScopeName" - * 2) "memberName()" one of the (overloaded) function or define - * with name memberName. - * 3) "memberName(...)" a specific (overloaded) function or define - * with name memberName - * 4) "::name a global variable or define - * 4) "#memberName member variable, global variable or define - * 5) ("ScopeName::")+"memberName()" - * 6) ("ScopeName::")+"memberName(...)" - * 7) ("ScopeName::")+"memberName" - * instead of :: the # symbol may also be used. - */ -bool generateRef(OutputDocInterface &od,const char *scName, - const char *name,bool inSeeBlock,const char *rt) + +/*! Returns an object to reference to given its name and context + * @post return value TRUE implies *resContext!=0 or *resMember!=0 + */ +bool resolveRef(/* in */ const char *scName, + /* in */ const char *name, + /* in */ bool inSeeBlock, + /* out */ Definition **resContext, + /* out */ MemberDef **resMember + ) { - //printf("generateRef(scName=%s,name=%s,rt=%s)\n",scName,name,rt); + //printf("resolveRef(scName=%s,name=%s,inSeeBlock=%d,rt=%s)\n",scName,name,inSeeBlock,rt); QCString tsName = name; bool memberScopeFirst = tsName.find('#')!=-1; - QCString tmpName = substitute(tsName,"#","::"); - QCString linkText = rt; - int scopePos=tmpName.findRev("::"); - int bracePos=tmpName.findRev('('); // reverse is needed for operator()(...) + QCString fullName = substitute(tsName,"#","::"); + int scopePos=fullName.findRev("::"); + int bracePos=fullName.findRev('('); // reverse is needed for operator()(...) + + // default result values + *resContext=0; + *resMember=0; + if (bracePos==-1) // simple name { ClassDef *cd=0; NamespaceDef *nd=0; - if (linkText.isEmpty()) - { - linkText=tmpName; - // strip :: prefix if present - if (linkText.at(0)==':' && linkText.at(1)==':') - { - linkText=linkText.right(linkText.length()-2); - } - } - if (scopePos==-1 && isLowerCase(tsName)) { // link to lower case only name => do not try to autolink - od.docify(linkText); - // text has been written, stop now. return FALSE; } //printf("scName=%s tmpName=%s\n",scName,tmpName.data()); // check if this is a class or namespace reference - if (scName!=tmpName && getScopeDefs(scName,name,cd,nd)) + if (scName!=fullName && getScopeDefs(scName,name,cd,nd)) { if (cd) // scope matches that of a class { - od.writeObjectLink(cd->getReference(), - cd->getOutputFileBase(),0,linkText); - if (!cd->isReference() /*&& !Config_getBool("PDF_HYPERLINKS")*/) - { - writePageRef(od,cd->getOutputFileBase(),0); - } + *resContext = cd; } else // scope matches that of a namespace { - od.writeObjectLink(nd->getReference(), - nd->getOutputFileBase(),0,linkText); - if (!nd->getReference() /*&& !Config_getBool("PDF_HYPERLINKS")*/) - { - writePageRef(od,nd->getOutputFileBase(),0); - } + ASSERT(nd!=0); + *resContext = nd; } - // link has been written, stop now. return TRUE; } - else if (scName==tmpName || (!inSeeBlock && scopePos==-1)) // nothing to link => output plain text + else if (scName==fullName || (!inSeeBlock && scopePos==-1)) // nothing to link => output plain text { - od.docify(linkText); - // text has been written, stop now. return FALSE; } // continue search... - linkText = rt; } // extract scope @@ -2368,22 +2337,15 @@ bool generateRef(OutputDocInterface &od,const char *scName, //printf("scopeContext=%s scopeUser=%s\n",scopeContext.data(),scopeUser.data()); // extract userscope+name - int endNamePos=bracePos!=-1 ? bracePos : tmpName.length(); - QCString nameStr=tmpName.left(endNamePos); + int endNamePos=bracePos!=-1 ? bracePos : fullName.length(); + QCString nameStr=fullName.left(endNamePos); // extract arguments QCString argsStr; - if (bracePos!=-1) argsStr=tmpName.right(tmpName.length()-bracePos); + if (bracePos!=-1) argsStr=fullName.right(fullName.length()-bracePos); - // create a default link text if none was explicitly given - if (linkText.isEmpty()) - { - //if (!scopeUser.isEmpty()) linkText=scopeUser+"::"; - linkText=nameStr; - if (linkText.left(2)=="::") linkText=linkText.right(linkText.length()-2); - } - //printf("scope=`%s' name=`%s' arg=`%s' linkText=`%s'\n", - // scopeStr.data(),nameStr.data(),argsStr.data(),linkText.data()); + //printf("scope=`%s' name=`%s' arg=`%s'\n", + // scopeStr.data(),nameStr.data(),argsStr.data()); // strip template specifier // TODO: match against the correct partial template instantiation @@ -2394,14 +2356,11 @@ bool generateRef(OutputDocInterface &od,const char *scName, nameStr=nameStr.left(templPos)+nameStr.right(nameStr.length()-endTemplPos-1); } - MemberDef *md = 0; - ClassDef *cd = 0; - FileDef *fd = 0; + MemberDef *md = 0; + ClassDef *cd = 0; + FileDef *fd = 0; NamespaceDef *nd = 0; - GroupDef *gd = 0; - - //printf("Try with scName=`%s' nameStr=`%s' argsStr=`%s'\n", - // scopeStr.data(),nameStr.data(),argsStr.data()); + GroupDef *gd = 0; // check if nameStr is a member or global. if (getDefs(scopeStr,nameStr,argsStr, @@ -2413,112 +2372,119 @@ bool generateRef(OutputDocInterface &od,const char *scName, ) { //printf("after getDefs md=%p cd=%p fd=%p nd=%p gd=%p\n",md,cd,fd,nd,gd); - QCString anchor; - if (md->isLinkable()) anchor = md->anchor(); - QCString cName,aName; - if (cd) // nameStr is a member of cd - { - //printf("addObjectLink(%s,%s,%s,%s)\n",cd->getReference(), - // cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data()); - od.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), - anchor,linkText.stripWhiteSpace()); - cName=cd->getOutputFileBase(); - aName=md->anchor(); - } - else if (nd) // nameStr is a member of nd - { - //printf("writing namespace link\n"); - od.writeObjectLink(nd->getReference(),nd->getOutputFileBase(), - anchor,linkText.stripWhiteSpace()); - cName=nd->getOutputFileBase(); - aName=md->anchor(); - } - else if (fd) // nameStr is a global in file fd - { - //printf("addFileLink(%s,%s,%s)\n",fd->getOutputFileBase(),anchor.data(), - // resultName.stripWhiteSpace().data()); - od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(), - anchor,linkText.stripWhiteSpace()); - cName=fd->getOutputFileBase(); - aName=md->anchor(); - } - else if (gd) - { - //printf("addGroupLink(%s,%s,%s)\n",fd->getOutputFileBase().data(),anchor.data(), - // gd->name().data()); - od.writeObjectLink(gd->getReference(),gd->getOutputFileBase(), - anchor,linkText.stripWhiteSpace()); - cName=gd->getOutputFileBase(); - aName=md->anchor(); - } - else // should not be reached - { - //printf("add no link fd=cd=0\n"); - od.docify(linkText); - } + *resMember=md; + if (cd) *resContext=cd; + else if (nd) *resContext=nd; + else if (fd) *resContext=fd; + else if (gd) *resContext=gd; + else { *resContext=0; *resMember=0; return FALSE; } + return TRUE; + } + else if (inSeeBlock && !nameStr.isEmpty() && (gd=Doxygen::groupSDict[nameStr])) + { // group link + *resContext=gd; + return TRUE; + } - // for functions we add the arguments if explicitly specified or else "()" - if (!rt && (md->isFunction() || md->isPrototype() || md->isSignal() || md->isSlot() || md->isDefine())) - { - if (argsStr.isEmpty() && (!md->isDefine() || md->argsString()!=0)) - // od.writeString("()") - ; - else - od.docify(argsStr); - } + return FALSE; +} + +/*! + * generate a reference to a class, namespace or member. + * `scName' is the name of the scope that contains the documentation + * string that is returned. + * `name' is the name that we want to link to. + * `name' may have five formats: + * 1) "ScopeName" + * 2) "memberName()" one of the (overloaded) function or define + * with name memberName. + * 3) "memberName(...)" a specific (overloaded) function or define + * with name memberName + * 4) "::name a global variable or define + * 4) "#memberName member variable, global variable or define + * 5) ("ScopeName::")+"memberName()" + * 6) ("ScopeName::")+"memberName(...)" + * 7) ("ScopeName::")+"memberName" + * instead of :: the # symbol may also be used. + */ + +bool generateRef(OutputDocInterface &od,const char *scName, + const char *name,bool inSeeBlock,const char *rt) +{ + //printf("generateRef(scName=%s,name=%s,rt=%s)\n",scName,name,rt); + + Definition *compound; + MemberDef *md; - // generate the page reference (for LaTeX) - if ((!cName.isEmpty() || !aName.isEmpty()) && md->isLinkableInProject()) + // create default link text + QCString linkText = rt; + if (linkText.isEmpty()) + { + linkText=substitute(name,"#","::"); + // strip :: prefix if present + if (linkText.at(0)==':' && linkText.at(1)==':') { - writePageRef(od,cName,aName); + linkText=linkText.right(linkText.length()-2); } - return TRUE; } - else if (inSeeBlock && !nameStr.isEmpty() && (gd=Doxygen::groupSDict[nameStr])) - { // group link - od.startTextLink(gd->getOutputFileBase(),0); - if (rt) // explict link text + + if (resolveRef(scName,name,inSeeBlock,&compound,&md)) + { + if (md) // link to member { - od.docify(rt); + od.writeObjectLink(compound->getReference(), + compound->getOutputFileBase(), + md->anchor(),linkText); + // generate the page reference (for LaTeX) + if (!compound->isReference() && !md->anchor().isEmpty() && + md->isLinkableInProject()) + { + writePageRef(od,compound->getOutputFileBase(),md->anchor()); + } } - else // use group title as the default link text + else // link to compound { - od.docify(gd->groupTitle()); + if (rt==0 && compound->definitionType()==Definition::TypeGroup) + { + linkText=((GroupDef *)compound)->groupTitle(); + } + od.writeObjectLink(compound->getReference(), + compound->getOutputFileBase(), + 0,linkText); + if (!compound->isReference()) + { + writePageRef(od,compound->getOutputFileBase(),0); + } } - od.endTextLink(); return TRUE; } - - // nothing found - if (rt) - od.docify(rt); - else + else // no link possible { od.docify(linkText); - if (!argsStr.isEmpty()) od.docify(argsStr); + return FALSE; } - return FALSE; } -//---------------------------------------------------------------------- -// General function that generates the HTML code for a reference to some -// file, class or member from text `lr' within the context of class `clName'. -// This link has the text 'lt' (if not 0), otherwise `lr' is used as a -// basis for the link's text. -// returns TRUE if a link could be generated. - -bool generateLink(OutputDocInterface &od,const char *clName, - const char *lr,bool inSeeBlock,const char *lt) +bool resolveLink(/* in */ const char *scName, + /* in */ const char *lr, + /* in */ bool inSeeBlock, + /* out */ Definition **resContext, + /* out */ PageInfo **resPageInfo, + /* out */ QCString &resAnchor + ) { - //printf("generateLink clName=`%s' lr=`%s' lt=`%s'\n",clName,lr,lt); + //printf("resolveLink clName=`%s' lr=`%s' lt=`%s'\n",clName,lr,lt); + + *resContext=0; + *resPageInfo=0; + QCString linkRef=lr; - FileDef *fd; + FileDef *fd; GroupDef *gd; PageInfo *pi; bool ambig; if (linkRef.isEmpty()) // no reference name! { - od.docify(lt); return FALSE; } else if ((pi=Doxygen::pageSDict->find(linkRef))) // link to a page @@ -2528,62 +2494,84 @@ bool generateLink(OutputDocInterface &od,const char *clName, { SectionInfo *si=0; if (!pi->name.isEmpty()) si=Doxygen::sectionDict[pi->name]; - od.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),si ? si->label.data() : 0,lt); - if (gd->isLinkableInProject()) - { - writePageRef(od,gd->getOutputFileBase(),si ? si->label.data() : 0); - } + *resContext=gd; + if (si) resAnchor = si->label; } else { - od.writeObjectLink(pi->getReference(),pi->getOutputFileBase(),0,lt); - if (!pi->isReference()) - { - writePageRef(od,pi->name,0); - } + *resPageInfo=pi; } return TRUE; } else if ((pi=Doxygen::exampleSDict->find(linkRef))) // link to an example { - od.writeObjectLink(0,convertNameToFile(pi->name+"-example"),0,lt); - if (!pi->isReference()) - { - writePageRef(od,convertNameToFile(pi->name+"-example"),0); - } + *resPageInfo=pi; return TRUE; } else if ((gd=Doxygen::groupSDict[linkRef])) // link to a group { - //od.startTextLink(gd->getOutputFileBase(),0); - //if (lt) - // od.docify(lt); - //else - // od.docify(gd->groupTitle()); - //od.endTextLink(); - QCString title; - if (lt) title=lt; else title=gd->groupTitle(); - od.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),0,title); - if (gd->isLinkableInProject()) - { - writePageRef(od,gd->getOutputFileBase(),0); - } + *resContext=gd; + return TRUE; + } + else if ((fd=findFileDef(Doxygen::inputNameDict,linkRef,ambig)) // file link + && fd->isLinkable()) + { + *resContext=fd; return TRUE; } - else if ((fd=findFileDef(Doxygen::inputNameDict,linkRef,ambig)) - && fd->isLinkable()) + else // probably a class or member reference { - // link to documented input file - od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,lt); - if (fd->isLinkableInProject()) + MemberDef *md; + bool res = resolveRef(scName,lr,inSeeBlock,resContext,&md); + if (md) resAnchor=md->anchor(); + return res; + } +} + + +//---------------------------------------------------------------------- +// General function that generates the HTML code for a reference to some +// file, class or member from text `lr' within the context of class `clName'. +// This link has the text 'lt' (if not 0), otherwise `lr' is used as a +// basis for the link's text. +// returns TRUE if a link could be generated. + +bool generateLink(OutputDocInterface &od,const char *clName, + const char *lr,bool inSeeBlock,const char *lt) +{ + Definition *compound; + PageInfo *pageInfo; + QCString anchor,linkText=lt; + if (resolveLink(clName,lr,inSeeBlock,&compound,&pageInfo,anchor)) + { + if (pageInfo) // link to page { - writePageRef(od,fd->getOutputFileBase(),0); + od.writeObjectLink(pageInfo->getReference(), + pageInfo->getOutputFileBase(),anchor,linkText); + if (!pageInfo->isReference()) + { + writePageRef(od,pageInfo->getOutputFileBase(),anchor); + } + } + else if (compound) // link to compound + { + if (lt==0 && compound->definitionType()==Definition::TypeGroup) + { + linkText=((GroupDef *)compound)->groupTitle(); + } + od.writeObjectLink(compound->getReference(), + compound->getOutputFileBase(),anchor,linkText); + if (!compound->isReference()) + { + writePageRef(od,compound->getOutputFileBase(),anchor); + } } return TRUE; } - else // probably a class or member reference + else // link could not be found { - return generateRef(od,clName,lr,inSeeBlock,lt); + od.docify(linkText); + return FALSE; } } @@ -3408,8 +3396,8 @@ void addRelatedPage(const char *name,const QCString &ptitle, QCString baseName=name; if (baseName.right(4)==".tex") baseName=baseName.left(baseName.length()-4); - else if (baseName.right(htmlFileExtensionLength)==htmlFileExtension) - baseName=baseName.left(baseName.length()-htmlFileExtensionLength); + else if (baseName.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension) + baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length()); QCString title=ptitle.stripWhiteSpace(); pi=new PageInfo(fileName,startLine,baseName,doc,title); @@ -44,6 +44,7 @@ class Definition; struct TagInfo; class MemberNameInfoSDict; struct ListItemInfo; +class PageInfo; //-------------------------------------------------------------------- @@ -91,10 +92,27 @@ extern bool getDefs(const QCString &scopeName, bool checkCV=FALSE ); + +extern bool resolveRef(/* in */ const char *scName, + /* in */ const char *name, + /* in */ bool inSeeBlock, + /* out */ Definition **resContext, + /* out */ MemberDef **resMember + ); + +extern bool resolveLink(/* in */ const char *scName, + /* in */ const char *lr, + /* in */ bool inSeeBlock, + /* out */ Definition **resContext, + /* out */ PageInfo **resPageInfo, + /* out */ QCString &resAnchor + ); + extern bool generateRef(OutputDocInterface &od,const char *, const char *,bool inSeeBlock,const char * =0); extern bool generateLink(OutputDocInterface &od,const char *, const char *,bool inSeeBlock,const char *); + extern void generateFileRef(OutputDocInterface &od,const char *, const char *linkTxt=0); void writePageRef(OutputDocInterface &od,const char *cn,const char *mn); diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 0eb94d2..4962334 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -895,6 +895,10 @@ class XMLGenerator : public OutputDocInterface { XML_DB(("(endSectionRefList)\n")); } + void writeCodeAnchor(const char *anchor) + { + XML_DB(("(writeCodeAnchor(%s))\n",anchor)); + } // Generator specific functions @@ -1311,6 +1315,12 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De writeXMLString(t,emd->initializer()); t << "</initializer>" << endl; } + t << " <briefdescription>" << endl; + writeXMLDocBlock(t,emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->briefDescription()); + t << " </briefdescription>" << endl; + t << " <detaileddescription>" << endl; + writeXMLDocBlock(t,emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->documentation()); + t << " </detaileddescription>" << endl; t << " </enumvalue>" << endl; } } |