diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-08-26 17:33:07 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-08-26 17:33:07 (GMT) |
commit | 55d2ef8412008e1560b0d5a2ecc2031f269af4a1 (patch) | |
tree | 6d5ee0db5c717ebabc57f2d2a15a1365d5e3fa19 | |
parent | 17e35fd285d98df3c7fe59ee8805152726c3572e (diff) | |
download | Doxygen-55d2ef8412008e1560b0d5a2ecc2031f269af4a1.zip Doxygen-55d2ef8412008e1560b0d5a2ecc2031f269af4a1.tar.gz Doxygen-55d2ef8412008e1560b0d5a2ecc2031f269af4a1.tar.bz2 |
Release-1.2.17-20020826
45 files changed, 4095 insertions, 900 deletions
@@ -1,6 +1,6 @@ -DOXYGEN Version 1.2.17-20020811 +DOXYGEN Version 1.2.17-20020825 Please read the installation section of the manual for instructions. -------- -Dimitri van Heesch (11 August 2002) +Dimitri van Heesch (25 August 2002) @@ -1,4 +1,4 @@ -DOXYGEN Version 1.2.17_20020811 +DOXYGEN Version 1.2.17_20020825 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) (11 August 2002) +Dimitri van Heesch (dimitri@stack.nl) (25 August 2002) @@ -1 +1 @@ -1.2.17-20020811 +1.2.17-20020825 @@ -27,7 +27,7 @@ f_prefix=/usr f_insttool=NO f_english=NO f_wizard=NO -f_langs=nl,se,cz,fr,it,de,jp,es,fi,ru,hr,pl,pt,hu,kr,ro,si,cn,no,br,dk,sk,ua,gr,tw,sr +f_langs=nl,se,cz,fr,it,de,jp,es,fi,ru,hr,pl,pt,hu,kr,ro,si,cn,no,br,dk,sk,ua,gr,tw,sr,ca while test -n "$1"; do case $1 in @@ -493,7 +493,7 @@ echo -n " Generating src/lang_cfg.h..." echo $f_langs | $f_perl -e '@l=split(/,/,<STDIN>); chomp @l; @allowed=(NL,SE,CZ,FR,IT,DE,JP,ES,FI,RU,HR,PL,PT,HU,KR,RO,SI,CN,NO,BR, - DK,SK,UA,GR,TW,SR); + DK,SK,UA,GR,TW,SR,CA); foreach my $elem (@l){ $elem =~ tr/a-z/A-Z/; $r=0; diff --git a/doc/config.doc b/doc/config.doc index 1c3d995..3f38ee0 100644 --- a/doc/config.doc +++ b/doc/config.doc @@ -116,6 +116,7 @@ followed by the descriptions of the tags grouped by category. \refitem cfg_graphical_hierarchy GRAPHICAL_HIERARCHY \refitem cfg_have_dot HAVE_DOT \refitem cfg_hhc_location HHC_LOCATION +\refitem cfg_hide_friend_compounds HIDE_FRIEND_COMPOUNDS \refitem cfg_hide_scope_names HIDE_SCOPE_NAMES \refitem cfg_hide_undoc_classes HIDE_UNDOC_CLASSES \refitem cfg_hide_undoc_members HIDE_UNDOC_MEMBERS @@ -278,6 +279,14 @@ followed by the descriptions of the tags grouped by category. various overviews. This option has no effect if \c EXTRACT_ALL is enabled. +\anchor cfg_hide_friend_compounds +<dt>\c HIDE_FRIEND_COMPOUNDS <dd> + \addindex HIDE_FRIEND_COMPOUNDS + If the \c HIDE_FRIEND_COMPOUNDS tag is set to \c YES, Doxygen will hide all + friend (class|struct|union) declarations. + If set to \c NO (the default) these declarations will be included in the + documentation. + \anchor cfg_brief_member_desc <dt>\c BRIEF_MEMBER_DESC <dd> \addindex BRIEF_MEMBER_DESC diff --git a/doc/history.doc b/doc/history.doc index 96314e8..3b1129a 100644 --- a/doc/history.doc +++ b/doc/history.doc @@ -76,7 +76,7 @@ <li>Many new commands (there are now more than 60!) to document more entities, to make the documentation look nicer, and to include examples or pieces of examples. -<li>Enum types, enum values, typedefs, #defines, and files can now be +<li>Enum types, enum values, typedefs, \#defines, and files can now be documented. <li>Completely new documentation, that is now generated by Doxygen. <li>A lot of small examples are now included. diff --git a/doc/index.doc b/doc/index.doc index 6c1aa66..da5246a 100644 --- a/doc/index.doc +++ b/doc/index.doc @@ -27,7 +27,7 @@ Version: $(VERSION) <h2>Introduction</h2> Doxygen is a documentation system for C++, C, Java, IDL -(Corba, Microsoft, and KDE-DCOP flavors) and to some extend PHP. +(Corba, Microsoft, and KDE-DCOP flavors) and to some extent PHP. It can help you in three ways: <ol> @@ -179,8 +179,8 @@ Thanks go to: <li>Petr Prikryl for coordinating the internationalisation support. All language maintainers for providing translations into many languages. <li>Erik Jan Lingen of <a href="http://www.habanera.nl/">Habanera</a>, Mark - Roddy, Paul Schwartz, Charles Duffy, Vadym Voznyuk, Philip Walton and - Dwight Browne for donating money. + Roddy, Paul Schwartz, Charles Duffy, Vadym Voznyuk, Philip Walton, + Dwight Browne, and Andreas Fredriksson for donating money. <li>The Comms group of <a href="http://www.symbian.com">Symbian</a> for donating an ultra cool <a href="http://www.psion.com/revoplus">Revo plus</a> organizer! diff --git a/doc/install.doc b/doc/install.doc index fe7fd55..1387f13 100644 --- a/doc/install.doc +++ b/doc/install.doc @@ -58,12 +58,12 @@ tools should be installed. \addindex Qt This is needed to build the GUI front-end. <li>A \f$\mbox{\LaTeX}\f$ distribution: for instance - <a href="http://www.tug.org/">teTeX 1.0</a>.<br> - \latexonly(see {\tt http://www.tug.org/})\endlatexonly. + <a href="http://www.tug.org/">teTeX 1.0</a> + \latexonly \\par (see {\tt http://www.tug.org/})\endlatexonly. This is needed for generating LaTeX, Postscript, and PDF output. <li><a href="http://www.research.att.com/sw/tools/graphviz/"> - the Graph visualization toolkit version 1.5</a><br> - \latexonly(see {\tt http://www.research.att.com/sw/tools/graphviz/})\endlatexonly. + the Graph visualization toolkit version 1.5</a> + \latexonly \\par (see {\tt http://www.research.att.com/sw/tools/graphviz/})\endlatexonly. Needed for the include dependency graphs, the graphical inheritance graphs, and the collaboration graphs. If you compile graphviz yourself, make sure you do include @@ -142,17 +142,17 @@ Compilation is now done by performing the following steps: <code>index.html</code> in the html directory). -<li>Optional: Generate a PostScript and PDF version of the manual - (you will need <code>latex</code> and <code>dvips</code> and - the ghostscript package for this). +<li>Optional: Generate a PDF version of the manual + (you will need <code>pdflatex</code>, <code>makeindex</code>, and + <code>egrep</code> for this). \verbatim make pdf \endverbatim - The PostScript manual <code>doxygen_manual.ps</code> will be located - in the latex directory of the distribution. Just send it to a - PostScript printer to print it or use <code>ghostview</code> to view it. + The PDF manual <code>doxygen_manual.pdf</code> will be located + in the latex directory of the distribution. Just + view and print it via the acrobat reader. </ol> diff --git a/doc/language.doc b/doc/language.doc index f850044..5f259fa 100644 --- a/doc/language.doc +++ b/doc/language.doc @@ -25,14 +25,14 @@ 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.17-20020804), 27 languages +Currently (version 1.2.14-20020317), 28 languages are supported (sorted alphabetically): -Brazilian Portuguese, Chinese, Chinese Traditional, Croatian, Czech, -Danish, Dutch, English, Finnish, French, -German, Greek, Hungarian, Italian, Japanese, -Korean, Norwegian, Polish, Portuguese, Romanian, -Russian, Serbian, Slovak, Slovene, Spanish, -Swedish, and Ukrainian. +Brazilian Portuguese, Catalan, Chinese, Chinese Traditional, Croatian, +Czech, Danish, Dutch, English, Finnish, +French, German, Greek, Hungarian, Italian, +Japanese, Korean, Norwegian, Polish, Portuguese, +Romanian, Russian, Serbian, Slovak, Slovene, +Spanish, Swedish, and Ukrainian. The table of information related to the supported languages follows. It is sorted by language alphabetically. The <b>Status</b> column @@ -58,6 +58,12 @@ when the translator was updated. <TD>up-to-date</TD> </TR> <TR BGCOLOR="#ffffff"> + <TD>Catalan</TD> + <TD>Albert Mora</TD> + <TD>amora@NOSPAM.iua.upf.es</TD> + <TD>up-to-date</TD> + </TR> + <TR BGCOLOR="#ffffff"> <TD>Chinese</TD> <TD>Wei Liu<br>Wang Weihan</TD> <TD>liuwei@NOSPAM.asiainfo.com<br>wangweihan@NOSPAM.capinfo.com.cn</TD> @@ -157,7 +163,7 @@ when the translator was updated. <TD>Polish</TD> <TD>Piotr Kaminski<br>Grzegorz Kowal</TD> <TD>Piotr.Kaminski@NOSPAM.ctm.gdynia.pl<br>g_kowal@NOSPAM.poczta.onet.pl</TD> - <TD>1.2.16</TD> + <TD>1.2.17</TD> </TR> <TR BGCOLOR="#ffffff"> <TD>Portuguese</TD> @@ -181,7 +187,7 @@ when the translator was updated. <TD>Serbian</TD> <TD>Dejan Milosavljevic</TD> <TD>dmilos@NOSPAM.email.com</TD> - <TD>1.2.16</TD> + <TD>1.2.17</TD> </TR> <TR BGCOLOR="#ffffff"> <TD>Slovak</TD> @@ -226,6 +232,8 @@ when the translator was updated. \hline Brazilian Portuguese & Fabio "FJTC" Jun Takada Chino & {\tt chino@icmc.sc.usp.br} & up-to-date \\ \hline + Catalan & Albert Mora & {\tt amora@iua.upf.es} & up-to-date \\ + \hline Chinese & Wei Liu & {\tt liuwei@asiainfo.com} & 1.2.13 \\ & Wang Weihan & {\tt wangweihan@capinfo.com.cn} & \\ \hline @@ -262,7 +270,7 @@ when the translator was updated. \hline Norwegian & Lars Erik Jordet & {\tt lej@circuitry.no} & 1.2.2 \\ \hline - Polish & Piotr Kaminski & {\tt Piotr.Kaminski@ctm.gdynia.pl} & 1.2.16 \\ + Polish & Piotr Kaminski & {\tt Piotr.Kaminski@ctm.gdynia.pl} & 1.2.17 \\ & Grzegorz Kowal & {\tt g\_kowal@poczta.onet.pl} & \\ \hline Portuguese & Rui Godinho Lopes & {\tt ruiglopes@yahoo.com} & up-to-date \\ @@ -271,7 +279,7 @@ when the translator was updated. \hline Russian & Alexandr Chelpanov & {\tt cav@cryptopro.ru} & up-to-date \\ \hline - Serbian & Dejan Milosavljevic & {\tt dmilos@email.com} & 1.2.16 \\ + Serbian & Dejan Milosavljevic & {\tt dmilos@email.com} & 1.2.17 \\ \hline Slovak & Stanislav Kudl\'{a}\v{c} & {\tt skudlac@pobox.sk} & up-to-date \\ \hline diff --git a/doc/language.tpl b/doc/language.tpl index a0dc352..fcf6da0 100644 --- a/doc/language.tpl +++ b/doc/language.tpl @@ -62,8 +62,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 @@ -93,7 +93,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/doc/maintainers.txt b/doc/maintainers.txt index 4673c16..44f387c 100644 --- a/doc/maintainers.txt +++ b/doc/maintainers.txt @@ -4,6 +4,9 @@ Brazilian Fabio "FJTC" Jun Takada Chino: chino@icmc.sc.usp.br +Catalan +Albert Mora: amora@iua.upf.es + Chinese Wei Liu: liuwei@asiainfo.com Wang Weihan: wangweihan@capinfo.com.cn diff --git a/doc/starting.doc b/doc/starting.doc index 85341e3..39bb117 100644 --- a/doc/starting.doc +++ b/doc/starting.doc @@ -42,10 +42,10 @@ recursively scanned. To simplify the creation of a configuration file, doxygen can create a template configuration file for you. To do this call \c doxygen with the \c -g option: - \verbatim doxygen -g <config-file> \endverbatim + where \<config-file\> is the name of the configuration file. If you omit the file name, a file named \c Doxyfile will be created. If a file with the name \<config-file\> already exists, doxygen will rename it to diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec index efa0314..ff9d860 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_20020811 +Version: 1.2.17_20020825 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 d8be5e5..2d4864f 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -433,11 +433,7 @@ void ClassDef::internalInsertMember(MemberDef *md, enumValMembers.append(md); break; case MemberDef::Function: - if (md->name()==localName() || // constructor - (md->name().find('~')!=-1 && // hack to detect destructor - md->name().find("operator")==-1 - ) - ) + if (md->isConstructor() || md->isDestructor()) { constructors.append(md); } diff --git a/src/config.l b/src/config.l index 7c8865c..86b11eb 100644 --- a/src/config.l +++ b/src/config.l @@ -1247,7 +1247,7 @@ void Config::create() "documentation generated by doxygen is written. Doxygen will use this \n" "information to generate all constant output in the proper language. \n" "The default language is English, other supported languages are: \n" - "Brazilian, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, \n" + "Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, \n" "Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en \n" "(Japanese with english messages), Korean, Norwegian, Polish, Portuguese, \n" "Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian.\n", @@ -1256,6 +1256,9 @@ void Config::create() #ifdef LANG_BR ce->addValue("Brazilian"); #endif +#ifdef LANG_CA + ce->addValue("Catalan"); +#endif #ifdef LANG_CN ce->addValue("Chinese"); #endif @@ -1377,6 +1380,14 @@ void Config::create() "overviews. This option has no effect if EXTRACT_ALL is enabled. \n", FALSE ); + cb = addBool( + "HIDE_FRIEND_COMPOUNDS", + "If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all \n" + "friend (class|struct|union) declarations. \n" + "If set to NO (the default) these declarations will be included in the \n" + "documentation. \n", + FALSE + ); cb = addBool( "BRIEF_MEMBER_DESC", "If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will \n" diff --git a/src/definition.cpp b/src/definition.cpp index 1e7652b..75de348 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -55,7 +55,6 @@ Definition::Definition(const char *df,int dl, m_partOfGroups=0; m_specialListItems=0; m_briefLine=1; - m_docFile=1; } Definition::~Definition() @@ -982,7 +982,7 @@ static void checkArgName(const QCString &name,bool isParam) * @retval TRUE if name was found. * @retval FALSE if name was not found. */ -bool findDocsForMemberOrCompound(const char *commandName, +static bool findDocsForMemberOrCompound(const char *commandName, QCString *pDoc, Definition **pDef) { @@ -1919,11 +1919,16 @@ LINKMASK [a-z_A-Z0-9:#.,~&*/\[\]<>()\-\+]+({B}*("const"|"volatile"))? QCString secName=&yytext[8]; secName=secName.left(secName.length()-1); SectionInfo *sec; + //printf("secName=%s\n",secName.data()); if ((sec=Doxygen::sectionDict[secName])) { //printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data()); outDoc->writeAnchor(sec->fileName,sec->label); } + else + { + //printf("Section %s not found!\n",secName.data()); + } } <DocScan>"\\_internalref"{B}+ { // for internal use only! internalRefFile.resize(0); @@ -2128,6 +2133,7 @@ LINKMASK [a-z_A-Z0-9:#.,~&*/\[\]<>()\-\+]+({B}*("const"|"volatile"))? } <DocRtfImageOpt>\n { writeImage(IT_RTF,0); + BEGIN(DocScan); } <DocRtfImageOpt>\"[^\n"]*\" { curImageCaption=stripQuotes(yytext); @@ -2947,64 +2953,68 @@ void parseDoc(OutputDocInterface &od,const char *fileName,int startLine, const char *clName,MemberDef *md,const QCString &docStr) { + //printf("parseDoc doc=`%s'\n",docStr.data()); + if (Debug::isFlagSet(Debug::Validate)) { od.parseDoc(fileName,startLine,clName,md,docStr); } - - strcpy(yyFileName,fileName); - yyLineNr = startLine; - - QCString docString=docStr; - resolveCopyDocCommands(clName,docString); - - yyLineNr = startLine; - //printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine); - initParser(); - initParseCodeContext(); - exampleDoc=FALSE; // do not cross reference with member docs - className=clName; - memberDef = md; - hasParamCommand = FALSE; - paramsFound.setAutoDelete(FALSE); - paramsFound.clear(); - parseDocument(od,docString); - - if (md && hasParamCommand && Config_getBool("WARN_IF_UNDOCUMENTED")) + else { - ArgumentList *al=memberDef->isDocsForDefinition() ? - memberDef->argumentList() : - memberDef->declArgumentList(); - if (al) + strcpy(yyFileName,fileName); + yyLineNr = startLine; + + QCString docString=docStr; + resolveCopyDocCommands(clName,docString); + + yyLineNr = startLine; + //printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine); + initParser(); + initParseCodeContext(); + exampleDoc=FALSE; // do not cross reference with member docs + className=clName; + memberDef = md; + hasParamCommand = FALSE; + paramsFound.setAutoDelete(FALSE); + paramsFound.clear(); + parseDocument(od,docString); + + if (md && hasParamCommand && Config_getBool("WARN_IF_UNDOCUMENTED")) { - ArgumentListIterator ali(*al); - Argument *a; - bool found=FALSE; - for (ali.toFirst();(a=ali.current());++ali) - { - QCString argName = memberDef->isDefine() ? a->type : a->name; - if (argName.right(3)=="...") argName=argName.left(argName.length()-3); - if (!argName.isEmpty() && paramsFound.find(argName)==0) - { - found = TRUE; - break; - } - } - if (found) + ArgumentList *al=memberDef->isDocsForDefinition() ? + memberDef->argumentList() : + memberDef->declArgumentList(); + if (al) { - QCString scope=memberDef->getScopeString(); - if (!scope.isEmpty()) scope+="::"; else scope=""; - warn(memberDef->docFile(),memberDef->docLine(), - "Warning: The following parameters of " - "%s%s%s are not documented:", - scope.data(),memberDef->name().data(), - argListToString(al).data()); + ArgumentListIterator ali(*al); + Argument *a; + bool found=FALSE; for (ali.toFirst();(a=ali.current());++ali) { - QCString argName = memberDef->isDefine() ? a->type : a->name; + QCString argName = memberDef->isDefine() ? a->type : a->name; + if (argName.right(3)=="...") argName=argName.left(argName.length()-3); if (!argName.isEmpty() && paramsFound.find(argName)==0) { - warn_cont( " parameter %s\n",argName.data()); + found = TRUE; + break; + } + } + if (found) + { + QCString scope=memberDef->getScopeString(); + if (!scope.isEmpty()) scope+="::"; else scope=""; + warn(memberDef->docFile(),memberDef->docLine(), + "Warning: The following parameters of " + "%s%s%s are not documented:", + scope.data(),memberDef->name().data(), + argListToString(al).data()); + for (ali.toFirst();(a=ali.current());++ali) + { + QCString argName = memberDef->isDefine() ? a->type : a->name; + if (!argName.isEmpty() && paramsFound.find(argName)==0) + { + warn_cont( " parameter %s\n",argName.data()); + } } } } diff --git a/src/docparser.cpp b/src/docparser.cpp index da1d808..9502eeb 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -24,6 +24,7 @@ #include <qcstring.h> #include <qstack.h> #include <qdict.h> +#include <ctype.h> #include "doxygen.h" #include "debug.h" @@ -40,11 +41,18 @@ //--------------------------------------------------------------------------- +// include file state +static QCString g_includeFileText; +static uint g_includeFileOffset; +static uint g_includeFileLength; + +// parser state static QCString g_context; static bool g_inSeeBlock; static bool g_insideHtmlLink; static QStack<DocNode> g_nodeStack; static QStack<DocStyleChange> g_styleStack; +static QList<Definition> g_copyStack; struct DocParserContext { @@ -53,6 +61,7 @@ struct DocParserContext bool insideHtmlLink; QStack<DocNode> nodeStack; QStack<DocStyleChange> styleStack; + QList<Definition> copyStack; }; static QStack<DocParserContext> g_parserStack; @@ -63,22 +72,24 @@ static void docParserPushContext() { doctokenizerYYpushContext(); DocParserContext *ctx = new DocParserContext; - ctx->context = g_context; - ctx->inSeeBlock = g_inSeeBlock; + ctx->context = g_context; + ctx->inSeeBlock = g_inSeeBlock; ctx->insideHtmlLink = g_insideHtmlLink; - ctx->nodeStack = g_nodeStack; - ctx->styleStack = g_styleStack; + ctx->nodeStack = g_nodeStack; + ctx->styleStack = g_styleStack; + ctx->copyStack = g_copyStack; g_parserStack.push(ctx); } static void docParserPopContext() { DocParserContext *ctx = g_parserStack.pop(); - g_context = ctx->context; - g_inSeeBlock = ctx->inSeeBlock; + g_context = ctx->context; + g_inSeeBlock = ctx->inSeeBlock; g_insideHtmlLink = ctx->insideHtmlLink; - g_nodeStack = ctx->nodeStack; - g_styleStack = ctx->styleStack; + g_nodeStack = ctx->nodeStack; + g_styleStack = ctx->styleStack; + g_copyStack = ctx->copyStack; delete ctx; doctokenizerYYpopContext(); } @@ -171,6 +182,112 @@ static bool insideLang(DocNode *n) //--------------------------------------------------------------------------- +/*! Looks for a documentation block with name commandName in the current + * context (g_context). The resulting documentation string is + * put in pDoc, the definition in which the documentation was found is + * put in pDef. + * @retval TRUE if name was found. + * @retval FALSE if name was not found. + */ +static bool findDocsForMemberOrCompound(const char *commandName, + QCString *pDoc, + Definition **pDef) +{ + pDoc->resize(0); + *pDef=0; + QCString cmdArg=commandName; + int l=cmdArg.length(); + if (l==0) return FALSE; + + int funcStart=cmdArg.find('('); + if (funcStart==-1) funcStart=l; + //int lastScopeStart=cmdArg.findRev("::",funcStart); + //int lastScopeEnd = lastScopeStart==-1 ? 0 : lastScopeStart+2; + //QCString scope=cmdArg.left(QMAX(lastScopeStart,0)); + //QCString name=cmdArg.mid(lastScopeEnd,funcStart-lastScopeEnd); + QCString name=cmdArg.left(funcStart); + QCString args=cmdArg.right(l-funcStart); + + // try if the link is to a member + MemberDef *md=0; + ClassDef *cd=0; + FileDef *fd=0; + NamespaceDef *nd=0; + GroupDef *gd=0; + PageInfo *pi=0; + bool found = getDefs(g_context,name,args,md,cd,fd,nd,gd,FALSE,0,TRUE); + if (found && md) + { + *pDoc=md->documentation(); + *pDef=md; + return TRUE; + } + + + int scopeOffset=g_context.length(); + do // for each scope + { + QCString fullName=cmdArg; + if (scopeOffset>0) + { + fullName.prepend(g_context.left(scopeOffset)+"::"); + } + //printf("Trying fullName=`%s'\n",fullName.data()); + + // try class, namespace, group, page, file reference + cd = Doxygen::classSDict[fullName]; + if (cd) // class + { + *pDoc=cd->documentation(); + *pDef=cd; + return TRUE; + } + nd = Doxygen::namespaceSDict[fullName]; + if (nd) // namespace + { + *pDoc=nd->documentation(); + *pDef=nd; + return TRUE; + } + gd = Doxygen::groupSDict[cmdArg]; + if (gd) // group + { + *pDoc=gd->documentation(); + *pDef=gd; + return TRUE; + } + pi = Doxygen::pageSDict->find(cmdArg); + if (pi) // page + { + *pDoc=pi->doc; + *pDef=(Definition *)pi; + return TRUE; + } + bool ambig; + fd = findFileDef(Doxygen::inputNameDict,cmdArg,ambig); + if (fd && !ambig) // file + { + *pDoc=fd->documentation(); + *pDef=fd; + return TRUE; + } + + if (scopeOffset==0) + { + scopeOffset=-1; + } + else + { + scopeOffset = g_context.findRev("::",scopeOffset-1); + if (scopeOffset==-1) scopeOffset=0; + } + } while (scopeOffset>=0); + + + return FALSE; +} +//--------------------------------------------------------------------------- + // forward declaration static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children,bool @@ -422,7 +539,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children tokToString(tok),tokenName.data(),doctokenizerYYlineno); break; } - DocAnchor *anchor = new DocAnchor(parent,g_token->name); + DocAnchor *anchor = new DocAnchor(parent,g_token->name,FALSE); children.append(anchor); } break; @@ -657,6 +774,10 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, children.append(par); lastPar=par; } + else + { + delete par; + } } while (retval==TK_NEWPARA); if (lastPar) lastPar->markLast(); @@ -665,6 +786,231 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, //--------------------------------------------------------------------------- +static void readTextFileByName(const QCString &file,QCString &text) +{ + bool ambig; + FileDef *fd; + if ((fd=findFileDef(Doxygen::exampleNameDict,file,ambig))) + { + text = fileToString(fd->absFilePath()); + } + else if (ambig) + { + printf("Error: included file name %s at line %d is ambigious.\n" + "Possible candidates:\n%s",file.data(),doctokenizerYYlineno, + showFileDefMatches(Doxygen::exampleNameDict,file).data() + ); + } + else + { + printf("Error: included file %s at line %d is not found. " + "Check you EXAMPLE_PATH",file.data(),doctokenizerYYlineno); + } +} + +//--------------------------------------------------------------------------- + +DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor) + : m_parent(parent) +{ + if (id.isEmpty()) + { + printf("Error: Empty anchor label at line %d!\n",doctokenizerYYlineno); + } + if (newAnchor) // found <a name="label"> + { + m_anchor = id; + } + else // found \anchor label + { + SectionInfo *sec = Doxygen::sectionDict[id]; + if (sec) + { + m_file = sec->fileName; + m_anchor = sec->label; + } + else + { + printf("Error: Invalid anchor id `%s' at line %d\n",id.data(),doctokenizerYYlineno); + } + } +} + +//--------------------------------------------------------------------------- + +void DocInclude::parse() +{ + switch(m_type) + { + case Include: + // fall through + case DontInclude: + readTextFileByName(m_file,m_text); + g_includeFileText = m_text; + g_includeFileOffset = 0; + g_includeFileLength = m_text.length(); + break; + case VerbInclude: + // fall through + case HtmlInclude: + readTextFileByName(m_file,m_text); + break; + } +} + +//--------------------------------------------------------------------------- + +void DocIncOperator::parse() +{ + const char *p = g_includeFileText; + uint l = g_includeFileLength; + uint o = g_includeFileOffset; + //printf("DocIncOperator::parse() text=%s off=%d len=%d\n",p,o,l); + uint so = o,bo; + bool nonEmpty = FALSE; + switch(type()) + { + case Line: + while (o<l) + { + char c = p[o]; + if (c=='\n') + { + if (nonEmpty) break; // we have a pattern to match + so=o+1; // no pattern, skip empty line + } + else if (!isspace(c)) // no white space char + { + nonEmpty=TRUE; + } + o++; + } + if (g_includeFileText.mid(so,o-so).find(m_pattern)!=-1) + { + m_text = g_includeFileText.mid(so,o-so); + } + g_includeFileOffset = QMIN(l,o+1); // set pointer to start of new line + break; + case SkipLine: + while (o<l) + { + so=o; + while (o<l) + { + char c = p[o]; + if (c=='\n') + { + if (nonEmpty) break; // we have a pattern to match + so=o+1; // no pattern, skip empty line + } + else if (!isspace(c)) // no white space char + { + nonEmpty=TRUE; + } + o++; + } + if (g_includeFileText.mid(so,o-so).find(m_pattern)!=-1) + { + m_text = g_includeFileText.mid(so,o-so); + break; + } + o++; // skip new line + } + g_includeFileOffset = QMIN(l,o+1); // set pointer to start of new line + break; + case Skip: + while (o<l) + { + so=o; + while (o<l) + { + char c = p[o]; + if (c=='\n') + { + if (nonEmpty) break; // we have a pattern to match + so=o+1; // no pattern, skip empty line + } + else if (!isspace(c)) // no white space char + { + nonEmpty=TRUE; + } + o++; + } + if (g_includeFileText.mid(so,o-so).find(m_pattern)!=-1) + { + break; + } + o++; // skip new line + } + g_includeFileOffset = so; // set pointer to start of new line + break; + case Until: + bo=o; + while (o<l) + { + so=o; + while (o<l) + { + char c = p[o]; + if (c=='\n') + { + if (nonEmpty) break; // we have a pattern to match + so=o+1; // no pattern, skip empty line + } + else if (!isspace(c)) // no white space char + { + nonEmpty=TRUE; + } + o++; + } + if (g_includeFileText.mid(so,o-so).find(m_pattern)!=-1) + { + m_text = g_includeFileText.mid(bo,o-bo); + break; + } + o++; // skip new line + } + g_includeFileOffset = QMIN(l,o+1); // set pointer to start of new line + break; + } +} + +//--------------------------------------------------------------------------- + +void DocCopy::parse() +{ + QCString doc; + Definition *def; + if (findDocsForMemberOrCompound(m_link,&doc,&def)) + { + if (g_copyStack.findRef(def)==-1) // definition not parsed earlier + { + docParserPushContext(); + g_context=def->name(); + g_styleStack.clear(); + g_nodeStack.clear(); + g_copyStack.append(def); + internalValidatingParseDoc(this,m_children,doc); + ASSERT(g_copyStack.remove(def)); + ASSERT(g_styleStack.isEmpty()); + ASSERT(g_nodeStack.isEmpty()); + docParserPopContext(); + } + else // oops, recursion + { + printf("Error: recursive call chain of \\copydoc commands detected at %d\n", + doctokenizerYYlineno); + } + } + else + { + printf("Error: target %s of \\copydoc command at line %d not found\n", + m_link.data(),doctokenizerYYlineno); + } +} + +//--------------------------------------------------------------------------- + void DocXRefItem::parse() { QCString listName; @@ -765,6 +1111,28 @@ void DocSecRefItem::parse() } doctokenizerYYsetStatePara(); handlePendingStyleCommands(this,m_children); + + SectionInfo *sec=0; + if (!m_target.isEmpty()) + { + sec=Doxygen::sectionDict[m_target]; + if (sec) + { + m_file = sec->fileName; + m_anchor = sec->label; + } + else + { + printf("Error reference to unknown section %s at line %d\n", + m_target.data(),doctokenizerYYlineno); + } + } + else + { + printf("Error reference to empty target at line %d\n", + doctokenizerYYlineno); + } + DBG(("DocSecRefItem::parse() end\n")); DocNode *n = g_nodeStack.pop(); ASSERT(n==this); @@ -817,6 +1185,10 @@ void DocSecRefList::parse() goto endsecreflist; } } + else if (tok==TK_WHITESPACE) + { + // ignore whitespace + } else { printf("Error: Unexpected token %s inside section reference list at line %d\n", @@ -1094,9 +1466,47 @@ void DocDotFile::parse() } } } + tok=doctokenizerYYlex(); + while (tok==TK_WORD) // there are values following the title + { + if (g_token->name=="width") + { + m_width=g_token->chars; + } + else if (g_token->name=="height") + { + m_height=g_token->chars; + } + else + { + printf("Error: Unknown option %s after image title at line %d\n", + g_token->name.data(),doctokenizerYYlineno); + } + tok=doctokenizerYYlex(); + } + ASSERT(tok==0); doctokenizerYYsetStatePara(); - handlePendingStyleCommands(this,m_children); + + bool ambig; + FileDef *fd = findFileDef(Doxygen::dotFileNameDict,m_name,ambig); + if (fd) + { + m_file = fd->absFilePath(); + } + else if (ambig) + { + printf("Error: included dot file name %s at line %d is ambigious.\n" + "Possible candidates:\n%s",m_name.data(),doctokenizerYYlineno, + showFileDefMatches(Doxygen::exampleNameDict,m_name).data() + ); + } + else + { + printf("Error: included dot file %s at line %d is not found " + "in any of the paths specified via DOTFILE_DIRS!",m_name.data(),doctokenizerYYlineno); + } + DBG(("DocDotFile::parse() end\n")); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); @@ -1133,6 +1543,25 @@ void DocImage::parse() } } } + tok=doctokenizerYYlex(); + while (tok==TK_WORD) // there are values following the title + { + if (g_token->name=="width") + { + m_width=g_token->chars; + } + else if (g_token->name=="height") + { + m_height=g_token->chars; + } + else + { + printf("Error: Unknown option %s after image title at line %d\n", + g_token->name.data(),doctokenizerYYlineno); + } + tok=doctokenizerYYlex(); + } + ASSERT(tok==0); doctokenizerYYsetStatePara(); handlePendingStyleCommands(this,m_children); @@ -1300,6 +1729,10 @@ int DocInternal::parse() m_children.append(par); lastPar=par; } + else + { + delete par; + } if (retval==TK_LISTITEM) { printf("Error: Invalid list item found at line %d!\n",doctokenizerYYlineno); @@ -1473,6 +1906,9 @@ int DocHtmlRow::parse() DBG(("DocHtmlRow::parse() start\n")); bool isHeading=FALSE; + bool isFirst=TRUE; + DocHtmlCell *cell=0; + // get next token int tok=doctokenizerYYlex(); // skip whitespace @@ -1511,12 +1947,15 @@ int DocHtmlRow::parse() // parse one or more cells do { - DocHtmlCell *td=new DocHtmlCell(this,isHeading); - m_children.append(td); - retval=td->parse(); + cell=new DocHtmlCell(this,isHeading); + cell->markFirst(isFirst); + isFirst=FALSE; + m_children.append(cell); + retval=cell->parse(); isHeading = retval==RetVal_TableHCell; } while (retval==RetVal_TableCell || retval==RetVal_TableHCell); + if (cell) cell->markLast(TRUE); endrow: DBG(("DocHtmlRow::parse() end\n")); @@ -2089,6 +2528,7 @@ int DocParamSect::parse(const QCString &cmdName) //-------------------------------------------------------------------------- + int DocPara::handleSimpleSection(DocSimpleSect::Type t) { DocSimpleSect *ss=0; @@ -2168,8 +2608,30 @@ void DocPara::handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type tokToString(tok),cmdName.data(),doctokenizerYYlineno); return; } - DocIncOperator *op = new DocIncOperator(this,t,g_token->name); + DocIncOperator *op = new DocIncOperator(this,t,g_token->name,g_context); + DocNode *n1 = m_children.last(); + DocNode *n2 = n1!=0 ? m_children.prev() : 0; + bool isFirst = n1==0 || // no last node + (n1->kind()!=DocNode::Kind_IncOperator && + n1->kind()!=DocNode::Kind_WhiteSpace + ) || // last node is not operator or whitespace + (n1->kind()==DocNode::Kind_WhiteSpace && + n2!=0 && n2->kind()!=DocNode::Kind_IncOperator + ); // previous not is not operator + op->markFirst(isFirst); + op->markLast(TRUE); + if (n1!=0 && n1->kind()==DocNode::Kind_IncOperator) + { + ((DocIncOperator *)n1)->markLast(FALSE); + } + else if (n1!=0 && n1->kind()==DocNode::Kind_WhiteSpace && + n2!=0 && n2->kind()==DocNode::Kind_IncOperator + ) + { + ((DocIncOperator *)n2)->markLast(FALSE); + } m_children.append(op); + op->parse(); } void DocPara::handleImage(const QCString &cmdName) @@ -2365,8 +2827,9 @@ void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t) tokToString(tok),cmdName.data(),doctokenizerYYlineno); return; } - DocInclude *inc = new DocInclude(this,g_token->name,t); + DocInclude *inc = new DocInclude(this,g_token->name,g_context,t); m_children.append(inc); + inc->parse(); } @@ -2594,7 +3057,7 @@ int DocPara::handleCommand(const QCString &cmdName) tokToString(tok),cmdName.data(),doctokenizerYYlineno); break; } - DocAnchor *anchor = new DocAnchor(this,g_token->name); + DocAnchor *anchor = new DocAnchor(this,g_token->name,FALSE); m_children.append(anchor); } break; @@ -2632,6 +3095,7 @@ int DocPara::handleCommand(const QCString &cmdName) } DocCopy *cpy = new DocCopy(this,g_token->name); m_children.append(cpy); + cpy->parse(); } break; case CMD_INCLUDE: @@ -2830,7 +3294,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const QList<Option> &tag { if (!opt->value.isEmpty()) { - DocAnchor *anc = new DocAnchor(this,opt->value); + DocAnchor *anc = new DocAnchor(this,opt->value,TRUE); m_children.append(anc); break; // stop looking for other tag options } @@ -3294,6 +3758,19 @@ int DocSection::parse() int retval=RetVal_OK; g_nodeStack.push(this); + SectionInfo *sec; + if (!m_id.isEmpty()) + { + sec=Doxygen::sectionDict[m_id]; + if (sec) + { + m_file = sec->fileName; + m_anchor = sec->label; + m_title = sec->title; + if (m_title.isEmpty()) m_title = sec->label; + } + } + // first parse any number of paragraphs bool isFirst=FALSE; DocPara *lastPar=0; @@ -3305,7 +3782,11 @@ int DocSection::parse() if (!par->isEmpty()) { m_children.append(par); - lastPar = par; + lastPar=par; + } + else + { + delete par; } if (retval==TK_LISTITEM) { @@ -3318,8 +3799,9 @@ int DocSection::parse() while (retval==RetVal_Section) // more sections follow { SectionInfo *sec=Doxygen::sectionDict[g_token->sectionId]; + ASSERT(sec!=0); int secLev = sec->type==SectionInfo::Subsection ? 2 : 1; - if (secLev==level()) // new section at same level + if (secLev<=level()) // new section at same or lower level { break; } @@ -3364,7 +3846,11 @@ void DocRoot::parse() if (!par->isEmpty()) { m_children.append(par); - lastPar = par; + lastPar=par; + } + else + { + delete par; } if (retval==TK_LISTITEM) { @@ -3377,6 +3863,7 @@ void DocRoot::parse() while (retval==RetVal_Section) { SectionInfo *sec=Doxygen::sectionDict[g_token->sectionId]; + ASSERT(sec!=0); int secLev = sec->type==SectionInfo::Subsection ? 2 : 1; if (secLev!=1) // wrong level { @@ -3417,6 +3904,9 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, g_styleStack.clear(); g_inSeeBlock = FALSE; g_insideHtmlLink = FALSE; + g_includeFileText.resize(0); + g_includeFileOffset = 0; + g_includeFileLength = 0; doctokenizerYYlineno=startLine; doctokenizerYYinit(input); diff --git a/src/docparser.h b/src/docparser.h index 343a9f7..ccb06e5 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -44,7 +44,7 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, //--------------------------------------------------------------------------- -/*! Abstract node interface with type information. */ +/*! @brief Abstract node interface with type information. */ class DocNode { public: @@ -81,22 +81,22 @@ class DocNode Kind_IndexEntry = 29, Kind_Internal = 30, Kind_HRef = 31, - Kind_Copy = 32, - Kind_Include = 33, - Kind_IncOperator = 34, - Kind_HtmlHeader = 35, - Kind_Image = 36, - Kind_DotFile = 37, - Kind_Link = 38, - Kind_Ref = 39, - Kind_Formula = 40, - Kind_SecRefItem = 41, - Kind_SecRefList = 42, - Kind_Language = 43, - Kind_LinkedWord = 44, - Kind_ParamSect = 45, - Kind_ParamList = 46, - Kind_InternalRef = 47 + Kind_Include = 32, + Kind_IncOperator = 33, + Kind_HtmlHeader = 34, + Kind_Image = 35, + Kind_DotFile = 36, + Kind_Link = 37, + Kind_Ref = 38, + Kind_Formula = 39, + Kind_SecRefItem = 40, + Kind_SecRefList = 41, + Kind_Language = 42, + Kind_LinkedWord = 43, + Kind_ParamSect = 44, + Kind_ParamList = 45, + Kind_InternalRef = 46, + Kind_Copy = 47 }; /*! Destructor. */ virtual ~DocNode() {} @@ -110,7 +110,7 @@ class DocNode virtual void accept(DocVisitor *v) = 0; }; -/*! Default accept implementation for compound nodes in the abstract +/*! @brief Default accept implementation for compound nodes in the abstract * syntax tree. */ template<class T> class CompAccept @@ -131,7 +131,7 @@ template<class T> class CompAccept }; -/*! Node representing a word +/*! @brief Node representing a word */ class DocWord : public DocNode { @@ -148,7 +148,7 @@ class DocWord : public DocNode QCString m_word; }; -/*! Node representing a word that can be linked to something +/*! @brief Node representing a word that can be linked to something */ class DocLinkedWord : public DocNode { @@ -174,7 +174,7 @@ class DocLinkedWord : public DocNode QCString m_anchor; }; -/*! Node representing an URL (or email address) */ +/*! @brief Node representing an URL (or email address) */ class DocURL : public DocNode { public: @@ -190,7 +190,7 @@ class DocURL : public DocNode QCString m_url; }; -/*! Node representing a line break */ +/*! @brief Node representing a line break */ class DocLineBreak : public DocNode { public: @@ -204,7 +204,7 @@ class DocLineBreak : public DocNode DocNode *m_parent; }; -/*! Node representing a horizonal ruler */ +/*! @brief Node representing a horizonal ruler */ class DocHorRuler : public DocNode { public: @@ -218,24 +218,24 @@ class DocHorRuler : public DocNode DocNode *m_parent; }; -/*! Node representing an anchor */ -// TODO: not just ignore </a>... +/*! @brief Node representing an anchor */ class DocAnchor : public DocNode { public: - DocAnchor(DocNode *parent,const QCString &anchor) : - m_parent(parent), m_anchor(anchor) {} + DocAnchor(DocNode *parent,const QCString &id,bool newAnchor); Kind kind() const { return Kind_Anchor; } DocNode *parent() const { return m_parent; } QCString anchor() const { return m_anchor; } + QCString file() const { return m_file; } void accept(DocVisitor *v) { v->visit(this); } private: DocNode *m_parent; QCString m_anchor; + QCString m_file; }; -/*! Node representing a style change */ +/*! @brief Node representing a style change */ class DocStyleChange : public DocNode { public: @@ -258,7 +258,7 @@ class DocStyleChange : public DocNode bool m_enable; }; -/*! Node representing a special symbol */ +/*! @brief Node representing a special symbol */ class DocSymbol : public DocNode { public: @@ -281,7 +281,7 @@ class DocSymbol : public DocNode char m_letter; }; -/*! Node representing some amount of white space */ +/*! @brief Node representing some amount of white space */ class DocWhiteSpace : public DocNode { public: @@ -296,8 +296,7 @@ class DocWhiteSpace : public DocNode QCString m_chars; }; -/*! Verbatim, unparsed text fragment */ -// TODO: parse code +/*! @brief Node representing a verbatim, unparsed text fragment */ class DocVerbatim : public DocNode { public: @@ -319,65 +318,64 @@ class DocVerbatim : public DocNode Type m_type; }; -/*! "to be copied" documentation block */ -// TODO: Find the matching block and insert it. -// (This should be a separate pass, or can we do it in one pass?). -class DocCopy : public DocNode -{ - public: - DocCopy(DocNode *parent,const QCString &link) : - m_parent(parent), m_link(link) {} - Kind kind() const { return Kind_Copy; } - QCString link() const { return m_link; } - DocNode *parent() const { return m_parent; } - void accept(DocVisitor *v) { v->visit(this); } - - private: - DocNode *m_parent; - QCString m_link; -}; - -/*! include/dontinclude block */ -// TODO: locate the file and handle it. +/*! @brief Node representing an included text block from file */ class DocInclude : public DocNode { public: enum Type { Include, DontInclude, VerbInclude, HtmlInclude }; - DocInclude(DocNode *parent,const QCString &file,Type t) : - m_parent(parent), m_file(file), m_type(t) {} - Kind kind() const { return Kind_Include; } - QCString file() const { return m_file; } - Type type() const { return m_type; } - DocNode *parent() const { return m_parent; } + DocInclude(DocNode *parent,const QCString &file, + const QCString context, Type t) : + m_parent(parent), m_file(file), m_context(context), m_type(t) {} + Kind kind() const { return Kind_Include; } + QCString file() const { return m_file; } + 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); } + void parse(); private: DocNode *m_parent; QCString m_file; + QCString m_context; + QCString m_text; Type m_type; }; -/*! include/dontinclude operator block */ -// TODO: check which file we should be working on and do the operation +/*! @brief Node representing a include/dontinclude operator block */ class DocIncOperator : public DocNode { public: enum Type { Line, SkipLine, Skip, Until }; - DocIncOperator(DocNode *parent,Type t,const QCString &pat) : - m_parent(parent), m_type(t), m_pattern(pat) {} + DocIncOperator(DocNode *parent,Type t,const QCString &pat, + const QCString &context) : + m_parent(parent), m_type(t), m_pattern(pat), m_context(context), + m_isFirst(FALSE), m_isLast(FALSE) {} Kind kind() const { return Kind_IncOperator; } Type type() const { return m_type; } + QCString text() const { return m_text; } QCString pattern() const { return m_pattern; } + QCString context() const { return m_context; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } + void parse(); + bool isFirst() const { return m_isFirst; } + bool isLast() const { return m_isLast; } + void markFirst(bool v=TRUE) { m_isFirst = v; } + void markLast(bool v=TRUE) { m_isLast = v; } private: DocNode *m_parent; Type m_type; + QCString m_text; QCString m_pattern; + QCString m_context; + bool m_isFirst; + bool m_isLast; }; -/*! Item of a cross-referenced list */ +/*! @brief Node representing an item of a cross-referenced list */ class DocFormula : public DocNode { public: @@ -396,7 +394,24 @@ class DocFormula : public DocNode //----------------------------------------------------------------------- -/*! Node representing a entry in the index. */ +/*! @brief Node representing a entry in the index. */ +class DocCopy : public CompAccept<DocCopy>, public DocNode +{ + public: + DocCopy(DocNode *parent,const QCString &link) + : m_parent(parent), m_link(link) { } + Kind kind() const { return Kind_IndexEntry; } + QCString link() const { return m_link; } + void parse(); + DocNode *parent() const { return m_parent; } + void accept(DocVisitor *v) { CompAccept<DocCopy>::accept(this,v); } + + private: + DocNode *m_parent; + QCString m_link; +}; + +/*! @brief Node representing a entry in the index. */ class DocIndexEntry : public CompAccept<DocIndexEntry>, public DocNode { public: @@ -410,7 +425,7 @@ class DocIndexEntry : public CompAccept<DocIndexEntry>, public DocNode DocNode *m_parent; }; -/*! Auto List */ +/*! @brief Node representing an auto List */ class DocAutoList : public CompAccept<DocAutoList>, public DocNode { public: @@ -430,7 +445,7 @@ class DocAutoList : public CompAccept<DocAutoList>, public DocNode }; -/*! Simple section title */ +/*! @brief Node representing a simple section title */ class DocTitle : public CompAccept<DocTitle>, public DocNode { public: @@ -444,7 +459,7 @@ class DocTitle : public CompAccept<DocTitle>, public DocNode DocNode *m_parent; }; -/*! Item of a cross-referenced list */ +/*! @brief Node representing an item of a cross-referenced list */ class DocXRefItem : public CompAccept<DocXRefItem>, public DocNode { public: @@ -469,44 +484,56 @@ class DocXRefItem : public CompAccept<DocXRefItem>, public DocNode QCString m_title; }; -/*! Image */ +/*! @brief Node representing an image */ class DocImage : public CompAccept<DocImage>, public DocNode { public: enum Type { Html, Latex, Rtf }; DocImage(DocNode *parent,const QCString &name,Type t) : m_parent(parent), m_name(name), m_type(t) {} - void parse(); - Kind kind() const { return Kind_Image; } - Type type() const { return m_type; } - QCString name() const { return m_name; } - DocNode *parent() const { return m_parent; } + Kind kind() const { return Kind_Image; } + Type type() const { return m_type; } + QCString name() const { return m_name; } + DocNode *parent() const { return m_parent; } + bool hasCaption() const { return !m_children.isEmpty(); } + QCString width() const { return m_width; } + QCString height() const { return m_height; } void accept(DocVisitor *v) { CompAccept<DocImage>::accept(this,v); } + void parse(); private: DocNode *m_parent; QCString m_name; Type m_type; + QCString m_width; + QCString m_height; }; -/*! Node representing a dot file */ +/*! @brief Node representing a dot file */ class DocDotFile : public CompAccept<DocDotFile>, public DocNode { public: DocDotFile(DocNode *parent,const QCString &name) : m_parent(parent), m_name(name) { } void parse(); - Kind kind() const { return Kind_DotFile; } - QCString name() const { return m_name; } - DocNode *parent() const { return m_parent; } + Kind kind() const { return Kind_DotFile; } + QCString name() const { return m_name; } + QCString file() const { return m_file; } + bool hasCaption() const { return !m_children.isEmpty(); } + QCString width() const { return m_width; } + QCString height() const { return m_height; } + DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocDotFile>::accept(this,v); } private: DocNode *m_parent; QCString m_name; + QCString m_file; + QCString m_width; + QCString m_height; }; -/*! Node representing a link to some item */ +/*! @brief Node representing a link to some item */ class DocLink : public CompAccept<DocLink>, public DocNode { public: @@ -526,7 +553,7 @@ class DocLink : public CompAccept<DocLink>, public DocNode QCString m_anchor; }; -/*! Node representing a reference to some item */ +/*! @brief Node representing a reference to some item */ class DocRef : public CompAccept<DocRef>, public DocNode { public: @@ -553,7 +580,7 @@ class DocRef : public CompAccept<DocRef>, public DocNode QCString m_text; }; -/*! Node representing an internal reference to some item */ +/*! @brief Node representing an internal reference to some item */ class DocInternalRef : public CompAccept<DocInternalRef>, public DocNode { public: @@ -571,7 +598,7 @@ class DocInternalRef : public CompAccept<DocInternalRef>, public DocNode QCString m_anchor; }; -/*! Language specific node */ +/*! @brief Node representing a Language specific section */ class DocLanguage : public CompAccept<DocLanguage>, public DocNode { public: @@ -588,7 +615,7 @@ class DocLanguage : public CompAccept<DocLanguage>, public DocNode QCString m_id; }; -/*! Hypertext reference */ +/*! @brief Node representing a Hypertext reference */ class DocHRef : public CompAccept<DocHRef>, public DocNode { public: @@ -605,7 +632,7 @@ class DocHRef : public CompAccept<DocHRef>, public DocNode QCString m_url; }; -/*! Html heading */ +/*! @brief Node Html heading */ class DocHtmlHeader : public CompAccept<DocHtmlHeader>, public DocNode { public: @@ -622,7 +649,7 @@ class DocHtmlHeader : public CompAccept<DocHtmlHeader>, public DocNode int m_level; }; -/*! Html description item */ +/*! @brief Node representing a Html description item */ class DocHtmlDescTitle : public CompAccept<DocHtmlDescTitle>, public DocNode { public: @@ -636,7 +663,7 @@ class DocHtmlDescTitle : public CompAccept<DocHtmlDescTitle>, public DocNode DocNode * m_parent; }; -/*! Html description list */ +/*! @brief Node representing a Html description list */ class DocHtmlDescList : public CompAccept<DocHtmlDescList>, public DocNode { public: @@ -650,43 +677,53 @@ class DocHtmlDescList : public CompAccept<DocHtmlDescList>, public DocNode DocNode * m_parent; }; -/*! Normal section */ +/*! @brief Node representing a normal section */ class DocSection : public CompAccept<DocSection>, public DocNode { public: DocSection(DocNode *parent,int level,const QCString &id) : m_parent(parent), m_level(level), m_id(id) {} - int parse(); - Kind kind() const { return Kind_Section; } - int level() const { return m_level; } - QCString id() const { return m_id; } - DocNode *parent() const { return m_parent; } + Kind kind() const { return Kind_Section; } + int level() const { return m_level; } + QCString title() const { return m_title; } + QCString anchor() const { return m_anchor; } + QCString id() const { return m_id; } + QCString file() const { return m_file; } + DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocSection>::accept(this,v); } + int parse(); private: DocNode *m_parent; int m_level; QCString m_id; + QCString m_title; + QCString m_anchor; + QCString m_file; }; -/*! Reference to a section */ +/*! @brief Node representing a reference to a section */ class DocSecRefItem : public CompAccept<DocSecRefItem>, public DocNode { public: DocSecRefItem(DocNode *parent,const QCString &target) : m_parent(parent), m_target(target) {} - void parse(); - Kind kind() const { return Kind_SecRefItem; } - QCString target() const { return m_target; } - DocNode *parent() const { return m_parent; } + Kind kind() const { return Kind_SecRefItem; } + QCString target() const { return m_target; } + QCString file() const { return m_file; } + QCString anchor() const { return m_anchor; } + DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocSecRefItem>::accept(this,v); } + void parse(); private: DocNode *m_parent; QCString m_target; + QCString m_file; + QCString m_anchor; }; -/*! List of section references */ +/*! @brief Node representing a list of section references */ class DocSecRefList : public CompAccept<DocSecRefList>, public DocNode { public: @@ -700,9 +737,7 @@ class DocSecRefList : public CompAccept<DocSecRefList>, public DocNode DocNode *m_parent; }; -/*! Internal section of documentation */ -// TODO: decide if it should be visible -// Separate pass to remove internal parts? +/*! @brief Node representing an internal section of documentation */ class DocInternal : public CompAccept<DocInternal>, public DocNode { public: @@ -716,7 +751,7 @@ class DocInternal : public CompAccept<DocInternal>, public DocNode DocNode *m_parent; }; -/*! Simple list */ +/*! @brief Node representing a simple list */ class DocSimpleList : public CompAccept<DocSimpleList>, public DocNode { public: @@ -730,7 +765,7 @@ class DocSimpleList : public CompAccept<DocSimpleList>, public DocNode DocNode *m_parent; }; -/*! Html list */ +/*! @brief Node representing a Html list */ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode { public: @@ -747,7 +782,7 @@ class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode Type m_type; }; -/*! Simple section */ +/*! Node representing a simple section */ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode { public: @@ -770,7 +805,7 @@ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode DocTitle * m_title; }; -/*! Parameter section */ +/*! Node representing a parameter section */ class DocParamSect : public CompAccept<DocParamSect>, public DocNode { public: @@ -790,7 +825,7 @@ class DocParamSect : public CompAccept<DocParamSect>, public DocNode Type m_type; }; -/*! Paragraph in the documentation tree */ +/*! Node representing a paragraph in the documentation tree */ class DocPara : public CompAccept<DocPara>, public DocNode { public: @@ -820,7 +855,6 @@ class DocPara : public CompAccept<DocPara>, public DocNode void handleRef(const QCString &cmdName); int handleLanguageSwitch(); - private: DocNode *m_parent; QCString m_sectionId; @@ -828,7 +862,7 @@ class DocPara : public CompAccept<DocPara>, public DocNode bool m_isLast; }; -/*! Node representing a parameter list. */ +/*! @brief Node representing a parameter list. */ class DocParamList : public DocNode { public: @@ -853,7 +887,7 @@ class DocParamList : public DocNode QStrList m_params; }; -/*! Node representing an item of a auto list */ +/*! @brief Node representing an item of a auto list */ class DocAutoListItem : public DocNode { public: @@ -874,7 +908,7 @@ class DocAutoListItem : public DocNode DocPara *m_paragraph; }; -/*! Simple list item */ +/*! @brief Node representing a simple list item */ class DocSimpleListItem : public DocNode { public: @@ -896,7 +930,7 @@ class DocSimpleListItem : public DocNode DocPara *m_paragraph; }; -/*! Html list item */ +/*! @brief Node representing a Html list item */ class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode { public: @@ -910,7 +944,7 @@ class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode DocNode *m_parent; }; -/*! Html description data */ +/*! @brief Node representing a Html description data */ class DocHtmlDescData : public CompAccept<DocHtmlDescData>, public DocNode { public: @@ -925,7 +959,7 @@ class DocHtmlDescData : public CompAccept<DocHtmlDescData>, public DocNode }; -/*! Html list item */ +/*! @brief Node representing a Html list item */ class DocHtmlPre : public CompAccept<DocHtmlPre>, public DocNode { public: @@ -939,25 +973,31 @@ class DocHtmlPre : public CompAccept<DocHtmlPre>, public DocNode DocNode *m_parent; }; -/*! Html table cell */ +/*! @brief Node representing a Html table cell */ class DocHtmlCell : public CompAccept<DocHtmlCell>, public DocNode { public: DocHtmlCell(DocNode *parent,bool isHeading) : - m_parent(parent), m_isHeading(isHeading) {} + m_parent(parent), m_isHeading(isHeading), + m_isFirst(FALSE), m_isLast(FALSE) {} int parse(); bool isHeading() const { return m_isHeading; } + bool isFirst() const { return m_isFirst; } + bool isLast() const { return m_isLast; } Kind kind() const { return Kind_HtmlCell; } DocNode *parent() const { return m_parent; } - uint numCells() const { return m_children.count(); } void accept(DocVisitor *v) { CompAccept<DocHtmlCell>::accept(this,v); } + void markFirst(bool v=TRUE) { m_isFirst=v; } + void markLast(bool v=TRUE) { m_isLast=v; } private: DocNode * m_parent; bool m_isHeading; + bool m_isFirst; + bool m_isLast; }; -/*! Html table caption */ +/*! @brief Node representing a Html table caption */ class DocHtmlCaption : public CompAccept<DocHtmlCaption>, public DocNode { public: @@ -971,7 +1011,7 @@ class DocHtmlCaption : public CompAccept<DocHtmlCaption>, public DocNode DocNode * m_parent; }; -/*! Html table row */ +/*! @brief Node representing a Html table row */ class DocHtmlRow : public CompAccept<DocHtmlRow>, public DocNode { public: @@ -986,16 +1026,17 @@ class DocHtmlRow : public CompAccept<DocHtmlRow>, public DocNode DocNode * m_parent; }; -/*! Html table */ +/*! @brief Node representing a Html table */ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode { public: DocHtmlTable(DocNode *parent) : m_parent(parent) { m_caption=0; } - ~DocHtmlTable() { delete m_caption; } - int parse(); - Kind kind() const { return Kind_HtmlTable; } + ~DocHtmlTable() { delete m_caption; } + Kind kind() const { return Kind_HtmlTable; } DocNode *parent() const { return m_parent; } - uint numRows() const { return m_children.count(); } + uint numRows() const { return m_children.count(); } + bool hasCaption() { return m_caption!=0; } + int parse(); uint numCols() const { uint cols=0; @@ -1016,7 +1057,7 @@ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode }; -/*! Root node of documentation tree */ +/*! @brief Root node of documentation tree */ class DocRoot : public CompAccept<DocRoot>, public DocNode { public: diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 7f43614..1ec3e44 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -235,7 +235,11 @@ OPCAST {BLANK}+[^(\r\n.,]+ OPMASK ({BLANK}*{OPNORM}({FUNCARG}?))|({OPCAST}{FUNCARG}) LNKWORD1 {SCOPEMASK}({FUNCARG}({BLANK}*("const"|"volatile"))?)? LNKWORD2 {SCOPEPRE}*"operator"{OPMASK} -WORD [^ \t\n\r\\@<>&$#,.]+ +WORD1 [^ \t\n\r\\@<>&$#,.]+ +WORD2 "."|"," +WORD1NQ [^ \t\n\r\\@<>&$#,."]+ +WORD2NQ "."|"," +HTMLTAG "<"(("/")?){ID}({BLANK}+{ATTRIB})*">" %option noyywrap %option yylineno @@ -243,6 +247,10 @@ WORD [^ \t\n\r\\@<>&$#,.]+ %x St_Para %x St_Comment %x St_Title +%x St_TitleN +%x St_TitleQ +%x St_TitleA +%x St_TitleV %x St_Code %x St_HtmlOnly %x St_LatexOnly @@ -317,13 +325,13 @@ WORD [^ \t\n\r\\@<>&$#,.]+ g_token->text = tagName.mid(i+1,tagName.length()-i-2); return TK_RCSTAG; } -<St_Para>"$("{ID}")" { /* environment variable */ +<St_Para,St_HtmlOnly>"$("{ID}")" { /* environment variable */ QCString name = &yytext[2]; name = name.left(name.length()-1); QCString value = getenv(name); for (int i=value.length()-1;i>=0;i--) unput(value.at(i)); } -<St_Para>"<"(("/")?){ID}({BLANK}+{ATTRIB})*">" { /* html tag */ +<St_Para>{HTMLTAG} { /* html tag */ g_token->name = yytext; int startNamePos=1; if (g_token->name.at(1)=='/') startNamePos++; @@ -349,11 +357,8 @@ WORD [^ \t\n\r\\@<>&$#,.]+ g_token->name = yytext; return TK_LNKWORD; } -<St_Para>"."|"," { - g_token->name = yytext; - return TK_WORD; - } -<St_Para>{WORD} { /* function call */ +<St_Para>{WORD1} | +<St_Para>{WORD2} { /* function call */ g_token->name = yytext; return TK_WORD; @@ -383,7 +388,7 @@ WORD [^ \t\n\r\\@<>&$#,.]+ <St_HtmlOnly>{CMD}"endhtmlonly" { return RetVal_OK; } -<St_HtmlOnly>[^\\@\n]+ | +<St_HtmlOnly>[^\\@\n$]+ | <St_HtmlOnly>\n | <St_HtmlOnly>. { g_token->verb+=yytext; @@ -404,26 +409,87 @@ WORD [^ \t\n\r\\@<>&$#,.]+ <St_Verbatim>. { /* Verbatim text */ g_token->verb+=yytext; } -<St_Title>"&"{ID}";" { /* symbol */ +<St_Title>"\"" { // quoted title + BEGIN(St_TitleQ); + } +<St_Title>[ \t]+ { + g_token->chars=yytext; + return TK_WHITESPACE; + } +<St_Title>. { // non-quoted title + unput(*yytext); + BEGIN(St_TitleN); + } +<St_Title>\n { + return 0; + } +<St_TitleN>"&"{ID}";" { /* symbol */ g_token->name = yytext; return TK_SYMBOL; } -<St_Title>{SPCMD1} | -<St_Title>{SPCMD2} { /* special command */ +<St_TitleN>{SPCMD1} | +<St_TitleN>{SPCMD2} { /* special command */ g_token->name = yytext+1; return TK_COMMAND; } -<St_Title>{WORD} { /* word */ +<St_TitleN>{WORD1} | +<St_TitleN>{WORD2} { /* word */ g_token->name = yytext; return TK_WORD; } -<St_Title>[ \t]+ { +<St_TitleN>[ \t]+ { + g_token->chars=yytext; + return TK_WHITESPACE; + } +<St_TitleN>\n { /* new line => end of title */ + unput(*yytext); + return 0; + } +<St_TitleQ>"&"{ID}";" { /* symbol */ + g_token->name = yytext; + return TK_SYMBOL; + } +<St_TitleQ>{SPCMD1} | +<St_TitleQ>{SPCMD2} { /* special command */ + g_token->name = yytext+1; + return TK_COMMAND; + } +<St_TitleQ>{WORD1NQ} | +<St_TitleQ>{WORD2NQ} { /* word */ + g_token->name = yytext; + return TK_WORD; + } +<St_TitleQ>[ \t]+ { g_token->chars=yytext; return TK_WHITESPACE; } -<St_Title>\n { /* new line => end of title */ +<St_TitleQ>"\"" { /* closing quote => end of title */ + BEGIN(St_TitleA); + return 0; + } +<St_TitleQ>\n { /* new line => end of title */ + unput(*yytext); return 0; } +<St_TitleA>{BLANK}*{ID}{BLANK}*"="{BLANK}* { // title attribute + g_token->name = yytext; + g_token->name = g_token->name.left( + g_token->name.find('=')).stripWhiteSpace(); + BEGIN(St_TitleV); + } +<St_TitleV>[^ \t\r\n]+ { // attribute value + g_token->chars = yytext; + BEGIN(St_TitleN); + return TK_WORD; + } +<St_TitleV,St_TitleA>. { + unput(*yytext); + return 0; + } +<St_TitleV,St_TitleA>\n { + return 0; + } + <St_Ref>{ID} { g_token->name=yytext; return TK_WORD; @@ -458,8 +524,8 @@ WORD [^ \t\n\r\\@<>&$#,.]+ g_token->name = yytext+1; return TK_COMMAND; } -<St_Ref2>[^ \t\n\r\\@<&$"]+ | -<St_Ref2>[^ \t\n\r\\@<&$"]+"("[^\n")]*")"({BLANK}*("const"|"volatile"))? { +<St_Ref2>{WORD1NQ} | +<St_Ref2>{WORD2NQ} { /* word */ g_token->name = yytext; return TK_WORD; diff --git a/src/docvisitor.h b/src/docvisitor.h index b66161f..771971f 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -51,7 +51,6 @@ class DocAnchor; class DocIndexEntry; class DocInternal; class DocHRef; -class DocCopy; class DocInclude; class DocIncOperator; class DocHtmlHeader; @@ -67,6 +66,7 @@ class DocLinkedWord; class DocParamSect; class DocParamList; class DocInternalRef; +class DocCopy; /*! @brief Abstract visitor that participates in the visitor pattern. */ @@ -83,7 +83,6 @@ class DocVisitor virtual void visit(DocLineBreak *) = 0; virtual void visit(DocHorRuler *) = 0; virtual void visit(DocAnchor *) = 0; - virtual void visit(DocCopy *) = 0; virtual void visit(DocInclude *) = 0; virtual void visit(DocIncOperator *) = 0; virtual void visit(DocFormula *) = 0; @@ -158,6 +157,8 @@ class DocVisitor virtual void visitPost(DocXRefItem *) = 0; virtual void visitPre(DocInternalRef *) = 0; virtual void visitPost(DocInternalRef *) = 0; + virtual void visitPre(DocCopy *) = 0; + virtual void visitPost(DocCopy *) = 0; }; #endif @@ -16,6 +16,9 @@ * */ +#ifndef _DOT_H +#define _DOT_H + #include "qtbc.h" #include <qlist.h> #include <qdict.h> @@ -171,3 +174,4 @@ void generateGraphLegend(const char *path); void writeDotGraphFromFile(const char *inFile,const char *outDir, const char *outFile,GraphOutputFormat format); +#endif diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 95b723d..75481c9 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -199,6 +199,7 @@ static void addRelatedPage(Entry *root) { if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) break; } + //printf("addRelatedPage() %s gd=%p\n",root->name.data(),gd); addRelatedPage(root->name,root->args,root->doc,root->anchors, root->fileName,root->startLine, root->sli, @@ -1448,27 +1449,52 @@ static bool isVarWithConstructor(Entry *root) { static QRegExp initChars("[0-9\"'&*!^]+"); static QRegExp idChars("[a-z_A-Z][a-z_A-Z0-9]*"); - if (root->type.isEmpty()) return FALSE; + bool result=FALSE; + bool typeIsClass; Definition *ctx = 0; - //printf("isVarWithConstructor(%s,%s)\n",root->parent->name.data(), - // root->type.data()); + if (root->parent && root->parent->section&Entry::COMPOUND_MASK) + { // inside a class + result=FALSE; + goto done; + } + if (root->type.isEmpty()) + { + result=FALSE; + goto done; + } if (root->parent->name) ctx=Doxygen::namespaceSDict.find(root->parent->name); - bool typeIsClass=getResolvedClass(ctx,root->type)!=0; + typeIsClass=getResolvedClass(ctx,root->type)!=0; if (typeIsClass) // now we still have to check if the arguments are // types or values. Since we do not have complete type info // we need to rely on heuristics :-( { //printf("typeIsClass\n"); ArgumentList *al = root->argList; - if (al==0) return FALSE; // empty arg list -> function prototype. + if (al==0 || al->isEmpty()) + { + result=FALSE; // empty arg list -> function prototype. + goto done; + } ArgumentListIterator ali(*al); Argument *a; for (ali.toFirst();(a=ali.current());++ali) { //printf("a->name=%s a->type=%s\n",a->name.data(),a->type.data()); - if (!a->name.isEmpty() || !a->defval.isEmpty()) return FALSE; // arg has (type,name) pair -> function prototype - if (a->type.isEmpty() || getResolvedClass(ctx,a->type)!=0) return FALSE; // arg type is a known type - if (a->type.find(initChars)==0) return TRUE; // argument type starts with typical initializer char + if (!a->name.isEmpty() || !a->defval.isEmpty()) + { + result=FALSE; // arg has (type,name) pair -> function prototype + goto done; + } + if (a->type.isEmpty() || getResolvedClass(ctx,a->type)!=0) + { + result=FALSE; // arg type is a known type + goto done; + } + if (a->type.find(initChars)==0) + { + result=TRUE; // argument type starts with typical initializer char + goto done; + } QCString resType=resolveTypeDef(ctx,a->type); if (resType.isEmpty()) resType=a->type; int len; @@ -1480,14 +1506,17 @@ static bool isVarWithConstructor(Entry *root) resType=="double" || resType=="char" || resType=="signed" || resType=="const" || resType=="unsigned") { - return FALSE; // type keyword -> function prototype + result=FALSE; // type keyword -> function prototype + goto done; } } } - return TRUE; + result=TRUE; } - // return type not a class -> function prototype - return FALSE; +done: + //printf("isVarWithConstructor(%s,%s)=%d\n",root->parent->name.data(), + // root->type.data(),result); + return result; } //---------------------------------------------------------------------- @@ -3380,7 +3409,8 @@ static void computeClassRelations() bName.right(2)!="::") { if (!root->name.isEmpty() && root->name[0]!='@' && - (guessSection(root->fileName)==Entry::HEADER_SEC || Config_getBool("EXTRACT_LOCAL_CLASSES")) + (guessSection(root->fileName)==Entry::HEADER_SEC || Config_getBool("EXTRACT_LOCAL_CLASSES")) && + (root->protection!=Private || Config_getBool("EXTRACT_PRIVATE")) ) warn_undoc( root->fileName,root->startLine, @@ -3560,9 +3590,14 @@ static void addListReferences() PageInfo *pi=0; for (pdi.toFirst();(pi=pdi.current());++pdi) { + QCString name = pi->name; + if (pi->getGroupDef()) + { + name = pi->getGroupDef()->getOutputFileBase().copy(); + } addRefItem(pi->specialListItems, theTranslator->trPage(TRUE,TRUE), - pi->name,pi->title); + name,pi->title); } } @@ -5830,69 +5865,6 @@ static void findMainPage(Entry *root) //---------------------------------------------------------------------------- -///*! Search for all Java package statements -// */ -//static void buildPackageList(Entry *root) -//{ -// if (root->section == Entry::PACKAGE_SEC || root->section == Entry::PACKAGEDOC_SEC && !root->name.isEmpty()) -// { -// PackageDef *pd=0; -// if ((pd=Doxygen::packageDict.find(root->name))==0) -// { -// QCString tagName; -// if (root->tagInfo) -// { -// tagName=root->tagInfo->tagName; -// } -// pd = new PackageDef(root->fileName,root->startLine,root->name,tagName); -// Doxygen::packageDict.inSort(root->name,pd); -// pd->setDocumentation(root->doc,root->docFile,root->docLine); -// pd->setBriefDescription(root->brief,root->briefFile,root->briefLine); -// } -// else -// { -// if (!pd->documentation() && !root->doc.isEmpty()) -// { -// pd->setDocumentation(root->doc,root->docFile,root->docLine); -// } -// if (!pd->briefDescription() && !root->brief.isEmpty()) -// { -// pd->setBriefDescription(root->brief,root->briefFile,root->briefLine); -// } -// } -// bool ambig; -// FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig); -// if (fd) -// { -// fd->setPackageDef(pd); -// } -// } -// EntryListIterator eli(*root->sublist); -// Entry *e; -// for (;(e=eli.current());++eli) -// { -// buildPackageList(e); -// } -//} - -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- - -/*! Add Java classes to their respective packages */ -//static void addClassesToPackages() -//{ -// ClassDef *cd; -// ClassSDict::Iterator cli(Doxygen::classSDict); -// for (;(cd=cli.current());++cli) -// { -// PackageDef *pd = cd->packageDef(); -// if (pd) pd->addClass(cd); -// } -//} - -//---------------------------------------------------------------------------- - static void resolveUserReferences() { QDictIterator<SectionInfo> sdi(Doxygen::sectionDict); @@ -5904,35 +5876,6 @@ static void resolveUserReferences() // si->fileName.data()); PageInfo *pi=0; - // if this section is in a page and the page is in a group, then we - // have to adjust the link file name to point to the group. - if (!si->fileName.isEmpty() && - (pi=Doxygen::pageSDict->find(si->fileName)) && - pi->getGroupDef()) - { - si->fileName=pi->getGroupDef()->getOutputFileBase().copy(); - } - - - if (si->definition) - { - // TODO: there should be one function in Definition that returns - // the file to link to, so we can avoid the following tests. - GroupDef *gd=0; - if (si->definition->definitionType()==Definition::TypeMember) - { - gd = ((MemberDef *)si->definition)->getGroupDef(); - } - - if (gd) - { - si->fileName=gd->getOutputFileBase().copy(); - } - else - { - si->fileName=si->definition->getOutputFileBase().copy(); - } - } // hack: the items of a todo/test/bug/deprecated list are all fragments from // different files, so the resulting section's all have the wrong file // name (not from the todo/test/bug/deprecated list, but from the file in @@ -5943,12 +5886,48 @@ static void resolveUserReferences() for (rli.toFirst();(rl=rli.current());++rli) { QCString label="_"+rl->listName(); // "_todo", "_test", ... - if (si->label==label) + if (si->label.left(label.length())==label) { + si->fileName=rl->listName(); si->generated=TRUE; break; } } + + //printf("start: si->label=%s si->fileName=%s\n",si->label.data(),si->fileName.data()); + if (!si->generated) + { + // if this section is in a page and the page is in a group, then we + // have to adjust the link file name to point to the group. + if (!si->fileName.isEmpty() && + (pi=Doxygen::pageSDict->find(si->fileName)) && + pi->getGroupDef()) + { + si->fileName=pi->getGroupDef()->getOutputFileBase().copy(); + } + + if (si->definition) + { + // TODO: there should be one function in Definition that returns + // the file to link to, so we can avoid the following tests. + GroupDef *gd=0; + if (si->definition->definitionType()==Definition::TypeMember) + { + gd = ((MemberDef *)si->definition)->getGroupDef(); + } + + if (gd) + { + si->fileName=gd->getOutputFileBase().copy(); + } + else + { + //si->fileName=si->definition->getOutputFileBase().copy(); + //printf("Setting si->fileName to %s\n",si->fileName.data()); + } + } + } + //printf("end: si->label=%s si->fileName=%s\n",si->label.data(),si->fileName.data()); } } @@ -5959,6 +5938,7 @@ static void resolveUserReferences() static void generatePageDocs() { + //printf("documentedPages=%d real=%d\n",documentedPages,Doxygen::pageSDict->count()); if (documentedPages==0) return; PageSDict::Iterator pdi(*Doxygen::pageSDict); PageInfo *pi=0; @@ -6756,9 +6736,10 @@ static int readFileOrDirectory(const char *s, if (resultList || resultDict) { rs=new QCString(fi.absFilePath()); + if (resultList) resultList->append(rs); + if (resultDict) resultDict->insert(fi.absFilePath(),rs); } - if (resultList) resultList->append(rs); - if (resultDict) resultDict->insert(fi.absFilePath(),rs); + if (killDict) killDict->insert(fi.absFilePath(),(void *)0x8); } } @@ -6858,6 +6839,7 @@ void initDoxygen() initPreprocessor(); + Doxygen::sectionDict.setAutoDelete(TRUE); } void readConfiguration(int argc, char **argv) @@ -7293,6 +7275,7 @@ void parseInput() QDict<void> *killDict = new QDict<void>(10007); int inputSize=0; QStrList &inputList=Config_getList("INPUT"); + inputFiles.setAutoDelete(TRUE); s=inputList.first(); while (s) { diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 758af1e..b2d3691 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -131,6 +131,7 @@ void GroupDef::addNamespace(const NamespaceDef *def) void GroupDef::addPage(PageInfo *def) { + //printf("Making page %s part of a group\n",def->name.data()); pageDict->append(def->name,def); def->makePartOfGroup(this); } diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp new file mode 100644 index 0000000..062f109 --- /dev/null +++ b/src/htmldocvisitor.cpp @@ -0,0 +1,67 @@ +/****************************************************************************** + * + * + * + * + * 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. + * + */ + +#include "htmldocvisitor.h" + +void HtmlDocVisitor::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 HtmlDocVisitor::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 HtmlDocVisitor::endLink() +{ + m_t << "</a>"; +} + diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 9f0f699..39956da 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -25,8 +25,9 @@ #include "doxygen.h" #include "outputgen.h" #include "code.h" +#include "dot.h" -/*! Concrete visitor implementation for pretty printing */ +/*! @brief Concrete visitor implementation for HTML output. */ class HtmlDocVisitor : public DocVisitor { public: @@ -34,6 +35,8 @@ class HtmlDocVisitor : public DocVisitor : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) {} //-------------------------------------- + // visitor functions for leaf nodes + //-------------------------------------- void visit(DocWord *w) { @@ -91,7 +94,7 @@ class HtmlDocVisitor : public DocVisitor void visit(DocURL *u) { if (m_hide) return; - m_t << "<a href=\"" << u->url() << "\">" << u->url() << "</a> "; + m_t << "<a href=\"" << u->url() << "\">" << u->url() << "</a>"; } void visit(DocLineBreak *) { @@ -159,39 +162,50 @@ class HtmlDocVisitor : public DocVisitor 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; + case DocInclude::Include: + m_t << "<div class=\"fragment\"><pre>"; + parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + m_t << "</pre></div>"; + break; + case DocInclude::DontInclude: + break; + case DocInclude::HtmlInclude: + m_t << inc->text(); + break; + case DocInclude::VerbInclude: + m_t << "<div class=\"fragment\"><pre>"; + filter(inc->text()); + m_t << "</pre></div>"; + break; } - printf("\"/>"); } void visit(DocIncOperator *op) { - if (m_hide) return; - // TODO - printf("<incoperator pattern=\"%s\" type=\"",op->pattern().data()); - switch(op->type()) + //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", + // op->type(),op->isFirst(),op->isLast(),op->text().data()); + if (op->isFirst()) + { + m_t << "<div class=\"fragment\"><pre>"; + m_hide = TRUE; + } + if (op->type()!=DocIncOperator::Skip) + { + parseCode(m_ci,op->context(),op->text(),FALSE,0); + } + if (op->isLast()) + { + m_hide = FALSE; + m_t << "</pre></div>"; + } + else { - case DocIncOperator::Line: printf("line"); break; - case DocIncOperator::Skip: printf("skip"); break; - case DocIncOperator::SkipLine: printf("skipline"); break; - case DocIncOperator::Until: printf("until"); break; + m_t << endl; } - printf("\"/>"); } void visit(DocFormula *f) { @@ -205,9 +219,15 @@ class HtmlDocVisitor : public DocVisitor 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; + m_t << " src=\"" << f->name() << ".png\">"; + if (f->text().at(0)=='\\') + m_t << endl << "</center><p>" << endl; + else + m_t << " "; } + + //-------------------------------------- + // visitor functions for compound nodes //-------------------------------------- void visitPre(DocAutoList *l) @@ -249,15 +269,15 @@ class HtmlDocVisitor : public DocVisitor !(p->parent() && // and for parameter sections p->parent()->kind()==DocNode::Kind_ParamSect ) - ) m_t << "<p>\n"; + ) m_t << "\n<p>\n"; } void visitPre(DocRoot *) { - m_t << "<hr><h4><font color=\"red\">New parser:</font></h4>\n"; + //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"; + //m_t << "<hr><h4><font color=\"red\">Old parser:</font></h4>\n"; } void visitPre(DocSimpleSect *s) { @@ -295,12 +315,11 @@ class HtmlDocVisitor : public DocVisitor 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>"; + m_t << ":</b></dt><dd>"; } } void visitPost(DocSimpleSect *) @@ -332,11 +351,14 @@ class HtmlDocVisitor : public DocVisitor } void visitPre(DocSection *s) { - m_t << "<h%d>",s->level(); + m_t << "<h" << s->level()+1 << ">"; + m_t << "<a name=\"" << s->anchor(); + filter(s->title()); + m_t << "\"</a>" << endl; + m_t << "</h" << s->level()+1 << ">\n"; } - void visitPost(DocSection *s) + void visitPost(DocSection *) { - m_t << "</h%d>\n",s->level(); } void visitPre(DocHtmlList *s) { @@ -449,7 +471,7 @@ class HtmlDocVisitor : public DocVisitor } void visitPost(DocHRef *) { - m_t << "</a>\n"; + m_t << "</a>"; } void visitPre(DocHtmlHeader *header) { @@ -461,18 +483,68 @@ class HtmlDocVisitor : public DocVisitor } void visitPre(DocImage *img) { - m_t << "<img src=\"" << img->name() << "\">\n"; + if (img->type()==DocImage::Html) + { + QCString baseName=img->name(); + int i; + if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + m_t << "<div align=\"center\">" << endl; + m_t << "<img src=\"" << img->name() << "\" alt=\"" + << baseName << "\">" << endl; + if (img->hasCaption()) + { + m_t << "<p><strong>"; + } + } + else // other format -> skip + { + m_hide=TRUE; + } } - void visitPost(DocImage *) + void visitPost(DocImage *img) { + if (img->type()==DocImage::Html) + { + if (img->hasCaption()) + { + m_t << "</strong></p>"; + } + m_t << "</div>" << endl; + } + else // other format + { + m_hide=FALSE; + } } - void visitPre(DocDotFile *) + void visitPre(DocDotFile *df) { - // TODO + QCString baseName=df->file(); + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + QCString outDir = Config_getString("HTML_OUTPUT"); + writeDotGraphFromFile(df->file(),outDir,baseName,BITMAP); + m_t << "<div align=\"center\">" << endl; + m_t << "<img src=\"" << baseName << "." + << Config_getEnum("DOT_IMAGE_FORMAT") << "\" alt=\"" + << baseName << "\">" << endl; + if (df->hasCaption()) + { + m_t << "<p><strong>"; + } } - void visitPost(DocDotFile *) + void visitPost(DocDotFile *df) { - // TODO + if (df->hasCaption()) + { + m_t << "</strong></p>" << endl; + } + m_t << "</div>" << endl; } void visitPre(DocLink *lnk) { @@ -490,30 +562,37 @@ class HtmlDocVisitor : public DocVisitor void visitPost(DocRef *) { endLink(); + m_t << " "; } - void visitPre(DocSecRefItem *) + void visitPre(DocSecRefItem *ref) { - // TODO + QCString refName=ref->file(); + if (refName.right(Doxygen::htmlFileExtension.length())!=Doxygen::htmlFileExtension) + { + refName+=Doxygen::htmlFileExtension; + } + m_t << "<li><a href=\"" << refName << "#" << ref->anchor() << "\">"; + } void visitPost(DocSecRefItem *) { - // TODO + m_t << "</a> "; } void visitPre(DocSecRefList *) { - // TODO + m_t << "<multicol cols=3>" << endl; + m_t << "<ul>" << endl; } void visitPost(DocSecRefList *) { - // TODO + m_t << "</ul>" << endl; + m_t << "</multicol>" << endl; } void visitPre(DocLanguage *) { - // TODO } void visitPost(DocLanguage *) { - // TODO } void visitPre(DocParamSect *s) { @@ -526,6 +605,8 @@ class HtmlDocVisitor : public DocVisitor m_t << theTranslator->trReturnValues(); break; case DocParamSect::Exception: m_t << theTranslator->trExceptions(); break; + default: + ASSERT(0); } m_t << ":"; m_t << "</b></dt><dd>" << endl; @@ -556,8 +637,9 @@ class HtmlDocVisitor : public DocVisitor 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>"; + << x->file() << Doxygen::htmlFileExtension << "#" << x->anchor() << "\">"; + filter(x->title()); + m_t << ":</a></b></dt><dd>"; } void visitPost(DocXRefItem *) { @@ -570,54 +652,30 @@ class HtmlDocVisitor : public DocVisitor void visitPost(DocInternalRef *) { endLink(); + m_t << " "; } - - 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) + void visitPre(DocCopy *) { - 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() + void visitPost(DocCopy *) { - m_t << "</a> "; } + + private: + + //-------------------------------------- + // helper functions + //-------------------------------------- + + void filter(const char *str); + void startLink(const QCString &ref,const QCString &file, + const QCString &anchor); + void endLink(); + + //-------------------------------------- + // state variables + //-------------------------------------- + QTextStream &m_t; BaseCodeDocInterface &m_ci; bool m_insidePre; diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 37cd81f..61f2eef 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -1239,14 +1239,11 @@ 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/lang_cfg.h b/src/lang_cfg.h index fe373e3..4e7adfe 100644 --- a/src/lang_cfg.h +++ b/src/lang_cfg.h @@ -24,3 +24,4 @@ #define LANG_GR #define LANG_TW #define LANG_SR +#define LANG_CA diff --git a/src/language.cpp b/src/language.cpp index 5711b07..28ed750 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -100,6 +100,9 @@ #ifdef LANG_SR #include "translator_sr.h" #endif +#ifdef LANG_CA +#include "translator_ca.h" +#endif //#ifdef LANG_JS //#include "translator_js.h" //#endif diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp new file mode 100644 index 0000000..ab310c8 --- /dev/null +++ b/src/latexdocvisitor.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * + * + * + * 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. + * + */ + +#include "latexdocvisitor.h" +#include "util.h" + +void LatexDocVisitor::filter(const char *str) +{ + filterLatexString(m_t,str,FALSE,m_insidePre); +} + +void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) +{ + if (ref.isEmpty() && Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hyperlink{"; + if (!file.isEmpty()) m_t << file; + if (!file.isEmpty() && !anchor.isEmpty()) m_t << "_"; + if (!anchor.isEmpty()) m_t << anchor; + m_t << "}{"; + + } + else + { + m_t << "{\\bf "; + } +} + +void LatexDocVisitor::endLink() +{ + m_t << "}"; +} + diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h new file mode 100644 index 0000000..0de6510 --- /dev/null +++ b/src/latexdocvisitor.h @@ -0,0 +1,788 @@ +/****************************************************************************** + * + * + * + * + * 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 _LATEXDOCVISITOR_H +#define _LATEXDOCVISITOR_H + +#include "docvisitor.h" +#include "docparser.h" +#include "language.h" +#include "doxygen.h" +#include "outputgen.h" +#include "code.h" +#include "dot.h" + +/*! @brief Concrete visitor implementation for LaTeX output. */ +class LatexDocVisitor : public DocVisitor +{ + public: + LatexDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) + : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) {} + + //-------------------------------------- + // visitor functions for leaf nodes + //-------------------------------------- + + 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 << "$\\backslash$"; 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 << "\\copyright"; break; + case DocSymbol::Apos: m_t << "'"; break; + case DocSymbol::Quot: m_t << "''"; break; + case DocSymbol::Uml: + if (s->letter()=='i') + m_t << "\\\"{\\i}"; + else + m_t << "\\\"{" << s->letter() << "}"; + break; + case DocSymbol::Acute: + if (s->letter()=='i') + m_t << "\\'{\\i}"; + else + m_t << "\\'{" << s->letter() << "}"; + break; + case DocSymbol::Grave: + if (s->letter()=='i') + m_t << "\\`{\\i}"; + else + m_t << "\\`{" << s->letter() << "}"; + break; + case DocSymbol::Circ: + if (s->letter()=='i') + m_t << "\\^{\\i}"; + else + m_t << "\\^{" << s->letter() << "}"; + break; + case DocSymbol::Tilde: m_t << "\\~{" << s->letter() << "}"; + case DocSymbol::Szlig: m_t << "\"s"; break; + case DocSymbol::Cedil: m_t << "\\c{" << s->letter() << "}"; break; + case DocSymbol::Ring: m_t << "\\" << s->letter() << s->letter(); break; + case DocSymbol::Nbsp: m_t << "\\ "; break; + default: + printf("Error: unknown symbol found\n"); + } + } + void visit(DocURL *u) + { + if (m_hide) return; + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\href{" << u->url() << "}"; + } + m_t << "{\\tt " << u->url() << "}"; + } + void visit(DocLineBreak *) + { + if (m_hide) return; + m_t << "\\par\n"; + } + void visit(DocHorRuler *) + { + if (m_hide) return; + m_t << "\n\n"; + } + void visit(DocStyleChange *s) + { + if (m_hide) return; + switch (s->style()) + { + case DocStyleChange::Bold: + if (s->enable()) m_t << "{\\bf "; else m_t << "} "; + break; + case DocStyleChange::Italic: + if (s->enable()) m_t << "{\\em "; else m_t << "} "; + break; + case DocStyleChange::Code: + if (s->enable()) m_t << "{\\tt "; else m_t << "} "; + break; + case DocStyleChange::Subscript: + if (s->enable()) m_t << "$_{\\mbox{"; else m_t << "}}$ "; + break; + case DocStyleChange::Superscript: + if (s->enable()) m_t << "$^{\\mbox{"; else m_t << "}}$ "; + break; + case DocStyleChange::Center: + if (s->enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} "; + break; + case DocStyleChange::Small: + if (s->enable()) m_t << "\\footnotesize "; else m_t << "\\normalsize "; + break; + } + } + void visit(DocVerbatim *s) + { + if (m_hide) return; + switch(s->type()) + { + case DocVerbatim::Code: // fall though + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + parseCode(m_ci,s->context(),s->text(),FALSE,0); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + case DocVerbatim::Verbatim: + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + m_t << s->text(); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + case DocVerbatim::HtmlOnly: + /* nothing */ + break; + case DocVerbatim::LatexOnly: + m_t << s->text(); + break; + } + } + void visit(DocAnchor *anc) + { + if (m_hide) return; + m_t << "\\label{" << anc->anchor() << "}" << endl; + if (!anc->file().isEmpty() && Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hypertarget{" << anc->file() << "_" << anc->anchor() + << "}{}" << endl; + } + } + void visit(DocInclude *inc) + { + if (m_hide) return; + switch(inc->type()) + { + case DocInclude::Include: + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + case DocInclude::DontInclude: + break; + case DocInclude::HtmlInclude: + break; + case DocInclude::VerbInclude: + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + m_t << inc->text(); + m_t << "\\end{verbatim}\\normalsize" << endl; + break; + } + } + void visit(DocIncOperator *op) + { + //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", + // op->type(),op->isFirst(),op->isLast(),op->text().data()); + if (op->isFirst()) + { + m_t << "\n\n\\footnotesize\\begin{verbatim}"; + m_hide = TRUE; + } + if (op->type()!=DocIncOperator::Skip) + { + parseCode(m_ci,op->context(),op->text(),FALSE,0); + } + if (op->isLast()) + { + m_hide = FALSE; + m_t << "\\end{verbatim}\\normalsize" << endl; + } + else + { + m_t << endl; + } + } + void visit(DocFormula *f) + { + if (m_hide) return; + m_t << f->text(); + } + + //-------------------------------------- + // visitor functions for compound nodes + //-------------------------------------- + + void visitPre(DocAutoList *l) + { + if (l->isEnumList()) + { + m_t << "\\begin{enumerate}" << endl; + } + else + { + m_t << "\\begin{itemize}" << endl; + } + } + void visitPost(DocAutoList *l) + { + if (l->isEnumList()) + { + m_t << "\\end{enumerate}" << endl; + } + else + { + m_t << "\\end{itemize}" << endl; + } + } + void visitPre(DocAutoListItem *) + { + m_t << "\\item "; + } + void visitPost(DocAutoListItem *) + { + } + 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 << endl << endl; + } + void visitPre(DocRoot *) + { + } + void visitPost(DocRoot *) + { + } + void visitPre(DocSimpleSect *s) + { + m_t << "\\begin{Desc}\n\\item["; + 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; + } + + // special case 1: user defined title + if (s->type()!=DocSimpleSect::User) + { + m_t << ":]"; + } + } + void visitPost(DocSimpleSect *) + { + m_t << "\\end{Desc}" << endl; + } + void visitPre(DocTitle *) + { + } + void visitPost(DocTitle *) + { + m_t << "]"; + } + void visitPre(DocSimpleList *) + { + m_t << "\\begin{itemize}" << endl; + } + void visitPost(DocSimpleList *) + { + m_t << "\\end{itemize}" << endl; + } + void visitPre(DocSimpleListItem *) + { + m_t << "\\item "; + } + void visitPost(DocSimpleListItem *) + { + } + void visitPre(DocSection *s) + { + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hypertarget{" << s->file() << "_" << s->anchor() << "}{}"; + } + if (s->level()==1) + { + if (Config_getBool("COMPACT_LATEX")) + { + m_t << "\\subsubsection{"; + } + else + { + m_t << "\\subsection{"; + } + } + else if (s->level()==2) + { + if (Config_getBool("COMPACT_LATEX")) + { + m_t << "\\paragraph{"; + } + else + { + m_t << "\\subsubsection{"; + } + } + filter(s->title()); + m_t << "}\\label{" << s->anchor() << "}" << endl; + } + void visitPost(DocSection *) + { + } + void visitPre(DocHtmlList *s) + { + if (s->type()==DocHtmlList::Ordered) + m_t << "\\begin{enumerate}" << endl; + else + m_t << "\\begin{itemize}" << endl; + } + void visitPost(DocHtmlList *s) + { + if (s->type()==DocHtmlList::Ordered) + m_t << "\\end{enumerate}" << endl; + else + m_t << "\\end{itemize}" << endl; + } + void visitPre(DocHtmlListItem *) + { + m_t << "\\item "; + } + void visitPost(DocHtmlListItem *) + { + } + void visitPre(DocHtmlPre *) + { + m_t << "\\small\\begin{alltt}"; + m_insidePre=TRUE; + } + void visitPost(DocHtmlPre *) + { + m_insidePre=FALSE; + m_t << "\\end{alltt}\\normalsize " << endl; + } + void visitPre(DocHtmlDescList *) + { + m_t << "\\begin{description}" << endl; + } + void visitPost(DocHtmlDescList *) + { + m_t << "\\end{description}" << endl; + } + void visitPre(DocHtmlDescTitle *) + { + m_t << "\\item["; + } + void visitPost(DocHtmlDescTitle *) + { + m_t << "]"; + } + void visitPre(DocHtmlDescData *) + { + } + void visitPost(DocHtmlDescData *) + { + } + void visitPre(DocHtmlTable *t) + { + if (t->hasCaption()) + { + m_t << "\\begin{table}[h]"; + } + m_t << "\\begin{TabularC}{" << t->numCols() << "}\n\\hline\n"; + } + void visitPost(DocHtmlTable *t) + { + if (t->hasCaption()) + { + m_t << "\\end{table}\n"; + } + else + { + m_t << "\\\\\\hline\n\\end{TabularC}\n"; + } + } + void visitPre(DocHtmlCaption *) + { + m_t << "\\\\\\hline\n\\end{TabularC}\n\\centering\n\\caption{"; + } + void visitPost(DocHtmlCaption *) + { + m_t << "}\n"; + } + void visitPre(DocHtmlRow *) + { + } + void visitPost(DocHtmlRow *) + { + m_t << "\\\\\\hline\n"; + } + void visitPre(DocHtmlCell *) + { + } + void visitPost(DocHtmlCell *c) + { + if (!c->isLast()) m_t << "&"; + } + void visitPre(DocIndexEntry *) + { + m_hide = TRUE; + } + void visitPost(DocIndexEntry *) + { + m_hide = FALSE; + } + void visitPre(DocInternal *) + { + m_t << "\\begin{Desc}" << endl + << "\\item[" << theTranslator->trForInternalUseOnly() << "]" << endl; + } + void visitPost(DocInternal *) + { + m_t << "\\end{Desc}" << endl; + } + void visitPre(DocHRef *href) + { + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\href{"; + m_t << href->url(); + m_t << "}"; + } + m_t << "{\\tt "; + } + void visitPost(DocHRef *) + { + m_t << "}"; + } + void visitPre(DocHtmlHeader *header) + { + if (Config_getBool("COMPACT_LATEX")) + { + switch(header->level()) + { + case 1: m_t << "\\subsection{"; break; + case 2: m_t << "\\subsubsection{"; break; + case 3: m_t << "\\paragraph{"; break; + } + } + else + { + switch(header->level()) + { + case 1: m_t << "\\section{"; break; + case 2: m_t << "\\subsection{"; break; + case 3: m_t << "\\subsubsection{"; break; + } + } + } + void visitPost(DocHtmlHeader *) + { + m_t << "}"; + } + void visitPre(DocImage *img) + { + if (img->type()==DocImage::Latex) + { + if (img->hasCaption()) + { + m_t << "\\begin{figure}[H]" << endl; + m_t << "\\begin{center}" << endl; + } + else + { + m_t << "\\mbox{"; + } + QCString gfxName = img->name(); + if (gfxName.right(4)==".eps" || gfxName.right(4)==".pdf") + { + gfxName=gfxName.left(gfxName.length()-4); + } + m_t << "\\includegraphics"; + if (!img->width().isEmpty()) + { + m_t << "[width=" << img->width() << "]"; + } + else if (!img->height().isEmpty()) + { + m_t << "[height=" << img->height() << "]"; + } + m_t << "{" << gfxName << "}"; + if (img->hasCaption()) + { + m_t << "\\caption{"; + } + } + else // other format -> skip + { + m_hide=TRUE; + } + } + void visitPost(DocImage *img) + { + if (img->type()==DocImage::Latex) + { + m_t << "}" << endl; // end mbox or caption + if (img->hasCaption()) + { + m_t << "\\end{center}" << endl; + m_t << "\\end{figure}" << endl; + } + } + else // other format + { + m_hide=FALSE; + } + } + void visitPre(DocDotFile *df) + { + QCString baseName=df->file(); + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") + { + baseName=baseName.left(baseName.length()-4); + } + QCString outDir = Config_getString("LATEX_OUTPUT"); + writeDotGraphFromFile(df->file(),outDir,baseName,EPS); + if (df->hasCaption()) + { + m_t << "\\begin{figure}[H]" << endl; + m_t << "\\begin{center}" << endl; + } + else + { + m_t << "\\mbox{"; + } + m_t << "\\includegraphics"; + if (!df->width().isEmpty()) + { + m_t << "[width=" << df->width() << "]"; + } + else if (!df->height().isEmpty()) + { + m_t << "[height=" << df->height() << "]"; + } + m_t << "{" << baseName << "}"; + + if (df->hasCaption()) + { + m_t << "\\caption{"; + } + } + void visitPost(DocDotFile *df) + { + m_t << "}" << endl; // end mbox or caption + if (df->hasCaption()) + { + m_t << "\\end{center}" << endl; + m_t << "\\end{figure}" << endl; + } + } + 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(); + m_t << " "; + } + void visitPre(DocSecRefItem *) + { + m_t << "\\item \\contentsline{section}{"; + } + void visitPost(DocSecRefItem *ref) + { + m_t << "}{\\ref{" << ref->anchor() << "}}{}" << endl; + } + void visitPre(DocSecRefList *) + { + m_t << "\\footnotesize" << endl; + m_t << "\\begin{multicols}{2}" << endl; + m_t << "\\begin{CompactList}" << endl; + } + void visitPost(DocSecRefList *) + { + m_t << "\\end{CompactList}" << endl; + m_t << "\\end{multicols}" << endl; + m_t << "\\normalsize" << endl; + } + void visitPre(DocLanguage *) + { + } + void visitPost(DocLanguage *) + { + } + void visitPre(DocParamSect *s) + { + m_t << "\\begin{Desc}" << endl; + m_t << "\\item["; + 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; + default: + ASSERT(0); + } + m_t << ":]" << endl; + m_t << "\\begin{description}" << endl; + } + void visitPost(DocParamSect *) + { + m_t << "\\end{description}" << endl; + m_t << "\\end{Desc}" << endl; + } + void visitPre(DocParamList *pl) + { + m_t << "\\item[{\\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 << "}]"; + } + void visitPost(DocParamList *) + { + } + void visitPre(DocXRefItem *x) + { + m_t << "\\begin{Desc}" << endl; + m_t << "\\item["; + if (Config_getBool("PDF_HYPERLINKS")) + { + m_t << "\\hyperlink{" << x->file() << "_" << x->anchor() << "}{"; + } + else + { + m_t << "{\\bf "; + } + filter(x->title()); + m_t << "}]"; + } + void visitPost(DocXRefItem *) + { + m_t << "\\end{Desc}" << endl; + } + void visitPre(DocInternalRef *ref) + { + startLink(0,ref->file(),ref->anchor()); + } + void visitPost(DocInternalRef *) + { + endLink(); + m_t << " "; + } + void visitPre(DocCopy *) + { + } + void visitPost(DocCopy *) + { + } + + private: + + //-------------------------------------- + // helper functions + //-------------------------------------- + + void filter(const char *str); + void startLink(const QCString &ref,const QCString &file, + const QCString &anchor); + void endLink(); + + //-------------------------------------- + // state variables + //-------------------------------------- + + QTextStream &m_t; + BaseCodeDocInterface &m_ci; + bool m_insidePre; + bool m_hide; +}; + +#endif diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 987538b..d9f7b24 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -29,6 +29,7 @@ #include "version.h" #include "dot.h" #include "page.h" +#include "latexdocvisitor.h" //static QCString filterTitle(const char *s) //{ @@ -242,6 +243,7 @@ static void writeDefaultHeaderPart1(QTextStream &t) t << "\\usepackage{makeidx}\n" "\\usepackage{fancyhdr}\n" "\\usepackage{graphicx}\n" + "\\usepackage{multicol}\n" "\\usepackage{float}\n" "\\usepackage{alltt}\n"; if (Config_getBool("PDF_HYPERLINKS")) @@ -1163,6 +1165,7 @@ void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) void LatexGenerator::writeAnchor(const char *fName,const char *name) { + //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name); t << "\\label{" << name << "}" << endl; if (fName && Config_getBool("PDF_HYPERLINKS")) { @@ -1283,158 +1286,42 @@ void LatexGenerator::writeSectionRefItem(const char *,const char *lab, // t << " (p.\\,\\pageref{" << lab << "})" << endl; //} -//void LatexGenerator::docify(const char *str) -//{ -// docifyStatic(t,str); -//} - -/*! - * Function converts Latin2 character to latex strin] representin the same - * character. - */ -void LatexGenerator::latin2ToLatex(unsigned char c) -{ - switch (c) - { - case 0xA1: t << c; break; - case 0xA2: t << c; break; - case 0xA3: t << c; break; - case 0xA4: t << c; break; - case 0xA5: t << c; break; - case 0xA6: t << "\\'{S}"; break; - case 0xA7: t << c; break; - case 0xA8: t << c; break; - case 0xA9: t << "\\v{S}"; break; - case 0xAA: t << "\\c{S}"; break; - case 0xAB: t << "\\v{T}"; break; - case 0xAC: t << "\\'{Z}"; break; - case 0xAD: t << c; break; - case 0xAE: t << "\\v{Z}"; break; - case 0xAF: t << "\\.{Z}"; break; - - case 0xB0: t << c; break; - case 0xB1: t << c; break; - case 0xB2: t << c; break; - case 0xB3: t << c; break; - case 0xB4: t << c; break; - case 0xB5: t << c; break; - case 0xB6: t << "\\'{s}"; break; - case 0xB7: t << c; break; - case 0xB8: t << c; break; - case 0xB9: t << "\\v{s}"; break; - case 0xBA: t << "\\c{s}"; break; - case 0xBB: t << "\\v{t}"; break; - case 0xBC: t << "\\'{z}"; break; - case 0xBD: t << c; break; - case 0xBE: t << "\\v{z}"; break; - case 0xBF: t << "\\.{z}"; break; - - case 0xC0: t << "\\'{R}"; break; - case 0xC1: t << "\\'{A}"; break; - case 0xC2: t << "\\^{A}"; break; - case 0xC3: t << "\\u{A}"; break; - case 0xC4: t << "\\\"{A}"; break; - case 0xC5: t << "\\'{L}"; break; - case 0xC6: t << "\\'{C}"; break; - case 0xC7: t << "\\c{C}"; break; - case 0xC8: t << "\\v{C}"; break; - case 0xC9: t << "\\'{E}"; break; - case 0xCA: t << "\\c{E}"; break; - case 0xCB: t << "\\\"{E}"; break; - case 0xCC: t << "\\v{E}"; break; - case 0xCD: t << "\\'{I}"; break; - case 0xCE: t << "\\^{I}"; break; - case 0xCF: t << "\\v{D}"; break; - - case 0xD0: t << "\\bar{D}"; break; - case 0xD1: t << "\\'{N}"; break; - case 0xD2: t << "\\v{N}"; break; - case 0xD3: t << "\\'{O}"; break; - case 0xD4: t << "\\^{O}"; break; - case 0xD5: t << "\\H{O}"; break; - case 0xD6: t << "\\\"{O}"; break; - case 0xD7: t << c; break; - case 0xD8: t << "\\v{R}"; break; - case 0xD9: t << c; break; - case 0xDA: t << "\\'{U}"; break; - case 0xDB: t << "\\H{U}"; break; - case 0xDC: t << "\\\"{U}"; break; - case 0xDD: t << "\\'{Y}"; break; - case 0xDE: t << "\\c{T}"; break; - case 0xDF: t << "\\ss"; break; - - case 0xE0: t << "\\'{r}"; break; - case 0xE1: t << "\\'{a}"; break; - case 0xE2: t << "\\^{a}"; break; - case 0xE3: t << c; break; - case 0xE4: t << "\\\"{a}"; break; - case 0xE5: t << "\\'{l}"; break; - case 0xE6: t << "\\'{c}"; break; - case 0xE7: t << "\\c{c}"; break; - case 0xE8: t << "\\v{c}"; break; - case 0xE9: t << "\\'{e}"; break; - case 0xEA: t << c; break; - case 0xEB: t << "\\\"{e}"; break; - case 0xEC: t << "\\v{e}"; break; - case 0xED: t << "\\'{\\i}"; break; - case 0xEE: t << "\\^{\\i}"; break; - case 0xEF: t << "\\v{d}"; break; - - case 0xF0: t << "\\bar{d}"; break; - case 0xF1: t << "\\'{n}"; break; - case 0xF2: t << "\\v{n}"; break; - case 0xF3: t << "\\'{o}"; break; - case 0xF4: t << "\\^{o}"; break; - case 0xF5: t << "\\H{o}"; break; - case 0xF6: t << "\\\"{o}"; break; - case 0xF7: t << c; break; - case 0xF8: t << "\\v{r}"; break; - case 0xF9: t << c; break; - case 0xFA: t << "\\'{u}"; break; - case 0xFB: t << "\\H{u}"; break; - case 0xFC: t << "\\\"{u}"; break; - case 0xFD: t << "\\'{y}"; break; - case 0xFE: t << c; break; - case 0xFF: t << c; break; - - default: t << c; - } -} //void LatexGenerator::docifyStatic(QTextStream &t,const char *str) void LatexGenerator::docify(const char *str) { - static bool isCzech = theTranslator->idLanguage()=="czech"; +#if 0 + //static bool isCzech = theTranslator->idLanguage()=="czech"; static bool isJapanese = theTranslator->idLanguage()=="japanese"; - static bool isKorean = theTranslator->idLanguage()=="korean"; - static bool isRussian = theTranslator->idLanguage()=="russian"; - static bool isUkrainian = theTranslator->idLanguage()=="ukrainian"; - static bool isChinese = theTranslator->idLanguage()=="chinese" || - theTranslator->idLanguage()=="chinese-traditional"; - static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2"; - static bool isGreek = theTranslator->idLanguage()=="greek"; + //static bool isKorean = theTranslator->idLanguage()=="korean"; + //static bool isRussian = theTranslator->idLanguage()=="russian"; + //static bool isUkrainian = theTranslator->idLanguage()=="ukrainian"; + //static bool isChinese = theTranslator->idLanguage()=="chinese" || + // theTranslator->idLanguage()=="chinese-traditional"; + //static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2"; + //static bool isGreek = theTranslator->idLanguage()=="greek"; if (str) { const unsigned char *p=(const unsigned char *)str; unsigned char c; unsigned char pc='\0'; + bool multiByte = FALSE; while (*p) { - static bool MultiByte = FALSE; c=*p++; if( isJapanese) { - if (MultiByte) + if (multiByte) { t << (char)c; - MultiByte = FALSE; + multiByte = FALSE; pc = c; continue; } if (c>=0x80) { - MultiByte = TRUE; + multiByte = TRUE; t << (char)c; pc = c; continue; @@ -1453,185 +1340,13 @@ void LatexGenerator::docify(const char *str) } else { - switch(c) - { - case '#': t << "\\#"; break; - case '$': t << "\\$"; break; - case '%': t << "\\%"; break; - case '^': t << "$^\\wedge$"; break; - case '&': t << "\\&"; break; - case '*': t << "$\\ast$"; break; - case '_': t << "\\_"; - if (!insideTabbing) t << "\\-"; - break; - case '{': t << "\\{"; break; - case '}': t << "\\}"; break; - case '<': t << "$<$"; break; - case '>': t << "$>$"; break; - case '|': t << "$|$"; break; - case '~': t << "$\\sim$"; break; - case '[': if (Config_getBool("PDF_HYPERLINKS")) - t << "\\mbox{[}"; - else - t << "["; - break; - case ']': if (pc=='[') t << "$\\,$"; - if (Config_getBool("PDF_HYPERLINKS")) - t << "\\mbox{]}"; - else - t << "]"; - break; - case '-': if (*p=='>') - { t << " $\\rightarrow$ "; p++; } - else - { t << (char)c; } - break; - case '\\': if (*p=='<') - { t << "$<$"; p++; } - else if (*p=='>') - { t << "$>$"; p++; } - else - { t << "$\\backslash$"; } - break; - case '"': { t << "\\char`\\\"{}"; } - break; - - default: - // Some languages uses wide characters - if (isJapanese || isKorean || isChinese) - { - if (c>=128) - { - t << (char)c; - if (*p) - { - c = *p++; - t << (char)c; - } - } - else // ascii char => see if we can insert a hypenation hint - { - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - else if (isCzech || isRussian || isUkrainian) - { - if (c>=128) - { - t << (char)c; - } - else // ascii char => see if we can insert a hypenation hint - { - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - else if (isLatin2) - { - if (c>=128) - { - latin2ToLatex(c); - } - else - { - // see if we can insert an hyphenation hint - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - else if (isGreek) - { - if (c<128) - { - t << "\\textlatin{" << (char)c << "}"; - } - else - { - t << (char)c; - } - } - else // language is other than Czech, Russian or Japanese - { - switch(c) - { - // the Latin-1 characters - case 161: t << "!`"; break; - case 181: t << "$\\mu$"; break; - case 191: t << "?`"; break; - case 192: t << "\\`{A}"; break; - case 193: t << "\\'{A}"; break; - case 194: t << "\\^{A}"; break; - case 195: t << "\\~{A}"; break; - case 196: t << "\\\"{A}"; break; - case 197: t << "\\AA{}"; break; - case 198: t << "\\AE{}"; break; - case 199: t << "\\c{C}"; break; - case 200: t << "\\`{E}"; break; - case 201: t << "\\'{E}"; break; - case 202: t << "\\^{E}"; break; - case 203: t << "\\\"{E}"; break; - case 204: t << "\\`{I}"; break; - case 205: t << "\\'{I}"; break; - case 206: t << "\\^{I}"; break; - case 207: t << "\\\"{I}"; break; - case 208: t << "D "; break; // anyone know the real code? - case 209: t << "\\~{N}"; break; - case 210: t << "\\`{O}"; break; - case 211: t << "\\'{O}"; break; - case 212: t << "\\^{O}"; break; - case 213: t << "\\~{O}"; break; - case 214: t << "\\\"{O}"; break; - case 215: t << "$\\times$"; break; - case 216: t << "\\O"; break; - case 217: t << "\\`{U}"; break; - case 218: t << "\\'{U}"; break; - case 219: t << "\\^{U}"; break; - case 220: t << "\\\"{U}"; break; - case 221: t << "\\'{Y}"; break; - case 223: t << "\\ss{}"; break; - case 224: t << "\\`{a}"; break; - case 225: t << "\\'{a}"; break; - case 226: t << "\\^{a}"; break; - case 227: t << "\\~{a}"; break; - case 228: t << "\\\"{a}"; break; - case 229: t << "\\aa{}"; break; - case 230: t << "\\ae{}"; break; - case 231: t << "\\c{c}"; break; - case 232: t << "\\`{e}"; break; - case 233: t << "\\'{e}"; break; - case 234: t << "\\^{e}"; break; - case 235: t << "\\\"{e}"; break; - case 236: t << "\\`{\\i}"; break; - case 237: t << "\\'{\\i}"; break; - case 238: t << "\\^{\\i}"; break; - case 239: t << "\\\"{\\i}"; break; - case 241: t << "\\~{n}"; break; - case 242: t << "\\`{o}"; break; - case 243: t << "\\'{o}"; break; - case 244: t << "\\^{o}"; break; - case 245: t << "\\~{o}"; break; - case 246: t << "\\\"{o}"; break; - case 248: t << "\\o{}"; break; - case 249: t << "\\`{u}"; break; - case 250: t << "\\'{u}"; break; - case 251: t << "\\^{u}"; break; - case 252: t << "\\\"{u}"; break; - case 253: t << "\\'{y}"; break; - case 255: t << "\\\"{y}"; break; - default: // normal ascii char - { - // see if we can insert an hyphenation hint - if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; - } - } - } - } + filterLatexChar(t,c,insideTabbing); } pc = c; } } +#endif + filterLatexString(t,str,insideTabbing,insidePre); } void LatexGenerator::codify(const char *str) @@ -1965,3 +1680,10 @@ void LatexGenerator::endSectionRefList() t << "\\normalsize" << endl; } +void LatexGenerator::printDoc(DocNode *n) +{ + LatexDocVisitor *visitor = new LatexDocVisitor(t,*this); + n->accept(visitor); + delete visitor; +} + diff --git a/src/latexgen.h b/src/latexgen.h index cf36929..11a0516 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -15,8 +15,8 @@ * */ -#ifndef OUTPUT_H -#define OUTPUT_H +#ifndef LATEXGEN_H +#define LATEXGEN_H #include "outputgen.h" @@ -42,6 +42,8 @@ class LatexGenerator : public OutputGenerator bool isEnabled(OutputType o) { return (o==Latex && active); } OutputGenerator *get(OutputType o) { return (o==Latex) ? this : 0; } + void printDoc(DocNode *); + void startFile(const char *name,const char *manName, const char *title, bool external); void writeFooter(int,bool) {} @@ -287,7 +289,6 @@ class LatexGenerator : public OutputGenerator void writeCodeAnchor(const char *) {} private: - void latin2ToLatex(unsigned char); LatexGenerator(const LatexGenerator &); LatexGenerator &operator=(const LatexGenerator &); int col; diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index ac5c03d..700c9da 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -22,12 +22,16 @@ HEADERS = bufstr.h \ cmdmapper.h \ code.h \ commentcnv.h \ + config.h \ constexp.h \ cppvalue.h \ debug.h \ + declinfo.h \ + defargs.h \ defgen.h \ - doxygen.h \ - scanner.h \ + define.h \ + definition.h \ + diagram.h \ doc.h \ docparser.h \ doctokenizer.h \ @@ -41,12 +45,14 @@ HEADERS = bufstr.h \ formula.h \ ftvhelp.h \ groupdef.h \ + htmldocvisitor.h \ htmlgen.h \ htmlhelp.h \ image.h \ index.h \ instdox.h \ language.h \ + latexdocvisitor.h \ latexgen.h \ logos.h \ mangen.h \ @@ -75,9 +81,11 @@ HEADERS = bufstr.h \ translator.h \ translator_adapter.h \ translator_br.h \ + translator_ca.h \ translator_cn.h \ translator_cz.h \ translator_de.h \ + translator_dk.h \ translator_en.h \ translator_es.h \ translator_fi.h \ @@ -96,6 +104,10 @@ HEADERS = bufstr.h \ translator_ru.h \ translator_se.h \ translator_si.h \ + translator_sk.h \ + translator_sr.h \ + translator_tw.h \ + translator_ua.h \ treeview.h \ unistd.h \ util.h \ @@ -127,12 +139,14 @@ SOURCES = ce_lex.cpp \ formula.cpp \ ftvhelp.cpp \ groupdef.cpp \ + htmldocvisitor.cpp \ htmlgen.cpp \ htmlhelp.cpp \ image.cpp \ index.cpp \ instdox.cpp \ language.cpp \ + latexdocvisitor.cpp \ latexgen.cpp \ logos.cpp \ mangen.cpp \ diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 64aeb4c..3127259 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -552,6 +552,8 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() */ bool MemberDef::isBriefSectionVisible() const { + bool hasDocs = hasDocumentation(); + // only include static members with file/namespace scope if // explicitly enabled in the config file bool visibleIfStatic = !(getClassDef()==0 && @@ -562,7 +564,7 @@ bool MemberDef::isBriefSectionVisible() const // only include members is the are documented or // HIDE_UNDOC_MEMBERS is NO in the config file bool visibleIfDocumented = (!Config_getBool("HIDE_UNDOC_MEMBERS") || - hasDocumentation() || + hasDocs || isDocumentedFriendClass() ); @@ -574,6 +576,15 @@ bool MemberDef::isBriefSectionVisible() const !Config_getBool("REPEAT_BRIEF") ); + // Hide friend (class|struct|union) declarations if HIDE_FRIEND_COMPOUNDS is true + bool visibleIfFriendCompound = !(Config_getBool("HIDE_FRIEND_COMPOUNDS") && + isFriend() && + (type=="friend class" || + type=="friend struct" || + type=="friend union" + ) + ); + // only include members that are non-private unless EXTRACT_PRIVATE is // set to YES or the member is part of a group bool visibleIfPrivate = (protection()!=Private || @@ -581,8 +592,28 @@ bool MemberDef::isBriefSectionVisible() const mtype==Friend ); - bool visible = visibleIfStatic && visibleIfDocumented && - visibleIfEnabled && visibleIfPrivate && !annScope; + // hide member if it overrides a member in a superclass and has no + // documentation + bool visibleIfDocVirtual = (reimplements() || hasDocs); + + // true if this member is a constructor or destructor + bool cOrDTor = isConstructor() || isDestructor(); + + // hide default constructors or destructors (no args) without + // documentation + bool visibleIfNotDefaultCDTor = !(cOrDTor && + defArgList && + (defArgList->isEmpty() || + defArgList->first()->type == "void" + ) && + !hasDocs + ); + + bool visible = visibleIfStatic && visibleIfDocumented && + visibleIfEnabled && visibleIfPrivate && + visibleIfDocVirtual && visibleIfNotDefaultCDTor && + visibleIfFriendCompound && + !annScope; //printf("MemberDef::isBriefSectionVisible() %d\n",visible); return visible; } @@ -896,9 +927,11 @@ bool MemberDef::isDetailedSectionLinkable() const // is documented enum value (mtype==EnumValue && !briefDescription().isEmpty()) || // has brief description that is part of the detailed description - (!briefDescription().isEmpty() && - Config_getBool("ALWAYS_DETAILED_SEC") && - Config_getBool("REPEAT_BRIEF") + (!briefDescription().isEmpty() && // has brief docs + (Config_getBool("ALWAYS_DETAILED_SEC") && // they or visible in + Config_getBool("REPEAT_BRIEF") || // detailed section or + !Config_getBool("BRIEF_MEMBER_DESC") // they are explicitly not + ) // shown in brief section ) || // has a multi-line initialization block //(initLines>0 && initLines<maxInitLines) || @@ -1196,9 +1229,9 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, /* write brief description */ if (!brief.isEmpty() && - (Config_getBool("REPEAT_BRIEF") - /* || (!Config_getBool("BRIEF_MEMBER_DESC") && documentation().isEmpty())*/ - ) /* || !annMemb */ + (Config_getBool("REPEAT_BRIEF") || + !Config_getBool("BRIEF_MEMBER_DESC") + ) ) { parseDoc(ol,briefFile(),briefLine(),scopeName,this,brief); @@ -1493,10 +1526,15 @@ void MemberDef::warnIfUndocumented() else t="file", d=fd; - if (d && d->isLinkable() && !isLinkable() && !isDocumentedFriendClass() - && name().find('@')==-1) + if (d && d->isLinkable() && !isLinkable() && + !isDocumentedFriendClass() && + name().find('@')==-1 && + (prot!=Private || Config_getBool("EXTRACT_PRIVATE")) + ) + { warn_undoc(m_defFileName,m_defLine,"Warning: Member %s of %s %s is not documented.", name().data(),t,d->name().data()); + } } @@ -1730,3 +1768,13 @@ Specifier MemberDef::virtualness() const return v; } +bool MemberDef::isConstructor() const +{ + return classDef ? name()==classDef->localName() : FALSE; +} + +bool MemberDef::isDestructor() const +{ + return name().find('~')!=-1 && name().find("operator")==-1; +} + diff --git a/src/memberdef.h b/src/memberdef.h index 073b5f6..8dd36f3 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -120,6 +120,8 @@ class MemberDef : public Definition bool isExplicit() const { return (memSpec&Entry::Explicit)!=0; } bool isMutable() const { return (memSpec&Entry::Mutable)!=0; } bool isExternal() const { return explExt; } + bool isConstructor() const; + bool isDestructor() const; bool hasOneLineInitializer() const; bool hasMultiLineInitializer() const; diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 76854bf..6403053 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -31,7 +31,8 @@ NamespaceDef::NamespaceDef(const char *df,int dl, const char *name,const char *lref) : Definition(df,dl,name) { - fileName=(QCString)"namespace"+name; + fileName="namespace"; + fileName+=name; classSDict = new ClassSDict(17); namespaceSDict = new NamespaceSDict(17); m_innerCompounds = new SDict<Definition>(17); diff --git a/src/outputgen.h b/src/outputgen.h index 7390e45..48752cc 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -120,15 +120,6 @@ class BaseOutputDocInterface : public BaseCodeDocInterface /*! Starts a new paragraph */ virtual void newParagraph() = 0; - /*! Starts a enumeration list: e.g. \c <ol> in html. - * writeListItem() is used for the items. - */ - virtual void startEnumList() = 0; - - /*! Ends an enumeration list: e.g. \c </ol> in html. - */ - virtual void endEnumList() = 0; - /*! Writes a link to an object in the documentation. * \param ref If this is non-zero, the object is to be found in * an external documentation file. @@ -150,10 +141,6 @@ class BaseOutputDocInterface : public BaseCodeDocInterface */ virtual void endHtmlLink() = 0; - /*! Writes a (link to an) email address found in the documentation. - * \param url The email address, this is also used for the link text. - */ - virtual void writeMailLink(const char *url) = 0; /*! Changes the text font to bold face. The bold section ends with * endBold() @@ -190,21 +177,8 @@ class BaseOutputDocInterface : public BaseCodeDocInterface */ virtual void endCodeFragment() = 0; - /*! Starts a fragment of preformatted text. This means that - * spacing, tabs and newlines should be kept in the output - */ - virtual void startPreFragment() = 0; - - /*! Ends a preformatted text fragment. */ - virtual void endPreFragment() = 0; - /*! Starts a fragment of verbatim test. This is preformatted text, - * without any special internal structure. - */ - virtual void startVerbatimFragment() = 0; - /*! Ends a verbatim text fragment. */ - virtual void endVerbatimFragment() = 0; /*! Writes a horizontal ruler to the output */ virtual void writeRuler() = 0; @@ -224,14 +198,53 @@ class BaseOutputDocInterface : public BaseCodeDocInterface * description itself: e.g. \c <dd> in HTML. */ virtual void endDescItem() = 0; - virtual void startSubsection() = 0; - virtual void endSubsection() = 0; - virtual void startSubsubsection() = 0; - virtual void endSubsubsection() = 0; + virtual void startCenter() = 0; virtual void endCenter() = 0; virtual void startSmall() = 0; virtual void endSmall() = 0; + + virtual void startSimpleSect(SectionTypes t,const char *file, + const char *anchor,const char *title) = 0; + virtual void endSimpleSect() = 0; + virtual void startParamList(ParamListTypes t,const char *title) = 0; + virtual void endParamList() = 0; + + virtual void writeDescItem() = 0; + virtual void startTitle() = 0; + virtual void endTitle() = 0; + + virtual void writeAnchor(const char *fileName,const char *name) = 0; + virtual void startSection(const char *,const char *,SectionInfo::SectionType) = 0; + virtual void endSection(const char *,SectionInfo::SectionType) = 0; + + virtual void lineBreak() = 0; + virtual void addIndexItem(const char *s1,const char *s2) = 0; + + virtual void writeNonBreakableSpace(int) = 0; + virtual void startDescTable() = 0; + virtual void endDescTable() = 0; + virtual void startDescTableTitle() = 0; + virtual void endDescTableTitle() = 0; + virtual void startDescTableData() = 0; + virtual void endDescTableData() = 0; + virtual void startTextLink(const char *file,const char *anchor) = 0; + virtual void endTextLink() = 0; + virtual void startPageRef() = 0; + virtual void endPageRef(const char *,const char *) = 0; + + + /********************* Functions to remove *******************************/ + + virtual void writeMailLink(const char *url) = 0; + virtual void startPreFragment() = 0; + virtual void endPreFragment() = 0; + virtual void startVerbatimFragment() = 0; + virtual void endVerbatimFragment() = 0; + virtual void startSubsection() = 0; + virtual void endSubsection() = 0; + virtual void startSubsubsection() = 0; + virtual void endSubsubsection() = 0; virtual void startSubscript() = 0; virtual void endSubscript() = 0; virtual void startSuperscript() = 0; @@ -254,50 +267,26 @@ class BaseOutputDocInterface : public BaseCodeDocInterface virtual void writeRing(char) = 0; virtual void writeSharpS() = 0; virtual void writeCCedil(char) = 0; - virtual void startSimpleSect(SectionTypes t,const char *file, - const char *anchor,const char *title) = 0; - virtual void endSimpleSect() = 0; - virtual void startParamList(ParamListTypes t,const char *title) = 0; - virtual void endParamList() = 0; virtual void endDescTitle() = 0; - virtual void writeDescItem() = 0; - virtual void startTitle() = 0; - virtual void endTitle() = 0; - virtual void writeAnchor(const char *fileName,const char *name) = 0; - virtual void startSection(const char *,const char *,SectionInfo::SectionType) = 0; - virtual void endSection(const char *,SectionInfo::SectionType) = 0; virtual void writeSectionRef(const char *,const char *, const char *,const char *) = 0; virtual void writeSectionRefItem(const char *,const char *,const char *) = 0; - virtual void lineBreak() = 0; - virtual void addIndexItem(const char *s1,const char *s2) = 0; - virtual void writeFormula(const char *,const char *) = 0; - virtual void writeNonBreakableSpace(int) = 0; + virtual void startEnumList() = 0; + + virtual void endEnumList() = 0; virtual void startImage(const char *,const char *,bool) = 0; virtual void endImage(bool) = 0; virtual void startDotFile(const char *,bool) = 0; virtual void endDotFile(bool) = 0; - virtual void startDescTable() = 0; - virtual void endDescTable() = 0; - virtual void startDescTableTitle() = 0; - virtual void endDescTableTitle() = 0; - virtual void startDescTableData() = 0; - virtual void endDescTableData() = 0; - virtual void startTextLink(const char *file,const char *anchor) = 0; - virtual void endTextLink() = 0; - virtual void startPageRef() = 0; - virtual void endPageRef(const char *,const char *) = 0; - - - + virtual void writeFormula(const char *,const char *) = 0; virtual void startHtmlOnly() = 0; virtual void endHtmlOnly() = 0; virtual void startLatexOnly() = 0; virtual void endLatexOnly() = 0; - virtual void startSectionRefList() = 0; virtual void endSectionRefList() = 0; + /************************************************************************/ }; diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 20595bc..9e2247f 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -147,11 +147,6 @@ class PrintDocVisitor : public DocVisitor indent_leaf(); printf("<anchor name=\"%s\"/>",a->anchor().data()); } - void visit(DocCopy *c) - { - indent_leaf(); - printf("<copy link=\"%s\"/>",c->link().data()); - } void visit(DocInclude *inc) { indent_leaf(); @@ -456,7 +451,14 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocImage *img) { indent_pre(); - printf("<image src=\"%s\">\n",img->name().data()); + printf("<image src=\"%s\" type=\"",img->name().data()); + switch(img->type()) + { + case DocImage::Html: printf("html"); break; + case DocImage::Latex: printf("latex"); break; + case DocImage::Rtf: printf("rtf"); break; + } + printf("\" width=%s height=%s>\n",img->width().data(),img->height().data()); } void visitPost(DocImage *) { @@ -539,11 +541,12 @@ class PrintDocVisitor : public DocVisitor { printf("<param>%s</param>",s); } + printf("\n"); } void visitPost(DocParamList *) { indent_post(); - printf("</parameters>"); + printf("</parameters>\n"); } void visitPre(DocParamSect *ps) { @@ -556,23 +559,23 @@ class PrintDocVisitor : public DocVisitor case DocParamSect::Exception: printf("exception"); break; case DocParamSect::Unknown: printf("unknown"); break; } - printf(">"); + printf(">\n"); } void visitPost(DocParamSect *) { indent_post(); - printf("</paramsect>"); + printf("</paramsect>\n"); } void visitPre(DocXRefItem *x) { indent_pre(); - printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\"/>", + printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\"/>\n", x->file().data(),x->anchor().data(),x->title().data()); } void visitPost(DocXRefItem *) { indent_post(); - printf("<xrefitem/>"); + printf("<xrefitem/>\n"); } void visitPre(DocInternalRef *r) { @@ -584,6 +587,16 @@ class PrintDocVisitor : public DocVisitor indent_post(); printf("</internalref>\n"); } + void visitPre(DocCopy *c) + { + indent_pre(); + printf("<copy link=\"%s\">\n",c->link().data()); + } + void visitPost(DocCopy *) + { + indent_post(); + printf("</copy>\n"); + } private: // helper functions diff --git a/src/scanner.l b/src/scanner.l index ca13399..17dd7be 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -383,7 +383,7 @@ static QCString extractName(const QCString &s) static void setContext() { QCString fileName = yyFileName; - insideIDL = fileName.right(4)==".idl"; + insideIDL = fileName.right(4)==".idl" || fileName.right(4)==".odl"; insideJava = fileName.right(5)==".java"; insidePHP = fileName.right(4)==".php" || fileName.right(4)==".inc"; if ( insidePHP ) @@ -461,9 +461,12 @@ static void addSpecialItem(const char *listName) QCString cmdString; cmdString.sprintf("\\%s %d\n",listName,itemId); current->doc += cmdString; + QCString tmpName = current->name; + current->name = listName; sectionType=SectionInfo::Anchor; sectionLabel=anchorLabel; addSection(); + current->name = tmpName; } current->brief = slString.copy(); // restore orginial brief desc. } @@ -900,35 +903,59 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN( CompoundName ); } <FindMembers>{B}*"module"{BN}+ { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "module" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; lineCount(); - BEGIN( CompoundName ); + if (insideIDL) + { + isTypedef=FALSE; + current->section = Entry::NAMESPACE_SEC; + current->type = "module" ; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + BEGIN( CompoundName ); + } + else + { + addType( current ) ; + current->name = QCString(yytext).stripWhiteSpace(); + } } <FindMembers>{B}*"library"{BN}+ { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "library" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; lineCount(); - BEGIN( CompoundName ); + if (insideIDL) + { + isTypedef=FALSE; + current->section = Entry::NAMESPACE_SEC; + current->type = "library" ; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + BEGIN( CompoundName ); + } + else + { + addType( current ) ; + current->name = QCString(yytext).stripWhiteSpace(); + } } <FindMembers>{B}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba IDL interface - isTypedef=FALSE; - current->section = Entry::INTERFACE_SEC; - addType( current ) ; - current->type += " interface" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; lineCount(); - BEGIN( CompoundName ); + if (insideIDL) + { + isTypedef=FALSE; + current->section = Entry::INTERFACE_SEC; + addType( current ) ; + current->type += " interface" ; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + BEGIN( CompoundName ); + } + else + { + addType( current ) ; + current->name = QCString(yytext).stripWhiteSpace(); + } } <FindMembers>{B}*"exception"{BN}+ { // Corba IDL exception isTypedef=FALSE; @@ -950,19 +977,31 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) current->fileName = yyFileName; current->startLine = yyLineNr; current->bodyLine = yyLineNr; - //if (current->mtArgList) // transfer template arguments - //{ - // if (current->tArgList) - // { - // delete current->tArgList; - // } - // current->tArgList = current->mtArgList; - // current->mtArgList = 0; - //} lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } +<FindMembers>{B}*"coclass"{BN}+ { + if (insideIDL) + { + isTypedef=FALSE; + current->section = Entry::CLASS_SEC; + addType( current ) ; + current->type += " coclass" ; + current->fileName = yyFileName; + current->startLine = yyLineNr; + current->bodyLine = yyLineNr; + lineCount() ; + BEGIN( CompoundName ) ; + } + else + { + addType(current); + current->name = yytext; + current->name = current->name.stripWhiteSpace(); + lineCount(); + } + } <FindMembers>{B}*(("typedef"{BN}+)?)("volatile"{BN}+)?"struct{" | <FindMembers>{B}*(("typedef"{BN}+)?)("volatile"{BN}+)?"struct"/{BN}+ { isTypedef=((QCString)yytext).find("typedef")!=-1; @@ -4482,7 +4521,8 @@ static void parseCompounds(Entry *rt) { if (ce->fileName.right(5)==".java" || ce->fileName.right(4)==".php" || - ce->fileName.right(4)==".inc") + 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_ca.h b/src/translator_ca.h new file mode 100644 index 0000000..51c5969 --- /dev/null +++ b/src/translator_ca.h @@ -0,0 +1,1405 @@ +/****************************************************************************** + * + * + * + * 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 TRANSLATOR_CA_H +#define TRANSLATOR_CA_H + +// When defining a translator class for the new language, follow +// the description in the documentation. One of the steps says +// that you should copy the translator_en.h (this) file to your +// translator_xx.h new file. Your new language should use the +// Translator class as the base class. This means that you need to +// implement exactly the same (pure virtual) methods as the +// TranslatorEnglish does. Because of this, it is a good idea to +// start with the copy of TranslatorEnglish and replace the strings +// one by one. +// +// It is not necessary to include "translator.h" or +// "translator_adapter.h" here. The files are included in the +// language.cpp correctly. Not including any of the mentioned +// files frees the maintainer from thinking about whether the +// first, the second, or both files should be included or not, and +// why. This holds namely for localized translators because their +// base class is changed occasionaly to adapter classes when the +// Translator class changes the interface, or back to the +// Translator class (by the local maintainer) when the localized +// translator is made up-to-date again. + +class TranslatorCatalan : public Translator +{ + public: + + // --- Language control methods ------------------- + + /*! Used for identification of the language. The identification + * should not be translated. It should be replaced by the name + * of the language in English using lower-case characters only + * (e.g. "czech", "japanese", "russian", etc.). It should be equal to + * the identification used in language.cpp. + */ + virtual QCString idLanguage() + { return "catalan"; } + + /*! Used to get the LaTeX command(s) for the language support. + * This method should return string with commands that switch + * LaTeX to the desired language. For example + * <pre>"\\usepackage[german]{babel}\n" + * </pre> + * or + * <pre>"\\usepackage{polski}\n" + * "\\usepackage[latin2]{inputenc}\n" + * "\\usepackage[T1]{fontenc}\n" + * </pre> + * + * The English LaTeX does not use such commands. Because of this + * the empty string is returned in this implementation. + */ + virtual QCString latexLanguageSupportCommand() + { + return "\\usepackage[catalan]{babel} \n\\usepackage[latin1]{inputenc}"; + } + + /*! return the language charset. This will be used for the HTML output */ + virtual QCString idLanguageCharset() + { + return "iso-8859-1"; + } + + // --- Language translation methods ------------------- + + /*! used in the compound documentation before a list of related functions. */ + virtual QCString trRelatedFunctions() + { return "Funcions Associades"; } + + /*! subscript for the related functions. */ + virtual QCString trRelatedSubscript() + { return "(Remarcar que aquestes funcions no són funcions membre.)"; } + + /*! header that is put before the detailed description of files, classes and namespaces. */ + virtual QCString trDetailedDescription() + { return "Descripció detallada"; } + + /*! header that is put before the list of typedefs. */ + virtual QCString trMemberTypedefDocumentation() + { return "Documentació de les Definicions de Tipus membre"; } + + /*! header that is put before the list of enumerations. */ + virtual QCString trMemberEnumerationDocumentation() + { return "Documentació de les Enumeracions membre"; } + + /*! header that is put before the list of member functions. */ + virtual QCString trMemberFunctionDocumentation() + { return "Documentació de les Funcions membre"; } + + /*! header that is put before the list of member attributes. */ + virtual QCString trMemberDataDocumentation() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Documentació dels camps"; + } + else + { + return "Documentació de les dades membre"; + } + } + + /*! this is the text of a link put after brief descriptions. */ + virtual QCString trMore() + { return "Més..."; } + + /*! put in the class documentation */ + virtual QCString trListOfAllMembers() + { return "Llista de tots els membres."; } + + /*! used as the title of the "list of all members" page of a class */ + virtual QCString trMemberList() + { return "Llista dels membres"; } + + /*! this is the first part of a sentence that is followed by a class name */ + virtual QCString trThisIsTheListOfAllMembers() + { return "Aquesta és la llista complerta dels membres de "; } + + /*! this is the remainder of the sentence after the class name */ + virtual QCString trIncludingInheritedMembers() + { return ", incloent tots els membres heretats."; } + + /*! this is put at the author sections at the bottom of man pages. + * parameter s is name of the project name. + */ + virtual QCString trGeneratedAutomatically(const char *s) + { QCString result="Generat automàticament per Doxygen"; + if (s) result+=(QCString)" per a "+s; + result+=" a partir del codi font."; + return result; + } + + /*! put after an enum name in the list of all members */ + virtual QCString trEnumName() + { return "nom de la enum"; } + + /*! put after an enum value in the list of all members */ + virtual QCString trEnumValue() + { return "valors de la enum"; } + + /*! put after an undocumented member in the list of all members */ + virtual QCString trDefinedIn() + { return "definit a"; } + + // quick reference sections + + /*! This is put above each page as a link to the list of all groups of + * compounds or files (see the \\group command). + */ + virtual QCString trModules() + { return "Mòduls"; } + + /*! This is put above each page as a link to the class hierarchy */ + virtual QCString trClassHierarchy() + { return "Jerarquia de Classes"; } + + /*! This is put above each page as a link to the list of annotated classes */ + virtual QCString trCompoundList() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Estructures de Dades"; + } + else + { + return "Llistes Compostes"; + } + } + + /*! This is put above each page as a link to the list of documented files */ + virtual QCString trFileList() + { return "Llista dels arxius"; } + + /*! This is put above each page as a link to the list of all verbatim headers */ + virtual QCString trHeaderFiles() + { return "Fitxers d'encapçalaments"; } + + /*! This is put above each page as a link to all members of compounds. */ + virtual QCString trCompoundMembers() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Camps de dades"; + } + else + { + return "Membres compostos"; + } + } + + /*! This is put above each page as a link to all members of files. */ + virtual QCString trFileMembers() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Globals"; + } + else + { + return "Arxius membres"; + } + } + + /*! This is put above each page as a link to all related pages. */ + virtual QCString trRelatedPages() + { return "Pàgines relacionades"; } + + /*! This is put above each page as a link to all examples. */ + virtual QCString trExamples() + { return "Exemples"; } + + /*! This is put above each page as a link to the search engine. */ + virtual QCString trSearch() + { return "Cerca"; } + + /*! This is an introduction to the class hierarchy. */ + virtual QCString trClassHierarchyDescription() + { return "Aquesta llista d'herència està ordenada toscament, " + "però no completa, de forma alfabètica:"; + } + + /*! This is an introduction to the list with all files. */ + virtual QCString trFileListDescription(bool extractAll) + { + QCString result="Aquesta és la llista de tots els arxius "; + if (!extractAll) result+="documentats "; + result+="acompanyats amb breus descripcions:"; + return result; + } + + /*! This is an introduction to the annotated compound list. */ + virtual QCString trCompoundListDescription() + { + + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Aquestes són les estructures de dades acompanyades amb breus descripcions:"; + } + else + { + return "Aquestes són les classes, estructures, " + "unions i interfícies acompnyades amb breus descripcions:"; + } + } + + /*! This is an introduction to the page with all class members. */ + virtual QCString trCompoundMembersDescription(bool extractAll) + { + QCString result="Aquesta és la llista de tots els "; + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="camps d'estructures i unions"; + } + else + { + result+="membres de classe"; + } + if (!extractAll) + { + result+="documentats "; + } + result+=" amb enllaços a "; + if (extractAll) + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="la documentació de l'estructura/unió per a cada camp:"; + } + else + { + result+="la documentació de la classe per a cada membre:"; + } + } + else + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="les estructures/unions que pertanyen a:"; + } + else + { + result+="les classes que pertanyen:"; + } + } + return result; + } + /*! This is an introduction to the page with all file members. */ + virtual QCString trFileMembersDescription(bool extractAll) + { + QCString result="Aquesta és la llista de "; + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="totes les funcions, variables, definicions, enumeracions, i definicions de tipus"; + if (!extractAll) result+="documentades "; + } + else + { + result+="tots els membres de l'arxiu"; + if (!extractAll) result+="documentat "; + } + result+=" amb enllaços "; + if (extractAll) + result+="als arxius als quals corresponen:"; + else + result+="a la documentació:"; + return result; + } + + /*! This is an introduction to the page with the list of all header files. */ + virtual QCString trHeaderFilesDescription() + { return "Aquesta és la llista d'arxius d'encapçalament que ofereix l'API:"; } + + /*! This is an introduction to the page with the list of all examples */ + virtual QCString trExamplesDescription() + { return "Aquesta és la llista de tots els exemples:"; } + + /*! This is an introduction to the page with the list of related pages */ + virtual QCString trRelatedPagesDescription() + { return "Aquesta és la llista de totes les pàgines de documentació associades:"; } + + /*! This is an introduction to the page with the list of class/file groups */ + virtual QCString trModulesDescription() + { return "Aquesta és la llista de mòduls:"; } + + /*! This sentences is used in the annotated class/file lists if no brief + * description is given. + */ + virtual QCString trNoDescriptionAvailable() + { return "No hi ha cap descripció disponible"; } + + // index titles (the project name is prepended for these) + + + /*! This is used in HTML as the title of index.html. */ + virtual QCString trDocumentation() + { return "Documentació"; } + + /*! This is used in LaTeX as the title of the chapter with the + * index of all groups. + */ + virtual QCString trModuleIndex() + { return "Índex de Mòduls"; } + + /*! This is used in LaTeX as the title of the chapter with the + * class hierarchy. + */ + virtual QCString trHierarchicalIndex() + { return "Índex Jeràrquic"; } + + /*! This is used in LaTeX as the title of the chapter with the + * annotated compound index. + */ + virtual QCString trCompoundIndex() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Índex d'Estructures de Dades"; + } + else + { + return "Índex Compost"; + } + } + + /*! This is used in LaTeX as the title of the chapter with the + * list of all files. + */ + virtual QCString trFileIndex() + { return "Índex d'Arxius"; } + + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all groups. + */ + virtual QCString trModuleDocumentation() + { return "Documentació dels mòduls"; } + + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all classes, structs and unions. + */ + virtual QCString trClassDocumentation() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Documentació de les Estructures de Dades"; + } + else + { + return "Documentació de les Classes"; + } + } + + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all files. + */ + virtual QCString trFileDocumentation() + { return "Documentació dels Arxius"; } + + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all examples. + */ + virtual QCString trExampleDocumentation() + { return "Documentació dels Exemples"; } + + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all related pages. + */ + virtual QCString trPageDocumentation() + { return "Documentació de les pàgines"; } + + /*! This is used in LaTeX as the title of the document */ + virtual QCString trReferenceManual() + { return "Manual de Referència"; } + + /*! This is used in the documentation of a file as a header before the + * list of defines + */ + virtual QCString trDefines() + { return "Definicions"; } + + /*! This is used in the documentation of a file as a header before the + * list of function prototypes + */ + virtual QCString trFuncProtos() + { return "Prototipus de Funcions"; } + + /*! This is used in the documentation of a file as a header before the + * list of typedefs + */ + virtual QCString trTypedefs() + { return "Definicions de Tipus"; } + + /*! This is used in the documentation of a file as a header before the + * list of enumerations + */ + virtual QCString trEnumerations() + { return "Enumeracions"; } + + /*! This is used in the documentation of a file as a header before the + * list of (global) functions + */ + virtual QCString trFunctions() + { return "Funcions"; } + + /*! This is used in the documentation of a file as a header before the + * list of (global) variables + */ + virtual QCString trVariables() + { return "Variables"; } + + /*! This is used in the documentation of a file as a header before the + * list of (global) variables + */ + virtual QCString trEnumerationValues() + { return "Valors de les Enumeracions"; } + + /*! This is used in the documentation of a file before the list of + * documentation blocks for defines + */ + virtual QCString trDefineDocumentation() + { return "Documentació de les Definicions"; } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for function prototypes + */ + virtual QCString trFunctionPrototypeDocumentation() + { return "Documentació de les Funcions Prototipus"; } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for typedefs + */ + virtual QCString trTypedefDocumentation() + { return "Documentació de les Definicions de Tipus"; } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for enumeration types + */ + virtual QCString trEnumerationTypeDocumentation() + { return "Documentació dels Tipus de les Enumeracions"; } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for enumeration values + */ + virtual QCString trEnumerationValueDocumentation() + { return "Documentació dels Valors de les Enumeracions"; } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for functions + */ + virtual QCString trFunctionDocumentation() + { return "Documentació de les Funcions"; } + + /*! This is used in the documentation of a file/namespace before the list + * of documentation blocks for variables + */ + virtual QCString trVariableDocumentation() + { return "Documentació de les Variables"; } + + /*! This is used in the documentation of a file/namespace/group before + * the list of links to documented compounds + */ + virtual QCString trCompounds() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Estructures de Dades"; + } + else + { + return "Compostos"; + } + } + + /*! This is used in the standard footer of each page and indicates when + * the page was generated + */ + virtual QCString trGeneratedAt(const char *date,const char *projName) + { + QCString result=(QCString)"Generat a "+date; + if (projName) result+=(QCString)" per a "+projName; + result+=(QCString)" per"; + return result; + } + /*! This is part of the sentence used in the standard footer of each page. + */ + virtual QCString trWrittenBy() + { + return "escrit per"; + } + + /*! this text is put before a class diagram */ + virtual QCString trClassDiagram(const char *clName) + { + return (QCString)"Diagrama d'Herència per a "+clName+":"; + } + + /*! this text is generated when the \\internal command is used. */ + virtual QCString trForInternalUseOnly() + { return "Tan sols per a ús intern."; } + + /*! this text is generated when the \\reimp command is used. */ + virtual QCString trReimplementedForInternalReasons() + { return "Reimplementat per raons internes; l'API no es veu afectada."; } + + /*! this text is generated when the \\warning command is used. */ + virtual QCString trWarning() + { return "Atenció"; } + + /*! this text is generated when the \\bug command is used. */ + virtual QCString trBugsAndLimitations() + { return "Errors i limitacions"; } + + /*! this text is generated when the \\version command is used. */ + virtual QCString trVersion() + { return "Versió"; } + + /*! this text is generated when the \\date command is used. */ + virtual QCString trDate() + { return "Data"; } + + /*! this text is generated when the \\return command is used. */ + virtual QCString trReturns() + { return "Retorna"; } + + /*! this text is generated when the \\sa command is used. */ + virtual QCString trSeeAlso() + { return "Mireu també"; } + + /*! this text is generated when the \\param command is used. */ + virtual QCString trParameters() + { return "Paràmetres"; } + + /*! this text is generated when the \\exception command is used. */ + virtual QCString trExceptions() + { return "Excepcions"; } + + /*! this text is used in the title page of a LaTeX document. */ + virtual QCString trGeneratedBy() + { return "Generat per"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990307 +////////////////////////////////////////////////////////////////////////// + + /*! used as the title of page containing all the index of all namespaces. */ + virtual QCString trNamespaceList() + { return "Llista dels Espais de Noms"; } + + /*! used as an introduction to the namespace list */ + virtual QCString trNamespaceListDescription(bool extractAll) + { + QCString result="Aquests són tots els espais de noms "; + if (!extractAll) result+="documentats "; + result+="amb breus descripcions:"; + return result; + } + + /*! used in the class documentation as a header before the list of all + * friends of a class + */ + virtual QCString trFriends() + { return "Classes Amigues"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990405 +////////////////////////////////////////////////////////////////////////// + + /*! used in the class documentation as a header before the list of all + * related classes + */ + virtual QCString trRelatedFunctionDocumentation() + { return "Documentació de funcions amigues i relacionades"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990425 +////////////////////////////////////////////////////////////////////////// + + /*! used as the title of the HTML page of a class/struct/union */ + virtual QCString trCompoundReference(const char *clName, + ClassDef::CompoundType compType, + bool isTemplate) + { + QCString result="Referència de la"; + switch(compType) + { + case ClassDef::Class: result+=" Classe "; break; + case ClassDef::Struct: result+=" Estructura "; break; + case ClassDef::Union: result+=" Unió "; break; + case ClassDef::Interface: result+=" Interfície "; break; + case ClassDef::Exception: result+=" Excepció "; break; + } + if (isTemplate) result+="Template "; + result+=(QCString)clName; + return result; + } + + /*! used as the title of the HTML page of a file */ + virtual QCString trFileReference(const char *fileName) + { + QCString result="Referència de l'Arxiu "; + result+=fileName; + return result; + } + + /*! used as the title of the HTML page of a namespace */ + virtual QCString trNamespaceReference(const char *namespaceName) + { + QCString result="Referència de l'Espai de Noms "; + result+=namespaceName; + return result; + } + + virtual QCString trPublicMembers() + { return "Mètodes públics"; } + virtual QCString trPublicSlots() + { return "Slots públics"; } + virtual QCString trSignals() + { return "Senyals"; } + virtual QCString trStaticPublicMembers() + { return "Mètodes Públics Estàtics"; } + virtual QCString trProtectedMembers() + { return "Mètodes Protegits"; } + virtual QCString trProtectedSlots() + { return "Slots Protegits"; } + virtual QCString trStaticProtectedMembers() + { return "Mètodes Protegits Estàtics"; } + virtual QCString trPrivateMembers() + { return "Mètodes Privats"; } + virtual QCString trPrivateSlots() + { return "Slots Privats"; } + virtual QCString trStaticPrivateMembers() + { return "Mètodes Privats Estàtics"; } + + /*! this function is used to produce a comma-separated list of items. + * use generateMarker(i) to indicate where item i should be put. + */ + virtual QCString trWriteList(int numEntries) + { + QCString result; + int i; + // the inherits list contain `numEntries' classes + for (i=0;i<numEntries;i++) + { + // use generateMarker to generate placeholders for the class links! + result+=generateMarker(i); // generate marker for entry i in the list + // (order is left to right) + + if (i!=numEntries-1) // not the last entry, so we need a separator + { + if (i<numEntries-2) // not the fore last entry + result+=", "; + else // the fore last entry + result+=" i "; + } + } + return result; + } + + /*! used in class documentation to produce a list of base classes, + * if class diagrams are disabled. + */ + virtual QCString trInheritsList(int numEntries) + { + return "Hereda "+trWriteList(numEntries)+"."; + } + + /*! used in class documentation to produce a list of super classes, + * if class diagrams are disabled. + */ + virtual QCString trInheritedByList(int numEntries) + { + return "Heredat per "+trWriteList(numEntries)+"."; + } + + /*! used in member documentation blocks to produce a list of + * members that are hidden by this one. + */ + virtual QCString trReimplementedFromList(int numEntries) + { + return "Reimplementat de "+trWriteList(numEntries)+"."; + } + + /*! used in member documentation blocks to produce a list of + * all member that overwrite the implementation of this member. + */ + virtual QCString trReimplementedInList(int numEntries) + { + return "Reimplementat a "+trWriteList(numEntries)+"."; + } + + /*! This is put above each page as a link to all members of namespaces. */ + virtual QCString trNamespaceMembers() + { return "Membres de l'Espai de Noms"; } + + /*! This is an introduction to the page with all namespace members */ + virtual QCString trNamespaceMemberDescription(bool extractAll) + { + QCString result="Aquesta és la llista de tots els membres de l'espai de noms "; + if (!extractAll) result+="documentats "; + result+="amb enllaços a "; + if (extractAll) + result+="la documentació de l'espai de noms de cada membre:"; + else + result+="l'espai de noms al qual corresponen:"; + return result; + } + /*! This is used in LaTeX as the title of the chapter with the + * index of all namespaces. + */ + virtual QCString trNamespaceIndex() + { return "Índex d'Espais de Noms"; } + + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all namespaces. + */ + virtual QCString trNamespaceDocumentation() + { return "Documentació de l'Espai de Noms"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990522 +////////////////////////////////////////////////////////////////////////// + + /*! This is used in the documentation before the list of all + * namespaces in a file. + */ + virtual QCString trNamespaces() + { return "Espais de Noms"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990728 +////////////////////////////////////////////////////////////////////////// + + /*! This is put at the bottom of a class documentation page and is + * followed by a list of files that were used to generate the page. + */ + virtual QCString trGeneratedFromFiles(ClassDef::CompoundType compType, + bool single) + { // here s is one of " Class", " Struct" or " Union" + // single is true implies a single file + QCString result=(QCString)"La documentació d'aquesta "; + switch(compType) + { + case ClassDef::Class: result+="classe"; break; + case ClassDef::Struct: result+="estructura"; break; + case ClassDef::Union: result+="unió"; break; + case ClassDef::Interface: result+="interfície"; break; + case ClassDef::Exception: result+="excepció"; break; + } + result+=" es va generar a partir del"; + if (!single) result+="s"; + result+=" següent"; + if (!single) result+="s"; + result+=" arxiu"; + if (!single) result+="s:"; else result+=":"; + return result; + } + + /*! This is in the (quick) index as a link to the alphabetical compound + * list. + */ + virtual QCString trAlphabeticalList() + { return "Llista Alfabètica"; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-990901 +////////////////////////////////////////////////////////////////////////// + + /*! This is used as the heading text for the retval command. */ + virtual QCString trReturnValues() + { return "Valors de retorn"; } + + /*! This is in the (quick) index as a link to the main page (index.html) + */ + virtual QCString trMainPage() + { return "Pàgina principal"; } + + /*! This is used in references to page that are put in the LaTeX + * documentation. It should be an abbreviation of the word page. + */ + virtual QCString trPageAbbreviation() + { return "p."; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-991003 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trSources() + { + return "Codi Font"; + } + virtual QCString trDefinedAtLineInSourceFile() + { + return "Definició a la línia @0 de l'arxiu @1."; + } + virtual QCString trDefinedInSourceFile() + { + return "Definició a l'arxiu @0."; + } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-991205 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trDeprecated() + { + return "Antiquat"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.0.0 +////////////////////////////////////////////////////////////////////////// + + /*! this text is put before a collaboration diagram */ + virtual QCString trCollaborationDiagram(const char *clName) + { + return (QCString)"Diagrama de col·laboració per a "+clName+":"; + } + /*! this text is put before an include dependency graph */ + virtual QCString trInclDepGraph(const char *fName) + { + return (QCString)"Inclou el graf de dependències per a "+fName+":"; + } + /*! header that is put before the list of constructor/destructors. */ + virtual QCString trConstructorDocumentation() + { + return "Documentació del Constructor i el Destructor"; + } + /*! Used in the file documentation to point to the corresponding sources. */ + virtual QCString trGotoSourceCode() + { + return "Veure el codi d'aquest arxiu."; + } + /*! Used in the file sources to point to the corresponding documentation. */ + virtual QCString trGotoDocumentation() + { + return "Veure la documentació d'aquest fitxer."; + } + /*! Text for the \\pre command */ + virtual QCString trPrecondition() + { + return "Precondició"; + } + /*! Text for the \\post command */ + virtual QCString trPostcondition() + { + return "Postcondició"; + } + /*! Text for the \\invariant command */ + virtual QCString trInvariant() + { + return "Invariant"; + } + /*! Text shown before a multi-line variable/enum initialization */ + virtual QCString trInitialValue() + { + return "Valor inicial:"; + } + /*! Text used the source code in the file index */ + virtual QCString trCode() + { + return "codi"; + } + virtual QCString trGraphicalHierarchy() + { + return "Jerarquia Gràfica de la Classe"; + } + virtual QCString trGotoGraphicalHierarchy() + { + return "Veure la jerarquia gràfica de la classe"; + } + virtual QCString trGotoTextualHierarchy() + { + return "Veure la jerarquia textual de la classe"; + } + virtual QCString trPageIndex() + { + return "Pàgina Índex"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.0 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trNote() + { + return "Nota"; + } + virtual QCString trPublicTypes() + { + return "Tipus Públics"; + } + virtual QCString trPublicAttribs() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Camps de Dades"; + } + else + { + return "Atributs Públics"; + } + } + virtual QCString trStaticPublicAttribs() + { + return "Atributs Públics Estàtics"; + } + virtual QCString trProtectedTypes() + { + return "Tipus Protegits"; + } + virtual QCString trProtectedAttribs() + { + return "Atributs Protegits"; + } + virtual QCString trStaticProtectedAttribs() + { + return "Atributs Protegits Estàtics"; + } + virtual QCString trPrivateTypes() + { + return "Tipus Privats"; + } + virtual QCString trPrivateAttribs() + { + return "Atributs Privats"; + } + virtual QCString trStaticPrivateAttribs() + { + return "Atributs Privats Estàtics"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.3 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a \\todo item */ + virtual QCString trTodo() + { + return "Per fer"; + } + /*! Used as the header of the todo list */ + virtual QCString trTodoList() + { + return "Llista de coses per fer"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.4 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trReferencedBy() + { + return "Referenciat a"; + } + virtual QCString trRemarks() + { + return "Remarca"; + } + virtual QCString trAttention() + { + return "Atenció"; + } + virtual QCString trInclByDepGraph() + { + return "Aquest gràfic mostra quins arxius inclouen, " + "de forma directa o indirecta, aquest arxiu:"; + } + virtual QCString trSince() + { + return "Des de"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.5 +////////////////////////////////////////////////////////////////////////// + + /*! title of the graph legend page */ + virtual QCString trLegendTitle() + { + return "Llegenda del Gràfic"; + } + /*! page explaining how the dot graph's should be interpreted + * The %A in the text below are to prevent link to classes called "A". + */ + virtual QCString trLegendDocs() + { + return + "Aquesta pàgina explica com s'interpreten els gràfics generats per doxygen.<p>\n" + "Considera aquest exemple:\n" + "\\code\n" + "/*! Classe invisible per culpa del retall */\n" + "class Invisible { };\n\n" + "/*! Classe truncada, l'herència està amagada */\n" + "class Truncated : public Invisible { };\n\n" + "/* Classe no documentada amb comentaris doxygen */\n" + "class Undocumented { };\n\n" + "/*! Classe heredada amb herència pública */\n" + "class PublicBase : public Truncated { };\n\n" + "/*! Una classe Template */\n" + "template<class T> class Templ { };\n\n" + "/*! Classe heredada utilitzant herència protegida */\n" + "class ProtectedBase { };\n\n" + "/*! Classe heredada utiltzant herència privada */\n" + "class PrivateBase { };\n\n" + "/*! Classe usada per la classe heretada */\n" + "class Used { };\n\n" + "/*! Super classe que hereda una quantitat de classes */\n" + "class Inherited : public PublicBase,\n" + " protected ProtectedBase,\n" + " private PrivateBase,\n" + " public Undocumented\n" + " public Templ<int>\n" + "{\n" + " private:\n" + " Used *m_usedClass;\n" + "};\n" + "\\endcode\n" + "Si l'etiqueta \\c MAX_DOT_GRAPH_HEIGHT està igualada a 24a0 al fitxer de configuració, resultarà el gràfic següent:" + "<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n" + "<p>\n" + "Les caixes del gràfic superior tenen aquesta interpretació:\n" + "<ul>\n" + "<li>Una caixa negra plena represent l'estructura o classe per la qual el gràfic s'ha generat.\n" + "<li>Una caixa de vora negra representa una estructura o classe documentada.\n" + "<li>Una caixa de vora verda representa una estructura o classe indocumentada.\n" + "<li>Una caixa de vora vermalla representa una estructura o classe documentada de la qual " + "no es mostren totes les relacions d'herència/inclusió. Un gràfic és truncat si no s'ajusta als límits.\n" + "</ul>\n" + "Les sagetes tenen aquest significat:\n" + "<ul>\n" + "<li>Una sageta blau fosc remarca una relació d'herència de tipus pública entre dues classes.\n" + "<li>Una sageta verd fosc remarca una relació d'herència de tipus protegida entre dues classes.\n" + "<li>Una sageta roig fosc remarca una relació d'herència de tipus privada entre dues classes.\n" + "<li>Una sageta puntejada de color porpra indica que una classe és continguda o usada per una altra classe." + " La sageta s'etiqueta amb la variable o variables a través de les quals la classe o estructura apuntada és accessible.\n" + "<li>Una sageta puntejada de color groc indica la relació entre una instància template i la classe template de què ha set instanciada." + " La sageta s'etiqueta amb els paràmetres template de la instància.\n" + "</ul>\n"; + } + /*! text for the link to the legend page */ + virtual QCString trLegend() + { + return "llegenda"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.0 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a test item */ + virtual QCString trTest() + { + return "Prova"; + } + /*! Used as the header of the test list */ + virtual QCString trTestList() + { + return "Llista de proves"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.1 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a section header for KDE-2 IDL methods */ + virtual QCString trDCOPMethods() + { + return "Mètodes DCOP"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.2 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a section header for IDL properties */ + virtual QCString trProperties() + { + return "Propietats"; + } + /*! Used as a section header for IDL property documentation */ + virtual QCString trPropertyDocumentation() + { + return "Documentació de les Propietats"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.4 +////////////////////////////////////////////////////////////////////////// + + /*! Used for Java interfaces in the summary section of Java packages */ + virtual QCString trInterfaces() + { + return "Interfícies"; + } + /*! Used for Java classes in the summary section of Java packages */ + virtual QCString trClasses() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Estructures de Dades"; + } + else + { + return "Classes"; + } + } + /*! Used as the title of a Java package */ + virtual QCString trPackage(const char *name) + { + return (QCString)"Paquet "+name; + } + /*! Title of the package index page */ + virtual QCString trPackageList() + { + return "Llista de Paquets"; + } + /*! The description of the package index page */ + virtual QCString trPackageListDescription() + { + return "Aquesta és la llista de paquets, amb una breu descripció (si se'n disposa):"; + } + /*! The link name in the Quick links header for each page */ + virtual QCString trPackages() + { + return "Paquets"; + } + /*! Used as a chapter title for Latex & RTF output */ + virtual QCString trPackageDocumentation() + { + return "Documentació dels Paquets"; + } + /*! Text shown before a multi-line define */ + virtual QCString trDefineValue() + { + return "Valor:"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.5 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a \\bug item */ + virtual QCString trBug() + { + return "Error"; + } + /*! Used as the header of the bug list */ + virtual QCString trBugList() + { + return "Llista d'Errors"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.6 +////////////////////////////////////////////////////////////////////////// + + /*! Used as ansicpg for RTF file + * + * The following table shows the correlation of Charset name, Charset Value and + * <pre> + * Codepage number: + * Charset Name Charset Value(hex) Codepage number + * ------------------------------------------------------ + * DEFAULT_CHARSET 1 (x01) + * SYMBOL_CHARSET 2 (x02) + * OEM_CHARSET 255 (xFF) + * ANSI_CHARSET 0 (x00) 1252 + * RUSSIAN_CHARSET 204 (xCC) 1251 + * EE_CHARSET 238 (xEE) 1250 + * GREEK_CHARSET 161 (xA1) 1253 + * TURKISH_CHARSET 162 (xA2) 1254 + * BALTIC_CHARSET 186 (xBA) 1257 + * HEBREW_CHARSET 177 (xB1) 1255 + * ARABIC _CHARSET 178 (xB2) 1256 + * SHIFTJIS_CHARSET 128 (x80) 932 + * HANGEUL_CHARSET 129 (x81) 949 + * GB2313_CHARSET 134 (x86) 936 + * CHINESEBIG5_CHARSET 136 (x88) 950 + * </pre> + * + */ + virtual QCString trRTFansicp() + { + return "1252"; + } + + + /*! Used as ansicpg for RTF fcharset + * \see trRTFansicp() for a table of possible values. + */ + virtual QCString trRTFCharSet() + { + return "0"; + } + + /*! Used as header RTF general index */ + virtual QCString trRTFGeneralIndex() + { + return "Índex"; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trClass(bool first_capital, bool singular) + { + QCString result((first_capital ? "Classe" : "classe")); + if (!singular) result+="s"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trFile(bool first_capital, bool singular) + { + QCString result((first_capital ? "Arxiu" : "arxiu")); + if (!singular) result+="s"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trNamespace(bool first_capital, bool singular) + { + QCString result((first_capital ? "Namespace" : "namespace")); + if (!singular) result+="s"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trGroup(bool first_capital, bool singular) + { + QCString result((first_capital ? "Grup" : "grup")); + if (!singular) result+="s"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trPage(bool first_capital, bool singular) + { + QCString result((first_capital ? "Pàgin" : "pàgin")); + if (!singular) result+="es"; else result+="a"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trMember(bool first_capital, bool singular) + { + QCString result((first_capital ? "Membre" : "membre")); + if (!singular) result+="s"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trField(bool first_capital, bool singular) + { + QCString result((first_capital ? "Camp" : "camp")); + if (!singular) result+="s"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trGlobal(bool first_capital, bool singular) + { + QCString result((first_capital ? "Global" : "global")); + if (!singular) result+="s"; + return result; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.7 +////////////////////////////////////////////////////////////////////////// + + /*! This text is generated when the \\author command is used and + * for the author section in man pages. */ + virtual QCString trAuthor(bool first_capital, bool singular) + { + QCString result((first_capital ? "Autor" : "autor")); + if (!singular) result+="s"; + return result; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.11 +////////////////////////////////////////////////////////////////////////// + + /*! This text is put before the list of members referenced by a member + */ + virtual QCString trReferences() + { + return "Referències"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.13 +////////////////////////////////////////////////////////////////////////// + + /*! used in member documentation blocks to produce a list of + * members that are implemented by this one. + */ + virtual QCString trImplementedFromList(int numEntries) + { + return "Implementa "+trWriteList(numEntries)+"."; + } + + /*! used in member documentation blocks to produce a list of + * all members that implement this abstract member. + */ + virtual QCString trImplementedInList(int numEntries) + { + return "Implementat a "+trWriteList(numEntries)+"."; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.16 +////////////////////////////////////////////////////////////////////////// + + /*! used in RTF documentation as a heading for the Table + * of Contents. + */ + virtual QCString trRTFTableOfContents() + { + return "Taula de Continguts"; + } + +}; + +#endif diff --git a/src/util.cpp b/src/util.cpp index 5be38ca..9afb8ac 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2286,7 +2286,7 @@ bool resolveRef(/* in */ const char *scName, /* out */ MemberDef **resMember ) { - //printf("resolveRef(scName=%s,name=%s,inSeeBlock=%d,rt=%s)\n",scName,name,inSeeBlock,rt); + //printf("resolveRef(scName=%s,name=%s,inSeeBlock=%d)\n",scName,name,inSeeBlock); QCString tsName = name; bool memberScopeFirst = tsName.find('#')!=-1; @@ -2473,7 +2473,7 @@ bool resolveLink(/* in */ const char *scName, /* out */ QCString &resAnchor ) { - //printf("resolveLink clName=`%s' lr=`%s' lt=`%s'\n",clName,lr,lt); + //printf("resolveLink clName=`%s' lr=`%s'\n",scName,lr); *resContext=0; *resPageInfo=0; @@ -2542,6 +2542,15 @@ bool generateLink(OutputDocInterface &od,const char *clName, Definition *compound; PageInfo *pageInfo; QCString anchor,linkText=lt; + if (linkText.isEmpty()) + { + linkText=substitute(lr,"#","::"); + // strip :: prefix if present + if (linkText.at(0)==':' && linkText.at(1)==':') + { + linkText=linkText.right(linkText.length()-2); + } + } if (resolveLink(clName,lr,inSeeBlock,&compound,&pageInfo,anchor)) { if (pageInfo) // link to page @@ -3386,10 +3395,12 @@ void addRelatedPage(const char *name,const QCString &ptitle, ) { PageInfo *pi=0; + //printf("addRelatedPage(name=%s gd=%p)\n",name,gd); if ((pi=Doxygen::pageSDict->find(name)) && !tagInfo) { // append documentation block to the page. pi->doc+="\n\n"+doc; + //printf("Adding page docs `%s' pi=%p name=%s\n",doc.data(),pi,name); } else // new page { @@ -3431,6 +3442,7 @@ void addRelatedPage(const char *name,const QCString &ptitle, pi->fileName = pageName; pi->addSections(anchors); + //printf("Appending page `%s'\n",baseName.data()); Doxygen::pageSDict->append(baseName,pi); if (gd) gd->addPage(pi); @@ -3458,7 +3470,7 @@ void addRelatedPage(const char *name,const QCString &ptitle, // si->label.data(),si->definition?si->definition->name().data():"<none>", // si->fileName.data()); //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data()); - //printf("Adding section info %s\n",pi->name.data()); + //printf("Adding section key=%s si->fileName=%s\n",pageName.data(),si->fileName.data()); Doxygen::sectionDict.insert(pageName,si); } } @@ -3470,6 +3482,7 @@ void addRefItem(const QList<ListItemInfo> *sli, const char *prefix, const char *name,const char *title,const char *args) { + //printf("addRefItem(%s,%s,%s,%s)\n",prefix,name,title,args); if (sli) { QListIterator<ListItemInfo> slii(*sli); @@ -3478,18 +3491,18 @@ void addRefItem(const QList<ListItemInfo> *sli, { RefList *refList = Doxygen::specialLists->find(lii->type); ASSERT(refList!=0); - //printf("addRefItem(%s) todoId=%d testId=%d bugId=%d\n",name,todoId,testId,bugId); if (Config_getBool(refList->optionName())) { RefItem *item = refList->getRefItem(lii->itemId); ASSERT(item!=0); if (item->written) return; + //printf("anchor=%s\n",item->listAnchor.data()); QCString doc(1000); - doc += "<dl><dt>\\anchor "; + doc = "\\anchor "; doc += item->listAnchor; - doc += " "; + doc += " <dl><dt>"; doc += prefix; doc += " \\_internalref "; doc += name; @@ -3500,7 +3513,6 @@ void addRefItem(const QList<ListItemInfo> *sli, doc += "</dt>\n<dd>"; doc += item->text; doc += "</dd></dl>\n"; - //printf("Todo page: %s\n",doc.data()); addRelatedPage(refList->listName(),refList->pageTitle(),doc,0,"generated",1,0,0,0); item->written=TRUE; } @@ -3532,3 +3544,361 @@ void addGroupListToTitle(OutputList &ol,Definition *d) } } +/*! + * Function converts Latin1 character to latex string representin the same + * character. + */ +static void latin1ToLatex(QTextStream &t,unsigned char c) +{ + switch (c) + { + // the Latin-1 characters + case 161: t << "!`"; break; + case 181: t << "$\\mu$"; break; + case 191: t << "?`"; break; + case 192: t << "\\`{A}"; break; + case 193: t << "\\'{A}"; break; + case 194: t << "\\^{A}"; break; + case 195: t << "\\~{A}"; break; + case 196: t << "\\\"{A}"; break; + case 197: t << "\\AA{}"; break; + case 198: t << "\\AE{}"; break; + case 199: t << "\\c{C}"; break; + case 200: t << "\\`{E}"; break; + case 201: t << "\\'{E}"; break; + case 202: t << "\\^{E}"; break; + case 203: t << "\\\"{E}"; break; + case 204: t << "\\`{I}"; break; + case 205: t << "\\'{I}"; break; + case 206: t << "\\^{I}"; break; + case 207: t << "\\\"{I}"; break; + case 208: t << "D "; break; // anyone know the real code? + case 209: t << "\\~{N}"; break; + case 210: t << "\\`{O}"; break; + case 211: t << "\\'{O}"; break; + case 212: t << "\\^{O}"; break; + case 213: t << "\\~{O}"; break; + case 214: t << "\\\"{O}"; break; + case 215: t << "$\\times$"; break; + case 216: t << "\\O"; break; + case 217: t << "\\`{U}"; break; + case 218: t << "\\'{U}"; break; + case 219: t << "\\^{U}"; break; + case 220: t << "\\\"{U}"; break; + case 221: t << "\\'{Y}"; break; + case 223: t << "\\ss{}"; break; + case 224: t << "\\`{a}"; break; + case 225: t << "\\'{a}"; break; + case 226: t << "\\^{a}"; break; + case 227: t << "\\~{a}"; break; + case 228: t << "\\\"{a}"; break; + case 229: t << "\\aa{}"; break; + case 230: t << "\\ae{}"; break; + case 231: t << "\\c{c}"; break; + case 232: t << "\\`{e}"; break; + case 233: t << "\\'{e}"; break; + case 234: t << "\\^{e}"; break; + case 235: t << "\\\"{e}"; break; + case 236: t << "\\`{\\i}"; break; + case 237: t << "\\'{\\i}"; break; + case 238: t << "\\^{\\i}"; break; + case 239: t << "\\\"{\\i}"; break; + case 241: t << "\\~{n}"; break; + case 242: t << "\\`{o}"; break; + case 243: t << "\\'{o}"; break; + case 244: t << "\\^{o}"; break; + case 245: t << "\\~{o}"; break; + case 246: t << "\\\"{o}"; break; + case 248: t << "\\o{}"; break; + case 249: t << "\\`{u}"; break; + case 250: t << "\\'{u}"; break; + case 251: t << "\\^{u}"; break; + case 252: t << "\\\"{u}"; break; + case 253: t << "\\'{y}"; break; + case 255: t << "\\\"{y}"; break; + default: t << c; + } +} + +/*! + * Function converts Latin2 character to latex string representin the same + * character. + */ +static void latin2ToLatex(QTextStream &t,unsigned char c) +{ + switch (c) + { + case 0xA1: t << c; break; + case 0xA2: t << c; break; + case 0xA3: t << c; break; + case 0xA4: t << c; break; + case 0xA5: t << c; break; + case 0xA6: t << "\\'{S}"; break; + case 0xA7: t << c; break; + case 0xA8: t << c; break; + case 0xA9: t << "\\v{S}"; break; + case 0xAA: t << "\\c{S}"; break; + case 0xAB: t << "\\v{T}"; break; + case 0xAC: t << "\\'{Z}"; break; + case 0xAD: t << c; break; + case 0xAE: t << "\\v{Z}"; break; + case 0xAF: t << "\\.{Z}"; break; + + case 0xB0: t << c; break; + case 0xB1: t << c; break; + case 0xB2: t << c; break; + case 0xB3: t << c; break; + case 0xB4: t << c; break; + case 0xB5: t << c; break; + case 0xB6: t << "\\'{s}"; break; + case 0xB7: t << c; break; + case 0xB8: t << c; break; + case 0xB9: t << "\\v{s}"; break; + case 0xBA: t << "\\c{s}"; break; + case 0xBB: t << "\\v{t}"; break; + case 0xBC: t << "\\'{z}"; break; + case 0xBD: t << c; break; + case 0xBE: t << "\\v{z}"; break; + case 0xBF: t << "\\.{z}"; break; + + case 0xC0: t << "\\'{R}"; break; + case 0xC1: t << "\\'{A}"; break; + case 0xC2: t << "\\^{A}"; break; + case 0xC3: t << "\\u{A}"; break; + case 0xC4: t << "\\\"{A}"; break; + case 0xC5: t << "\\'{L}"; break; + case 0xC6: t << "\\'{C}"; break; + case 0xC7: t << "\\c{C}"; break; + case 0xC8: t << "\\v{C}"; break; + case 0xC9: t << "\\'{E}"; break; + case 0xCA: t << "\\c{E}"; break; + case 0xCB: t << "\\\"{E}"; break; + case 0xCC: t << "\\v{E}"; break; + case 0xCD: t << "\\'{I}"; break; + case 0xCE: t << "\\^{I}"; break; + case 0xCF: t << "\\v{D}"; break; + + case 0xD0: t << "\\bar{D}"; break; + case 0xD1: t << "\\'{N}"; break; + case 0xD2: t << "\\v{N}"; break; + case 0xD3: t << "\\'{O}"; break; + case 0xD4: t << "\\^{O}"; break; + case 0xD5: t << "\\H{O}"; break; + case 0xD6: t << "\\\"{O}"; break; + case 0xD7: t << c; break; + case 0xD8: t << "\\v{R}"; break; + case 0xD9: t << c; break; + case 0xDA: t << "\\'{U}"; break; + case 0xDB: t << "\\H{U}"; break; + case 0xDC: t << "\\\"{U}"; break; + case 0xDD: t << "\\'{Y}"; break; + case 0xDE: t << "\\c{T}"; break; + case 0xDF: t << "\\ss"; break; + + case 0xE0: t << "\\'{r}"; break; + case 0xE1: t << "\\'{a}"; break; + case 0xE2: t << "\\^{a}"; break; + case 0xE3: t << c; break; + case 0xE4: t << "\\\"{a}"; break; + case 0xE5: t << "\\'{l}"; break; + case 0xE6: t << "\\'{c}"; break; + case 0xE7: t << "\\c{c}"; break; + case 0xE8: t << "\\v{c}"; break; + case 0xE9: t << "\\'{e}"; break; + case 0xEA: t << c; break; + case 0xEB: t << "\\\"{e}"; break; + case 0xEC: t << "\\v{e}"; break; + case 0xED: t << "\\'{\\i}"; break; + case 0xEE: t << "\\^{\\i}"; break; + case 0xEF: t << "\\v{d}"; break; + + case 0xF0: t << "\\bar{d}"; break; + case 0xF1: t << "\\'{n}"; break; + case 0xF2: t << "\\v{n}"; break; + case 0xF3: t << "\\'{o}"; break; + case 0xF4: t << "\\^{o}"; break; + case 0xF5: t << "\\H{o}"; break; + case 0xF6: t << "\\\"{o}"; break; + case 0xF7: t << c; break; + case 0xF8: t << "\\v{r}"; break; + case 0xF9: t << c; break; + case 0xFA: t << "\\'{u}"; break; + case 0xFB: t << "\\H{u}"; break; + case 0xFC: t << "\\\"{u}"; break; + case 0xFD: t << "\\'{y}"; break; + case 0xFE: t << c; break; + case 0xFF: t << c; break; + + default: t << c; + } +} + +void filterLatexString(QTextStream &t,const char *str, + bool insideTabbing,bool insidePre) +{ + static bool isCzech = theTranslator->idLanguage()=="czech"; + static bool isJapanese = theTranslator->idLanguage()=="japanese"; + static bool isKorean = theTranslator->idLanguage()=="korean"; + static bool isRussian = theTranslator->idLanguage()=="russian"; + static bool isUkrainian = theTranslator->idLanguage()=="ukrainian"; + static bool isChinese = theTranslator->idLanguage()=="chinese" || + theTranslator->idLanguage()=="chinese-traditional"; + static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2"; + static bool isGreek = theTranslator->idLanguage()=="greek"; + if (str) + { + const unsigned char *p=(const unsigned char *)str; + unsigned char c; + unsigned char pc='\0'; + while (*p) + { + c=*p++; + + if (insidePre) + { + switch(c) + { + case '\\': t << "\\(\\backslash\\)"; break; + case '{': t << "\\{"; break; + case '}': t << "\\}"; break; + default: + { + // Some languages use wide characters + if (c>=128 && (isJapanese || isKorean || isChinese)) + { + t << (char)c; + if (*p) + { + c = *p++; + t << (char)c; + } + } + else + { + t << (char)c; + } + break; + } + } + } + else + { + switch(c) + { + case '#': t << "\\#"; break; + case '$': t << "\\$"; break; + case '%': t << "\\%"; break; + case '^': t << "$^\\wedge$"; break; + case '&': t << "\\&"; break; + case '*': t << "$\\ast$"; break; + case '_': t << "\\_"; + if (!insideTabbing) t << "\\-"; + break; + case '{': t << "\\{"; break; + case '}': t << "\\}"; break; + case '<': t << "$<$"; break; + case '>': t << "$>$"; break; + case '|': t << "$|$"; break; + case '~': t << "$\\sim$"; break; + case '[': if (Config_getBool("PDF_HYPERLINKS")) + t << "\\mbox{[}"; + else + t << "["; + break; + case ']': if (pc=='[') t << "$\\,$"; + if (Config_getBool("PDF_HYPERLINKS")) + t << "\\mbox{]}"; + else + t << "]"; + break; + case '-': if (*p=='>') + { t << " $\\rightarrow$ "; p++; } + else + { t << (char)c; } + break; + case '\\': if (*p=='<') + { t << "$<$"; p++; } + else if (*p=='>') + { t << "$>$"; p++; } + else + { t << "$\\backslash$"; } + break; + case '"': { t << "\\char`\\\"{}"; } + break; + + default: + { + // Some languages use wide characters + if (isJapanese || isKorean || isChinese) + { + if (c>=128) + { + t << (char)c; + if (*p) + { + c = *p++; + t << (char)c; + } + } + else // ascii char => see if we can insert a hypenation hint + { + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else if (isCzech || isRussian || isUkrainian) + { + if (c>=128) + { + t << (char)c; + } + else // ascii char => see if we can insert a hypenation hint + { + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else if (isGreek) + { + if (c<128) + { + t << "\\textlatin{" << (char)c << "}"; + } + else + { + t << (char)c; + } + } + else if (isLatin2) + { + if (c>=128) + { + latin2ToLatex(t,c); + } + else + { + // see if we can insert an hyphenation hint + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else // another language => assume latin1 charset + { + if (c>=128) + { + latin1ToLatex(t,c); + } + else + { + // see if we can insert an hyphenation hint + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + } + } + } + pc = c; + } + } +} @@ -199,6 +199,8 @@ void addRelatedPage(const char *name,const QCString &ptitle, ); QCString escapeCharsInString(const char *name,bool allowDots); void addGroupListToTitle(OutputList &ol,Definition *d); +void filterLatexString(QTextStream &t,const char *str, + bool insideTabbing=FALSE,bool insidePre=FALSE); #endif diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 4962334..5bb7226 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -895,9 +895,9 @@ class XMLGenerator : public OutputDocInterface { XML_DB(("(endSectionRefList)\n")); } - void writeCodeAnchor(const char *anchor) + void writeCodeAnchor(const char *) { - XML_DB(("(writeCodeAnchor(%s))\n",anchor)); + XML_DB(("(writeCodeAnchor)\n")); } // Generator specific functions diff --git a/wintools/Doxygen.dsp b/wintools/Doxygen.dsp index d8f63dc..c19e181 100644 --- a/wintools/Doxygen.dsp +++ b/wintools/Doxygen.dsp @@ -25,7 +25,7 @@ CFG=Doxygen - Win32 Debug # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "Doxygen" # PROP Scc_LocalPath ".." -CPP=cwcl.exe +CPP=xicl6.exe RSC=rc.exe !IF "$(CFG)" == "Doxygen - Win32 Release" @@ -48,7 +48,7 @@ RSC=rc.exe BSC32=snBsc.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=cwlink.exe +LINK32=xilink6.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 @@ -72,7 +72,7 @@ LINK32=cwlink.exe BSC32=snBsc.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo -LINK32=cwlink.exe +LINK32=xilink6.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept @@ -603,6 +603,10 @@ SOURCE=..\src\doc.h # End Source File # Begin Source File +SOURCE=..\src\docvisitor.h +# End Source File +# Begin Source File + SOURCE=..\src\dot.h # End Source File # Begin Source File @@ -763,6 +767,10 @@ SOURCE=..\src\pre.h # End Source File # Begin Source File +SOURCE=..\src\printdocvisitor.h +# End Source File +# Begin Source File + SOURCE=..\qtools\qarray.h # End Source File # Begin Source File @@ -995,10 +1003,6 @@ SOURCE=..\src\translator_dk.h # End Source File # Begin Source File -SOURCE="..\src\translator_en-old.h" -# End Source File -# Begin Source File - SOURCE=..\src\translator_en.h # End Source File # Begin Source File |