From c4ef46195917656ebebed63e3fab5c135d9905a2 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 6 Aug 2000 15:11:00 +0000 Subject: Release-1.2.0-20000806 --- INSTALL | 4 +- README | 4 +- VERSION | 2 +- addon/configgen/config_templ.h | 2 +- addon/configgen/config_templ.l | 197 ++- addon/doxywizard/doxywizard_templ.cpp | 2 +- doc/commands.doc | 35 +- doc/config.doc | 13 + doc/starting.doc | 31 +- packages/rpm/doxygen.spec | 2 +- src/Makefile.in | 2 +- src/classdef.cpp | 16 +- src/classdef.h | 2 + src/classlist.cpp | 2 +- src/code.l | 54 +- src/config.h | 4 +- src/config.l | 199 ++- src/definition.cpp | 5 +- src/definition.h | 6 + src/diagram.cpp | 17 +- src/diagram.h | 5 +- src/doc.h | 33 + src/doc.l | 2214 +++++++++++++++++++++++++++++ src/doxygen.cpp | 475 +++---- src/doxygen.h | 10 +- src/doxygen.pro.in | 6 +- src/doxygen.t | 4 + src/filedef.cpp | 16 +- src/groupdef.cpp | 14 +- src/htmlgen.cpp | 21 +- src/htmlgen.h | 8 +- src/index.cpp | 10 +- src/latexgen.cpp | 53 +- src/latexgen.h | 7 +- src/mangen.h | 8 +- src/memberdef.cpp | 58 +- src/memberdef.h | 5 +- src/memberlist.cpp | 6 +- src/memberlist.h | 4 +- src/namespacedef.cpp | 14 +- src/outputgen.h | 9 +- src/outputlist.h | 15 +- src/rtfgen.cpp | 77 +- src/rtfgen.h | 7 +- src/scanner.h | 14 +- src/scanner.l | 2451 +++------------------------------ src/translator.h | 4 +- src/translator_cz.h | 20 + src/translator_fr.h | 238 ++++ src/translator_nl.h | 4 +- src/util.cpp | 335 +++-- src/util.h | 44 +- 52 files changed, 3781 insertions(+), 3007 deletions(-) create mode 100644 src/doc.h create mode 100644 src/doc.l diff --git a/INSTALL b/INSTALL index a6943b9..bae44bc 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ -DOXYGEN Version 1.2.0-20000731 +DOXYGEN Version 1.2.0-20000806 Please read the installation section of the manual for instructions. -------- -Dimitri van Heesch (31 July 2000) +Dimitri van Heesch (06 August 2000) diff --git a/README b/README index 6b488e0..11584c4 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -DOXYGEN Version 1.2.0-20000731 +DOXYGEN Version 1.2.0-20000806 Please read INSTALL for compilation instructions. @@ -7,4 +7,4 @@ The latest version of doxygen can be obtained at Enjoy, -Dimitri van Heesch (31 July 2000) +Dimitri van Heesch (06 August 2000) diff --git a/VERSION b/VERSION index 42a10c0..c6784c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0-20000731 +1.2.0-20000806 diff --git a/addon/configgen/config_templ.h b/addon/configgen/config_templ.h index 0d5ac13..50b479b 100644 --- a/addon/configgen/config_templ.h +++ b/addon/configgen/config_templ.h @@ -21,7 +21,7 @@ #include #include -extern void parseConfig(const QCString &config); +extern void parseConfig(const QCString &config,const char *fn); extern void writeTemplateConfig(QFile *f,bool shortList); extern void checkConfig(); extern void configStrToVal(); diff --git a/addon/configgen/config_templ.l b/addon/configgen/config_templ.l index e98ace9..3da3d56 100644 --- a/addon/configgen/config_templ.l +++ b/addon/configgen/config_templ.l @@ -27,6 +27,7 @@ #include #include #include +#include #include "config.h" #include "version.h" @@ -58,6 +59,7 @@ void initWarningFormat() #include "language.h" #endif +#define MAX_INCLUDE_DEPTH 10 #define YY_NEVER_INTERACTIVE 1 #define YY_NO_UNPUT @@ -72,16 +74,31 @@ void initWarningFormat() * * static variables */ - -static const char * inputString; -static int inputPosition; -static int yyLineNr; -static QCString tmpString; -static QCString * s=0; -static bool * b=0; -static QStrList * l=0; -static int lastState; -static QCString elemStr; + +struct ConfigFileState +{ + int lineNr; + FILE *filePtr; + YY_BUFFER_STATE oldState; + YY_BUFFER_STATE newState; + QCString fileName; +}; + +static const char *inputString; +static int inputPosition; +static int yyLineNr; +static QCString yyFileName; +static QCString tmpString; +static QCString *s=0; +static bool *b=0; +static QStrList *l=0; +static int lastState; +static QCString elemStr; +static QCString includeName; +static QStrList includePathList; +static QStack includeStack; +static int includeDepth; + #CONFIG Static /* ----------------------------------------------------------------- @@ -91,15 +108,100 @@ static QCString elemStr; static int yyread(char *buf,int max_size) { - int c=0; - while( c < max_size && inputString[inputPosition] ) + // no file included + if (includeStack.isEmpty()) { - *buf = inputString[inputPosition++] ; - c++; buf++; + int c=0; + while( c < max_size && inputString[inputPosition] ) + { + *buf = inputString[inputPosition++] ; + c++; buf++; + } + return c; + } + else + { + //assert(includeStack.current()->newState==YY_CURRENT_BUFFER); + return fread(buf,1,max_size,includeStack.current()->filePtr); } - return c; } + +static FILE *tryPath(const char *path,const char *fileName) +{ + QCString absName=(QCString)path+"/"+fileName; + QFileInfo fi(absName); + if (fi.exists() && fi.isFile()) + { + FILE *f=fopen(absName,"r"); + if (!f) err("Error: could not open file %s for reading\n",absName.data()); + return f; + } + return 0; +} + +static FILE *findFile(const char *fileName) +{ + char *s=includePathList.first(); + while (s) // try each of the include paths + { + FILE *f = tryPath(s,fileName); + if (f) return f; + s=includePathList.next(); + } + // try cwd if includePathList fails + return tryPath(".",fileName); +} + +static void readIncludeFile(const char *incName) +{ + if (includeDepth==MAX_INCLUDE_DEPTH) { + err("Error: maximum include depth (%d) reached, %s is not included. Aborting...\n", + MAX_INCLUDE_DEPTH,incName); + exit(1); + } + + QCString inc = incName; + inc = inc.stripWhiteSpace(); + uint incLen = inc.length(); + if (inc.at(0)=='"' && inc.at(incLen-1)=='"') // strip quotes + { + inc=inc.mid(1,incLen-2); + } + + FILE *f; + + //printf("Searching for `%s'\n",incFileName.data()); + if ((f=findFile(inc))) // see if the include file can be found + { + // For debugging +#if SHOW_INCLUDES + for (i=0;ioldState=YY_CURRENT_BUFFER; + fs->lineNr=yyLineNr; + fs->fileName=yyFileName; + fs->filePtr=f; + // push the state on the stack + includeStack.push(fs); + // set the scanner to the include file + yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); + fs->newState=YY_CURRENT_BUFFER; + yyFileName=inc; + includeDepth++; + } + else + { + err("Error: @INCLUDE = %s: not found!\n",inc.data()); + exit(1); + } +} + + %} %option noyywrap @@ -111,13 +213,44 @@ static int yyread(char *buf,int max_size) %x GetStrList %x GetQuotedString %x GetEnvVar +%x Include %% <*>\0x0d "#" { BEGIN(SkipComment); } #CONFIG Rules -[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); } + +"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; } + /* include a config file */ +"@INCLUDE"[ \t]*"=" { BEGIN(Include);} +([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { + readIncludeFile(yytext); + BEGIN(Start); + } +<> { + //printf("End of include file\n"); + //printf("Include stack depth=%d\n",g_includeStack.count()); + if (includeStack.isEmpty()) + { + //printf("Terminating scanner!\n"); + yyterminate(); + } + else + { + ConfigFileState *fs=includeStack.pop(); + pclose(fs->filePtr); + YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; + yy_switch_to_buffer( fs->oldState ); + yy_delete_buffer( oldBuf ); + yyLineNr=fs->lineNr; + yyFileName=fs->fileName; + delete fs; fs=0; + includeDepth--; + } + } + +[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); } \n { yyLineNr++; BEGIN(Start); } \n { yyLineNr++; @@ -141,22 +274,6 @@ static int yyread(char *buf,int max_size) BEGIN(GetQuotedString); tmpString.resize(0); } - /* -"\$\(" { - //printf(">> Enter env\n"); - lastEnvState=YY_START; - BEGIN(GetEnvVar); - } -[a-z_A-Z0-9]+")" { - yytext[yyleng-1]='\0'; - const char *env=getenv(yytext); - int i; - int l=strlen(env); - //printf("env name=`%s' text=`%s'\n",yytext,env); - for (i=l-1;i>=0;i--) unput(env[i]); - BEGIN(lastEnvState); - } - */ "\""|"\n" { //printf("Quoted String = `%s'\n",tmpString.data()); if (lastState==GetString) @@ -165,7 +282,7 @@ static int yyread(char *buf,int max_size) elemStr+=tmpString; if (*yytext=='\n') { - err("Warning: Missing end quote (\") on line %d\n",yyLineNr); + err("Warning: Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data()); yyLineNr++; } BEGIN(lastState); @@ -185,8 +302,8 @@ static int yyread(char *buf,int max_size) { *b=FALSE; warn_cont("Warning: Invalid value `%s' for " - "boolean tag in line %d; use YES or NO\n", - bs.data(),yyLineNr); + "boolean tag in line %d, file %s; use YES or NO\n", + bs.data(),yyLineNr,yyFileName.data()); } } [^ \#\"\t\r\n]+ { @@ -249,7 +366,7 @@ static void writeStringList(QTextStream &t,QStrList &l) const char *s=p; bool hasBlanks=FALSE; while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t'); - if (!first) t << " "; + if (!first) t << " "; first=FALSE; if (hasBlanks) t << "\"" << s << "\""; else t << s; p = l.next(); @@ -378,7 +495,7 @@ static void substEnvVarsInString(QCString &s) QCString env=getenv(s.mid(i+2,l-3)); substEnvVarsInString(env); // recursively expand variables if needed. s = s.left(i)+env+s.right(s.length()-i-l); - p=i+l; + p=i+env.length(); // next time start at the end of the expanded string } //printf("substEnvVarInString(%s) end\n",s.data()); } @@ -866,11 +983,15 @@ void checkConfig() } -void parseConfig(const QCString &s) +void parseConfig(const QCString &s,const char *fn) { inputString = s; inputPosition = 0; yyLineNr = 1; + yyFileName=fn; + includeStack.setAutoDelete(TRUE); + includeStack.clear(); + includeDepth = 0; configYYrestart( configYYin ); BEGIN( Start ); configYYlex(); diff --git a/addon/doxywizard/doxywizard_templ.cpp b/addon/doxywizard/doxywizard_templ.cpp index cdc1145..00ed10c 100644 --- a/addon/doxywizard/doxywizard_templ.cpp +++ b/addon/doxywizard/doxywizard_templ.cpp @@ -78,7 +78,7 @@ static bool loadConfig( QString loadFile ) // parse the config file // this will initialize the various Config data members - parseConfig(contents); + parseConfig(contents,loadFile); configStrToVal(); f.close(); diff --git a/doc/commands.doc b/doc/commands.doc index 37d4890..dd0c378 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -909,7 +909,7 @@ Public/Protected/Private/... section. \sa section \ref cmdlink "\\link".
-\subsection cmdlink \link +\subsection cmdlink \link \addindex \link The links that are automatically generated by Doxygen always have the @@ -924,10 +924,6 @@ Public/Protected/Private/... section. See section \ref autolink "autolink" for more information on automatically generated links and valid link-objects. - \b Note: - Keep in mind that links are only meaningful in HTML text; - in \f$\mbox{\LaTeX}\f$ text, the link text is just written to the output. -
\subsection cmdref \ref ["(text)"] @@ -1315,7 +1311,7 @@ Public/Protected/Private/... section. \ref cmdlatexonly "\\latexonly".
-\subsection cmdimage \image [=] +\subsection cmdimage \image [""] [=] \addindex \image Inserts an image into the documentation. This command is format @@ -1327,27 +1323,36 @@ Public/Protected/Private/... section. The second argument specifies the file name of the image. Doxygen will look for files in the paths (or files) that you specified - after the \ref cfg_image_path "IMAGE_PATH" tag. + after the \ref cfg_image_path "IMAGE_PATH" tag. If the image is found it will be copied to the correct output directory. If the image name contains spaces you'll have to put quotes (") around it. - - The third argument can be used to specify the width or height of the - image. This is only useful for \f$\mbox{\LaTeX}\f$ output - (i.e. format=latex). \c sizeindication can be either - \c width or \c height. The size should be a valid + You can also specify an absolute URL instead of a file name, but then + doxygen does not copy the image or check its existance. + + The third argument is optional and can be used to specify the caption + that is displayed below the image. This argument has to be specified + between quotes even if it does not contain any spaces. The quotes are + stripped before the caption is displayed. + + The fourth argument is also optional and can be used to specify the + width or height of the image. This is only useful + for \f$\mbox{\LaTeX}\f$ output + (i.e. format=latex). The \c sizeindication can be + either \c width or \c height. The size should be a valid size specifier in \f$\mbox{\LaTeX}\f$ (for example 10cm or - 6in). + 6in or a symbolic width like \\textwidth). Here is example of a comment block: \verbatim /*! Here is a snapshot of my new application: * \image html application.jpg - * \image latex application.eps width=10cm + * \image latex application.eps "My application" width=10cm */ \endverbatim - And this is an example of how the configuration file may look: + And this is an example of how the relevant part of the configuration file + may look: \verbatim IMAGE_PATH = my_image_dir diff --git a/doc/config.doc b/doc/config.doc index c282896..063f634 100644 --- a/doc/config.doc +++ b/doc/config.doc @@ -40,6 +40,19 @@ Multiple lines can be concatenated by inserting a backslash (\\) as the last character of a line. Environment variables can be expanded using the pattern \c $(ENV_VARIABLE_NAME). +You can also include part of a configuration file from another configuration +file using a \@INCLUDE tag as follows: +\verbatim +@INCLUDE = config_file_name +\endverbatim +The include file is searched in the current working directory. You can +also specify a list of directories that should be searched before looking +in the current working directory. Do this by putting a \@INCLUDEPATH tag +with these paths before the \@INCLUDE tag, e.g: +\verbatim +@INCLUDEPATH = my_config_dir +\endverbatim + The configuration options can be divided into several categories. Below is an alphabetical index of the tags that are recognized followed by the descriptions of the tags grouped by category. diff --git a/doc/starting.doc b/doc/starting.doc index 23c6268..cd48df3 100644 --- a/doc/starting.doc +++ b/doc/starting.doc @@ -197,21 +197,22 @@ During parsing the following steps take place: See section \ref htmlcmds for an overview of all supported HTML tags. -Using a number of column-aligned minus signs at the start of a - line in a comment block will generate a bullet list. - Nested lists are also possible. + By putting a number of column-aligned minus signs at the start of a + line, a bullet list will automatically be generated. + Numbered lists can also be generated by using a minus followed by a hash. + Nesting of lists is allowed.

Here is an example: \verbatim /*! * A list of events: * - mouse events - * - mouse move event - * - mouse click event - * - mouse double click event\n - * More info about the click event. + * -# mouse move event + * -# mouse click event\n + * More info about the click event. + * -# mouse double click event * - keyboard events - * - key down event - * - key up event + * -# key down event + * -# key up event * * More text here. */ @@ -220,13 +221,13 @@ Using a number of column-aligned minus signs at the start of a A list of events: - mouse events - - mouse move event - - mouse click event\n - More info about the click event. - - mouse double click event + -# mouse move event + -# mouse click event\n + More info about the click event. + -# mouse double click event - keyboard events - - key down event - - key up event + -# key down event + -# key up event More text here. diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec index e44625a..3a30f60 100644 --- a/packages/rpm/doxygen.spec +++ b/packages/rpm/doxygen.spec @@ -1,5 +1,5 @@ Name: doxygen -Version: 1.2.0-20000731 +Version: 1.2.0-20000806 Summary: documentation system for C, C++ and IDL Release: 1 Source0: doxygen-%{version}.src.tar.gz diff --git a/src/Makefile.in b/src/Makefile.in index 0d19f57..cd4138d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -39,7 +39,7 @@ clean: Makefile.doxygen Makefile.doxytag Makefile.doxysearch $(MAKE) -f Makefile.doxysearch clean distclean: clean - -$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \ + -$(RM) scanner.cpp doc.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \ ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp \ declinfo.cpp defargs.cpp diff --git a/src/classdef.cpp b/src/classdef.cpp index 928860a..bd7ee04 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -21,7 +21,7 @@ #include "classdef.h" #include "classlist.h" #include "entry.h" -#include "scanner.h" +#include "doc.h" #include "doxygen.h" #include "membername.h" #include "message.h" @@ -974,7 +974,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trMemberTypedefDocumentation()); ol.endGroupHeader(); - typedefMembers.writeDocumentation(ol,name()); + typedefMembers.writeDocumentation(ol,name(),this); } enumMembers.countDocMembers(); @@ -984,7 +984,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trMemberEnumerationDocumentation()); ol.endGroupHeader(); - enumMembers.writeDocumentation(ol,name()); + enumMembers.writeDocumentation(ol,name(),this); } //enumValMembers.countDocMembers(); @@ -1004,7 +1004,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trConstructorDocumentation()); ol.endGroupHeader(); - constructors.writeDocumentation(ol,name()); + constructors.writeDocumentation(ol,name(),this); } functionMembers.countDocMembers(); @@ -1014,7 +1014,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trMemberFunctionDocumentation()); ol.endGroupHeader(); - functionMembers.writeDocumentation(ol,name()); + functionMembers.writeDocumentation(ol,name(),this); } relatedMembers.countDocMembers(); @@ -1024,7 +1024,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trRelatedFunctionDocumentation()); ol.endGroupHeader(); - relatedMembers.writeDocumentation(ol,name()); + relatedMembers.writeDocumentation(ol,name(),this); } variableMembers.countDocMembers(); @@ -1034,7 +1034,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trMemberDataDocumentation()); ol.endGroupHeader(); - variableMembers.writeDocumentation(ol,name()); + variableMembers.writeDocumentation(ol,name(),this); } ol.startTextBlock(); @@ -1601,7 +1601,7 @@ void ClassDef::determineImplUsageRelation() MemberDef *md=mi->memberDef; if (md->isVariable()) // for each member variable in this class { - QCString type=md->typeString(); + QCString type=removeRedundantWhiteSpace(md->typeString()); int typeLen=type.length(); static const QRegExp re("[a-z_A-Z][a-z_A-Z0-9:]*"); //printf("in class %s found var type=`%s' name=`%s'\n", diff --git a/src/classdef.h b/src/classdef.h index a0a494d..168d731 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -203,6 +203,7 @@ struct UsesClassDef UsesClassDef(ClassDef *cd) : classDef(cd) { accessors = new QDict(17); + containment = TRUE; } ~UsesClassDef() { @@ -218,6 +219,7 @@ struct UsesClassDef ClassDef *classDef; QDict *accessors; QCString templSpecifiers; + bool containment; }; class UsesClassDict : public QDict diff --git a/src/classlist.cpp b/src/classlist.cpp index d037a77..68436d4 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -20,7 +20,7 @@ #include "util.h" #include "outputlist.h" #include "language.h" -#include "scanner.h" +#include "doc.h" ClassList::ClassList() : QList() { diff --git a/src/code.l b/src/code.l index be75cc3..9edf6e2 100644 --- a/src/code.l +++ b/src/code.l @@ -410,7 +410,7 @@ static bool getLink(const char *className, FileDef *fd; NamespaceDef *nd; GroupDef *gd; - QCString m=memberName; + QCString m=removeRedundantWhiteSpace(memberName); QCString c=className; //printf("Trying `%s'::`%s'\n",c.data(),m.data()); if (getDefs(c,m,"()",md,cd,fd,nd,gd) && md->isLinkable()) @@ -574,39 +574,6 @@ static void generateMemberLink(OutputList &ol,const char *varName, if (mcd && mcd->isLinkable()) { if (generateClassMemberLink(ol,mcd,memName)) return; -#if 0 - //printf("Found class `%s'\n",mcd->name().data()); - MemberName *mmn=memberNameDict[memName]; - if (mmn) - { - MemberNameIterator mmni(*mmn); - MemberDef *mmd,*xmd=0; - ClassDef *xcd=0; - const int maxInheritanceDepth = 100000; - int mdist=maxInheritanceDepth; - for (;(mmd=mmni.current());++mmni) - { - int m=minClassDistance(mcd,mmd->getClassDef()); - if (mgetClassDef()->isLinkable()) - { - mdist=m; - xcd=mmd->getClassDef(); - xmd=mmd; - } - } - if (mdist!=maxInheritanceDepth) - { - if (g_currentDefinition && g_currentMemberDef && - xmd!=g_currentMemberDef && g_insideBody) - { - xmd->addSourceReference(g_currentMemberDef); - } - writeMultiLineCodeLink(ol,xcd->getReference(), - xcd->getOutputFileBase(),xmd->anchor(),memName); - return; - } - } -#endif } } } @@ -617,27 +584,12 @@ static void generateMemberLink(OutputList &ol,const char *varName, return; } -static QCString removeWhiteSpace(const char *s) -{ - QCString result; - if (s) - { - const char *p=s; - int c; - while ((c=*p++)) - { - if (c!=' ' && c!='\n' && c!='\r' && c!='\t') result+=c; - } - } - return result; -} - static void generateFunctionLink(OutputList &ol,char *funcName) { OutputList result(&ol); CodeClassDef *ccd=0; QCString locScope=g_classScope.copy(); - QCString locFunc=removeWhiteSpace(funcName); + QCString locFunc=removeRedundantWhiteSpace(funcName); int i=locFunc.findRev("::"); if (i>0) { @@ -970,7 +922,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" addType(); g_name+=yytext; } -{SCOPENAME}{B}*"<"[^\n\>]*">"/{B}* { // A *pt; +{SCOPENAME}{B}*"<"[^\n\"\>]*">"/{B}* { // A *pt; generateClassLink(*g_code,yytext); addType(); g_name+=yytext; diff --git a/src/config.h b/src/config.h index c1a4fb6..a5661f4 100644 --- a/src/config.h +++ b/src/config.h @@ -1,4 +1,4 @@ -/* This file was generated by configgen on Mon Jul 31 16:07:18 2000 +/* This file was generated by configgen on Sat Aug 5 20:49:38 2000 * from config_templ.h * * DO NOT EDIT! @@ -27,7 +27,7 @@ #include #include -extern void parseConfig(const QCString &config); +extern void parseConfig(const QCString &config,const char *fn); extern void writeTemplateConfig(QFile *f,bool shortList); extern void checkConfig(); extern void configStrToVal(); diff --git a/src/config.l b/src/config.l index eebe6bd..54f168a 100644 --- a/src/config.l +++ b/src/config.l @@ -1,4 +1,4 @@ -/* This file was generated by configgen on Mon Jul 31 16:11:27 2000 +/* This file was generated by configgen on Sun Aug 6 16:28:57 2000 * from config_templ.l * * DO NOT EDIT! @@ -33,6 +33,7 @@ #include #include #include +#include #include "config.h" #include "version.h" @@ -64,6 +65,7 @@ void initWarningFormat() #include "language.h" #endif +#define MAX_INCLUDE_DEPTH 10 #define YY_NEVER_INTERACTIVE 1 #define YY_NO_UNPUT @@ -178,16 +180,31 @@ QStrList Config::extDocPathList; * * static variables */ - -static const char * inputString; -static int inputPosition; -static int yyLineNr; -static QCString tmpString; -static QCString * s=0; -static bool * b=0; -static QStrList * l=0; -static int lastState; -static QCString elemStr; + +struct ConfigFileState +{ + int lineNr; + FILE *filePtr; + YY_BUFFER_STATE oldState; + YY_BUFFER_STATE newState; + QCString fileName; +}; + +static const char *inputString; +static int inputPosition; +static int yyLineNr; +static QCString yyFileName; +static QCString tmpString; +static QCString *s=0; +static bool *b=0; +static QStrList *l=0; +static int lastState; +static QCString elemStr; +static QCString includeName; +static QStrList includePathList; +static QStack includeStack; +static int includeDepth; + static QCString tabSizeString; static QCString colsInAlphaIndexString; static QCString maxDotGraphWidthString; @@ -200,15 +217,100 @@ static QCString maxDotGraphHeightString; static int yyread(char *buf,int max_size) { - int c=0; - while( c < max_size && inputString[inputPosition] ) + // no file included + if (includeStack.isEmpty()) + { + int c=0; + while( c < max_size && inputString[inputPosition] ) + { + *buf = inputString[inputPosition++] ; + c++; buf++; + } + return c; + } + else { - *buf = inputString[inputPosition++] ; - c++; buf++; + //assert(includeStack.current()->newState==YY_CURRENT_BUFFER); + return fread(buf,1,max_size,includeStack.current()->filePtr); } - return c; } + +static FILE *tryPath(const char *path,const char *fileName) +{ + QCString absName=(QCString)path+"/"+fileName; + QFileInfo fi(absName); + if (fi.exists() && fi.isFile()) + { + FILE *f=fopen(absName,"r"); + if (!f) err("Error: could not open file %s for reading\n",absName.data()); + return f; + } + return 0; +} + +static FILE *findFile(const char *fileName) +{ + char *s=includePathList.first(); + while (s) // try each of the include paths + { + FILE *f = tryPath(s,fileName); + if (f) return f; + s=includePathList.next(); + } + // try cwd if includePathList fails + return tryPath(".",fileName); +} + +static void readIncludeFile(const char *incName) +{ + if (includeDepth==MAX_INCLUDE_DEPTH) { + err("Error: maximum include depth (%d) reached, %s is not included. Aborting...\n", + MAX_INCLUDE_DEPTH,incName); + exit(1); + } + + QCString inc = incName; + inc = inc.stripWhiteSpace(); + uint incLen = inc.length(); + if (inc.at(0)=='"' && inc.at(incLen-1)=='"') // strip quotes + { + inc=inc.mid(1,incLen-2); + } + + FILE *f; + + //printf("Searching for `%s'\n",incFileName.data()); + if ((f=findFile(inc))) // see if the include file can be found + { + // For debugging +#if SHOW_INCLUDES + for (i=0;ioldState=YY_CURRENT_BUFFER; + fs->lineNr=yyLineNr; + fs->fileName=yyFileName; + fs->filePtr=f; + // push the state on the stack + includeStack.push(fs); + // set the scanner to the include file + yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); + fs->newState=YY_CURRENT_BUFFER; + yyFileName=inc; + includeDepth++; + } + else + { + err("Error: @INCLUDE = %s: not found!\n",inc.data()); + exit(1); + } +} + + %} %option noyywrap @@ -220,6 +322,7 @@ static int yyread(char *buf,int max_size) %x GetStrList %x GetQuotedString %x GetEnvVar +%x Include %% @@ -343,7 +446,37 @@ static int yyread(char *buf,int max_size) "BIN_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&Config::binAbsPath; s->resize(0); } "EXT_DOC_PATHS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extDocPathList; l->clear(); elemStr=""; } "EXT_DOC_PATHS"[ \t]*"+=" { BEGIN(GetStrList); l=&Config::extDocPathList; elemStr=""; } -[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); } + +"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; } + /* include a config file */ +"@INCLUDE"[ \t]*"=" { BEGIN(Include);} +([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { + readIncludeFile(yytext); + BEGIN(Start); + } +<> { + //printf("End of include file\n"); + //printf("Include stack depth=%d\n",g_includeStack.count()); + if (includeStack.isEmpty()) + { + //printf("Terminating scanner!\n"); + yyterminate(); + } + else + { + ConfigFileState *fs=includeStack.pop(); + pclose(fs->filePtr); + YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; + yy_switch_to_buffer( fs->oldState ); + yy_delete_buffer( oldBuf ); + yyLineNr=fs->lineNr; + yyFileName=fs->fileName; + delete fs; fs=0; + includeDepth--; + } + } + +[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); } \n { yyLineNr++; BEGIN(Start); } \n { yyLineNr++; @@ -367,22 +500,6 @@ static int yyread(char *buf,int max_size) BEGIN(GetQuotedString); tmpString.resize(0); } - /* -"\$\(" { - //printf(">> Enter env\n"); - lastEnvState=YY_START; - BEGIN(GetEnvVar); - } -[a-z_A-Z0-9]+")" { - yytext[yyleng-1]='\0'; - const char *env=getenv(yytext); - int i; - int l=strlen(env); - //printf("env name=`%s' text=`%s'\n",yytext,env); - for (i=l-1;i>=0;i--) unput(env[i]); - BEGIN(lastEnvState); - } - */ "\""|"\n" { //printf("Quoted String = `%s'\n",tmpString.data()); if (lastState==GetString) @@ -391,7 +508,7 @@ static int yyread(char *buf,int max_size) elemStr+=tmpString; if (*yytext=='\n') { - err("Warning: Missing end quote (\") on line %d\n",yyLineNr); + err("Warning: Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data()); yyLineNr++; } BEGIN(lastState); @@ -411,8 +528,8 @@ static int yyread(char *buf,int max_size) { *b=FALSE; warn_cont("Warning: Invalid value `%s' for " - "boolean tag in line %d; use YES or NO\n", - bs.data(),yyLineNr); + "boolean tag in line %d, file %s; use YES or NO\n", + bs.data(),yyLineNr,yyFileName.data()); } } [^ \#\"\t\r\n]+ { @@ -807,7 +924,7 @@ static void writeStringList(QTextStream &t,QStrList &l) const char *s=p; bool hasBlanks=FALSE; while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t'); - if (!first) t << " "; + if (!first) t << " "; first=FALSE; if (hasBlanks) t << "\"" << s << "\""; else t << s; p = l.next(); @@ -2160,7 +2277,7 @@ static void substEnvVarsInString(QCString &s) QCString env=getenv(s.mid(i+2,l-3)); substEnvVarsInString(env); // recursively expand variables if needed. s = s.left(i)+env+s.right(s.length()-i-l); - p=i+l; + p=i+env.length(); // next time start at the end of the expanded string } //printf("substEnvVarInString(%s) end\n",s.data()); } @@ -2689,11 +2806,15 @@ void checkConfig() } -void parseConfig(const QCString &s) +void parseConfig(const QCString &s,const char *fn) { inputString = s; inputPosition = 0; yyLineNr = 1; + yyFileName=fn; + includeStack.setAutoDelete(TRUE); + includeStack.clear(); + includeDepth = 0; configYYrestart( configYYin ); BEGIN( Start ); configYYlex(); diff --git a/src/definition.cpp b/src/definition.cpp index a28228f..13707d8 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -23,7 +23,8 @@ #include "language.h" #include "message.h" #include "outputlist.h" -#include "scanner.h" +#include "doc.h" +#include "code.h" #include Definition::Definition(const char *df,int dl, @@ -39,6 +40,8 @@ Definition::Definition(const char *df,int dl, bodyDef=0; sourceRefList=0; sourceRefDict=0; + m_todoId=0; + m_testId=0; } Definition::~Definition() diff --git a/src/definition.h b/src/definition.h index 232e632..cf59b0a 100644 --- a/src/definition.h +++ b/src/definition.h @@ -101,6 +101,10 @@ class Definition void writeSourceRefs(OutputList &ol,const char *scopeName); void addSourceReference(MemberDef *d); + void setRefItems(int todoId,int testId) { m_todoId=todoId; m_testId=testId; } + int todoId() const { return m_todoId; } + int testId() const { return m_testId; } + /*! returns the file in which this definition was found */ QCString getDefFileName() const { return defFileName; } /*! returns the line number at which the definition was found */ @@ -124,6 +128,8 @@ class Definition MemberList *sourceRefList; // list of entities that refer to this // entity in their definition MemberDict *sourceRefDict; + int m_testId; // id for test case + int m_todoId; // id for todo case }; diff --git a/src/diagram.cpp b/src/diagram.cpp index 3f6dd61..2173f16 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -475,7 +475,8 @@ void TreeDiagram::computeExtremes(uint *maxLabelLen,uint *maxXPos) void TreeDiagram::drawBoxes(QTextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, - uint cellWidth,uint cellHeight) + uint cellWidth,uint cellHeight, + bool generateMap) { DiagramRow *dr=first(); if (!doBase) dr=next(); @@ -543,7 +544,8 @@ void TreeDiagram::drawBoxes(QTextStream &t,Image *image, bool hasDocs=di->getClassDef()->isLinkable(); writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow, hasDocs,di->getChildren()->count()>0); - if (!firstRow) writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight); + if (!firstRow && generateMap) + writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight); } else { @@ -575,7 +577,8 @@ void TreeDiagram::drawBoxes(QTextStream &t,Image *image, } bool hasDocs=di->getClassDef()->isLinkable(); writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow,hasDocs); - if (!firstRow) writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight); + if (!firstRow && generateMap) + writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight); } else { @@ -1244,7 +1247,7 @@ void ClassDiagram::writeFigure(QTextStream &output,const char *path, void ClassDiagram::writeImageMap(QTextStream &t,const char *path, - const char *fileName) + const char *fileName, bool generateMap) { uint baseRows=base->computeRows(); uint superRows=super->computeRows(); @@ -1271,13 +1274,13 @@ void ClassDiagram::writeImageMap(QTextStream &t,const char *path, Image image(imageWidth,imageHeight); - base->drawBoxes(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight); - super->drawBoxes(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight); + base->drawBoxes(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight,generateMap); + super->drawBoxes(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight,generateMap); base->drawConnectors(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight); super->drawConnectors(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight); image.save((QCString)path+"/"+fileName+".gif"); - t << "" << endl; + if (generateMap) t << "" << endl; } diff --git a/src/diagram.h b/src/diagram.h index 2557065..74495b8 100644 --- a/src/diagram.h +++ b/src/diagram.h @@ -104,7 +104,8 @@ class TreeDiagram : public QList void drawBoxes(QTextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, - uint cellWidth,uint cellHeight); + uint cellWidth,uint cellHeight, + bool generateMap=TRUE); void drawConnectors(QTextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, @@ -123,7 +124,7 @@ class ClassDiagram void writeFigure(QTextStream &t,const char *path, const char *file); void writeImageMap(QTextStream &t,const char *path, - const char *file); + const char *file,bool generateMap=TRUE); private: TreeDiagram *base; TreeDiagram *super; diff --git a/src/doc.h b/src/doc.h new file mode 100644 index 0000000..ee54f8a --- /dev/null +++ b/src/doc.h @@ -0,0 +1,33 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2000 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 DOC_H +#define DOC_H + +#include "qtbc.h" + +class OutputList; + +extern void parseDoc(OutputList &ol, + const char *fileName,int startLine, + const char *clName, const char *memName, + const QCString &docString); +extern void parseExample(OutputList &ol,const QCString &docString, + const char *fileName); +extern void parseText(OutputList &ol,const QCString &txtString); + +#endif diff --git a/src/doc.l b/src/doc.l new file mode 100644 index 0000000..4aa17c8 --- /dev/null +++ b/src/doc.l @@ -0,0 +1,2214 @@ +/***************************************************************************** + * + * + * + * Copyright (C) 1997-2000 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. + * + */ + +%{ + +/* + * includes + */ +#include +#include +#include +#include +#include + +#include "qtbc.h" +#include +#include +#include + +#include "doc.h" +#include "code.h" +#include "message.h" +#include "doxygen.h" +#include "config.h" +#include "util.h" +#include "language.h" +#include "outputlist.h" +#include "reflist.h" + +#ifndef WIN32 +#include +#endif + +#define YY_NEVER_INTERACTIVE 1 + +/* ----------------------------------------------------------------- + * + * scanner's state variables + */ +static bool insideArgumentList; +static QCString className; +static QCString memberName; +static OutputList * outDoc; +static QCString linkRef; +static QCString linkText; +static QCString codeBlock; +static const char * inputString; +static int inputPosition; +static char yyFileName[4096] ; +static int yyLineNr = 1 ; +static bool exampleDoc; +static QCString exampleName; +static QCString htmlUrl,htmlText; +static QCString currentIncludeFile; +static int includeFileOffset = 0; +static int includeFileLength = 0; +static bool firstLine; +static bool inParamBlock; +static bool inRetValBlock; +static bool inExceptionBlock; +static bool inSeeBlock; +static bool inReturnBlock; +static bool inAuthorBlock; +static bool inDeprecatedBlock; +static bool inVersionBlock; +static bool inSinceBlock; +static bool inDateBlock; +static bool inBugBlock; +static bool inNoteBlock; +static bool inPreBlock; +static bool inPostBlock; +static bool inInvarBlock; +static bool inWarningBlock; +static bool inRemarkBlock; +static bool inAttentionBlock; +static bool inParBlock; +static QCString sectionRef; +static bool insideVerbatim = FALSE; +static int depthIf; +//static int currentListIndentLevel; +static QStack currentListIndent; +static QCString curImageName; +static QCString curImageCaption; +static QCString internalRefFile; +static QCString internalRefAnchor; + +//----------------------------------------------------------------------------- + +static void initParser() +{ + insideArgumentList=FALSE; + className.resize(0); + memberName.resize(0); + linkRef.resize(0); + linkText.resize(0); + codeBlock.resize(0); + htmlUrl.resize(0); + htmlText.resize(0); + currentIncludeFile.resize(0); + includeFileOffset = 0; + includeFileLength = 0; + firstLine = TRUE; + inParamBlock = FALSE; + inRetValBlock = FALSE; + inExceptionBlock = FALSE; + inSeeBlock = FALSE; + inReturnBlock = FALSE; + inAuthorBlock = FALSE; + inDeprecatedBlock = FALSE; + inVersionBlock = FALSE; + inSinceBlock = FALSE; + inDateBlock = FALSE; + inBugBlock = FALSE; + inNoteBlock = FALSE; + inPreBlock = FALSE; + inPostBlock = FALSE; + inInvarBlock = FALSE; + inWarningBlock = FALSE; + inRemarkBlock = FALSE; + inAttentionBlock = FALSE; + inParBlock = FALSE; +} + +//----------------------------------------------------------------------------- + +void scanString(const char *s); +void internalParseDocument(const char *s); + +//----------------------------------------------------------------------------- + +class TableElem +{ + public: + TableElem(int r,int c); + ~TableElem(); + int getRow() { return row; } + int getCol() { return col; } + OutputList *outputList() { return ol; } + + private: + OutputList *ol; + int row; + int col; +}; + +TableElem::TableElem(int r,int c) +{ + //printf("TableElem::TableElem(%d,%d)\n",r,c); + ol=new OutputList(outDoc); + outDoc=ol; + row=r; + col=c; +} + +TableElem::~TableElem() +{ + //printf("TableElem::~TableElem(%d,%d)\n",row,col); + delete ol; ol=0; +} + +class Table +{ + public: + Table(); + ~Table(); + void newRow(); + void newElem(); + + private: + OutputList *parentDoc; + QList *elemList; + int curRow; + int curCol; + int rows; + int cols; +}; + +Table::Table() +{ + parentDoc=outDoc; + elemList=new QList; + elemList->setAutoDelete(TRUE); + curRow=curCol=rows=cols=0; +} + +Table::~Table() +{ + //printf("Table::~Table()\n"); + // use elemList & cols & rows + if (cols>0 && rows>0) + { + parentDoc->startTable(cols); + TableElem *e=elemList->first(); + while (e) + { + if (e->getRow()>0) + { + if (e->getCol()==0) + { + if (e->getRow()>1) parentDoc->endTableRow(); + parentDoc->nextTableRow(); + } + else + { + parentDoc->nextTableColumn(); + } + *parentDoc+=*e->outputList(); + parentDoc->endTableColumn(); + } + e=elemList->next(); + } + parentDoc->endTable(); + } + delete elemList; elemList=0; + outDoc=parentDoc; +} + +void Table::newRow() +{ + //printf("Table::newRow()\n"); + curRow++; + if (curRow>rows) rows=curRow; + curCol=0; +} + +void Table::newElem() +{ + //printf("Table::newElem(%d,%d)\n",curRow,curCol); + TableElem *te = new TableElem(curRow,curCol); + elemList->append(te); + + curCol++; + if (curCol>cols) cols=curCol; +} + +static QStack tableStack; +static Table *curTable; + +static void startTable() +{ + //printf("startTable()\n"); + curTable=new Table; + tableStack.push(curTable); +} + +static void endTable() +{ + //printf("endTable()\n"); + delete tableStack.pop(); // the destructor adds the table to the stream! + curTable=tableStack.top(); +} + +static void forceEndTable() +{ + err("Error: More
tags found than
" + "tags in documentation block in file %s!\n",yyFileName); + while (!tableStack.isEmpty()) + { + endTable(); + } +} + +//----------------------------------------------------------------------------- + +static void endArgumentList() +{ + if (insideArgumentList) + { + insideArgumentList=FALSE; + outDoc->endItemList(); + } +} + +static void includeFile(OutputList &ol,const char *fileName,bool quiet) +{ + bool ambig; + FileDef *fd; + if ((fd=findFileDef(exampleNameDict,fileName,ambig))) + { + currentIncludeFile=fileToString(fd->absFilePath()); + includeFileOffset=0; + includeFileLength=currentIncludeFile.length(); + OutputList codeFrag(&ol); + parseCode(codeFrag,0,currentIncludeFile,exampleDoc,exampleName); + if (!quiet) + { + ol.startCodeFragment(); + ol+=codeFrag; + ol.endCodeFragment(); + } + } + else if (ambig) + { + QCString text; + text.sprintf("Include file name %s is ambigious.\n",fileName); + text+="Possible candidates:\n"; + text+=showFileDefMatches(exampleNameDict,fileName); + warn(yyFileName,yyLineNr,text); + } + else + { + warn(yyFileName,yyLineNr, + "Warning: example file %s is not found. " + "Check your EXAMPLE_PATH",fileName + ); + } +} + +static void verbIncludeFile(OutputList &ol,const char *name) +{ + bool ambig; + FileDef *fd; + if ((fd=findFileDef(exampleNameDict,name,ambig))) + { + ol.startCodeFragment(); + ol.codify(fileToString(fd->absFilePath())); + ol.endCodeFragment(); + } + else if (ambig) + { + QCString text; + text.sprintf("Include file name %s is ambigious.\n",name); + text+=("Possible candidates:\n"); + text+=showFileDefMatches(exampleNameDict,name); + warn(yyFileName,yyLineNr,text); + } + else + { + warn(yyFileName,yyLineNr, + "Warning: example file %s is not found. " + "Check your EXAMPLE_PATH",name); + } +} + + +static QCString stripQuotes(const char *s) +{ + QCString name; + if (s==0 || *s==0) return name; + name=s; + if (name.at(0)=='"' && name.at(name.length()-1)=='"') + { + name=name.mid(1,name.length()-2); + } + return name; +} + +static QCString stripKnownExtensions(const char *text) +{ + QCString result=text; + if (result.right(4)==".tex") result=result.left(result.length()-4); + else if (result.right(5)==".html") result=result.left(result.length()-5); + //printf("%s stripKnowExtensions(%s)\n",result.data(),text); + return result; +} + +static void skipLine(OutputList &ol,const char *key) +{ + bool found=FALSE; + while (!found) + { + QCString s; + char c; + while ( includeFileOffsetstartEnumList(); else outDoc->startItemList(); + } + void endList() + { + if (enumerated) outDoc->endEnumList(); else outDoc->endItemList(); + } + void writeItem() + { + outDoc->writeListItem(); + } + int indent; + bool enumerated; +}; + +static QStack listIndentStack; +static bool insideItemList = FALSE; + +static void addListItemMarker(const char *marker,int dashPos,bool enumerated) +{ + // find the actual position at which the bullet was found + int i; + int indent=0; + for (i=0;istartList(); + listIndentStack.top()->writeItem(); + insideItemList=TRUE; + } + else + { + IndentInfo *pPrevInfo = listIndentStack.top(); + if (pPrevInfo->indent==indent && pPrevInfo->enumerated==enumerated) + // new item of same kind at the same indent level + { + pPrevInfo->writeItem(); + } + else if (pPrevInfo->indent==indent) + // new item of diffent kind at the same indent level + { + // switch to a diffent list type + pPrevInfo->endList(); + pPrevInfo->enumerated=enumerated; + pPrevInfo->startList(); + pPrevInfo->writeItem(); + } + else if (pPrevInfo->indentstartList(); + listIndentStack.top()->writeItem(); + } + else // end sub item list + { + pPrevInfo->endList(); + listIndentStack.pop(); + delete pPrevInfo; + // safe guard against wrong indenting + if (listIndentStack.isEmpty()) + { + insideItemList=FALSE; + warn(yyFileName,yyLineNr, + "Warning: list item with invalid indent found!"); + } + else + { + listIndentStack.top()->writeItem(); + } + } + } +} + +// end the current (nested) list regardless of the nesting level. +static void forceEndItemList() +{ + IndentInfo *info; + while ((info=listIndentStack.pop())!=0) + { + info->endList(); + delete info; + } + insideItemList=FALSE; +} + +//----------------------------------------------------------------- + +static bool inBlock() +{ + return inParamBlock || inRetValBlock || inSeeBlock || inReturnBlock || inAuthorBlock || + inVersionBlock || inSinceBlock || inDateBlock || inWarningBlock || inRemarkBlock || + inAttentionBlock || inBugBlock || inNoteBlock || + inParBlock || inExceptionBlock || inDeprecatedBlock || inPreBlock || + inPostBlock || inInvarBlock; +} + +static void endBlock() +{ + if (inParamBlock || inRetValBlock || inExceptionBlock) + { + outDoc->endDescTableData(); + outDoc->endDescTable(); + } + outDoc->endDescList(); + inParamBlock=inRetValBlock=inSeeBlock=inReturnBlock=inAuthorBlock= + inVersionBlock=inSinceBlock=inDateBlock=inBugBlock=inNoteBlock=inWarningBlock= + inParBlock=inExceptionBlock=inDeprecatedBlock=inPreBlock=inPostBlock= + inInvarBlock=inRemarkBlock=inAttentionBlock=FALSE; +} + +//----------------------------------------------------------------- + +enum ImageTypes +{ + IT_Html, + IT_Latex +}; + +// search for an image in the imageNameDict and if found +// copies the image to the output directory (which is the +// html directory if type==0 or the latex directory if type==1) +static QCString findAndCopyImage(const char *fileName,ImageTypes type) +{ + QCString result; + bool ambig; + FileDef *fd; + if ((fd=findFileDef(imageNameDict,fileName,ambig))) + { + QFile inImage(QString(fd->absFilePath().data())); + if (inImage.open(IO_ReadOnly)) + { + result = fileName; + int i; + if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1) + { + result.right(result.length()-i-1); + } + QCString outputDir; + switch(type) + { + case IT_Html: + outputDir = Config::htmlOutputDir; + break; + case IT_Latex: + outputDir = Config::latexOutputDir; + break; + } + QCString outputFile = outputDir+"/"+result; + QFile outImage(QString(outputFile.data())); + if (outImage.open(IO_WriteOnly)) // copy the image + { + char *buffer = new char[inImage.size()]; + inImage.readBlock(buffer,inImage.size()); + outImage.writeBlock(buffer,inImage.size()); + outImage.flush(); + delete buffer; + } + else + { + warn(yyFileName,yyLineNr, + "Warning: could not write output image %s",outputFile.data()); + } + } + else + { + warn(yyFileName,yyLineNr, + "Warning: could not open image %s",fileName); + } + } + else if (ambig) + { + QCString text; + text.sprintf("Warning: image file name %s is ambigious.\n",fileName); + text+="Possible candidates:\n"; + text+=showFileDefMatches(imageNameDict,fileName); + warn(yyFileName,yyLineNr,text); + } + else + { + result=fileName; + if (result.left(5)!="http:" && result.left(6)!="https:") + { + warn(yyFileName,yyLineNr, + "Warning: image file %s is not found in IMAGE_PATH: " + "assuming external image.",fileName + ); + } + } + return result; +} + + +void writeImage(ImageTypes it,const char *size) +{ + bool hasCaption=!curImageCaption.isEmpty(); + outDoc->pushGeneratorState(); + switch(it) + { + case IT_Latex: + { + outDoc->disableAllBut(OutputGenerator::Latex); + outDoc->startImage(curImageName,size,hasCaption); + if (hasCaption) + { + scanString(curImageCaption); + } + outDoc->endImage(hasCaption); + } + break; + case IT_Html: + { + outDoc->disableAllBut(OutputGenerator::Html); + outDoc->startImage(curImageName,0,hasCaption); + if (hasCaption) + { + scanString(curImageCaption); + } + outDoc->endImage(hasCaption); + } + break; + } + outDoc->popGeneratorState(); +} + + +/* ----------------------------------------------------------------- */ +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); + +static int yyread(char *buf,int max_size) +{ + int c=0; + while( c < max_size && inputString[inputPosition] ) + { + *buf = inputString[inputPosition++] ; + //printf("%d (%c)\n",*buf,*buf); + c++; buf++; + } + return c; +} + +//ATTR ((({BN}+[^\>]+)/">")?) +%} + +CMD ("\\"|"@") +BN [ \t\n\r] +BL [ \t\r]*"\n" +B [ \t] +BS ^(({B}*"//")?)(({B}*"*"+)?){B}* +FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+] +FILEECHAR [a-z_A-Z0-9\-\+] +FILEMASK {FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)+ +FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]+"\"") +ID [a-z_A-Z][a-z_A-Z0-9]* +SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) +SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+ +URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/\=]+ +NONTERM [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9] +WORD ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"") +ATTR ({B}+[^>\n]*)? +A [aA] +BOLD [bB] +BODY [bB][oO][dD][yY] +BR [bB][rR] +EM [eE][mM] +CENTER [cC][eE][nN][tT][eE][rR] +CODE [cC][oO][dD][eE] +DL [dD][lL] +DD [dD][dD] +DT [dD][tT] +DFN [dD][fF][nN] +FORM [fF][oO][rR][mM] +H1 [hH]1 +H2 [hH]2 +H3 [hH][3-6] +HEAD [hH][eE][aA][dD] +HR [hH][rR] +HREF [hH][rR][eE][fF] +I [iI] +IMG [iI][mM][gG] +INPUT [iI][nN][pP][uU][tT] +LI [lL][iI] +META [mM][eE][tT][aA] +MULTICOL [mM][uU][lL][tT][iI][cC][oO][lL] +NAME [nN][aA][mM][eE] +OL [oO][lL] +P [pP] +PRE [pP][rR][eE] +SMALL [sS][mM][aA][lL][lL] +STRONG [sS][tT][rR][oO][nN][gG] +SUB [sS][uU][bB] +SUP [sS][uU][pP] +SRC [sS][rR][cC] +TABLE [tT][aA][bB][lL][eE] +TITLE [tT][iI][tT][lL][eE] +TD [tT][dD] +TR [tT][rR] +TT [tT][tT] +UL [uU][lL] +VAR [vV][aA][rR] +DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") + +%option noyywrap + +%x Text +%x DocScan +%x DocParam +%x DocException +%x DocHtmlScan +%x DocLatexScan +%x DocEmphasis +%x DocBold +%x DocCode +%x DocIf +%x DocCodeBlock +%x DocInternal +%x DocLink +%x DocLinkText +%x DocSkipWord +%x DocInclude +%x DocDontInclude +%x DocHtmlLink +%x DocHtmlAnchor +%x DocHtmlHref1 +%x DocHtmlHref2 +%x DocSkiplineKey +%x DocSkipKey +%x DocLineKey +%x DocUntilKey +%x DocKeyEnd +%x DocPar +%x DocRefName +%x DocVerbatim +%x DocVerbInc +%x DocIndexWord +%x DocRefArg +%x DocRefArgStart +%x DocRefItem +%x DocRefItemName +%x DocInternalRef +%x DocInternalRefText +%x DocImage +%x DocHtmlImageName +%x DocHtmlImageOpt +%x DocLatexImageName +%x DocLatexImageOpt + +%% + +<*>\x0d +^{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */ + QCString text=yytext; + int dashPos = text.findRev('-'); + //printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1)); + bool isEnumerated = text.at(dashPos+1)=='#'; + addListItemMarker(yytext,dashPos,isEnumerated); + } +\n{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */ + QCString text=yytext; + int dashPos = text.findRev('-'); + //printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1)); + bool isEnumerated = text.at(dashPos+1)=='#'; + addListItemMarker(yytext+1,dashPos,isEnumerated); + } +"©" { outDoc->writeCopyright(); } +""" { outDoc->writeQuote(); } +"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } +"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } +"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } +"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } +"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } +"ß" { outDoc->writeSharpS(); } +"&[aA]ring;" { outDoc->writeRing(yytext[1]); } +"$("[a-z_A-Z]+")" { + QCString envvar=&yytext[2]; + envvar=envvar.left(envvar.length()-1); + outDoc->docify(getenv(envvar)); + } +{CMD}"htmlonly"/[^a-z_A-Z0-9] { + outDoc->pushGeneratorState(); /*storeOutputListState();*/ + outDoc->disableAllBut(OutputGenerator::Html); + BEGIN(DocHtmlScan); + } +{CMD}"endhtmlonly"/[^a-z_A-Z0-9] { + /*restoreOutputListState();*/ + outDoc->popGeneratorState(); + BEGIN(DocScan); + } +{CMD}"latexonly"/[^a-z_A-Z0-9] { + /*storeOutputListState();*/ + outDoc->pushGeneratorState(); + outDoc->disableAllBut(OutputGenerator::Latex); + BEGIN(DocLatexScan); + } +{CMD}"endlatexonly"/[^a-z_A-Z0-9] { + /*restoreOutputListState();*/ + outDoc->popGeneratorState(); + BEGIN(DocScan); + } +"//"|"/*"|"*/" { + outDoc->writeString(yytext); + } +.|\n { + char c[2]; + c[0]=*yytext;c[1]='\0'; + outDoc->writeString(c); + } +"\\postheader"/{BN} +"\\functionindex"/{BN} { writeMemberList(*outDoc); } +"\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); } +"\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); } +"\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ } +"\\header"/{BN} { BEGIN( DocSkipWord ); } +"\\define"/{BN} { BEGIN( DocSkipWord ); } +{CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); } +{FILE} { + verbIncludeFile(*outDoc,stripQuotes(yytext)); + BEGIN( DocScan ); + } +{CMD}"verbatim"/[^a-z_A-Z0-9] { + outDoc->startCodeFragment(); + insideVerbatim=TRUE; + BEGIN(DocVerbatim); + } +{CMD}"endverbatim"/[^a-z_A-Z0-9] { + outDoc->endCodeFragment(); + insideVerbatim=FALSE; + BEGIN(DocScan); + } +[^\n\\\@]*"\n" { + //printf("docifying: %s\n",yytext); + outDoc->codify(yytext); + } +"\n"|"//"|"/*"|"*/" { + outDoc->codify(yytext); + } +. { + //printf("char %c\n",*yytext); + char c[2];c[0]=*yytext;c[1]='\0'; + outDoc->codify(c); + } +{CMD}"internal"/{BN} { + if (!Config::internalDocsFlag) + { + outDoc->newParagraph(); + scanString(theTranslator->trForInternalUseOnly()+"\n"); + //outDoc->writeString("For internal use only.\n"); + BEGIN( DocInternal ); + } + } +"\\reimp"/{BN} { + outDoc->newParagraph(); + scanString(theTranslator->trReimplementedForInternalReasons()+"\n"); + } +{CMD}"link"/{BN} { BEGIN( DocLink ); } +[a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); } +[a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well! + linkRef = stripKnownExtensions(yytext); + linkText = ""; + BEGIN( DocLinkText ); + } +. { linkText += *yytext; } +"\n" { linkText += " "; } +{CMD}"endlink" { // <- needed for things like \endlink. + //printf("GenerateLink className=`%s' linkRef=`%s' linkText=`%s'\n", + // className.data(),linkRef.data(),linkText.data()); + generateLink(*outDoc,className,linkRef,inSeeBlock,linkText.stripWhiteSpace()); + BEGIN( DocScan ); + } +{CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr, + "Warning: \\endlink without \\link " + "in documentation." + ); + } +{CMD}"addindex"{B}+ { + BEGIN(DocIndexWord); + } +"\\form#"[0-9]+ { + Formula *formula=formulaNameDict[yytext]; + if (formula) + { + QCString formName; + formName.sprintf("form-%d.gif",formula->getId()); + outDoc->writeFormula(formName,formula->getFormulaText()); + } + } +[^\n]+ { + //printf("Adding %s to index\n",yytext); + outDoc->addToIndex(yytext,0); + BEGIN(DocScan); + } +{CMD}("arg"|"li")/{BN} { + if (insideArgumentList) + { + outDoc->writeListItem(); + } + else + { + outDoc->startItemList(); + outDoc->writeListItem(); + insideArgumentList=TRUE; + } + } +(({B}*"\n"){2,}{B}*)?{CMD}"par"{B}* { + BEGIN(DocPar); + } +[^\n]*{BN} { + QCString title=QCString(yytext).stripWhiteSpace(); + bool b = inBlock(); + if (!title.isEmpty()) + { + endArgumentList(); + if (b) endBlock(); + inParBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + outDoc->docify(title); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->newParagraph(); + } + BEGIN(DocScan); + } +{CMD}"warning"/{BN} { + endArgumentList(); + if (!inWarningBlock) + { + if (inBlock()) endBlock(); + inWarningBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trWarning()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"remark"[s]?/{BN} { + endArgumentList(); + if (!inRemarkBlock) + { + if (inBlock()) endBlock(); + inRemarkBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trRemarks()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"attention"[s]?/{BN} { + endArgumentList(); + if (!inAttentionBlock) + { + if (inBlock()) endBlock(); + inAttentionBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trAttention()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"bug"[s]?/{BN} { + endArgumentList(); + if (!inBugBlock) + { + if (inBlock()) endBlock(); + inBugBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trBugsAndLimitations()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"note"[s]?/{BN} { + endArgumentList(); + if (!inNoteBlock) + { + if (inBlock()) endBlock(); + inNoteBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trNote()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"pre"/{BN} { + endArgumentList(); + if (!inPreBlock) + { + if (inBlock()) endBlock(); + inPreBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trPrecondition()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"post"/{BN} { + endArgumentList(); + if (!inPostBlock) + { + if (inBlock()) endBlock(); + inPostBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trPostcondition()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"invariant"/{BN} { + endArgumentList(); + if (!inInvarBlock) + { + if (inBlock()) endBlock(); + inInvarBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trInvariant()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"version"/{BN} { + endArgumentList(); + if (!inVersionBlock) + { + if (inBlock()) endBlock(); + inVersionBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trVersion()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"since"/{BN} { + endArgumentList(); + if (!inSinceBlock) + { + if (inBlock()) endBlock(); + inSinceBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trSince()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +{CMD}"date"/{BN} { + endArgumentList(); + if (!inDateBlock) + { + if (inBlock()) endBlock(); + inDateBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trDate()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +"\\todo "[0-9]+ { // this tag is generated in an earlier pass + if (Config::generateTodoList) + { + QCString numStr=yytext; + numStr=numStr.right(numStr.length()-6); + bool ok; int num = numStr.toUInt(&ok); + RefItem *item = todoList.getRefItem(num); + ASSERT(item!=0); + endArgumentList(); + if (inBlock()) endBlock(); + outDoc->startDescList(); + outDoc->startBold(); + outDoc->writeObjectLink(0,"todo",item->listAnchor,theTranslator->trTodo()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + internalParseDocument(item->text); + outDoc->endDescList(); + } + } +"\\test "[0-9]+ { // this tag is generated in an earlier pass + if (Config::generateTestList) + { + QCString numStr=yytext; + numStr=numStr.right(numStr.length()-6); + bool ok; int num = numStr.toUInt(&ok); + RefItem *item = testList.getRefItem(num); + ASSERT(item!=0); + endArgumentList(); + if (inBlock()) endBlock(); + outDoc->startDescList(); + outDoc->startBold(); + outDoc->writeObjectLink(0,"test",item->listAnchor,theTranslator->trTest()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + internalParseDocument(item->text); + outDoc->endDescList(); + } + } +{CMD}"deprecated"/{BN} { + endArgumentList(); + if (!inDeprecatedBlock) + { + if (inBlock()) endBlock(); + inDeprecatedBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trDeprecated()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->writeDescItem(); + } + } +"$"[a-zA-Z_0-9]+":"[^\n\$]+"$" { // RCS tag + QCString tagName(&yytext[1]); + int i=tagName.find(':'); + tagName=tagName.left(i); + QCString tagText=&yytext[i+2]; + tagText=tagText.left(tagText.length()-1); + endArgumentList(); + if (inBlock()) endBlock(); + outDoc->startDescList(); + outDoc->startBold(); + scanString(tagName+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + scanString(tagText); + outDoc->endDescList(); + } +{CMD}"author"/{BN} { + endArgumentList(); + if (!inAuthorBlock) + { + if (inBlock()) endBlock(); + inAuthorBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trAuthors()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->docify(", "); + } + } +{CMD}("return"([s])?|"result")/{BN} { + endArgumentList(); + if (!inReturnBlock) + { + if (inBlock()) endBlock(); + inReturnBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trReturns()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + } +{CMD}("sa"|"see")/{BN} { + endArgumentList(); + if (!inSeeBlock) + { + if (inBlock()) endBlock(); + inSeeBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trSeeAlso()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + } + else + { + outDoc->docify(", "); + } + } +(({B}*"\n"){2,}{B}*)?{CMD}"param"/{BN} { + QCString t=yytext; + if (t.contains('\n')>1 && insideItemList) + { + forceEndItemList(); + } + endArgumentList(); + if (!inParamBlock) + { + if (inBlock()) endBlock(); + inParamBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trParameters()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + outDoc->startDescTable(); + } + else + { + outDoc->endDescTableData(); + } + BEGIN(DocParam); + } +(({B}*"\n"){2,}{B}*)?{CMD}"retval"/{BN} { + QCString t=yytext; + if (t.contains('\n')>1 && insideItemList) + { + forceEndItemList(); + } + endArgumentList(); + if (!inRetValBlock) + { + if (inBlock()) endBlock(); + inRetValBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trReturnValues()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + outDoc->startDescTable(); + } + else + { + outDoc->endDescTableData(); + } + BEGIN(DocParam); + } +(({B}*"\n"){2,}{B}*)?{CMD}("exception"|"throw")s?/{BN} { + QCString t=yytext; + if (t.contains('\n')>1 && insideItemList) + { + forceEndItemList(); + } + endArgumentList(); + if (!inExceptionBlock) + { + if (inBlock()) endBlock(); + inExceptionBlock=TRUE; + outDoc->startDescList(); + outDoc->startBold(); + scanString(theTranslator->trExceptions()+": "); + outDoc->endBold(); + outDoc->endDescTitle(); + outDoc->writeDescItem(); + outDoc->startDescTable(); + } + else + { + outDoc->endDescTableData(); + } + BEGIN(DocException); + } +"\\capt".* +({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} { + outDoc->startDescTableTitle(); + outDoc->startEmphasis(); + outDoc->docify(substitute(yytext,"\"","")); + outDoc->endEmphasis(); + outDoc->endDescTableTitle(); + outDoc->startDescTableData(); + BEGIN(DocScan); + } +{SCOPENAME} { + outDoc->startDescTableTitle(); + outDoc->startEmphasis(); + outDoc->docify(yytext); + outDoc->endEmphasis(); + outDoc->endDescTableTitle(); + outDoc->startDescTableData(); + BEGIN(DocScan); + } +{CMD}"section "{ID}"\n" { + QCString secName=&yytext[9]; // skip "\section " + secName=secName.left(secName.length()-1); // remove \n + //printf("SectionName %s found\n",secName.data()); + SectionInfo *sec; + if ((sec=sectionDict[secName])) + { + //printf("Title %s\n",sec->title.data()); + outDoc->writeSection(sec->label,sec->title, + sec->type==SectionInfo::Subsection); + } + } +{CMD}"anchor "{ID}"\n" { + QCString secName=&yytext[8]; + secName=secName.left(secName.length()-1); + SectionInfo *sec; + if ((sec=sectionDict[secName])) + { + //printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data()); + outDoc->writeAnchor(sec->fileName,sec->label); + } + } +"\\_internalref"{B}+ { // for internal use only! + internalRefFile.resize(0); + internalRefAnchor.resize(0); + BEGIN(DocInternalRef); + } +[A-Z_a-z0-9.:\-\+]+ { + internalRefFile=yytext; + int i = internalRefFile.find(':'); + if (i!=-1) + { + internalRefAnchor=internalRefFile.right(internalRefFile.length()-i-1); + internalRefFile=internalRefFile.left(i); + } + //printf("InternalRef yytext=`%s' file=`%s' anchor=`%s'\n",yytext,internalRefFile.data(),internalRefAnchor.data()); + BEGIN(DocInternalRefText); + } +\"[^\n\"]*\" { + QCString text=substitute(yytext,"\"",""); + outDoc->writeObjectLink(0,internalRefFile,internalRefAnchor,text); + BEGIN(DocScan); + } +{CMD}"ref" { + BEGIN(DocRefName); + } +{CMD}"refitem" { + BEGIN(DocRefItem); + } +{CMD}"if"/{BN} { + outDoc->pushGeneratorState(); + depthIf++; + BEGIN(DocIf); + } +{CMD}"endif"/[^a-z_A-Z0-9] { + if (--depthIf<0) + { + warn(yyFileName,yyLineNr, + "Warning: documentation block contains \\endif without " + "matching \\if found in documentation." + ); + } + else + { + outDoc->popGeneratorState(); + } + } +[^\n\t ]+ { + if (Config::sectionFilterList.find(yytext)==-1) + { + outDoc->disableAll(); + } + BEGIN(DocScan); + } +{SCOPENAME}|{FILE} { + QCString ref=yytext; + SectionInfo *sec; + if ((sec=sectionDict[ref])) + { + QCString text; + if (sec->title.isEmpty()) + text=sec->label; + else + text=sec->title; + if (sec->type==SectionInfo::Anchor) + { + //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + outDoc->writeObjectLink(0,sec->fileName,sec->label,text); + writePageRef(*outDoc,sec->label,0); + } + else + { + //printf(" ref sec=%p sec->fileName=%s text=%s\n",sec,sec->fileName.data(),text.data()); + outDoc->writeSectionRef(sec->fileName,sec->label,text); + } + } + else if (!generateLink(*outDoc,className,yytext,TRUE,0)) + { + warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",yytext); + //outDoc->writeBoldString(" unknown reference! "); + } + BEGIN(DocScan); + } +({SCOPENAME}|{FILE}){B}+/"\"" { + sectionRef=yytext; + sectionRef=sectionRef.stripWhiteSpace(); + BEGIN(DocRefArgStart); + } +"\"" { + BEGIN(DocRefArg); + } +[^\"\n]+[\n\"] { + yytext[yyleng-1]='\0'; + QCString text=substitute(yytext,"\\\\","\\"); + SectionInfo *sec; + if ((sec=sectionDict[sectionRef])) + { + if (sec->type==SectionInfo::Anchor) + { + //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + outDoc->writeObjectLink(0,sec->fileName,sec->label,text); + //printf("Writing page ref `%s'\n",sec->label.data()); + writePageRef(*outDoc,sec->label,0); + } + else + { + outDoc->writeSectionRef(sec->fileName,sec->label,text); + } + } + else if (!generateLink(*outDoc,className,sectionRef,TRUE,text)) + { + warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data()); + outDoc->writeBoldString(" unknown reference! "); + } + BEGIN(DocScan); + } +{ID} { + sectionRef=yytext; + BEGIN(DocRefItemName); + } +.*/"\n" { + SectionInfo *sec; + QCString text=yytext; + if ((sec=sectionDict[sectionRef])) + { + outDoc->writeSectionRefItem(sec->fileName,sec->label,text.stripWhiteSpace()); + } + else + { + warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data()); + outDoc->writeBoldString(" unknown reference! "); + } + BEGIN(DocScan); + } +{CMD}"image"{B}+ { + BEGIN(DocImage); + } +[hH][tT][mM][lL] { + BEGIN(DocHtmlImageName); + } +[lL][aA][tT][eE][xX] { + BEGIN(DocLatexImageName); + } +{FILE}|{URLMASK} { + curImageName = findAndCopyImage(stripQuotes(yytext),IT_Html); + curImageCaption.resize(0); + if (curImageName.isEmpty()) + { + BEGIN(DocScan); + } + else + { + BEGIN(DocHtmlImageOpt); + } + } +\n { + writeImage(IT_Html,0); + BEGIN(DocScan); + } +\"[^\n"]*\" { + curImageCaption=stripQuotes(yytext); + } +{FILE} { + curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex); + curImageCaption.resize(0); + if (curImageName.isEmpty()) + BEGIN(DocScan); + else + BEGIN(DocLatexImageOpt); + } +\n { // no width specified + writeImage(IT_Latex,0); + BEGIN(DocScan); + } +\"[^\n"]*\" { + curImageCaption=stripQuotes(yytext); + } +("width"{B}*"="{B}*)(([0-9\.]+({B}*{ID})?)|("\\"{ID})) { + writeImage(IT_Latex,yytext); + BEGIN(DocScan); + } +("height"{B}*"="{B}*)(([0-9\.]+({B}*{ID})?)|("\\"{ID})) { + writeImage(IT_Latex,yytext); + BEGIN(DocScan); + } +[a-z_A-Z0-9\.\-]+ { + warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext); + } +\n { + warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!"); + outDoc->enableAll(); + BEGIN(DocScan); + } +{CMD}"code"({BN}*"\n"|{B}*) { + outDoc->startCodeFragment(); + codeBlock.resize(0); + BEGIN( DocCodeBlock ); + } +{CMD}"endcode"/[^a-z_A-Z0-9] { + warn(yyFileName,yyLineNr,"Warning: \\endcode without

 or \\code "
+    					       "in the documentation."); 
+					}
+					
+{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"?	{
+  					  generateRef(*outDoc,className,yytext,inSeeBlock);
+					  BEGIN(DocScan);
+  					}
+{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" {
+  					  generateRef(*outDoc,className,yytext,inSeeBlock);
+					  BEGIN(DocScan);
+  					}
+{SCOPEMASK}("()")?	{
+  					  generateRef(*outDoc,className,yytext,inSeeBlock);
+					  BEGIN(DocScan);
+  					}
+({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")"	{ 
+				          QCString oName=yytext;
+					  generateRef(*outDoc,className,
+					              removeRedundantWhiteSpace(oName),inSeeBlock);
+					  BEGIN(DocScan);
+					}
+({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")"	{ 
+    					  QCString oName=yytext;
+					  generateRef(*outDoc,className,
+					              removeRedundantWhiteSpace(oName),inSeeBlock);
+					  BEGIN(DocScan);
+					}
+("http:"|"https:"|"ftp:"|"file:"){URLMASK}	{ outDoc->writeHtmlLink(yytext,yytext); }
+[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+	{ outDoc->writeMailLink(yytext); }
+{FILEMASK}			{
+					  generateFileRef(*outDoc,yytext);
+					}
+{BN}*{CMD}"endcode"/[^a-z_A-Z0-9]  { // needed to match things like \endcode. (note the dot)
+				          parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
+					  //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
+					  outDoc->endCodeFragment();
+					  BEGIN( DocScan ); 
+					}
+""	{ 
+				          parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
+					  //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
+					  outDoc->endCodeFragment();
+					  BEGIN( DocScan ); 
+					}
+{CMD}("e"|"em"|"a"){BN}+       { BEGIN( DocEmphasis ); }
+{CMD}"b"{BN}+			{ BEGIN( DocBold ); }
+{CMD}("c"|"p"){BN}+            { BEGIN( DocCode ); }
+{CMD}"l"{BN}+		
+"\\n"/[^a-z_A-Z0-9]		{ outDoc->lineBreak(); }
+{CMD}"include"{BN}+		{ BEGIN( DocInclude ); }
+{CMD}"dontinclude"{BN}+	{ BEGIN( DocDontInclude ); }
+{CMD}"skip"{BN}+	 	{ BEGIN( DocSkipKey ); }	
+{CMD}"skipline"{BN}+		{ BEGIN( DocSkiplineKey ); firstLine=TRUE; }
+{CMD}"line"{BN}+		{ BEGIN( DocLineKey ); firstLine=TRUE; }
+{CMD}"until"{BN}+		{ BEGIN( DocUntilKey ); firstLine=TRUE; }
+[^ \t\r\n]+			{ 
+  					  if (includeFileLength>0) 
+					    skipUntil(yytext); 
+  					  BEGIN( DocScan );
+					}
+[^ \t\r\n]+			{ 
+  					  if (includeFileLength>0) 
+					  {
+					    if (firstLine) outDoc->startCodeFragment();
+					    firstLine=FALSE;
+					    showLine(*outDoc,yytext); 
+					    BEGIN( DocKeyEnd );
+					  }
+					  else
+					  {
+  					    BEGIN( DocScan );
+					  }
+					}
+[^ \t\r\n]+		{ 
+  					  if (includeFileLength>0) 
+					  {
+					    if (firstLine) outDoc->startCodeFragment();
+					    firstLine=FALSE;
+					    skipLine(*outDoc,yytext); 
+					    BEGIN( DocKeyEnd );
+					  }
+					  else
+					  {
+  					    BEGIN( DocScan );
+					  }
+					}
+[^ \t\r\n]+		{ 
+  					  if (includeFileLength>0) 
+					  {
+					    if (firstLine) outDoc->startCodeFragment();
+					    firstLine=FALSE;
+					    showUntil(*outDoc,yytext); 
+					    BEGIN( DocKeyEnd );
+					  }
+					  else
+					  {
+  					    BEGIN( DocScan );
+					  }
+					}
+{CMD}"line"{BN}+		{ BEGIN(DocLineKey); }
+{CMD}"until"{BN}+		{ BEGIN(DocUntilKey); }
+{CMD}"skipline"{BN}+		{ BEGIN(DocSkiplineKey); }
+\n
+<>			{
+  					  if (!firstLine) outDoc->endCodeFragment();
+					  yyterminate();
+  					}
+.				{
+  					  unput(*yytext);
+  					  if (!firstLine) outDoc->endCodeFragment();
+					  BEGIN( DocScan );
+  					}
+"<"{MULTICOL}{ATTR}">"		
+""
+"<"{STRONG}{ATTR}">"		{ outDoc->startBold(); }
+""		{ outDoc->endBold(); }
+"<"{CENTER}{ATTR}">"		{ outDoc->startCenter(); }
+""		{ outDoc->endCenter(); }
+"<"{TABLE}{ATTR}">"		{ startTable(); }
+""		{ endTable(); }
+"<"{INPUT}{ATTR}">"
+"<"{SMALL}{ATTR}">"		{ outDoc->startSmall(); }
+""		{ outDoc->endSmall(); }
+"<"{META}{ATTR}">"
+"<"{FORM}{ATTR}">"
+""
+"<"{HEAD}{ATTR}">"			
+""			
+"<"{BODY}{ATTR}">"
+""
+"<"{CODE}{ATTR}">"		{ outDoc->startTypewriter(); }
+""		{ outDoc->endTypewriter(); }
+"<"{DFN}{ATTR}">"		{ outDoc->startTypewriter(); }
+""		{ outDoc->endTypewriter(); }
+"<"{VAR}{ATTR}">"		{ outDoc->startEmphasis(); }
+""		{ outDoc->endEmphasis(); }
+"<"{IMG}{ATTR}">"		{ 
+                                          /*storeOutputListState();*/
+  					  outDoc->pushGeneratorState();
+                                          outDoc->disableAllBut(OutputGenerator::Html);
+					  outDoc->writeString(yytext); 
+                                          /*restoreOutputListState();*/
+					  outDoc->popGeneratorState();
+					}
+"<"{PRE}{ATTR}">"			{ 
+  					  outDoc->startCodeFragment();
+  					  codeBlock.resize(0);
+					  BEGIN( DocCodeBlock ); 
+					}
+""		 	{ 
+  					  warn(yyFileName,yyLineNr,
+                                               "Warning: 
without
 or \\code"
+    					       "in the documentation."
+                                              ); 
+					}
+"<"{SUB}{ATTR}">"		{ outDoc->startSubscript(); }
+""		{ outDoc->endSubscript(); }
+"<"{SUP}{ATTR}">"		{ outDoc->startSuperscript(); }
+""		{ outDoc->endSuperscript(); }
+"<"{TR}{ATTR}">"		{ if (curTable) curTable->newRow(); }
+""			
+"<"{TD}{ATTR}">"		{ if (curTable) curTable->newElem(); }
+""
+"<"{OL}{ATTR}">"		{ outDoc->startEnumList(); 
+  					  currentListIndent.push("O");
+					}
+""		{ 
+					  if (currentListIndent.isEmpty())
+					  {
+					    warn(yyFileName,yyLineNr,
+                                                 "Warning: more  tags than 
    tags in the documentation." + ); + } + else if (currentListIndent.top()!="O") + { + warn(yyFileName,yyLineNr, + "Warning:
tag does not end a
    tag in the documentation." + ); + } + else + { + outDoc->endEnumList(); + currentListIndent.pop(); + } + } +"<"{UL}{ATTR}">" { outDoc->startItemList(); + currentListIndent.push("U"); + } +"" { + if (currentListIndent.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: more tags than
      tags in the documentation." + ); + } + else if (currentListIndent.top()!="U") + { + warn(yyFileName,yyLineNr, + "Warning:
    tag does not end a
      tag in the documentation." + ); + } + else + { + outDoc->endItemList(); + currentListIndent.pop(); + } + } +"<"{LI}{ATTR}">" { + if (/*currentListIndent.isEmpty() ||*/ //DvH: I removed this check because I use this in the manual (the
        is in a \htmlonly block!) + currentListIndent.top()=="D") + { + warn(yyFileName,yyLineNr, + "Warning: The
      • tag can only be used inside a
          ...
        or a
          ...
        block." + ); + } + else + { + outDoc->writeListItem(); + } + } +"" +"<"{TT}{ATTR}">" { outDoc->startTypewriter(); } +"" { outDoc->endTypewriter(); } +"<"{EM}{ATTR}">" { outDoc->startEmphasis(); } +"" { outDoc->endEmphasis(); } +"<"{HR}{ATTR}">" { outDoc->writeRuler(); } +"<"{DL}{ATTR}">" { outDoc->startDescription(); + currentListIndent.push("D"); + } +"" { + if (currentListIndent.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: more tags than
        tags in the documentation." + ); + } + else if (currentListIndent.top()!="D") + { + warn(yyFileName,yyLineNr, + "Warning:
        tag does not end a
        tag in the documentation." + ); + } + else + { + outDoc->endDescription(); + currentListIndent.pop(); + } + } +"<"{DT}{ATTR}">" { + if (currentListIndent.isEmpty() || + currentListIndent.top()!="D") + { + warn(yyFileName,yyLineNr, + "Warning: The
        tag can only be used inside a
        ...
        block." + ); + } + else + { + outDoc->startDescItem(); + } + } +"" +"<"{DD}{ATTR}">" { + if (currentListIndent.isEmpty() || + currentListIndent.top()!="D") + { + warn(yyFileName,yyLineNr, + "Warning: The
        tag can only be used inside a
        ...
        block." + ); + } + else + { + outDoc->endDescItem(); + } + } +"" +"<"{BR}{ATTR}">" { outDoc->lineBreak(); } +"<"{I}{ATTR}">" { outDoc->startEmphasis(); } +"" { outDoc->endEmphasis(); } +"" +"<"{A} { BEGIN(DocHtmlLink); } +"<"{BOLD}{ATTR}">" { outDoc->startBold(); } +"" { outDoc->endBold(); } +"<"{P}{ATTR}">" { + if (inBlock()) endBlock(); + outDoc->newParagraph(); } +"" +"<"{H1}{ATTR}">" { outDoc->startTitle(); } +"" { outDoc->endTitle(); } +"<"{H2}{ATTR}">" { outDoc->startSubsection(); } +"" { outDoc->endSubsection(); } +"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); } +"" { outDoc->endSubsubsection(); } +{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); } +[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); } +{HREF}{BN}*"="{BN}*("\""?) { + htmlUrl.resize(0); + htmlText.resize(0); + BEGIN(DocHtmlHref1); } +{URLMASK} { + htmlUrl=yytext; + } +">" { BEGIN(DocHtmlHref2); } +[^<]* { htmlText+=yytext; } +"<" { + outDoc->writeHtmlLink(htmlUrl,htmlText); + unput(*yytext); + BEGIN(DocScan); + } +">" { BEGIN(DocScan); } +{CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") { + outDoc->docify(&yytext[1]); + } +"%"[a-zA-Z_0-9\-]+ { + outDoc->docify(yytext+1); + } +[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" { + outDoc->startEmphasis(); + generateRef(*outDoc,className,yytext,inSeeBlock); + outDoc->endEmphasis(); + BEGIN( DocScan ); + } +{WORD} { + outDoc->startEmphasis(); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + outDoc->endEmphasis(); + BEGIN( DocScan ); + } +[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" { + outDoc->startBold(); + generateRef(*outDoc,className,yytext,inSeeBlock); + outDoc->endBold(); + BEGIN( DocScan ); + } +{WORD} { + outDoc->startBold(); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + outDoc->endBold(); + BEGIN( DocScan ); + } +[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()!\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" { + outDoc->startTypewriter(); + generateRef(*outDoc,className,yytext,inSeeBlock); + outDoc->endTypewriter(); + BEGIN( DocScan ); + } +{WORD} { + outDoc->startTypewriter(); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + outDoc->endTypewriter(); + BEGIN( DocScan ); + } +{FILE} { + includeFile(*outDoc,stripQuotes(yytext),FALSE); + BEGIN( DocScan ); + } +{FILE} { + includeFile(*outDoc,stripQuotes(yytext),TRUE); + BEGIN( DocScan ); + } +"//" { codeBlock += yytext; } +"/*" { codeBlock += yytext; } +\n { codeBlock += '\n'; } +[^\/\\\<\n]* { codeBlock += yytext; } +. { codeBlock += *yytext; } +"//" { + outDoc->docify(yytext); + } +"/*" { + outDoc->docify(yytext); + } +"\n" { outDoc->writeChar('\n'); } +({B}*"\n"){2,}{B}*"*"*{B}*"-"("#")?{B}+ { // new paragraph & start of a list + QCString text=yytext; + int dashPos = text.findRev('-'); + bool isEnumerated = text.at(dashPos+1)=='#'; + if (insideArgumentList) + { + insideArgumentList=FALSE; + outDoc->endItemList(); + } + else if (insideItemList) + { + forceEndItemList(); + } + else + { + outDoc->newParagraph(); + } + if (inBlock()) endBlock(); + addListItemMarker(strrchr(yytext,'\n')+1,dashPos,isEnumerated); + } +({B}*"\n"){2,}{B}* { // new paragraph + if (insideArgumentList) + { + insideArgumentList=FALSE; + outDoc->endItemList(); + } + else if (insideItemList) + { + forceEndItemList(); + } + else + { + outDoc->newParagraph(); + } + if (inBlock()) endBlock(); + } +{BN}+/\n { + outDoc->writeChar(' '); + } +\n?{B}* { + outDoc->writeChar(' '); + } +[a-z_A-Z0-9]+ { + outDoc->docify(yytext); + } +. { + outDoc->writeChar(*yytext); + } +<*>\n { yyLineNr++ ; } +<*>. + +%% + +//---------------------------------------------------------------------------- + +void scanString(const char *s) +{ + const char *oldInputString = inputString; + int oldInputPosition = inputPosition; + int oldRule = YY_START; + YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER; + yy_switch_to_buffer(yy_create_buffer(docYYin, YY_BUF_SIZE)); + inputString = s; + inputPosition = 0; + BEGIN( Text ); + docYYlex(); + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(oldBuffer); + inputString = oldInputString; + inputPosition = oldInputPosition; + BEGIN( oldRule ); +} + +void internalParseDocument(const char *s) +{ + const char *oldInputString = inputString; + int oldInputPosition = inputPosition; + int oldRule = YY_START; + YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER; + yy_switch_to_buffer(yy_create_buffer(docYYin, YY_BUF_SIZE)); + inputString = s; + inputPosition = 0; + BEGIN( DocScan ); + docYYlex(); + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(oldBuffer); + inputString = oldInputString; + inputPosition = oldInputPosition; + BEGIN( oldRule ); +} + +//---------------------------------------------------------------------------- + +void parseDocument(OutputList &ol,const QCString &docString) +{ + //inParamBlock=inSeeBlock=inReturnBlock=FALSE; + curTable = 0; + depthIf = 0; + outDoc = new OutputList(&ol); + currentIncludeFile.resize(0); + includeFileOffset=0; + includeFileLength=0; + currentListIndent.clear(); + if (!docString) return; + linkRef = ""; + linkText = ""; + inputString = docString; + inputPosition = 0; + docYYrestart( docYYin ); + BEGIN( DocScan ); + insideArgumentList = FALSE; + insideVerbatim = FALSE; + docYYlex(); + if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } + if (insideItemList) { forceEndItemList(); } + if (inBlock()) endBlock(); + if (!currentListIndent.isEmpty()) + { + warn(yyFileName,yyLineNr,"Warning: Documentation ended in the middle " + "of a list!"); + warn_cont("Missing: "); + while (!currentListIndent.isEmpty()) + { + char c; + switch((c=*currentListIndent.pop())) + { + case 'O': warn_cont("
"); break; + case 'U': warn_cont(""); break; + case 'D': warn_cont(""); break; + } + } + warn_cont("\n"); + } + if (depthIf!=0) + { + warn(yyFileName,yyLineNr,"Warning: Documentation block contains \\if " + "without matching \\endif: nesting level is %d",depthIf); + } + if (!tableStack.isEmpty()) + { + forceEndTable(); + } + if (insideVerbatim) + { + warn(yyFileName,yyLineNr, + "Warning: file ended inside a \\verbatim block!" + ); + } + ol+=*outDoc; + delete outDoc; outDoc=0; + return; +} + +//---------------------------------------------------------------------------- + +void parseDoc(OutputList &ol,const char *fileName,int startLine, + const char *clName,const char *memName,const QCString &docString) +{ + //printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine); + initParser(); + initParseCodeContext(); + exampleDoc=FALSE; // do not cross reference with member docs + className=clName; + memberName=memName; + strcpy(yyFileName,fileName); + yyLineNr = startLine; + parseDocument(ol,docString); + +} + +//---------------------------------------------------------------------------- + +void parseText(OutputList &ol,const QCString &txtString) +{ + if (txtString.isEmpty()) return; + inputString = txtString; + outDoc = new OutputList(&ol); + inputPosition = 0; + docYYrestart( docYYin ); + BEGIN( Text ); + docYYlex(); + ol+=*outDoc; + delete outDoc; outDoc=0; + return; +} + +//---------------------------------------------------------------------------- + +void parseExample(OutputList &ol,const QCString &docString, + const char *fileName) +{ + initParser(); + initParseCodeContext(); + exampleDoc=TRUE; // cross reference with member docs + exampleName=fileName; + strcpy(yyFileName,fileName); + parseDocument(ol,docString); +} + +//---------------------------------------------------------------------------- +extern "C" { // some bogus code to keep the compiler happy + void docYYdummy() { yy_flex_realloc(0,0); } +} diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 9c6f35c..2a788f0 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -30,6 +30,7 @@ #include "version.h" #include "doxygen.h" #include "scanner.h" +#include "doc.h" #include "entry.h" #include "index.h" #include "logos.h" @@ -172,74 +173,123 @@ const char *getOverloadDocs() //---------------------------------------------------------------------------- -static void addTodoItem(Entry *root,const char *prefix, - const char *name,const char *title=0) +static void addRelatedPage(const char *name,const QCString &ptitle, + const QCString &doc,QList *anchors, + const char *fileName,int startLine, + int todoId,int testId + ) { - //printf("addTodoItem(%s) todoId=%d\n",name,root->todoId); - if (root->todoId==0 || !Config::generateTodoList) return; - RefItem *item = todoList.getRefItem(root->todoId); - ASSERT(item!=0); - if (item->written) return; - - Entry *page = new Entry; - page->section = Entry::PAGEDOC_SEC; - page->fileName = "generated"; - page->startLine = 1; - page->name = "todo"; - page->args = theTranslator->trTodoList(); - page->doc += "
\\anchor "; - page->doc += item->listAnchor; - page->doc += "\n"; - page->doc += prefix; - page->doc += " \\ref "; - page->doc += name; - page->doc += " \""; - if (title && title[0]!='\0') - page->doc += title; + PageInfo *pi=0; + if ((pi=pageDict[name])) + { + //warn("Warning: Page %s was already documented. Ignoring documentation " + // "at line %d of %s\n",root->name.data(),root->startLine, + // root->fileName.data()); + + // append documentation block to the page. + pi->doc+="\n\n"+doc; + } else - page->doc += name; - page->doc += "\":
\n
"; - page->doc += item->text; - page->doc += "
\n"; - root->addSubEntry(page); + { + QCString baseName=name; + if (baseName.right(4)==".tex") + baseName=baseName.left(baseName.length()-4); + else if (baseName.right(5)==".html") + baseName=baseName.left(baseName.length()-5); - item->written=TRUE; + QCString title=ptitle.stripWhiteSpace(); + pi=new PageInfo(fileName,startLine,baseName,doc,title); + pi->todoId=todoId; + pi->testId=testId; + QCString pageName; + if (Config::caseSensitiveNames) + pageName=pi->name.copy(); + else + pageName=pi->name.lower(); + setFileNameForSections(anchors,pageName); + + pageList.append(pi); + pageDict.insert(baseName,pi); + if (!pi->title.isEmpty()) + { + //outputList->writeTitle(pi->name,pi->title); + + // a page name is a label as well! + SectionInfo *si=new SectionInfo( + pi->name,pi->title,SectionInfo::Section); + si->fileName=pageName; + //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data()); + //printf("Adding section info %s\n",pi->name.data()); + sectionDict.insert(pageName,si); + } + } } //---------------------------------------------------------------------------- -static void addTestItem(Entry *root,const char *prefix, - const char *name,const char *title=0) +static void addRefItem(int todoId,int testId,const char *prefix, + const char *name,const char *title,const char *args=0) { - //printf("addTestItem(%s) testId=%d\n",name,root->testId); - if (root->testId==0 || !Config::generateTestList) return; - RefItem *item = testList.getRefItem(root->testId); - ASSERT(item!=0); - if (item->written) return; - - Entry *page = new Entry; - page->section = Entry::PAGEDOC_SEC; - page->fileName = "generated"; - page->startLine = 1; - page->name = "test"; - page->args = theTranslator->trTestList(); - page->doc += "
\\anchor "; - page->doc += item->listAnchor; - page->doc += "\n"; - page->doc += prefix; - page->doc += " \\ref "; - page->doc += name; - page->doc += " \""; - if (title && title[0]!='\0') - page->doc += title; - else - page->doc += name; - page->doc += "\":
\n
"; - page->doc += item->text; - page->doc += "
\n"; - root->addSubEntry(page); - item->written=TRUE; + //printf("addRefItem(%s) todoId=%d testId\n",name,todoId,testId); + + //////////////////////////////////////////////////////////// + // add item to the todo list + //////////////////////////////////////////////////////////// + + if (todoId>0 && Config::generateTodoList) + { + RefItem *item = todoList.getRefItem(todoId); + ASSERT(item!=0); + if (item->written) return; + + QCString doc; + doc += "
\\anchor "; + doc += item->listAnchor; + doc += "\n"; + doc += prefix; + doc += " \\_internalref "; + doc += name; + doc += " \""; + doc += title; + doc += "\""; + if (args) doc += args; + doc += "
\n
"; + doc += item->text; + doc += "
\n"; + addRelatedPage("todo",theTranslator->trTodoList(),doc,0,"generated",1,0,0); + + item->written=TRUE; + } + + //////////////////////////////////////////////////////////// + // add item to the test list + //////////////////////////////////////////////////////////// + + if (testId>0 && Config::generateTestList) + { + RefItem *item = testList.getRefItem(testId); + ASSERT(item!=0); + if (item->written) return; + + QCString doc; + doc += "
\\anchor "; + doc += item->listAnchor; + doc += "\n"; + doc += prefix; + doc += " \\_internalref "; + doc += name; + doc += " \""; + doc += title; + doc += "\""; + if (args) doc += args; + doc += "
\n
"; + doc += item->text; + doc += "
\n"; + addRelatedPage("test",theTranslator->trTestList(),doc,0,"generated",1,0,0); + + item->written=TRUE; + } } //---------------------------------------------------------------------------- @@ -269,8 +319,7 @@ static void buildGroupList(Entry *root) groupList.append(gd); groupDict.insert(root->name,gd); addGroupToGroups(root,gd); - addTodoItem(root,"group",gd->name()); - addTestItem(root,"group",gd->name()); + gd->setRefItems(root->todoId,root->testId); } } EntryListIterator eli(*root->sublist); @@ -343,6 +392,7 @@ static void buildFileList(Entry *root) fd->setDocumentation(root->doc,FALSE); fd->setBriefDescription(root->brief); fd->addSectionsToDefinition(root->anchors); + fd->setRefItems(root->todoId,root->testId); QListIterator sli(*root->groups); QCString *s; for (;(s=sli.current());++sli) @@ -354,8 +404,6 @@ static void buildFileList(Entry *root) //printf("File %s: in group %s\n",fd->name().data(),s->data()); } } - addTodoItem(root,"file",fd->name()); - addTestItem(root,"file",fd->name()); } } else @@ -585,8 +633,7 @@ static void buildClassList(Entry *root) fd->insertClass(cd); } addClassToGroups(root,cd); - addTodoItem(root,"class",cd->name()); - addTestItem(root,"class",cd->name()); + cd->setRefItems(root->todoId,root->testId); if (!root->subGrouping) cd->setSubGrouping(FALSE); } else // new class @@ -627,8 +674,7 @@ static void buildClassList(Entry *root) if (!root->subGrouping) cd->setSubGrouping(FALSE); addClassToGroups(root,cd); - addTodoItem(root,"class",cd->name()); - addTestItem(root,"class",cd->name()); + cd->setRefItems(root->todoId,root->testId); // see if the class is found inside a namespace bool found=addNamespace(root,cd); @@ -740,8 +786,7 @@ static void buildNamespaceList(Entry *root) // insert the namespace in the file definition if (fd) fd->insertNamespace(nd); addNamespaceToGroups(root,nd); - addTodoItem(root,"namespace",nd->name()); - addTestItem(root,"namespace",nd->name()); + nd->setRefItems(root->todoId,root->testId); } else /* if (!root->doc.isEmpty() || !root->brief.isEmpty() || @@ -756,8 +801,7 @@ static void buildNamespaceList(Entry *root) //printf("Adding namespace to group\n"); addNamespaceToGroups(root,nd); - addTodoItem(root,"namespace",nd->name()); - addTestItem(root,"namespace",nd->name()); + nd->setRefItems(root->todoId,root->testId); bool ambig; // file definition containing the namespace nd @@ -880,8 +924,7 @@ static void findUsingDirectives(Entry *root) // add class to the list namespaceList.inSort(nd); namespaceDict.insert(root->name,nd); - addTodoItem(root,"namespace",nd->name()); - addTestItem(root,"namespace",nd->name()); + nd->setRefItems(root->todoId,root->testId); } } } @@ -1082,20 +1125,19 @@ static MemberDef *addVariableToClass( // add the member to the global list if (mn) { - mn->inSort(md); + mn->append(md); } else // new variable name { mn = new MemberName(name); - mn->inSort(md); + mn->append(md); //printf("Adding memberName=%s\n",mn->memberName()); memberNameDict.insert(name,mn); memberNameList.inSort(mn); // add the member to the class } cd->insertMember(md); - addTodoItem(root,"member",cd->name()+"::"+md->name()); - addTestItem(root,"member",cd->name()+"::"+md->name()); + md->setRefItems(root->todoId,root->testId); //TODO: insert FileDef instead of filename strings. cd->insertUsedFile(root->fileName); @@ -1123,6 +1165,9 @@ static MemberDef *addVariableToFile( root->protection ); + bool ambig; + FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig); + // see if the function is inside a namespace NamespaceDef *nd = 0; if (!scope.isEmpty()) @@ -1181,16 +1226,7 @@ static MemberDef *addVariableToFile( // variable already in the scope { addMemberDocs(root,md,def,0,FALSE); - if (nscope.isEmpty()) - { - addTodoItem(root,"member",md->name()); - addTestItem(root,"member",md->name()); - } - else - { - addTodoItem(root,"member",nscope+"::"+md->name()); - addTestItem(root,"member",nscope+"::"+md->name()); - } + md->setRefItems(root->todoId,root->testId); return md; } md=mn->next(); @@ -1214,8 +1250,6 @@ static MemberDef *addVariableToFile( md->setInitializer(root->initializer); md->setMaxInitLines(root->initLines); md->setMemberGroupId(root->mGrpId); - bool ambig; - FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig); md->setBodyDef(fd); md->setDefinition(def); //if (root->mGrpId!=-1) @@ -1223,12 +1257,11 @@ static MemberDef *addVariableToFile( // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} + md->setRefItems(root->todoId,root->testId); if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { nd->insertMember(md); md->setNamespace(nd); - addTodoItem(root,"member",nd->name()+"::"+md->name()); - addTestItem(root,"member",nd->name()+"::"+md->name()); } else { @@ -1237,20 +1270,18 @@ static MemberDef *addVariableToFile( { fd->insertMember(md); md->setFileDef(fd); - addTodoItem(root,"member",md->name()); - addTestItem(root,"member",md->name()); } } // add member definition to the list of globals if (mn) { - mn->inSort(md); + mn->append(md); } else { mn = new MemberName(name); - mn->inSort(md); + mn->append(md); functionNameDict.insert(name,mn); functionNameList.inSort(mn); } @@ -1617,12 +1648,12 @@ static void buildMemberList(Entry *root) MemberName *mn; if ((mn=memberNameDict[name])) { - mn->inSort(md); + mn->append(md); } else { mn = new MemberName(name); - mn->inSort(md); + mn->append(md); //printf("Adding memberName=%s\n",mn->memberName()); memberNameDict.insert(name,mn); memberNameList.inSort(mn); @@ -1632,8 +1663,6 @@ static void buildMemberList(Entry *root) cd->insertMember(md); // add file to list of used files cd->insertUsedFile(root->fileName); - addTodoItem(root,"member",cd->name()+"::"+md->name()); - addTestItem(root,"member",cd->name()+"::"+md->name()); addMemberToGroups(root,md); } @@ -1790,8 +1819,7 @@ static void buildMemberList(Entry *root) { nd->insertMember(md); md->setNamespace(nd); - addTodoItem(root,"member",nd->name()+"::"+md->name()); - addTestItem(root,"member",nd->name()+"::"+md->name()); + md->setRefItems(root->todoId,root->testId); } else { @@ -1806,8 +1834,7 @@ static void buildMemberList(Entry *root) // add member to the file fd->insertMember(md); md->setFileDef(fd); - addTodoItem(root,"member",md->name()); - addTestItem(root,"member",md->name()); + md->setRefItems(root->todoId,root->testId); } } @@ -1815,12 +1842,12 @@ static void buildMemberList(Entry *root) MemberName *mn; if ((mn=functionNameDict[name])) { - mn->inSort(md); + mn->append(md); } else { mn = new MemberName(name); - mn->inSort(md); + mn->append(md); functionNameDict.insert(name,mn); functionNameList.inSort(mn); } @@ -2274,6 +2301,84 @@ static void computeMemberReferences() } } +//---------------------------------------------------------------------- + +static void addTodoTestReferences() +{ + ClassDef *cd=classList.first(); + while (cd) + { + addRefItem(cd->todoId(),cd->testId(),"class",cd->getOutputFileBase(),cd->name()); + cd=classList.next(); + } + FileName *fn=inputNameList.first(); + while (fn) + { + FileDef *fd=fn->first(); + while (fd) + { + addRefItem(fd->todoId(),fd->testId(),"file",fd->getOutputFileBase(),fd->name()); + fd=fn->next(); + } + fn=inputNameList.next(); + } + NamespaceDef *nd=namespaceList.first(); + while (nd) + { + addRefItem(nd->todoId(),nd->testId(),"namespace",nd->getOutputFileBase(),nd->name()); + nd=namespaceList.next(); + } + GroupDef *gd=groupList.first(); + while (gd) + { + addRefItem(gd->todoId(),gd->testId(),"group",gd->getOutputFileBase(),gd->name()); + gd=groupList.next(); + } + PageInfo *pi=pageList.first(); + while (pi) + { + addRefItem(pi->todoId,pi->testId,"page",pi->name,pi->title); + pi=pageList.next(); + } + MemberNameListIterator mnli(memberNameList); + MemberName *mn=0; + for (mnli.toFirst();(mn=mnli.current());++mnli) + { + MemberNameIterator mni(*mn); + MemberDef *md=0; + for (mni.toFirst();(md=mni.current());++mni) + { + Definition *d=md->getClassDef(); + QCString scopeName; + if (d) scopeName=d->name(); + if (d==0) d=md->getFileDef(); + if (d==0) d=md->getGroupDef(); + if (d) + { + addRefItem(md->todoId(),md->testId(),"member",d->getOutputFileBase()+":"+md->anchor(),scopeName+"::"+md->name(),md->argsString()); + } + } + } + MemberNameListIterator fnli(functionNameList); + for (fnli.toFirst();(mn=fnli.current());++fnli) + { + MemberNameIterator mni(*mn); + MemberDef *md=0; + for (mni.toFirst();(md=mni.current());++mni) + { + Definition *d=md->getNamespaceDef(); + QCString scopeName; + if (d) scopeName=d->name(); + if (d==0) d=md->getBodyDef(); + if (d==0) d=md->getGroupDef(); + if (d) + { + addRefItem(md->todoId(),md->testId(),"member",d->getOutputFileBase()+":"+md->anchor(),scopeName+"::"+md->name(),md->argsString()); + } + } + } +} + //---------------------------------------------------------------------- @@ -2327,8 +2432,6 @@ static void addMemberDocs(Entry *root, doc+=root->doc; } md->setDocumentation(doc); - addTodoItem(root,"member",fullName); - addTestItem(root,"member",fullName); } else { @@ -2367,17 +2470,20 @@ static void addMemberDocs(Entry *root, //{ // md->setBody(root->body); //} - if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1) || - (md->isVariable() && !root->explicitExternal)) + bool ambig; + FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig); + if (fd) { - md->setBodySegment(root->bodyLine,root->endBodyLine); - bool ambig; - FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig); - md->setBodyDef(fd); - } - addTodoItem(root,"member",fullName); - addTestItem(root,"member",fullName); + if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1) || + (md->isVariable() && !root->explicitExternal)) + { + md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodyDef(fd); + } + + md->setRefItems(root->todoId,root->testId); + } } //md->setDefFile(root->fileName); @@ -3250,11 +3356,10 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl md->setBodyDef(fd); md->setMemberSpecifiers(root->memSpec); md->setMemberGroupId(root->mGrpId); - mn->inSort(md); + mn->append(md); cd->insertMember(md); cd->insertUsedFile(root->fileName); - addTodoItem(root,"member",cd->name()+"::"+md->name()); - addTestItem(root,"member",cd->name()+"::"+md->name()); + md->setRefItems(root->todoId,root->testId); } } else // unrelated function with the same name as a member @@ -3368,11 +3473,10 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl md->setBriefDescription(root->brief); md->addSectionsToDefinition(root->anchors); md->setMemberGroupId(root->mGrpId); - mn->inSort(md); + mn->append(md); cd->insertMember(md); cd->insertUsedFile(root->fileName); - addTodoItem(root,"member",cd->name()+"::"+md->name()); - addTestItem(root,"member",cd->name()+"::"+md->name()); + md->setRefItems(root->todoId,root->testId); if (newMemberName) { //printf("Adding memberName=%s\n",mn->memberName()); @@ -3596,6 +3700,7 @@ static void findEnums(Entry *root) //{ // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} + md->setRefItems(root->todoId,root->testId); if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { if (Config::hideScopeNames) @@ -3608,15 +3713,11 @@ static void findEnums(Entry *root) } nd->insertMember(md); md->setNamespace(nd); - addTodoItem(root,"member",nd->name()+"::"+md->name()); - addTestItem(root,"member",nd->name()+"::"+md->name()); } else if (isGlobal) { md->setDefinition(name); fd->insertMember(md); - addTodoItem(root,"member",md->name()); - addTestItem(root,"member",md->name()); } else if (cd) { @@ -3630,8 +3731,6 @@ static void findEnums(Entry *root) } cd->insertMember(md); cd->insertUsedFile(root->fileName); - addTodoItem(root,"member",cd->name()+"::"+md->name()); - addTestItem(root,"member",cd->name()+"::"+md->name()); } md->setDocumentation(root->doc); md->setBriefDescription(root->brief); @@ -3640,12 +3739,12 @@ static void findEnums(Entry *root) if ((mn=(*mnd)[name])) { // this is used if the same enum is in multiple namespaces/classes - mn->inSort(md); + mn->append(md); } else // new enum name { mn = new MemberName(name); - mn->inSort(md); + mn->append(md); mnd->insert(name,mn); mnl->inSort(mn); //printf("add %s to new memberName. Now %d members\n", @@ -3926,31 +4025,6 @@ static void computeClassImplUsageRelations() } //---------------------------------------------------------------------------- -//static void computeMemberGroups() -//{ -// ClassDef *cd; -// ClassListIterator cli(classList); -// for (;(cd=cli.current());++cli) -// { -// cd->computeMemberGroups(); -// } -//} - - -//---------------------------------------------------------------------------- -#if 0 -void computeClassIntfUsageRelations() -{ - ClassDef *cd; - ClassListIterator cli(classList); - for (;(cd=cli.current());++cli) - { - cd->determineIntfUsageRelation(); - } -} -#endif - -//---------------------------------------------------------------------------- // builds the list of all members for each class @@ -4357,8 +4431,6 @@ static void findDefineDocumentation(Entry *root) } //---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- // create a (sorted) list of separate documentation pages static void buildPageList(Entry *root) @@ -4367,59 +4439,16 @@ static void buildPageList(Entry *root) { if (!root->name.isEmpty()) { - PageInfo *pi=0; - if ((pi=pageDict[root->name])) - { - //warn("Warning: Page %s was already documented. Ignoring documentation " - // "at line %d of %s\n",root->name.data(),root->startLine, - // root->fileName.data()); - - // append documentation block to the page. - pi->doc+="\n\n"+root->doc; - } - else - { - QCString baseName=root->name.copy(); - if (baseName.right(4)==".tex") - baseName=baseName.left(baseName.length()-4); - else if (baseName.right(5)==".html") - baseName=baseName.left(baseName.length()-5); - - QCString title=root->args.stripWhiteSpace(); - pi=new PageInfo(root->fileName,root->startLine, - baseName, root->doc,title); - QCString pageName; - if (Config::caseSensitiveNames) - pageName=pi->name.copy(); - else - pageName=pi->name.lower(); - setFileNameForSections(root->anchors,pageName); - addTodoItem(root,"page",pageName,title); - addTestItem(root,"page",pageName,title); - - pageList.append(pi); - pageDict.insert(baseName,pi); - if (!pi->title.isEmpty()) - { - //outputList->writeTitle(pi->name,pi->title); - - // a page name is a label as well! - SectionInfo *si=new SectionInfo( - pi->name,pi->title,SectionInfo::Section); - si->fileName=pageName; - //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data()); - //printf("Adding section info %s\n",pi->name.data()); - sectionDict.insert(pageName,si); - } - } + addRelatedPage(root->name,root->args,root->doc,root->anchors, + root->fileName,root->startLine,root->todoId,root->testId + ); } } else if (root->section == Entry::MAINPAGEDOC_SEC) { QCString title=root->args.stripWhiteSpace(); if (title.isEmpty()) title=theTranslator->trMainPage(); - addTodoItem(root,"page","index",title); - addTestItem(root,"page","index",title); + addRefItem(root->todoId,root->testId,"page","index",title); } EntryListIterator eli(*root->sublist); Entry *e; @@ -4629,34 +4658,6 @@ static void generateGroupDocs() } //---------------------------------------------------------------------------- -// create member group documentation based on the documentation of the -// group's members. - -//void computeMemberGroupDocumentation() -//{ -// MemberGroupDictIterator mgdi(memberGroupDict); -// MemberGroup *mg; -// for (;(mg=mgdi.current());++mgdi) -// { -// mg->addDocumentation(); -// } -//} - -//---------------------------------------------------------------------------- -// generate member group pages - -//void generateMemberGroupDocs() -//{ -// MemberGroupDictIterator mgdi(memberGroupDict); -// MemberGroup *mg; -// for (;(mg=mgdi.current());++mgdi) -// { -// mg->writeDocumentation(*outputList); -// } -//} - - -//---------------------------------------------------------------------------- // generate module pages static void generateNamespaceDocs() @@ -5404,7 +5405,7 @@ int main(int argc,char **argv) { QCString configFile=fileToString(argv[optind+4]); if (configFile.isEmpty()) exit(1); - parseConfig(fileToString(argv[optind+4])); + parseConfig(fileToString(argv[optind+4]),argv[optind+4]); configStrToVal(); substituteEnvironmentVars(); checkConfig(); @@ -5442,7 +5443,7 @@ int main(int argc,char **argv) { QCString configFile=fileToString(argv[optind+3]); if (configFile.isEmpty()) exit(1); - parseConfig(fileToString(argv[optind+3])); + parseConfig(fileToString(argv[optind+3]),argv[optind+3]); configStrToVal(); substituteEnvironmentVars(); checkConfig(); @@ -5542,7 +5543,7 @@ int main(int argc,char **argv) } } - parseConfig(config); + parseConfig(config,configName); configStrToVal(); if (updateConfig) @@ -5838,6 +5839,9 @@ int main(int argc,char **argv) msg("Adding source references...\n"); addSourceReferences(); + + msg("Adding todo/test references...\n"); + addTodoTestReferences(); /************************************************************************** * Generate documentation * @@ -5917,7 +5921,6 @@ int main(int argc,char **argv) generateSearchIndex(); msg("Generating style sheet...\n"); - //outputList->enable(OutputGenerator::Latex); outputList->writeStyleInfo(0); // write first part outputList->disableAllBut(OutputGenerator::Latex); parseText(*outputList, diff --git a/src/doxygen.h b/src/doxygen.h index f48896c..f4cd097 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -28,7 +28,6 @@ #include "classlist.h" #include "membername.h" #include "filename.h" -//#include "define.h" #include "namespacedef.h" #include "formula.h" #include "section.h" @@ -37,7 +36,8 @@ struct PageInfo { PageInfo(const char *f, int l,const char *n,const char *d,const char *t) : - defFileName(f), defLine(l), name(n), doc(d), title(t) {} + defFileName(f), defLine(l), name(n), doc(d), title(t), + todoId(0), testId(0) {} // where the page definition was found QCString defFileName; @@ -47,6 +47,10 @@ struct PageInfo QCString name; QCString doc; QCString title; + + // ids + int todoId; + int testId; }; class PageList : public QList @@ -104,7 +108,6 @@ extern MemberNameDict functionNameDict; extern StringDict substituteDict; extern FileList fileList; extern FileDict fileDict; -//extern DefineDict defineDict; extern ClassDef unrelatedClass; extern QTextStream tagFile; extern SectionDict sectionDict; @@ -113,7 +116,6 @@ extern FileNameDict *includeNameDict; extern FileNameDict *exampleNameDict; extern FileNameDict *inputNameDict; extern FileNameDict *imageNameDict; -//extern FileList includeFiles; extern StringDict typedefDict; extern GroupList groupList; extern GroupDict groupDict; diff --git a/src/doxygen.pro.in b/src/doxygen.pro.in index 0fb674e..c219073 100644 --- a/src/doxygen.pro.in +++ b/src/doxygen.pro.in @@ -16,7 +16,7 @@ TEMPLATE = doxygen.t CONFIG = console qt warn_on $extraopts -HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \ +HEADERS = doxygen.h scanner.h doc.h classdef.h classlist.h memberdef.h \ membername.h index.h memberlist.h definition.h \ entry.h logos.h instdox.h message.h code.h \ filedef.h util.h cppvalue.h constexp.h \ @@ -27,8 +27,8 @@ HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \ translator_it.h formula.h debug.h membergroup.h htmlhelp.h \ translator_ru.h translator_pl.h dot.h rtfgen.h xml.h xml_dtd.h \ reflist.h -SOURCES = doxygen.cpp scanner.cpp classdef.cpp classlist.cpp memberdef.cpp \ - membername.cpp index.cpp memberlist.cpp \ +SOURCES = doxygen.cpp scanner.cpp doc.cpp classdef.cpp classlist.cpp \ + memberdef.cpp membername.cpp index.cpp memberlist.cpp \ entry.cpp logos.cpp instdox.cpp message.cpp code.cpp \ config.cpp filedef.cpp util.cpp groupdef.cpp \ outputgen.cpp outputlist.cpp htmlgen.cpp latexgen.cpp mangen.cpp \ diff --git a/src/doxygen.t b/src/doxygen.t index 1d6fc2f..c2d7aae 100644 --- a/src/doxygen.t +++ b/src/doxygen.t @@ -65,6 +65,9 @@ sub GenerateDep { #$ GenerateDep("defargs.cpp","defargs.l"); $(LEX) -PdefargsYY -t defargs.l >defargs.cpp +#$ GenerateDep("doc.cpp","doc.l"); + $(LEX) -PdocYY -t doc.l >doc.cpp + #$ GenerateDep("ce_lex.cpp","constexp.l","ce_parse.h"); $(LEX) -PcppExpYY -t constexp.l >ce_lex.cpp @@ -77,3 +80,4 @@ sub GenerateDep { xml_dtd.h: doxygen.dtd cat doxygen.dtd | sed -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >xml_dtd.h + diff --git a/src/filedef.cpp b/src/filedef.cpp index e35875f..462ee79 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -19,7 +19,7 @@ #include "memberlist.h" #include "classlist.h" #include "filedef.h" -#include "scanner.h" +#include "doc.h" #include "doxygen.h" #include "memberdef.h" #include "classdef.h" @@ -29,6 +29,8 @@ #include "outputlist.h" #include "dot.h" #include "message.h" +#include "code.h" +#include "xml.h" /*! create a new file definition, where \a p is the file path, \a the file name, and \a ref is an HTML anchor name if the @@ -355,7 +357,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trDefineDocumentation()); ol.endGroupHeader(); - defineMembers.writeDocumentation(ol,name()); + defineMembers.writeDocumentation(ol,name(),this); } protoMembers.countDocMembers(); @@ -365,7 +367,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); ol.endGroupHeader(); - protoMembers.writeDocumentation(ol,name()); + protoMembers.writeDocumentation(ol,name(),this); } typedefMembers.countDocMembers(); @@ -375,7 +377,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trTypedefDocumentation()); ol.endGroupHeader(); - typedefMembers.writeDocumentation(ol,name()); + typedefMembers.writeDocumentation(ol,name(),this); } enumMembers.countDocMembers(); @@ -385,7 +387,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trEnumerationTypeDocumentation()); ol.endGroupHeader(); - enumMembers.writeDocumentation(ol,name()); + enumMembers.writeDocumentation(ol,name(),this); } funcMembers.countDocMembers(); @@ -395,7 +397,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trFunctionDocumentation()); ol.endGroupHeader(); - funcMembers.writeDocumentation(ol,name()); + funcMembers.writeDocumentation(ol,name(),this); } varMembers.countDocMembers(); @@ -405,7 +407,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trVariableDocumentation()); ol.endGroupHeader(); - varMembers.writeDocumentation(ol,name()); + varMembers.writeDocumentation(ol,name(),this); } // write Author section (Man only) diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 72529d0..fb17114 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -22,7 +22,7 @@ #include "filedef.h" #include "classlist.h" #include "outputlist.h" -#include "scanner.h" +#include "doc.h" #include "namespacedef.h" #include "language.h" #include "util.h" @@ -373,7 +373,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trDefineDocumentation()); ol.endGroupHeader(); - defineMembers.writeDocumentation(ol,name()); + defineMembers.writeDocumentation(ol,name(),this); } protoMembers.countDocMembers(); @@ -383,7 +383,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); ol.endGroupHeader(); - protoMembers.writeDocumentation(ol,name()); + protoMembers.writeDocumentation(ol,name(),this); } typedefMembers.countDocMembers(); @@ -393,7 +393,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trTypedefDocumentation()); ol.endGroupHeader(); - typedefMembers.writeDocumentation(ol,name()); + typedefMembers.writeDocumentation(ol,name(),this); } enumMembers.countDocMembers(); @@ -403,7 +403,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trEnumerationTypeDocumentation()); ol.endGroupHeader(); - enumMembers.writeDocumentation(ol,name()); + enumMembers.writeDocumentation(ol,name(),this); } //enumValMembers.countDocMembers(); @@ -423,7 +423,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trFunctionDocumentation()); ol.endGroupHeader(); - funcMembers.writeDocumentation(ol,name()); + funcMembers.writeDocumentation(ol,name(),this); } varMembers.countDocMembers(); @@ -433,7 +433,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trVariableDocumentation()); ol.endGroupHeader(); - varMembers.writeDocumentation(ol,name()); + varMembers.writeDocumentation(ol,name(),this); } endFile(ol); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 913ec2f..f9b5075 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -277,13 +277,13 @@ void HtmlGenerator::writeStyleInfo(int part) } } -void HtmlGenerator::startDoxyAnchor(const char *,const char *, +void HtmlGenerator::startDoxyAnchor(const char *, const char *anchor, const char *name) { t << ""; } -void HtmlGenerator::endDoxyAnchor() +void HtmlGenerator::endDoxyAnchor(const char *,const char *) { } @@ -789,12 +789,11 @@ void HtmlGenerator::endAlphabeticalIndexList() void HtmlGenerator::writeIndexHeading(const char *s) { - //t << "
" << s << "
" << endl; t << "
  " << s << "  
"; } -void HtmlGenerator::writeImage(const char *name,const char *,const char *) +void HtmlGenerator::startImage(const char *name,const char *,bool hasCaption) { QCString baseName=name; int i; @@ -802,7 +801,21 @@ void HtmlGenerator::writeImage(const char *name,const char *,const char *) { baseName=baseName.right(baseName.length()-i-1); } + t << "
" << endl; t << "\""" << endl; + if (hasCaption) + { + t << "

"; + } +} + +void HtmlGenerator::endImage(bool hasCaption) +{ + if (hasCaption) + { + t << "

" << endl; + } + t << "
" << endl; } void HtmlGenerator::startMemberDoc(const char *,const char *,const char *,const char *) diff --git a/src/htmlgen.h b/src/htmlgen.h index 780c7d7..9fd1a84 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -142,9 +142,8 @@ class HtmlGenerator : public OutputGenerator void endMemberDoc(); //void writeDoxyAnchor(const char *fName,const char *clName, // const char *anchor,const char *name); - void startDoxyAnchor(const char *fName,const char *clName, - const char *anchor,const char *name); - void endDoxyAnchor(); + void startDoxyAnchor(const char *fName,const char *anchor,const char *name); + void endDoxyAnchor(const char *fName,const char *anchor); void startCodeAnchor(const char *label) { t << ""; } void endCodeAnchor() { } void writeLatexSpacing() {} @@ -201,7 +200,8 @@ class HtmlGenerator : public OutputGenerator void endQuickIndexItem(); void writeFormula(const char *,const char *); void writeNonBreakableSpace() { t << "   "; } - void writeImage(const char *,const char *,const char *); + void startImage(const char *,const char *,bool); + void endImage(bool); void startDescTable() { t << "" << endl; } diff --git a/src/index.cpp b/src/index.cpp index c56d265..c404f35 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -24,7 +24,7 @@ #include "message.h" #include "index.h" #include "doxygen.h" -#include "scanner.h" +#include "doc.h" #include "code.h" #include "config.h" #include "filedef.h" @@ -634,7 +634,7 @@ void writeNamespaceIndex(OutputList &ol) ol.endEmphasis(); } ol.docify(")"); - ol.writeEndAnnoItem(nd->name()); + ol.writeEndAnnoItem(nd->getOutputFileBase()); if (hasHtmlHelp) { htmlHelp->addContentsItem(nd->name(),nd->getOutputFileBase()); @@ -710,7 +710,7 @@ void writeAnnotatedClassList(OutputList &ol) ol.endEmphasis(); } ol.docify(")"); - ol.writeEndAnnoItem(cd->name()); + ol.writeEndAnnoItem(cd->getOutputFileBase()); if (Config::generateHtml && Config::htmlHelpFlag) { HtmlHelp::getInstance()->addContentsItem( @@ -1521,7 +1521,11 @@ void writeGraphInfo(OutputList &ol) startTitle(ol,0); parseText(ol,theTranslator->trLegendTitle()); endTitle(ol,0,0); + bool oldStripCommentsState = Config::stripCommentsFlag; + // temporarily disable the stripping of comments for our own code example! + Config::stripCommentsFlag = FALSE; parseDoc(ol,"graph_legend",1,0,0,theTranslator->trLegendDocs()); + Config::stripCommentsFlag = oldStripCommentsState; endFile(ol); ol.popGeneratorState(); } diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 721176c..757359b 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -800,7 +800,7 @@ void LatexGenerator::writeIndexItem(const char *ref,const char *fn, { t << "\\contentsline{section}{"; docify(name); - t << "}{\\pageref{" << name << "}}{}" << endl; + t << "}{\\pageref{" << fn << "}}{}" << endl; } else docify(name); @@ -871,14 +871,15 @@ void LatexGenerator::startTextLink(const char *f,const char *anchor) if (anchor) t << "_" << anchor; t << "}{"; } + else + { + t << "{\\bf "; + } } void LatexGenerator::endTextLink() { - if (Config::pdfHyperFlag) - { - t << "}"; - } + t << "}"; } void LatexGenerator::writeObjectLink(const char *ref, const char *f, @@ -936,7 +937,7 @@ void LatexGenerator::endTitleHead(const char *fileName,const char *name) t << "}" << endl; if (name) { - t << "\\label{" << name << "}\\index{" + t << "\\label{" << fileName << "}\\index{" << name << "@{"; docify(name); t << "}}" << endl; @@ -1012,13 +1013,9 @@ void LatexGenerator::endMemberDoc() if (Config::compactLatexFlag) t << "\\hfill"; } -void LatexGenerator::startDoxyAnchor(const char *fName,const char *clname, - const char *anchor,const char *) +void LatexGenerator::startDoxyAnchor(const char *fName,const char *anchor, + const char *) { - t << "\\label{"; - if (clname) t << clname; - if (anchor) t << "_" << anchor; - t << "}" << endl; if (Config::pdfHyperFlag) { t << "\\hypertarget{"; @@ -1028,12 +1025,16 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *clname, } } -void LatexGenerator::endDoxyAnchor() +void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) { if (Config::pdfHyperFlag) { t << "}" << endl; } + t << "\\label{"; + if (fName) t << fName; + if (anchor) t << "_" << anchor; + t << "}" << endl; } void LatexGenerator::writeAnchor(const char *fName,const char *name) @@ -1406,20 +1407,34 @@ void LatexGenerator::endMemberList() t << "\\end{CompactItemize}" << endl; } -void LatexGenerator::writeImage(const char *name,const char *w,const char *h) +void LatexGenerator::startImage(const char *name,const char *size,bool hasCaption) { - t << "\\mbox{"; + if (hasCaption) + t << "\\begin{figure}[H]" << endl; + else + t << "\\mbox{"; QCString gfxName = name; if (gfxName.right(4)==".eps") gfxName.left(gfxName.length()-4); // "\\epsfig{file=" << name; t << "\\includegraphics"; - if (w || h) t << "["; - if (w) t << "width=" << w; else if (h) t << "height=" << h; - if (w || h) t << "]"; + if (size) t << "[" << size << "]"; t << "{" << gfxName << "}"; - t << "}" << endl; + if (hasCaption) + t << "\\caption{"; + else + t << "}" << endl; } +void LatexGenerator::endImage(bool hasCaption) +{ + if (hasCaption) + { + t << "}" << endl; + t << "\\end{figure}" << endl; + } +} + + void LatexGenerator::startMemberGroupHeader(bool hasHeader) { if (hasHeader) t << "\\begin{Indent}"; diff --git a/src/latexgen.h b/src/latexgen.h index cb0ab81..7e8a174 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -125,8 +125,8 @@ class LatexGenerator : public OutputGenerator void lineBreak() { t << "\\par\n"; } void startMemberDoc(const char *,const char *,const char *,const char *); void endMemberDoc(); - void startDoxyAnchor(const char *,const char *,const char *,const char *); - void endDoxyAnchor(); + void startDoxyAnchor(const char *,const char *,const char *); + void endDoxyAnchor(const char *,const char *); void startCodeAnchor(const char *) {} void endCodeAnchor() {} void writeChar(char c); @@ -197,7 +197,8 @@ class LatexGenerator : public OutputGenerator void endQuickIndexItem() {} void writeFormula(const char *,const char *); void writeNonBreakableSpace(); - void writeImage(const char *,const char *,const char *); + void startImage(const char *,const char *,bool); + void endImage(bool); void startDescTable() { t << "\\begin{description}" << endl; } diff --git a/src/mangen.h b/src/mangen.h index a9ff427..09f5b48 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -122,9 +122,8 @@ class ManGenerator : public OutputGenerator void writeChar(char c); void startMemberDoc(const char *,const char *,const char *,const char *); void endMemberDoc() {} - void startDoxyAnchor(const char *,const char *, - const char *,const char *) {} - void endDoxyAnchor() {} + void startDoxyAnchor(const char *,const char *,const char *) {} + void endDoxyAnchor(const char *,const char *) {} void startCodeAnchor(const char *) {} void endCodeAnchor() {} void writeLatexSpacing() {} @@ -188,7 +187,8 @@ class ManGenerator : public OutputGenerator void endQuickIndexItem() {} void writeFormula(const char *,const char *) {} void writeNonBreakableSpace() { t << " "; } - void writeImage(const char *,const char *,const char *) {} + void startImage(const char *,const char *,bool) {} + void endImage(bool) {} void startDescTable() {} void endDescTable() {} diff --git a/src/memberdef.cpp b/src/memberdef.cpp index d64225c..f64950f 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -21,13 +21,14 @@ #include "membername.h" #include "doxygen.h" #include "util.h" +#include "code.h" #include "message.h" #include "htmlhelp.h" #include "language.h" #include "outputlist.h" #include "example.h" #include "membergroup.h" -#include "scanner.h" +#include "doc.h" #include "groupdef.h" #include "defargs.h" #include "xml.h" @@ -583,7 +584,7 @@ void MemberDef::writeDeclaration(OutputList &ol, { QCString doxyName=name().copy(); if (!cname.isEmpty()) doxyName.prepend(cname+"::"); - ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); + ol.startDoxyAnchor(cfname,anchor(),doxyName); ol.addToIndex(name(),cname); ol.addToIndex(cname,name()); if (hasHtmlHelp) @@ -763,7 +764,7 @@ void MemberDef::writeDeclaration(OutputList &ol, if (!detailsVisible && !Config::extractAllFlag && !annMemb) { - ol.endDoxyAnchor(); + ol.endDoxyAnchor(cfname,anchor()); } ol.endMemberItem((annoClassDef!=0 && indDepth==0) || annEnumType); @@ -796,7 +797,7 @@ void MemberDef::writeDeclaration(OutputList &ol, * all active output formats. */ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, - const char *scopeName) + const char *scopeName,Definition *container) { if (getClassDef()==0 && isStatic() && !Config::extractStaticFlag) return; bool hasDocs = detailsAreVisible(); @@ -809,16 +810,9 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, (!hasDocs && !briefDescription().isEmpty() && annUsed) ) { - // get definition. TODO: make a method of this - NamespaceDef *nd=getNamespaceDef(); - ClassDef *cd=getClassDef(); - FileDef *fd=getFileDef(); - Definition *d = 0; - if (cd) d=cd; else if (nd) d=nd; else d=fd; - ASSERT(d!=0); - - QCString cname = d->name(); - QCString cfname = d->getOutputFileBase(); + // get definition. + QCString cname = container->name(); + QCString cfname = container->getOutputFileBase(); // get member name QCString doxyName=name().copy(); @@ -858,7 +852,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, { if (vmd->isEnumerate() && ldef.mid(i,l)==vmd->name()) { - ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); + ol.startDoxyAnchor(cfname,anchor(),doxyName); ol.startMemberDoc(cname,name(),anchor(),name()); if (hasHtmlHelp) { @@ -874,7 +868,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (!found) // anonymous compound { //printf("Annonymous compound `%s'\n",cname.data()); - ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); + ol.startDoxyAnchor(cfname,anchor(),doxyName); ol.startMemberDoc(cname,name(),anchor(),name()); if (hasHtmlHelp) { @@ -895,13 +889,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } else { - ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); + ol.startDoxyAnchor(cfname,anchor(),doxyName); ol.startMemberDoc(cname,name(),anchor(),name()); if (hasHtmlHelp) { htmlHelp->addIndexItem(cname,name(),cfname,anchor()); } + ClassDef *cd=getClassDef(); ArgumentList *scopeAl=scopeDefTemplateArguments(); if (scopeAl==0 && cd) scopeAl=cd->templateArguments(); @@ -1016,7 +1011,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } if (!isDefine()) ol.endParameter(TRUE); ol.endMemberDoc(); - ol.endDoxyAnchor(); + ol.endDoxyAnchor(cfname,anchor()); ol.startIndent(); ol.pushGeneratorState(); @@ -1121,7 +1116,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } //ol.writeListItem(); ol.startDescTableTitle(); - ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name()); + ol.startDoxyAnchor(cfname,fmd->anchor(),fmd->name()); first=FALSE; ol.startEmphasis(); ol.docify(fmd->name()); @@ -1129,7 +1124,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.disableAllBut(OutputGenerator::Man); ol.writeString(" "); ol.enableAll(); - ol.endDoxyAnchor(); + ol.endDoxyAnchor(cfname,fmd->anchor()); ol.endDescTableTitle(); //ol.newParagraph(); ol.startDescTableData(); @@ -1324,10 +1319,10 @@ void MemberDef::warnIfUndocumented() t="class", d=cd; else if (nd) t="namespace", d=nd; - else if (fd) - t="file", d=fd; - else + else if (gd) t="group", d=gd; + else + t="file", d=fd; if (d && d->isLinkable() && !isLinkable() && name().find('@')==-1) warn_undoc(defFileName,defLine,"Warning: Member %s of %s %s is not documented.", @@ -1570,3 +1565,20 @@ void MemberDef::generateXML(QTextStream &t,Definition *def) t << ">" << endl; } +Definition *MemberDef::getCompoundDef() const +{ + NamespaceDef *nd=getNamespaceDef(); + ClassDef *cd=getClassDef(); + FileDef *fd=getFileDef(); + GroupDef *gd=getGroupDef(); + Definition *d = 0; + if (cd) d=cd; else if (nd) d=nd; else if (gd) d=gd; else d=fd; + ASSERT(d!=0); + return d; +} + +QCString MemberDef::anchor() const +{ + if (enumScope) return enumScope->anchor()+anc; + return anc; +} diff --git a/src/memberdef.h b/src/memberdef.h index 0ea0877..288dc94 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -79,7 +79,7 @@ class MemberDef : public Definition const char *typeString() const { return type; } const char *argsString() const { return args; } const char *excpString() const { return exception; } - const char *anchor() const { return anc; } + QCString anchor() const; const QCString &initializer() const { return init; } int initializerLines() const { return initLines; } int getMemberSpecifiers() const { return memSpec; } @@ -90,6 +90,7 @@ class MemberDef : public Definition GroupDef *getGroupDef() const { return group; } FileDef *getFileDef() const { return fileDef; } NamespaceDef* getNamespaceDef() const { return nspace; } + Definition *getCompoundDef() const; // direct kind info Protection protection() const { return prot; } @@ -144,7 +145,7 @@ class MemberDef : public Definition ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, bool inGroup); void writeDocumentation(MemberList *ml,OutputList &ol, - const char *scopeName/*,MemberType m*/); + const char *scopeName,Definition *container); void warnIfUndocumented(); // relation to other members diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 2ec52f1..ee46fc5 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -24,7 +24,7 @@ #include "language.h" #include "doxygen.h" #include "outputlist.h" -#include "scanner.h" +#include "doc.h" #include "groupdef.h" MemberList::MemberList() : QList() @@ -583,13 +583,13 @@ void MemberList::writeDeclarations(OutputList &ol, } void MemberList::writeDocumentation(OutputList &ol, - const char *scopeName/*, MemberDef::MemberType m*/) + const char *scopeName, Definition *container) { MemberListIterator mli(*this); MemberDef *md; for ( ; (md=mli.current()) ; ++mli) { - md->writeDocumentation(this,ol,scopeName); + md->writeDocumentation(this,ol,scopeName,container); } } diff --git a/src/memberlist.h b/src/memberlist.h index 118c327..1967ee3 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -55,8 +55,8 @@ class MemberList : public QList ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, const char *title,const char *subtitle, bool inGroup=FALSE,bool countSubGroups=TRUE); - void writeDocumentation(OutputList &ol,const char *scopeName - /*,MemberDef::MemberType m*/); + void writeDocumentation(OutputList &ol,const char *scopeName, + Definition *container); void addMemberGroup(MemberGroup *mg); private: diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 54aa1e6..8badc81 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -19,7 +19,7 @@ #include "namespacedef.h" #include "outputlist.h" #include "util.h" -#include "scanner.h" +#include "doc.h" #include "language.h" #include "classdef.h" #include "classlist.h" @@ -272,7 +272,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trDefineDocumentation()); ol.endGroupHeader(); - defineMembers.writeDocumentation(ol,name()); + defineMembers.writeDocumentation(ol,name(),this); } protoMembers.countDocMembers(); @@ -282,7 +282,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); ol.endGroupHeader(); - protoMembers.writeDocumentation(ol,name()); + protoMembers.writeDocumentation(ol,name(),this); } typedefMembers.countDocMembers(); @@ -292,7 +292,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trTypedefDocumentation()); ol.endGroupHeader(); - typedefMembers.writeDocumentation(ol,name()); + typedefMembers.writeDocumentation(ol,name(),this); } enumMembers.countDocMembers(); @@ -302,7 +302,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trEnumerationTypeDocumentation()); ol.endGroupHeader(); - enumMembers.writeDocumentation(ol,name()); + enumMembers.writeDocumentation(ol,name(),this); } //enumValMembers.countDocMembers(); @@ -322,7 +322,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trFunctionDocumentation()); ol.endGroupHeader(); - funcMembers.writeDocumentation(ol,name()); + funcMembers.writeDocumentation(ol,name(),this); } varMembers.countDocMembers(); @@ -332,7 +332,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.startGroupHeader(); parseText(ol,theTranslator->trVariableDocumentation()); ol.endGroupHeader(); - varMembers.writeDocumentation(ol,name()); + varMembers.writeDocumentation(ol,name(),this); } // write Author section (Man only) diff --git a/src/outputgen.h b/src/outputgen.h index 5b309c7..a782ada 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -122,9 +122,9 @@ class OutputGenerator virtual void startMemberDoc(const char *,const char *, const char *,const char *) = 0; virtual void endMemberDoc() = 0; - virtual void startDoxyAnchor(const char *fileName,const char *clName, - const char *anchor,const char *name) = 0; - virtual void endDoxyAnchor() = 0; + virtual void startDoxyAnchor(const char *fName,const char *anchor, + const char *name) = 0; + virtual void endDoxyAnchor(const char *fileName,const char *anchor) = 0; virtual void startCodeAnchor(const char *label) = 0; virtual void endCodeAnchor() = 0; virtual void writeLatexSpacing() = 0; @@ -187,7 +187,8 @@ class OutputGenerator virtual void endQuickIndexItem() = 0; virtual void writeFormula(const char *,const char *) = 0; virtual void writeNonBreakableSpace() = 0; - virtual void writeImage(const char *,const char *,const char *) = 0; + virtual void startImage(const char *,const char *,bool) = 0; + virtual void endImage(bool) = 0; virtual void startDescTable() = 0; virtual void endDescTable() = 0; diff --git a/src/outputlist.h b/src/outputlist.h index b651546..b177f02 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -203,11 +203,10 @@ class OutputList { forall(&OutputGenerator::startMemberDoc,clName,memName,anchor,title); } void endMemberDoc() { forall(&OutputGenerator::endMemberDoc); } - void startDoxyAnchor(const char *fn, const char *cn, - const char *anchor,const char *name) - { forall(&OutputGenerator::startDoxyAnchor,fn,cn,anchor,name); } - void endDoxyAnchor() - { forall(&OutputGenerator::endDoxyAnchor); } + void startDoxyAnchor(const char *fName,const char *anchor, const char *name) + { forall(&OutputGenerator::startDoxyAnchor,fName,anchor,name); } + void endDoxyAnchor(const char *fn,const char *anchor) + { forall(&OutputGenerator::endDoxyAnchor,fn,anchor); } void startCodeAnchor(const char *label) { forall(&OutputGenerator::startCodeAnchor,label); } void endCodeAnchor() @@ -332,8 +331,10 @@ class OutputList { forall(&OutputGenerator::writeFormula,n,t); } void writeNonBreakableSpace() { forall(&OutputGenerator::writeNonBreakableSpace); } - void writeImage(const char *n,const char *w,const char *h) - { forall(&OutputGenerator::writeImage,n,w,h); } + void startImage(const char *n,const char *s,bool c) + { forall(&OutputGenerator::startImage,n,s,c); } + void endImage(bool c) + { forall(&OutputGenerator::endImage,c); } void startDescTable() { forall(&OutputGenerator::startDescTable); } diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 8ea9fb0..29db892 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -1124,7 +1124,7 @@ void RTFGenerator::writeIndexItem(const char *ref,const char *fn, if (!ref && fn) { t << "\\tab "; - WriteRTFReference(name); + WriteRTFReference(fn); t << endl; } else @@ -1392,15 +1392,15 @@ void RTFGenerator::endTitleHead(const char *fileName,const char *name) // make an index entry addToIndex(name,0); - if (name) - { - writeAnchor(0,name); - } - - if (Config::rtfHyperFlag && fileName) - { + //if (name) + //{ + // writeAnchor(0,name); + //} + // + //if (Config::rtfHyperFlag && fileName) + //{ writeAnchor(fileName,0); - } + //} } } @@ -1459,13 +1459,16 @@ void RTFGenerator::endMemberDoc() newParagraph(); } -void RTFGenerator::startDoxyAnchor(const char *fName,const char *clname, - const char *anchor,const char *) +void RTFGenerator::startDoxyAnchor(const char *,const char *,const char *) +{ +} + +void RTFGenerator::endDoxyAnchor(const char *fName,const char *anchor) { QCString ref; - if (clname) + if (fName) { - ref+=clname; + ref+=fName; } if (anchor) { @@ -1479,33 +1482,6 @@ void RTFGenerator::startDoxyAnchor(const char *fName,const char *clname, t << "{\\bkmkend "; t << formatBmkStr(ref); t << "}" << endl; - - if (Config::rtfHyperFlag) - { // doxygen expects a bookmark based on fName for the hyper target so we make a second bookmark - ref=""; - - if (fName) - { - ref+=fName; - } - if (anchor) - { - ref+='_'; - ref+=anchor; - } - - t << "{\\bkmkstart "; - t << formatBmkStr(ref); - t << "}" << endl; - t << "{\\bkmkend "; - t << formatBmkStr(ref); - t << "}" << endl; - } -} - -void RTFGenerator::endDoxyAnchor() -{ - } @@ -1760,12 +1736,9 @@ void RTFGenerator::endClassDiagram(ClassDiagram &d, const char *fileName,const char *) { newParagraph(); - DBG_RTF(t <<"{\\comment This would be an image map..." << endl) // create a gif file - d.writeImageMap(t,dir,fileName); - - t << "}" << endl; + d.writeImageMap(t,dir,fileName,FALSE); // display the file t << "{" << endl; @@ -1855,16 +1828,14 @@ void RTFGenerator::endMemberList() #endif } -void RTFGenerator::writeImage(const char *,const char *,const char *) +void RTFGenerator::startImage(const char *,const char *,bool) { -#ifdef DELETEDCODE - t << "\\mbox{\\epsfig{file=" << name; - if (w) - t << "," << w; - else if (h) - t << "," << h; - t << "}}" << endl; -#endif + // not yet implemented +} + +void RTFGenerator::endImage(bool) +{ + // not yet implemented } void RTFGenerator::startDescTable() diff --git a/src/rtfgen.h b/src/rtfgen.h index e5cf9ca..d52352a 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -120,8 +120,8 @@ class RTFGenerator : public OutputGenerator void lineBreak(); void startMemberDoc(const char *,const char *,const char *,const char *); void endMemberDoc(); - void startDoxyAnchor(const char *,const char *,const char *,const char *); - void endDoxyAnchor(); + void startDoxyAnchor(const char *,const char *,const char *); + void endDoxyAnchor(const char *,const char *); void startCodeAnchor(const char *) {}; void endCodeAnchor() {}; void writeChar(char c); @@ -183,7 +183,8 @@ class RTFGenerator : public OutputGenerator void endQuickIndexItem() {} void writeFormula(const char *,const char *); void writeNonBreakableSpace(); - void writeImage(const char *,const char *,const char *); + void startImage(const char *,const char *,bool); + void endImage(bool); void startDescTable(); void endDescTable(); diff --git a/src/scanner.h b/src/scanner.h index 40add67..0763e33 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -19,22 +19,10 @@ #define SCANNER_H #include "qtbc.h" -#include -#include -#include - -#include "entry.h" -#include "code.h" class OutputList; +class Entry; extern void parseMain(Entry *); -extern void parseDoc(OutputList &ol, - const char *fileName,int startLine, - const char *clName, const char *memName, - const QCString &docString); -extern void parseExample(OutputList &ol,const QCString &docString, - const char *fileName); -extern void parseText(OutputList &ol,const QCString &txtString); #endif diff --git a/src/scanner.l b/src/scanner.l index 986b3b2..a8aefd9 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -43,6 +43,7 @@ #include "outputlist.h" #include "membergroup.h" #include "reflist.h" +#include "code.h" #ifndef WIN32 #include @@ -54,14 +55,6 @@ * * statics */ -static bool insideArgumentList; -static QCString className; -static QCString memberName; -static OutputList * outDoc; -static QCString code; -static QCString linkRef; -static QCString linkText; -static QCString codeBlock; static const char * inputString; static int inputPosition; static int lastContext; @@ -113,38 +106,11 @@ static bool gstat; static bool removeSlashes; static Specifier virt; static Specifier baseVirt; -static bool exampleDoc; -static QCString exampleName; -static QCString htmlUrl,htmlText; -static QCString currentIncludeFile; static QCString msType,msName,msArgs; static int memberGroupId = NOGROUP; static QCString memberGroupHeader; static QCString memberGroupDocs; -static int includeFileOffset = 0; -static int includeFileLength = 0; -static bool firstLine; static bool isTypedef; -static bool inParamBlock; -static bool inRetValBlock; -static bool inExceptionBlock; -static bool inSeeBlock; -static bool inReturnBlock; -static bool inAuthorBlock; -static bool inDeprecatedBlock; -static bool inVersionBlock; -static bool inSinceBlock; -static bool inDateBlock; -static bool inBugBlock; -static bool inNoteBlock; -static bool inPreBlock; -static bool inPostBlock; -static bool inInvarBlock; -static bool inWarningBlock; -static bool inRemarkBlock; -static bool inAttentionBlock; -static bool inParBlock; -static bool firstSeeArg; static char afterDocTerminator; static int tmpDocType; static QCString sectionLabel; @@ -154,46 +120,32 @@ static SectionInfo::SectionType static QCString funcPtrType; static QCString templateStr; static QCString baseName; -static QCString *specName; +static QCString* specName; static QCString formulaText; -static QCString sectionRef; static bool insideIDL = FALSE; static bool insideCppQuote = FALSE; -static bool insideVerbatim = FALSE; -static int depthIf; -// state variable for reading the argument list of a function static int argRoundCount; static int argSharpCount; static int currentArgumentContext; static int lastCopyArgStringContext; static int lastCopyArgContext; -static int currentListIndentLevel; static QCString *copyArgString; static QCString fullArgString; static ArgumentList *currentArgumentList; static QCString *currentTemplateSpec; -static QCString curImageName; static char lastCopyArgChar; static QCString *pCopyRoundString; static QCString *pCopyCurlyString; static QCString *pCopyQuotedString; +static bool insideFormula; + //----------------------------------------------------------------------------- static void initParser() { - insideArgumentList=FALSE; - className.resize(0); - memberName.resize(0); - code.resize(0); - linkRef.resize(0); - linkText.resize(0); - codeBlock.resize(0); - htmlUrl.resize(0); - htmlText.resize(0); - currentIncludeFile.resize(0); sectionLabel.resize(0); sectionTitle.resize(0); baseName.resize(0); @@ -210,169 +162,7 @@ static void initParser() gstat = FALSE; virt = Normal; baseVirt = Normal; - includeFileOffset = 0; - includeFileLength = 0; - firstLine = TRUE; isTypedef = FALSE; - inParamBlock = FALSE; - inRetValBlock = FALSE; - inExceptionBlock = FALSE; - inSeeBlock = FALSE; - inReturnBlock = FALSE; - inAuthorBlock = FALSE; - inDeprecatedBlock = FALSE; - inVersionBlock = FALSE; - inSinceBlock = FALSE; - inDateBlock = FALSE; - inBugBlock = FALSE; - inNoteBlock = FALSE; - inPreBlock = FALSE; - inPostBlock = FALSE; - inInvarBlock = FALSE; - inWarningBlock = FALSE; - inRemarkBlock = FALSE; - inAttentionBlock = FALSE; - inParBlock = FALSE; - firstSeeArg = FALSE; -} - -//----------------------------------------------------------------------------- - -void scanString(const char *s); -void internalParseDocument(const char *s); - -//----------------------------------------------------------------------------- - -class TableElem -{ - public: - TableElem(int r,int c); - ~TableElem(); - int getRow() { return row; } - int getCol() { return col; } - OutputList *outputList() { return ol; } - - private: - OutputList *ol; - int row; - int col; -}; - -TableElem::TableElem(int r,int c) -{ - //printf("TableElem::TableElem(%d,%d)\n",r,c); - ol=new OutputList(outDoc); - outDoc=ol; - row=r; - col=c; -} - -TableElem::~TableElem() -{ - //printf("TableElem::~TableElem(%d,%d)\n",row,col); - delete ol; ol=0; -} - -class Table -{ - public: - Table(); - ~Table(); - void newRow(); - void newElem(); - - private: - OutputList *parentDoc; - QList *elemList; - int curRow; - int curCol; - int rows; - int cols; -}; - -Table::Table() -{ - parentDoc=outDoc; - elemList=new QList; - elemList->setAutoDelete(TRUE); - curRow=curCol=rows=cols=0; -} - -Table::~Table() -{ - //printf("Table::~Table()\n"); - // use elemList & cols & rows - if (cols>0 && rows>0) - { - parentDoc->startTable(cols); - TableElem *e=elemList->first(); - while (e) - { - if (e->getRow()>0) - { - if (e->getCol()==0) - { - if (e->getRow()>1) parentDoc->endTableRow(); - parentDoc->nextTableRow(); - } - else - { - parentDoc->nextTableColumn(); - } - *parentDoc+=*e->outputList(); - parentDoc->endTableColumn(); - } - e=elemList->next(); - } - parentDoc->endTable(); - } - delete elemList; elemList=0; - outDoc=parentDoc; -} - -void Table::newRow() -{ - //printf("Table::newRow()\n"); - curRow++; - if (curRow>rows) rows=curRow; - curCol=0; -} - -void Table::newElem() -{ - //printf("Table::newElem(%d,%d)\n",curRow,curCol); - TableElem *te = new TableElem(curRow,curCol); - elemList->append(te); - - curCol++; - if (curCol>cols) cols=curCol; -} - -static QStack
tableStack; -static Table *curTable; - -static void startTable() -{ - //printf("startTable()\n"); - curTable=new Table; - tableStack.push(curTable); -} - -static void endTable() -{ - //printf("endTable()\n"); - delete tableStack.pop(); // the destructor adds the table to the stream! - curTable=tableStack.top(); -} - -static void forceEndTable() -{ - err("Error: More
tags found than
" - "tags in documentation block in file %s!\n",yyFileName); - while (!tableStack.isEmpty()) - { - endTable(); - } } //----------------------------------------------------------------------------- @@ -383,15 +173,6 @@ static void lineCount() yyLineNr += (*c == '\n') ; } -static void endArgumentList() -{ - if (insideArgumentList) - { - insideArgumentList=FALSE; - outDoc->endItemList(); - } -} - static void addType( Entry* current ) { if( current->type.length() ) @@ -405,69 +186,6 @@ static void addType( Entry* current ) current->argList->clear(); } -static void includeFile(OutputList &ol,const char *fileName,bool quiet) -{ - //FileInfo *f; - bool ambig; - FileDef *fd; - if ((fd=findFileDef(exampleNameDict,fileName,ambig))) - { - currentIncludeFile=fileToString(fd->absFilePath()); - includeFileOffset=0; - includeFileLength=currentIncludeFile.length(); - OutputList codeFrag(&ol); - parseCode(codeFrag,0,currentIncludeFile,exampleDoc,exampleName); - if (!quiet) - { - ol.startCodeFragment(); - ol+=codeFrag; - ol.endCodeFragment(); - } - } - else if (ambig) - { - QCString text; - text.sprintf("Include file name %s is ambigious.\n",fileName); - text+="Possible candidates:\n"; - text+=showFileDefMatches(exampleNameDict,fileName); - warn(yyFileName,yyLineNr,text); - } - else - { - warn(yyFileName,yyLineNr, - "Warning: example file %s is not found. " - "Check your EXAMPLE_PATH",fileName - ); - } -} - -static void verbIncludeFile(OutputList &ol,const char *name) -{ - //FileInfo *f; - bool ambig; - FileDef *fd; - if ((fd=findFileDef(exampleNameDict,name,ambig))) - { - ol.startCodeFragment(); - ol.codify(fileToString(fd->absFilePath())); - ol.endCodeFragment(); - } - else if (ambig) - { - QCString text; - text.sprintf("Include file name %s is ambigious.\n",name); - text+=("Possible candidates:\n"); - text+=showFileDefMatches(exampleNameDict,name); - warn(yyFileName,yyLineNr,text); - } - else - { - warn(yyFileName,yyLineNr, - "Warning: example file %s is not found. " - "Check your EXAMPLE_PATH",name); - } -} - static QCString stripQuotes(const char *s) { @@ -481,100 +199,6 @@ static QCString stripQuotes(const char *s) return name; } -static QCString stripKnownExtensions(const char *text) -{ - QCString result=text; - if (result.right(4)==".tex") result=result.left(result.length()-4); - else if (result.right(5)==".html") result=result.left(result.length()-5); - //printf("%s stripKnowExtensions(%s)\n",result.data(),text); - return result; -} - -static void skipLine(OutputList &ol,const char *key) -{ - bool found=FALSE; - while (!found) - { - QCString s; - char c; - while ( includeFileOffsetstartEnumList(); else outDoc->startItemList(); - } - void endList() - { - if (enumerated) outDoc->endEnumList(); else outDoc->endItemList(); - } - void writeItem() - { - outDoc->writeListItem(); - } - int indent; - bool enumerated; -}; - -static QStack listIndentStack; -static bool insideItemList = FALSE; - -static void addListItemMarker(const char *marker,int dashPos,bool enumerated) -{ - // find the actual position at which the bullet was found - int i; - int indent=0; - for (i=0;istartList(); - listIndentStack.top()->writeItem(); - insideItemList=TRUE; - } - else - { - IndentInfo *pPrevInfo = listIndentStack.top(); - if (pPrevInfo->indent==indent && pPrevInfo->enumerated==enumerated) - // new item of same kind at the same indent level - { - pPrevInfo->writeItem(); - } - else if (pPrevInfo->indent==indent) - // new item of diffent kind at the same indent level - { - // switch to a diffent list type - pPrevInfo->endList(); - pPrevInfo->enumerated=enumerated; - pPrevInfo->startList(); - pPrevInfo->writeItem(); - } - else if (pPrevInfo->indentstartList(); - listIndentStack.top()->writeItem(); - } - else // end sub item list - { - pPrevInfo->endList(); - listIndentStack.pop(); - delete pPrevInfo; - // safe guard against wrong indenting - if (listIndentStack.isEmpty()) - { - insideItemList=FALSE; - warn(yyFileName,yyLineNr, - "Warning: list item with invalid indent found!"); - } - else - { - listIndentStack.top()->writeItem(); - } - } - } -} - -// end the current (nested) list regardless of the nesting level. -static void forceEndItemList() -{ - IndentInfo *info; - while ((info=listIndentStack.pop())!=0) - { - info->endList(); - delete info; - } - insideItemList=FALSE; -} - //----------------------------------------------------------------- -static bool inBlock() -{ - return inParamBlock || inRetValBlock || inSeeBlock || inReturnBlock || inAuthorBlock || - inVersionBlock || inSinceBlock || inDateBlock || inWarningBlock || inRemarkBlock || - inAttentionBlock || inBugBlock || inNoteBlock || - inParBlock || inExceptionBlock || inDeprecatedBlock || inPreBlock || - inPostBlock || inInvarBlock; -} - -static void endBlock() -{ - if (inParamBlock || inRetValBlock || inExceptionBlock) - { - outDoc->endDescTableData(); - outDoc->endDescTable(); - } - outDoc->endDescList(); - inParamBlock=inRetValBlock=inSeeBlock=inReturnBlock=inAuthorBlock= - inVersionBlock=inSinceBlock=inDateBlock=inBugBlock=inNoteBlock=inWarningBlock= - inParBlock=inExceptionBlock=inDeprecatedBlock=inPreBlock=inPostBlock= - inInvarBlock=inRemarkBlock=inAttentionBlock=FALSE; -} - static void addSection() { //printf("New section pageName=%s label=%s title=%s\n", @@ -761,1584 +256,223 @@ static bool nameIsOperator(QCString &name) (name.length()==8 || !isId(name.at(name.length()-9))); } +static void checkFormula() +{ + if (insideFormula) + { + warn(yyFileName,yyLineNr,"Warning: End of comment block while inside formula."); + } +} + static void checkDocs() { + checkFormula(); if ((current->brief.length()>2 && current->brief.at(0)=='<' && current->brief.at(1)==' ') || (current->doc.length()>2 && current->doc.at(0)=='<' && current->doc.at(1)==' ') ) { - warn("Warning: Found lonely '<' symbol at the start of the documentation " - "at line %d of %s",yyLineNr,yyFileName); + warn(yyFileName,yyLineNr,"Warning: Found lonely '<' symbol at the start of the documentation."); } } -//static bool curLatexState; -//static bool curManState; -//static bool curHtmlState; -// -//static void storeOutputListState() -//{ -// curLatexState = outDoc->isEnabled(OutputGenerator::Latex); -// curHtmlState = outDoc->isEnabled(OutputGenerator::Html); -// curManState = outDoc->isEnabled(OutputGenerator::Man); -//} -// -//static void restoreOutputListState() -//{ -// if (curLatexState) -// outDoc->enable(OutputGenerator::Latex); -// else -// outDoc->disable(OutputGenerator::Latex); -// if (curHtmlState) -// outDoc->enable(OutputGenerator::Html); -// else -// outDoc->disable(OutputGenerator::Html); -// if (curManState) -// outDoc->enable(OutputGenerator::Man); -// else -// outDoc->disable(OutputGenerator::Man); -//} - -enum ImageTypes -{ - IT_Html, - IT_Latex -}; - -// search for an image in the imageNameDict and if found -// copies the image to the output directory (which is the -// html directory if type==0 or the latex directory if type==1) -static QCString findAndCopyImage(const char *fileName,ImageTypes type) -{ - QCString result; - bool ambig; - FileDef *fd; - if ((fd=findFileDef(imageNameDict,fileName,ambig))) - { - QFile inImage(QString(fd->absFilePath().data())); - if (inImage.open(IO_ReadOnly)) - { - result = fileName; - int i; - if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1) - { - result.right(result.length()-i-1); - } - QCString outputDir; - switch(type) - { - case IT_Html: - outputDir = Config::htmlOutputDir; - break; - case IT_Latex: - outputDir = Config::latexOutputDir; - break; - } - QCString outputFile = outputDir+"/"+result; - QFile outImage(QString(outputFile.data())); - if (outImage.open(IO_WriteOnly)) // copy the image - { - char *buffer = new char[inImage.size()]; - inImage.readBlock(buffer,inImage.size()); - outImage.writeBlock(buffer,inImage.size()); - outImage.flush(); - delete buffer; - } - else - { - warn(yyFileName,yyLineNr, - "Warning: could not write output image %s",outputFile.data()); - } - } - else - { - warn(yyFileName,yyLineNr, - "Warning: could not open image %s",fileName); - } - } - else if (ambig) - { - QCString text; - text.sprintf("Warning: image file name %s is ambigious.\n",fileName); - text+="Possible candidates:\n"; - text+=showFileDefMatches(imageNameDict,fileName); - warn(yyFileName,yyLineNr,text); - } - else - { - result=fileName; - if (result.left(5)!="http:" && result.left(6)!="https:") - { - warn(yyFileName,yyLineNr, - "Warning: image file %s is not found in IMAGE_PATH: " - "assuming external image.",fileName - ); - } - } - return result; -} - -// find first identifier in string (exclusing type keywords) -QCString extractName(const QCString &s) +static QCString extractName(const QCString &s) { static const QRegExp id("[a-z_A-Z][a-z_A-Z0-9]*"); int i,p=0,l; - while ((i=id.match(s,p,&l))!=-1) - { - QCString idstr=s.mid(i,l); - if (idstr!="struct" && idstr!="class" && idstr!="union") return idstr; - p=i+l; - } - return ""; -} - -/* ----------------------------------------------------------------- */ - -//static void addToBody(const char *text); -//static void addToBodyCond(const char *text); -/* ----------------------------------------------------------------- */ -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); - -static int yyread(char *buf,int max_size) -{ - int c=0; - while( c < max_size && inputString[inputPosition] ) - { - *buf = inputString[inputPosition++] ; - //printf("%d (%c)\n",*buf,*buf); - c++; buf++; - } - return c; -} - -//ATTR ((({BN}+[^\>]+)/">")?) -%} - -CMD ("\\"|"@") -SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup") -BN [ \t\n\r] -BL [ \t\r]*"\n" -B [ \t] -BS ^(({B}*"//")?)(({B}*"*"+)?){B}* -FILE ([a-z_A-Z0-9\\:\/\-\+]+("."[a-z_A-Z0-9\\:\/\-\+]+)*)|("\""[^\n\"]+"\"") -FILEMASK [a-z_A-Z0-9\.\\:\/\-\+]+"."[a-z_A-Z0-9\.\-\+]*[a-z_A-Z0-9\-\+] -ID [a-z_A-Z][a-z_A-Z0-9]* -SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) -SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) -SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+ -URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/\=]+ -NONTERM [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9] -WORD ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"") -ATTR ({B}+[^>\n]*)? -A [aA] -BOLD [bB] -BODY [bB][oO][dD][yY] -BR [bB][rR] -EM [eE][mM] -CENTER [cC][eE][nN][tT][eE][rR] -CODE [cC][oO][dD][eE] -DL [dD][lL] -DD [dD][dD] -DT [dD][tT] -DFN [dD][fF][nN] -FORM [fF][oO][rR][mM] -H1 [hH]1 -H2 [hH]2 -H3 [hH][3-6] -HEAD [hH][eE][aA][dD] -HR [hH][rR] -HREF [hH][rR][eE][fF] -I [iI] -IMG [iI][mM][gG] -INPUT [iI][nN][pP][uU][tT] -LI [lL][iI] -META [mM][eE][tT][aA] -MULTICOL [mM][uU][lL][tT][iI][cC][oO][lL] -NAME [nN][aA][mM][eE] -OL [oO][lL] -P [pP] -PRE [pP][rR][eE] -SMALL [sS][mM][aA][lL][lL] -STRONG [sS][tT][rR][oO][nN][gG] -SUB [sS][uU][bB] -SUP [sS][uU][pP] -SRC [sS][rR][cC] -TABLE [tT][aA][bB][lL][eE] -TITLE [tT][iI][tT][lL][eE] -TD [tT][dD] -TR [tT][rR] -TT [tT][tT] -UL [uU][lL] -VAR [vV][aA][rR] -DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") - -%option noyywrap - -%x Define -%x DefineArg -%x DefineEnd -%x Include -%x CompoundName -%x ClassVar -%x ClassTemplSpec -%x Bases -%x BasesProt -%x NextSemi -%x FindMembers -%x FindMemberName -%x FindFields -%x FindFieldArg -%x Function -%x FuncRound -%x ExcpRound -%x FuncQual -%x Operator -%x Array -%x ReadBody -%x Using -%x UsingDirective -%x NameSpaceDocArg1 -%x SkipCurly -%x SkipCurlyCpp -%x SkipCurlyEndDoc -%x SkipString -%x SkipInits -%x SkipCPP -%x SkipCPPBlock -%x SkipComment -%x SkipCxxComment -%x SkipCurlyBlock -%x SkipRoundBlock -%x SkipCode -%x Sharp -%x SkipSharp -%x SkipRound -%x SkipSquare -%x TypedefName -%x Comment -%x Doc -%x JavaDoc -%x ClassDoc -%x LineDoc -%x DefLineDoc -%x ClassDocArg1 -%x ClassDocArg2 -%x ClassDocArg3 -%x ClassDocFunc -%x ClassDocFuncPtr -%x ClassDocFuncQual -%x ClassDocFuncSkipLine -%x ClassDocFuncExc -%x ClassDocDefine -%x ClassDocRelates -%x ClassDocBrief -%x ClassDocOverload -%x ClassDefineArgs -%x CppQuote -%x EndCppQuote -%x GroupDocArg1 -%x GroupDocArg2 -%x GroupName -%x GroupHeader -%x StoreGroupDocs -%x AfterDoc -%x AfterDocBrief -%x AfterDocLine -%x PageDoc -%x PageDocTitle -%x PageDocArg1 -%x PageDocArg2 -%x FileDocArg1 -%x FileDocArg2 -%x ExampleDoc -%x ExampleDocArg1 -%x EnumDoc -%x EnumDocArg1 -%x FuncPtr -%x EndFuncPtr -%x FuncFunc -%x FuncFuncEnd -%x FuncFuncType -%x MemberSpec -%x MemberSpecSkip -%x SkipVerbatim -%x Text -%x DocScan -%x DocParam -%x DocException -%x DocHtmlScan -%x DocLatexScan -%x DocEmphasis -%x DocBold -%x DocCode -%x DocIf -%x DocCodeBlock -%x DocInternal -%x DocLink -%x DocLinkText -%x DocSkipWord -%x DocInclude -%x DocDontInclude -%x DocDescItem -%x DocHtmlLink -%x DocHtmlAnchor -%x DocHtmlHref1 -%x DocHtmlHref2 -%x DocBaseClass -%x DocSkiplineKey -%x DocSkipKey -%x DocLineKey -%x DocUntilKey -%x DocKeyEnd -%x DocPar -%x DocRefName -%x DocVerbatim -%x DocVerbInc -%x DocIndexWord -%x DocRef -%x DocRefArg -%x DocRefArgStart -%x DocRefItem -%x DocRefItemName -%x DocImage -%x DocHtmlImageName -%x DocLatexImageName -%x DocLatexImageWidth -%x TodoParam -%x TestParam -%x SectionLabel -%x SectionTitle -%x SkipTemplate -%x EndTemplate -%x CopyArgString -%x CopyArgRound -%x CopyArgSharp -%x CopyArgComment -%x CopyArgCommentLine -%x SkipUnionSwitch -%x ReadFuncArgType -%x ReadTempArgs -%x Specialization -%x SkipHtmlComment -%x ReadFormulaShort -%x ReadFormulaLong -%x AnchorLabel -%x ReadInitializer -%x CopyString -%x CopyRound -%x CopyCurly -%x IDLUnionCase - -%% - -<*>\x06[^\x06]*\x06 { // new file - if (memberGroupId!=NOGROUP) - { - warn(yyFileName,yyLineNr,"Warning: Missing //@}"); - memberGroupId=NOGROUP; - } - yyLineNr= 0 ; // there is always an extra newline at the start of the file - int i; - for( i = 0 ; yytext[i+1] != 6 ; i++ ) - yyFileName[i] = yytext[i+1] ; - yyFileName[i] = 0 ; - insideIDL = i>4 && strcmp(&yyFileName[i-4],".idl")==0; - msg("Parsing file %s...\n",yyFileName); - current_root = global_root ; - initParser(); - current->reset(); - int sec=guessSection(yyFileName); - if (sec) - { - current->name = yyFileName; - current->name = current->name; - current->section = sec; - current_root->addSubEntry(current); - current = new Entry; - } - BEGIN( FindMembers ); - } -<*>\x0d -^{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */ - QCString text=yytext; - int dashPos = text.findRev('-'); - //printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1)); - bool isEnumerated = text.at(dashPos+1)=='#'; - addListItemMarker(yytext,dashPos,isEnumerated); - } -\n{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */ - QCString text=yytext; - int dashPos = text.findRev('-'); - //printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1)); - bool isEnumerated = text.at(dashPos+1)=='#'; - addListItemMarker(yytext+1,dashPos,isEnumerated); - } -"©" { outDoc->writeCopyright(); } -""" { outDoc->writeQuote(); } -"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } -"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } -"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } -"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } -"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } -"ß" { outDoc->writeSharpS(); } -"&[aA]ring;" { outDoc->writeRing(yytext[1]); } -"$("[a-z_A-Z]+")" { - QCString envvar=&yytext[2]; - envvar=envvar.left(envvar.length()-1); - outDoc->docify(getenv(envvar)); - } -{CMD}"htmlonly"/[^a-z_A-Z0-9] { - outDoc->pushGeneratorState(); /*storeOutputListState();*/ - outDoc->disableAllBut(OutputGenerator::Html); - BEGIN(DocHtmlScan); - } -{CMD}"endhtmlonly"/[^a-z_A-Z0-9] { - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -{CMD}"latexonly"/[^a-z_A-Z0-9] { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - BEGIN(DocLatexScan); - } -{CMD}"endlatexonly"/[^a-z_A-Z0-9] { - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -"//"|"/*"|"*/" { - outDoc->writeString(yytext); - } -.|\n { - char c[2]; - c[0]=*yytext;c[1]='\0'; - outDoc->writeString(c); - } -"\\postheader"/{BN} -"\\functionindex"/{BN} { writeMemberList(*outDoc); } -"\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); } -"\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); } -"\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ } -"\\header"/{BN} { BEGIN( DocSkipWord ); } -"\\define"/{BN} { BEGIN( DocSkipWord ); } -{CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); } -{FILE} { - verbIncludeFile(*outDoc,stripQuotes(yytext)); - BEGIN( DocScan ); - } -{CMD}"verbatim"/[^a-z_A-Z0-9] { - outDoc->startCodeFragment(); - insideVerbatim=TRUE; - BEGIN(DocVerbatim); - } -{CMD}"endverbatim"/[^a-z_A-Z0-9] { - outDoc->endCodeFragment(); - insideVerbatim=FALSE; - BEGIN(DocScan); - } -[^\n\\\@]*"\n" { - //printf("docifying: %s\n",yytext); - outDoc->codify(yytext); - } -"\n"|"//"|"/*"|"*/" { - outDoc->codify(yytext); - } -. { - //printf("char %c\n",*yytext); - char c[2];c[0]=*yytext;c[1]='\0'; - outDoc->codify(c); - } -{CMD}"internal"/{BN} { - if (!Config::internalDocsFlag) - { - outDoc->newParagraph(); - scanString(theTranslator->trForInternalUseOnly()+"\n"); - //outDoc->writeString("For internal use only.\n"); - BEGIN( DocInternal ); - } - } -"\\reimp"/{BN} { - outDoc->newParagraph(); - scanString(theTranslator->trReimplementedForInternalReasons()+"\n"); - } -{CMD}"link"/{BN} { BEGIN( DocLink ); } -[a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); } -[a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well! - linkRef = stripKnownExtensions(yytext); - linkText = ""; - BEGIN( DocLinkText ); - } -. { linkText += *yytext; } -"\n" { linkText += " "; } -{CMD}"endlink" { // <- needed for things like \endlink. - //printf("GenerateLink className=`%s' linkRef=`%s' linkText=`%s'\n", - // className.data(),linkRef.data(),linkText.data()); - generateLink(*outDoc,className,linkRef,inSeeBlock,linkText.stripWhiteSpace()); - BEGIN( DocScan ); - } - /* -"@ref"{B}+ { - BEGIN(DocRef); - } -{SCOPENAME} { - generateLink(*outDoc,className,yytext,TRUE,0); - BEGIN( DocScan ); - } - */ -{CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr, - "Warning: \\endlink without \\link " - "in documentation." - ); - } -{CMD}"addindex"{B}+ { - BEGIN(DocIndexWord); - } -"\\form#"[0-9]+ { - Formula *formula=formulaNameDict[yytext]; - if (formula) - { - QCString formName; - formName.sprintf("form-%d.gif",formula->getId()); - outDoc->writeFormula(formName,formula->getFormulaText()); - } - } -[^\n]+ { - //printf("Adding %s to index\n",yytext); - outDoc->addToIndex(yytext,0); - BEGIN(DocScan); - } -{CMD}("arg"|"li")/{BN} { - if (insideArgumentList) - { - outDoc->writeListItem(); - } - else - { - outDoc->startItemList(); - outDoc->writeListItem(); - insideArgumentList=TRUE; - } - } -(({B}*"\n"){2,}{B}*)?{CMD}"par"{B}* { - BEGIN(DocPar); - } -[^\n]*{BN} { - QCString title=QCString(yytext).stripWhiteSpace(); - bool b = inBlock(); - if (!title.isEmpty()) - { - endArgumentList(); - if (b) endBlock(); - inParBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - outDoc->docify(title); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->newParagraph(); - } - BEGIN(DocScan); - } -{CMD}"warning"/{BN} { - endArgumentList(); - if (!inWarningBlock) - { - if (inBlock()) endBlock(); - inWarningBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trWarning()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"remark"[s]?/{BN} { - endArgumentList(); - if (!inRemarkBlock) - { - if (inBlock()) endBlock(); - inRemarkBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trRemarks()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"attention"[s]?/{BN} { - endArgumentList(); - if (!inAttentionBlock) - { - if (inBlock()) endBlock(); - inAttentionBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trAttention()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"bug"[s]?/{BN} { - endArgumentList(); - if (!inBugBlock) - { - if (inBlock()) endBlock(); - inBugBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trBugsAndLimitations()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"note"[s]?/{BN} { - endArgumentList(); - if (!inNoteBlock) - { - if (inBlock()) endBlock(); - inNoteBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trNote()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"pre"/{BN} { - endArgumentList(); - if (!inPreBlock) - { - if (inBlock()) endBlock(); - inPreBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trPrecondition()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"post"/{BN} { - endArgumentList(); - if (!inPostBlock) - { - if (inBlock()) endBlock(); - inPostBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trPostcondition()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"invariant"/{BN} { - endArgumentList(); - if (!inInvarBlock) - { - if (inBlock()) endBlock(); - inInvarBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trInvariant()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"version"/{BN} { - endArgumentList(); - if (!inVersionBlock) - { - if (inBlock()) endBlock(); - inVersionBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trVersion()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"since"/{BN} { - endArgumentList(); - if (!inSinceBlock) - { - if (inBlock()) endBlock(); - inSinceBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trSince()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -{CMD}"date"/{BN} { - endArgumentList(); - if (!inDateBlock) - { - if (inBlock()) endBlock(); - inDateBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trDate()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -"\\todo "[0-9]+ { // this tag is generated in an earlier pass - if (Config::generateTodoList) - { - QCString numStr=yytext; - numStr=numStr.right(numStr.length()-6); - bool ok; int num = numStr.toUInt(&ok); - RefItem *item = todoList.getRefItem(num); - ASSERT(item!=0); - endArgumentList(); - if (inBlock()) endBlock(); - outDoc->startDescList(); - outDoc->startBold(); - outDoc->writeObjectLink(0,"todo",item->listAnchor,theTranslator->trTodo()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - internalParseDocument(item->text); - outDoc->endDescList(); - } - } -"\\test "[0-9]+ { // this tag is generated in an earlier pass - if (Config::generateTestList) - { - QCString numStr=yytext; - numStr=numStr.right(numStr.length()-6); - bool ok; int num = numStr.toUInt(&ok); - RefItem *item = testList.getRefItem(num); - ASSERT(item!=0); - endArgumentList(); - if (inBlock()) endBlock(); - outDoc->startDescList(); - outDoc->startBold(); - outDoc->writeObjectLink(0,"test",item->listAnchor,theTranslator->trTest()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - internalParseDocument(item->text); - outDoc->endDescList(); - } - } -{CMD}"deprecated"/{BN} { - endArgumentList(); - if (!inDeprecatedBlock) - { - if (inBlock()) endBlock(); - inDeprecatedBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trDeprecated()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->writeDescItem(); - } - } -"$"[a-zA-Z_0-9]+":"[^\n\$]+"$" { // RCS tag - QCString tagName(&yytext[1]); - int i=tagName.find(':'); - tagName=tagName.left(i); - QCString tagText=&yytext[i+2]; - tagText=tagText.left(tagText.length()-1); - endArgumentList(); - if (inBlock()) endBlock(); - outDoc->startDescList(); - outDoc->startBold(); - scanString(tagName+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - scanString(tagText); - outDoc->endDescList(); - } -{CMD}"author"/{BN} { - endArgumentList(); - if (!inAuthorBlock) - { - if (inBlock()) endBlock(); - inAuthorBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trAuthors()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->docify(", "); - } - } -{CMD}("return"([s])?|"result")/{BN} { - endArgumentList(); - if (!inReturnBlock) - { - if (inBlock()) endBlock(); - inReturnBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trReturns()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - } -{CMD}("sa"|"see")/{BN} { - endArgumentList(); - if (!inSeeBlock) - { - if (inBlock()) endBlock(); - inSeeBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trSeeAlso()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - } - else - { - outDoc->docify(", "); - } - } -(({B}*"\n"){2,}{B}*)?{CMD}"param"/{BN} { - QCString t=yytext; - if (t.contains('\n')>1 && insideItemList) - { - forceEndItemList(); - } - endArgumentList(); - if (!inParamBlock) - { - if (inBlock()) endBlock(); - inParamBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trParameters()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - outDoc->startDescTable(); - } - else - { - outDoc->endDescTableData(); - } - BEGIN(DocParam); - } -(({B}*"\n"){2,}{B}*)?{CMD}"retval"/{BN} { - QCString t=yytext; - if (t.contains('\n')>1 && insideItemList) - { - forceEndItemList(); - } - endArgumentList(); - if (!inRetValBlock) - { - if (inBlock()) endBlock(); - inRetValBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trReturnValues()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - outDoc->startDescTable(); - } - else - { - outDoc->endDescTableData(); - } - BEGIN(DocParam); - } -(({B}*"\n"){2,}{B}*)?{CMD}("exception"|"throw")s?/{BN} { - QCString t=yytext; - if (t.contains('\n')>1 && insideItemList) - { - forceEndItemList(); - } - endArgumentList(); - if (!inExceptionBlock) - { - if (inBlock()) endBlock(); - inExceptionBlock=TRUE; - outDoc->startDescList(); - outDoc->startBold(); - scanString(theTranslator->trExceptions()+": "); - outDoc->endBold(); - outDoc->endDescTitle(); - outDoc->writeDescItem(); - outDoc->startDescTable(); - } - else - { - outDoc->endDescTableData(); - } - BEGIN(DocException); - } -"\\capt".* -({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} { - outDoc->startDescTableTitle(); - outDoc->startEmphasis(); - outDoc->docify(substitute(yytext,"\"","")); - outDoc->endEmphasis(); - outDoc->endDescTableTitle(); - outDoc->startDescTableData(); - BEGIN(DocScan); - } -{SCOPENAME} { - outDoc->startDescTableTitle(); - outDoc->startEmphasis(); - outDoc->docify(yytext); - outDoc->endEmphasis(); - outDoc->endDescTableTitle(); - outDoc->startDescTableData(); - BEGIN(DocScan); - } -{CMD}"section "{ID}"\n" { - QCString secName=&yytext[9]; // skip "\section " - secName=secName.left(secName.length()-1); // remove \n - //printf("SectionName %s found\n",secName.data()); - SectionInfo *sec; - if ((sec=sectionDict[secName])) - { - //printf("Title %s\n",sec->title.data()); - outDoc->writeSection(sec->label,sec->title, - sec->type==SectionInfo::Subsection); - } - } -{CMD}"anchor "{ID}"\n" { - QCString secName=&yytext[8]; - secName=secName.left(secName.length()-1); - SectionInfo *sec; - if ((sec=sectionDict[secName])) - { - //printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data()); - outDoc->writeAnchor(sec->fileName,sec->label); - } - } -{CMD}"ref" { - BEGIN(DocRefName); - } -{CMD}"refitem" { - BEGIN(DocRefItem); - } -{CMD}"if"/{BN} { - outDoc->pushGeneratorState(); - depthIf++; - BEGIN(DocIf); - } -{CMD}"endif"/[^a-z_A-Z0-9] { - if (--depthIf<0) - { - warn(yyFileName,yyLineNr, - "Warning: documentation block contains \\endif without " - "matching \\if found in documentation." - ); - } - else - { - outDoc->popGeneratorState(); - } - } -[^\n\t ]+ { - if (Config::sectionFilterList.find(yytext)==-1) - { - outDoc->disableAll(); - } - BEGIN(DocScan); - } -{SCOPENAME}|{FILE} { - QCString ref=yytext; - SectionInfo *sec; - if ((sec=sectionDict[ref])) - { - QCString text; - if (sec->title.isEmpty()) - text=sec->label; - else - text=sec->title; - if (sec->type==SectionInfo::Anchor) - { - //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); - outDoc->writeObjectLink(0,sec->fileName,sec->label,text); - writePageRef(*outDoc,sec->label,0); - } - else - { - //printf(" ref sec=%p sec->fileName=%s text=%s\n",sec,sec->fileName.data(),text.data()); - outDoc->writeSectionRef(sec->fileName,sec->label,text); - } - } - else if (!generateLink(*outDoc,className,yytext,TRUE,0)) - { - warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",yytext); - //outDoc->writeBoldString(" unknown reference! "); - } - BEGIN(DocScan); - } -({SCOPENAME}|{FILE}){B}+/"\"" { - sectionRef=yytext; - sectionRef=sectionRef.stripWhiteSpace(); - BEGIN(DocRefArgStart); - } -"\"" { - BEGIN(DocRefArg); - } -[^\"\n]+[\n\"] { - yytext[yyleng-1]='\0'; - QCString text=substitute(yytext,"\\\\","\\"); - SectionInfo *sec; - if ((sec=sectionDict[sectionRef])) - { - if (sec->type==SectionInfo::Anchor) - { - //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); - outDoc->writeObjectLink(0,sec->fileName,sec->label,text); - //printf("Writing page ref `%s'\n",sec->label.data()); - writePageRef(*outDoc,sec->label,0); - } - else - { - outDoc->writeSectionRef(sec->fileName,sec->label,text); - } - } - else if (!generateLink(*outDoc,className,sectionRef,TRUE,text)) - { - warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data()); - outDoc->writeBoldString(" unknown reference! "); - } - BEGIN(DocScan); - } -{ID} { - sectionRef=yytext; - BEGIN(DocRefItemName); - } -.*/"\n" { - SectionInfo *sec; - QCString text=yytext; - if ((sec=sectionDict[sectionRef])) - { - outDoc->writeSectionRefItem(sec->fileName,sec->label,text.stripWhiteSpace()); - } - else - { - warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data()); - outDoc->writeBoldString(" unknown reference! "); - } - BEGIN(DocScan); - } -{CMD}"image"{B}+ { - BEGIN(DocImage); - } -[hH][tT][mM][lL] { - BEGIN(DocHtmlImageName); - } -[lL][aA][tT][eE][xX] { - BEGIN(DocLatexImageName); - } -{FILE}|{URLMASK} { - curImageName = findAndCopyImage(stripQuotes(yytext),IT_Html); - if (!curImageName.isEmpty()) - { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Html); - outDoc->writeImage(curImageName,0,0); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - } - BEGIN(DocScan); - } -{FILE} { - curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex); - if (curImageName.isEmpty()) - BEGIN(DocScan); - else - BEGIN(DocLatexImageWidth); - } -\n { // no width specified - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - outDoc->writeImage(curImageName,0,0); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -"width"{B}*"="{B}*[0-9\.]+({B}*{ID})? { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - outDoc->writeImage(curImageName,yytext,0); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -"height"{B}*"="{B}*[0-9\.]+({B}*{ID})? { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - outDoc->writeImage(curImageName,0,yytext); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -[a-z_A-Z0-9\.\-]+ { - warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext); - } -\n { - warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!"); - outDoc->enableAll(); - BEGIN(DocScan); - } -{CMD}"code"({BN}*"\n"|{B}*) { - outDoc->startCodeFragment(); - codeBlock.resize(0); - BEGIN( DocCodeBlock ); - } -{CMD}"endcode"/[^a-z_A-Z0-9] { - warn(yyFileName,yyLineNr,"Warning: \\endcode without
 or \\code "
-    					       "in the documentation."); 
-					}
-					
-{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"?	{
-  					  generateRef(*outDoc,className,yytext,inSeeBlock);
-					  BEGIN(DocScan);
-  					}
-{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" {
-  					  generateRef(*outDoc,className,yytext,inSeeBlock);
-					  BEGIN(DocScan);
-  					}
-{SCOPEMASK}("()")?	{
-  					  generateRef(*outDoc,className,yytext,inSeeBlock);
-					  BEGIN(DocScan);
-  					}
-({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")"	{ 
-				          QCString oName=yytext;
-					  generateRef(*outDoc,className,
-					              removeRedundantWhiteSpace(oName),inSeeBlock);
-					  BEGIN(DocScan);
-					}
-({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")"	{ 
-    					  QCString oName=yytext;
-					  generateRef(*outDoc,className,
-					              removeRedundantWhiteSpace(oName),inSeeBlock);
-					  BEGIN(DocScan);
-					}
-("http:"|"https:"|"ftp:"|"file:"){URLMASK}	{ outDoc->writeHtmlLink(yytext,yytext); }
-[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+	{ outDoc->writeMailLink(yytext); }
-{FILEMASK}			{
-					  generateFileRef(*outDoc,yytext);
-					}
-{BN}*{CMD}"endcode"/[^a-z_A-Z0-9]  { // needed to match things like \endcode. (note the dot)
-				          parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
-					  //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
-					  outDoc->endCodeFragment();
-					  BEGIN( DocScan ); 
-					}
-""	{ 
-				          parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
-					  //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
-					  outDoc->endCodeFragment();
-					  BEGIN( DocScan ); 
-					}
-{CMD}("e"|"em"|"a"){BN}+       { BEGIN( DocEmphasis ); }
-{CMD}"b"{BN}+			{ BEGIN( DocBold ); }
-{CMD}("c"|"p"){BN}+            { BEGIN( DocCode ); }
-{CMD}"l"{BN}+		
-"\\n"/[^a-z_A-Z0-9]		{ outDoc->lineBreak(); }
-{CMD}"include"{BN}+		{ BEGIN( DocInclude ); }
-{CMD}"dontinclude"{BN}+	{ BEGIN( DocDontInclude ); }
-{CMD}"skip"{BN}+	 	{ BEGIN( DocSkipKey ); }	
-{CMD}"skipline"{BN}+		{ BEGIN( DocSkiplineKey ); firstLine=TRUE; }
-{CMD}"line"{BN}+		{ BEGIN( DocLineKey ); firstLine=TRUE; }
-{CMD}"until"{BN}+		{ BEGIN( DocUntilKey ); firstLine=TRUE; }
-[^ \t\r\n]+			{ 
-  					  if (includeFileLength>0) 
-					    skipUntil(yytext); 
-  					  BEGIN( DocScan );
-					}
-[^ \t\r\n]+			{ 
-  					  if (includeFileLength>0) 
-					  {
-					    if (firstLine) outDoc->startCodeFragment();
-					    firstLine=FALSE;
-					    showLine(*outDoc,yytext); 
-					    BEGIN( DocKeyEnd );
-					  }
-					  else
-					  {
-  					    BEGIN( DocScan );
-					  }
-					}
-[^ \t\r\n]+		{ 
-  					  if (includeFileLength>0) 
-					  {
-					    if (firstLine) outDoc->startCodeFragment();
-					    firstLine=FALSE;
-					    skipLine(*outDoc,yytext); 
-					    BEGIN( DocKeyEnd );
-					  }
-					  else
-					  {
-  					    BEGIN( DocScan );
-					  }
-					}
-[^ \t\r\n]+		{ 
-  					  if (includeFileLength>0) 
-					  {
-					    if (firstLine) outDoc->startCodeFragment();
-					    firstLine=FALSE;
-					    showUntil(*outDoc,yytext); 
-					    BEGIN( DocKeyEnd );
-					  }
-					  else
-					  {
-  					    BEGIN( DocScan );
-					  }
-					}
-{CMD}"line"{BN}+		{ BEGIN(DocLineKey); }
-{CMD}"until"{BN}+		{ BEGIN(DocUntilKey); }
-{CMD}"skipline"{BN}+		{ BEGIN(DocSkiplineKey); }
-\n
-<>			{
-  					  if (!firstLine) outDoc->endCodeFragment();
-					  yyterminate();
-  					}
-.				{
-  					  unput(*yytext);
-  					  if (!firstLine) outDoc->endCodeFragment();
-					  BEGIN( DocScan );
-  					}
-"<"{MULTICOL}{ATTR}">"		
-""
-"<"{STRONG}{ATTR}">"		{ outDoc->startBold(); }
-""		{ outDoc->endBold(); }
-"<"{CENTER}{ATTR}">"		{ outDoc->startCenter(); }
-""		{ outDoc->endCenter(); }
-"<"{TABLE}{ATTR}">"		{ startTable(); }
-""		{ endTable(); }
-"<"{INPUT}{ATTR}">"
-"<"{SMALL}{ATTR}">"		{ outDoc->startSmall(); }
-""		{ outDoc->endSmall(); }
-"<"{META}{ATTR}">"
-"<"{FORM}{ATTR}">"
-""
-"<"{HEAD}{ATTR}">"			
-""			
-"<"{BODY}{ATTR}">"
-""
-"<"{CODE}{ATTR}">"		{ outDoc->startTypewriter(); }
-""		{ outDoc->endTypewriter(); }
-"<"{DFN}{ATTR}">"		{ outDoc->startTypewriter(); }
-""		{ outDoc->endTypewriter(); }
-"<"{VAR}{ATTR}">"		{ outDoc->startEmphasis(); }
-""		{ outDoc->endEmphasis(); }
-"<"{IMG}{ATTR}">"		{ 
-                                          /*storeOutputListState();*/
-  					  outDoc->pushGeneratorState();
-                                          outDoc->disableAllBut(OutputGenerator::Html);
-					  outDoc->writeString(yytext); 
-                                          /*restoreOutputListState();*/
-					  outDoc->popGeneratorState();
-					}
-"<"{PRE}{ATTR}">"			{ 
-  					  outDoc->startCodeFragment();
-  					  codeBlock.resize(0);
-					  BEGIN( DocCodeBlock ); 
-					}
-""		 	{ 
-  					  warn(yyFileName,yyLineNr,
-                                               "Warning: 
without
 or \\code"
-    					       "in the documentation."
-                                              ); 
-					}
-"<"{SUB}{ATTR}">"		{ outDoc->startSubscript(); }
-""		{ outDoc->endSubscript(); }
-"<"{SUP}{ATTR}">"		{ outDoc->startSuperscript(); }
-""		{ outDoc->endSuperscript(); }
-"<"{TR}{ATTR}">"		{ if (curTable) curTable->newRow(); }
-""			
-"<"{TD}{ATTR}">"		{ if (curTable) curTable->newElem(); }
-""
-"<"{OL}{ATTR}">"		{ outDoc->startEnumList(); 
-  					  currentListIndentLevel++;
-					}
-""		{ 
-					  if (currentListIndentLevel<=0)
-					  {
-					    warn(yyFileName,yyLineNr,
-                                                 "Warning: more  tags than 
    tags in the documentation." - ); - } - else - { - outDoc->endEnumList(); - currentListIndentLevel--; - } - } -"<"{UL}{ATTR}">" { outDoc->startItemList(); - currentListIndentLevel++; - } -"" { - if (currentListIndentLevel<=0) - { - warn(yyFileName,yyLineNr, - "Warning: more tags than
      tags in the documentation." - ); - } - else - { - outDoc->endItemList(); - currentListIndentLevel--; - } - } -"<"{LI}{ATTR}">" { outDoc->writeListItem(); } -"" -"<"{TT}{ATTR}">" { outDoc->startTypewriter(); } -"" { outDoc->endTypewriter(); } -"<"{EM}{ATTR}">" { outDoc->startEmphasis(); } -"" { outDoc->endEmphasis(); } -"<"{HR}{ATTR}">" { outDoc->writeRuler(); } -"<"{DL}{ATTR}">" { outDoc->startDescription(); - currentListIndentLevel++; - } -"" { - if (currentListIndentLevel<=0) - { - warn(yyFileName,yyLineNr, - "Warning: more tags than
      tags in the documentation." - ); - } - else - { - outDoc->endDescription(); - currentListIndentLevel--; - } - } -"<"{DT}{ATTR}">" { outDoc->startDescItem(); } -"" -"<"{DD}{ATTR}">" { outDoc->endDescItem(); } -"" -"<"{BR}{ATTR}">" { outDoc->lineBreak(); } -"<"{I}{ATTR}">" { outDoc->startEmphasis(); } -"" { outDoc->endEmphasis(); } -"" -"<"{A} { BEGIN(DocHtmlLink); } -"<"{BOLD}{ATTR}">" { outDoc->startBold(); } -"" { outDoc->endBold(); } -"<"{P}{ATTR}">" { - if (inBlock()) endBlock(); - outDoc->newParagraph(); } -"" -"<"{H1}{ATTR}">" { outDoc->startTitle(); } -"" { outDoc->endTitle(); } -"<"{H2}{ATTR}">" { outDoc->startSubsection(); } -"" { outDoc->endSubsection(); } -"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); } -"" { outDoc->endSubsubsection(); } -{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); } -[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); } -{HREF}{BN}*"="{BN}*("\""?) { - htmlUrl.resize(0); - htmlText.resize(0); - BEGIN(DocHtmlHref1); } -{URLMASK} { - htmlUrl=yytext; - } -">" { BEGIN(DocHtmlHref2); } -[^<]* { htmlText+=yytext; } - /* -\n { htmlText+='\n'; } - */ -"<" { - outDoc->writeHtmlLink(htmlUrl,htmlText); - unput(*yytext); - BEGIN(DocScan); - } -">" { BEGIN(DocScan); } -{CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") { - outDoc->docify(&yytext[1]); - } -"%"[a-zA-Z_0-9\-]+ { - outDoc->docify(yytext+1); - } -[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" { - outDoc->startEmphasis(); - generateRef(*outDoc,className,yytext,inSeeBlock); - outDoc->endEmphasis(); - BEGIN( DocScan ); - } -{WORD} { - outDoc->startEmphasis(); - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); - outDoc->endEmphasis(); - BEGIN( DocScan ); - } -[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" { - outDoc->startBold(); - generateRef(*outDoc,className,yytext,inSeeBlock); - outDoc->endBold(); - BEGIN( DocScan ); - } -{WORD} { - outDoc->startBold(); - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); - outDoc->endBold(); - BEGIN( DocScan ); - } -[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()!\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" { - outDoc->startTypewriter(); - generateRef(*outDoc,className,yytext,inSeeBlock); - outDoc->endTypewriter(); - BEGIN( DocScan ); - } -{WORD} { - outDoc->startTypewriter(); - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); - outDoc->endTypewriter(); - BEGIN( DocScan ); - } -{FILE} { - includeFile(*outDoc,stripQuotes(yytext),FALSE); - BEGIN( DocScan ); - } -{FILE} { - includeFile(*outDoc,stripQuotes(yytext),TRUE); - BEGIN( DocScan ); - } -"//" { codeBlock += yytext; } -"/*" { codeBlock += yytext; } -\n { codeBlock += '\n'; } -[^\/\\\<\n]* { codeBlock += yytext; } -. { codeBlock += *yytext; } -"//" { - outDoc->docify(yytext); - } -"/*" { - outDoc->docify(yytext); - } -"\n" { outDoc->writeChar('\n'); } -({B}*"\n"){2,}{B}*"*"*{B}*"-"("#")?{B}+ { // new paragraph & start of a list - QCString text=yytext; - int dashPos = text.findRev('-'); - bool isEnumerated = text.at(dashPos+1)=='#'; - if (insideArgumentList) - { - insideArgumentList=FALSE; - outDoc->endItemList(); - } - else if (insideItemList) - { - forceEndItemList(); - } - else - { - outDoc->newParagraph(); - } - if (inBlock()) endBlock(); - addListItemMarker(strrchr(yytext,'\n')+1,dashPos,isEnumerated); - } -({B}*"\n"){2,}{B}* { // new paragraph - if (insideArgumentList) - { - insideArgumentList=FALSE; - outDoc->endItemList(); - } - else if (insideItemList) + while ((i=id.match(s,p,&l))!=-1) + { + QCString idstr=s.mid(i,l); + if (idstr!="struct" && idstr!="class" && idstr!="union") return idstr; + p=i+l; + } + return ""; +} + +/* ----------------------------------------------------------------- */ +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); + +static int yyread(char *buf,int max_size) +{ + int c=0; + while( c < max_size && inputString[inputPosition] ) + { + *buf = inputString[inputPosition++] ; + //printf("%d (%c)\n",*buf,*buf); + c++; buf++; + } + return c; +} + +%} + +CMD ("\\"|"@") +SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup") +BN [ \t\n\r] +BL [ \t\r]*"\n" +B [ \t] +BS ^(({B}*"//")?)(({B}*"*"+)?){B}* +FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+] +FILEECHAR [a-z_A-Z0-9\-\+] +FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]+"\"") +ID [a-z_A-Z][a-z_A-Z0-9]* +SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) +SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) +ATTR ({B}+[^>\n]*)? +A [aA] +BR [bB][rR] +PRE [pP][rR][eE] +TABLE [tT][aA][bB][lL][eE] +TITLE [tT][iI][tT][lL][eE] + +%option noyywrap + +%x Define +%x DefineArg +%x DefineEnd +%x CompoundName +%x ClassVar +%x ClassTemplSpec +%x Bases +%x BasesProt +%x NextSemi +%x FindMembers +%x FindMemberName +%x FindFields +%x FindFieldArg +%x Function +%x FuncRound +%x ExcpRound +%x FuncQual +%x Operator +%x Array +%x ReadBody +%x Using +%x UsingDirective +%x NameSpaceDocArg1 +%x SkipCurly +%x SkipCurlyCpp +%x SkipCurlyEndDoc +%x SkipString +%x SkipInits +%x SkipCPP +%x SkipCPPBlock +%x SkipComment +%x SkipCxxComment +%x SkipCurlyBlock +%x SkipRoundBlock +%x SkipCode +%x Sharp +%x SkipSharp +%x SkipRound +%x SkipSquare +%x TypedefName +%x Comment +%x Doc +%x JavaDoc +%x ClassDoc +%x LineDoc +%x DefLineDoc +%x ClassDocArg1 +%x ClassDocArg2 +%x ClassDocArg3 +%x ClassDocFunc +%x ClassDocFuncPtr +%x ClassDocFuncQual +%x ClassDocFuncSkipLine +%x ClassDocFuncExc +%x ClassDocDefine +%x ClassDocRelates +%x ClassDocBrief +%x ClassDocOverload +%x ClassDefineArgs +%x DocBaseClass +%x CppQuote +%x EndCppQuote +%x GroupDocArg1 +%x GroupDocArg2 +%x GroupName +%x GroupHeader +%x StoreGroupDocs +%x AfterDoc +%x AfterDocBrief +%x AfterDocLine +%x PageDoc +%x PageDocTitle +%x PageDocArg1 +%x PageDocArg2 +%x FileDocArg1 +%x FileDocArg2 +%x ExampleDoc +%x ExampleDocArg1 +%x EnumDoc +%x EnumDocArg1 +%x FuncPtr +%x EndFuncPtr +%x FuncFunc +%x FuncFuncEnd +%x FuncFuncType +%x MemberSpec +%x MemberSpecSkip +%x SkipVerbatim +%x TodoParam +%x TestParam +%x SectionLabel +%x SectionTitle +%x SkipTemplate +%x EndTemplate +%x CopyArgString +%x CopyArgRound +%x CopyArgSharp +%x CopyArgComment +%x CopyArgCommentLine +%x SkipUnionSwitch +%x ReadFuncArgType +%x ReadTempArgs +%x Specialization +%x SkipHtmlComment +%x ReadFormulaShort +%x ReadFormulaLong +%x AnchorLabel +%x ReadInitializer +%x CopyString +%x CopyRound +%x CopyCurly +%x IDLUnionCase + +%% + +<*>\x06[^\x06]*\x06 { // new file + if (memberGroupId!=NOGROUP) { - forceEndItemList(); + warn(yyFileName,yyLineNr,"Warning: Missing //@}"); + memberGroupId=NOGROUP; } - else + yyLineNr= 0 ; // there is always an extra newline at the start of the file + int i; + for( i = 0 ; yytext[i+1] != 6 ; i++ ) + yyFileName[i] = yytext[i+1] ; + yyFileName[i] = 0 ; + insideIDL = i>4 && strcmp(&yyFileName[i-4],".idl")==0; + msg("Parsing file %s...\n",yyFileName); + current_root = global_root ; + initParser(); + current->reset(); + int sec=guessSection(yyFileName); + if (sec) { - outDoc->newParagraph(); + current->name = yyFileName; + current->name = current->name; + current->section = sec; + current_root->addSubEntry(current); + current = new Entry; } - if (inBlock()) endBlock(); - } -{BN}+/\n { - outDoc->writeChar(' '); - } -\n?{B}* { - outDoc->writeChar(' '); - } -[a-z_A-Z0-9]+ { - outDoc->docify(yytext); - } -. { - outDoc->writeChar(*yytext); + BEGIN( FindMembers ); } +<*>\x0d "{" { curlyCount=0; BEGIN(SkipCurlyBlock); @@ -2697,19 +831,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") else BEGIN( EndTemplate ); } - /* -"<" { - sharpCount++; - } -">" { - if (--sharpCount<=0) - { - BEGIN(FindMembers); - } - } -. - */ - "<" { current->name+='<'; *currentTemplateSpec+='<'; @@ -4447,12 +2568,14 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") todoStartContext = YY_START; lastBriefContext = TodoParam; // this is where we will continue at the end of the argument todoString = current->brief.copy(); // these will be swapped later on. + current->brief.resize(0); BEGIN(ClassDocBrief); } {CMD}"test"/[^a-z_A-Z0-9] { testStartContext = YY_START; lastBriefContext = TestParam; // this is where we will continue at the end of the argument testString = current->brief.copy(); // these will be swapped later on. + current->brief.resize(0); BEGIN(ClassDocBrief); } \n | @@ -4807,11 +2930,13 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") {CMD}"f$" { lastFormulaContext = YY_START; formulaText="$"; + insideFormula=TRUE; BEGIN(ReadFormulaShort); } {CMD}"f[" { lastFormulaContext = YY_START; formulaText="\\["; + insideFormula=TRUE; BEGIN(ReadFormulaLong); } {CMD}"f$" { @@ -4825,8 +2950,20 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") current->brief += addFormula(); else current->doc += addFormula(); + insideFormula=FALSE; BEGIN(lastFormulaContext); } +\n { + formulaText+=" "; + if (lastFormulaContext==LineDoc || + lastFormulaContext==AfterDocLine + ) + { + checkFormula(); + insideFormula=FALSE; + BEGIN(lastFormulaContext); + } + } {CMD}"f]" { formulaText+="\\]"; if (lastFormulaContext==ClassDocBrief || @@ -4838,10 +2975,11 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") current->brief += addFormula(); else current->doc += addFormula(); + insideFormula=FALSE; BEGIN(lastFormulaContext); } . { formulaText+=*yytext; } -{B}*"*/" { +{B}*"*/" { checkDocs(); //printf("current->section=%x\n",current->section); if (YY_START==SkipCode) // premature end of code block @@ -5212,59 +3350,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") //---------------------------------------------------------------------------- -//static void addToBody(const char *text) -//{ -// if (Config::includeSourceFlag) -// previous->body+=text; -//} - -//static void addToBodyCond(const char *text) -//{ -// if (Config::includeSourceFlag && lastStringContext==SkipCurly) -// previous->body+=text; -//} - -//---------------------------------------------------------------------------- - -void scanString(const char *s) -{ - const char *oldInputString = inputString; - int oldInputPosition = inputPosition; - int oldRule = YY_START; - YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE)); - inputString = s; - inputPosition = 0; - BEGIN( Text ); - scanYYlex(); - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(oldBuffer); - inputString = oldInputString; - inputPosition = oldInputPosition; - BEGIN( oldRule ); -} - -void internalParseDocument(const char *s) -{ - const char *oldInputString = inputString; - int oldInputPosition = inputPosition; - int oldRule = YY_START; - YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE)); - inputString = s; - inputPosition = 0; - BEGIN( DocScan ); - scanYYlex(); - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(oldBuffer); - inputString = oldInputString; - inputPosition = oldInputPosition; - BEGIN( oldRule ); -} - - -//---------------------------------------------------------------------------- - static void newDocState() { if (tmpDocType!=-1) @@ -5280,7 +3365,7 @@ static void newDocState() //---------------------------------------------------------------------------- -void parseCompounds(Entry *rt) +static void parseCompounds(Entry *rt) { //printf("parseCompounds(%s)\n",rt->name.data()); EntryListIterator eli(*rt->sublist); @@ -5353,102 +3438,6 @@ void parseMain(Entry *rt) } //---------------------------------------------------------------------------- - -void parseDocument(OutputList &ol,const QCString &docString) -{ - //inParamBlock=inSeeBlock=inReturnBlock=FALSE; - curTable = 0; - depthIf = 0; - outDoc = new OutputList(&ol); - currentIncludeFile.resize(0); - includeFileOffset=0; - includeFileLength=0; - currentListIndentLevel=0; - if (!docString) return; - linkRef = ""; - linkText = ""; - inputString = docString; - inputPosition = 0; - scanYYrestart( scanYYin ); - BEGIN( DocScan ); - insideArgumentList = FALSE; - insideVerbatim = FALSE; - scanYYlex(); - if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); } - if (insideItemList) { forceEndItemList(); } - if (inBlock()) endBlock(); - if (currentListIndentLevel>0) - { - warn(yyFileName,yyLineNr,"Warning: Documentation ended in the middle " - "of a list (indent level %d)!",currentListIndentLevel); - } - if (depthIf!=0) - { - warn(yyFileName,yyLineNr,"Warning: Documentation block contains \\if " - "without matching \\endif: nesting level is %d",depthIf); - } - if (!tableStack.isEmpty()) - { - forceEndTable(); - } - if (insideVerbatim) - { - warn(yyFileName,yyLineNr, - "Warning: file ended inside a \\verbatim block!" - ); - } - ol+=*outDoc; - delete outDoc; outDoc=0; - return; -} - -//---------------------------------------------------------------------------- - -void parseDoc(OutputList &ol,const char *fileName,int startLine, - const char *clName,const char *memName,const QCString &docString) -{ - //printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine); - initParser(); - initParseCodeContext(); - exampleDoc=FALSE; // do not cross reference with member docs - className=clName; - memberName=memName; - strcpy(yyFileName,fileName); - yyLineNr = startLine; - parseDocument(ol,docString); - -} - -//---------------------------------------------------------------------------- - -void parseText(OutputList &ol,const QCString &txtString) -{ - if (txtString.isEmpty()) return; - inputString = txtString; - outDoc = new OutputList(&ol); - inputPosition = 0; - scanYYrestart( scanYYin ); - BEGIN( Text ); - scanYYlex(); - ol+=*outDoc; - delete outDoc; outDoc=0; - return; -} - -//---------------------------------------------------------------------------- - -void parseExample(OutputList &ol,const QCString &docString, - const char *fileName) -{ - initParser(); - initParseCodeContext(); - exampleDoc=TRUE; // cross reference with member docs - exampleName=fileName; - strcpy(yyFileName,fileName); - parseDocument(ol,docString); -} - -//---------------------------------------------------------------------------- extern "C" { // some bogus code to keep the compiler happy void scannerYYdummy() { yy_flex_realloc(0,0); } } diff --git a/src/translator.h b/src/translator.h index 25d25d6..d5a82f4 100644 --- a/src/translator.h +++ b/src/translator.h @@ -982,12 +982,12 @@ class Translator // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// - /*! Used as a marker that is put before a todo item */ + /*! Used as a marker that is put before a test item */ virtual QCString trTest() { return "Test"; } - /*! Used as the header of the todo list */ + /*! Used as the header of the test list */ virtual QCString trTestList() { return "Test List"; diff --git a/src/translator_cz.h b/src/translator_cz.h index dba350b..b17fa90 100644 --- a/src/translator_cz.h +++ b/src/translator_cz.h @@ -45,6 +45,9 @@ // - Encoding conversion tables moved to the methods that use them. // - Updates for "new since 1.1.5". // +// 2000/08/02 (Petr Prikryl) +// - Updated for 1.2.0 +// // Notices: // -------- // The conditional compilation ensures or the neutral functionality @@ -1128,6 +1131,23 @@ class TranslatorCzech : public Translator { return DECODE("vysvìtlivky"); } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.0 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a test item */ + virtual QCString trTest() + { + return "Test"; + } + + /*! Used as the header of the test list */ + virtual QCString trTestList() + { + return "Seznam testù"; + } + }; #endif // TRANSLATOR_CZ_H diff --git a/src/translator_fr.h b/src/translator_fr.h index c7d9486..2bf7aa4 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -716,6 +716,244 @@ class TranslatorFrench : public Translator { return "Définition dans le fichier @0."; } +////////////////////////////////////////////////////////////////////////// +// new since 0.49-991205 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trDeprecated() + { + return "Obsolète"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.0.0 +////////////////////////////////////////////////////////////////////////// + + /*! this text is put before a collaboration diagram */ + virtual QCString trCollaborationDiagram(const char *clName) + { + return (QCString)"Diagramme de collaboration de "+clName+":"; + } + /*! this text is put before an include dependency graph */ + virtual QCString trInclDepGraph(const char *fName) + { + return (QCString)"Graphe des dépendances par inclusion pour "+fName+":"; + } + /*! header that is put before the list of constructor/destructors. */ + virtual QCString trConstructorDocumentation() + { + return "Documentation des contructeurs et destructeurs"; + } + /*! Used in the file documentation to point to the corresponding sources. */ + virtual QCString trGotoSourceCode() + { + return "Aller au code source de ce fichier."; + } + /*! Used in the file sources to point to the corresponding documentation. */ + virtual QCString trGotoDocumentation() + { + return "Aller à la documentation de ce fichier."; + } + /*! Text for the \pre command */ + virtual QCString trPrecondition() + { + return "Précondition"; + } + /*! Text for the \post command */ + virtual QCString trPostcondition() + { + return "Postcondition"; + } + /*! Text for the \invariant command */ + virtual QCString trInvariant() + { + return "Invariant"; + } + /*! Text shown before a multi-line variable/enum initialization */ + virtual QCString trInitialValue() + { + return "Initialisation:"; + } + /*! Text used the source code in the file index */ + virtual QCString trCode() + { + return "code"; + } + virtual QCString trGraphicalHierarchy() + { + return "Diagramme hiérarchique des classes"; + } + virtual QCString trGotoGraphicalHierarchy() + { + return "Aller au diagramme hiérarchique des classes"; + } + virtual QCString trGotoTextualHierarchy() + { + return "Aller à la hiérarchie des classes en texte"; + } + virtual QCString trPageIndex() + { + return "Index des pages"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.0 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trNote() + { + return "Note"; + } + virtual QCString trPublicTypes() + { + return "Types Publics"; + } + virtual QCString trPublicAttribs() + { + return "Attributs Publics"; + } + virtual QCString trStaticPublicAttribs() + { + return "Attributs Publics Statiques"; + } + virtual QCString trProtectedTypes() + { + return "Types Protégés"; + } + virtual QCString trProtectedAttribs() + { + return "Attributs Protégés"; + } + virtual QCString trStaticProtectedAttribs() + { + return "Attributs Protégés Statiques"; + } + virtual QCString trPrivateTypes() + { + return "Types Privés"; + } + virtual QCString trPrivateAttribs() + { + return "Attributs Privés"; + } + virtual QCString trStaticPrivateAttribs() + { + return "Attributs Privés Statiques"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.3 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a todo item */ + virtual QCString trTodo() + { + return "A Faire"; + } + /*! Used as the header of the todo list */ + virtual QCString trTodoList() + { + return "Liste des choses à faire"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.4 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trReferencedBy() + { + return "Référencé par"; + } + virtual QCString trRemarks() + { + return "Remarques"; + } + virtual QCString trAttention() + { + return "Attention"; + } + virtual QCString trInclByDepGraph() + { + return "Ce graphe montre quels fichiers incluent directement " + "ou indirectement ce fichier:"; + } + virtual QCString trSince() + { + return "Depuis"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.5 +////////////////////////////////////////////////////////////////////////// + + /*! title of the graph legend page */ + virtual QCString trLegendTitle() + { + return "Légende du graphe"; + } + /*! page explaining how the dot graph's should be interpreted */ + virtual QCString trLegendDocs() + { + return + "Cette page explique comment interpréter les graphes générés " + "par doxygen.

      \n" + + "Considérez l'exemple suivant:\n" + "\\code\n" + "/*! Classe invisible à cause d'une troncature */\n" + "class Invisible { };\n\n" + "/*! Classe tronquée, la relation d'héritage est masquée */\n" + "class Truncated : public Invisible { };\n\n" + "/*! Classe non documentée avec des commentaires Doxygen */\n" + "class Undocumented { };\n\n" + "/*! Classe dérivée par héritage public */\n" + "class PublicBase : public Truncated { };\n\n" + "/*! Classe dérivée par héritage protégé */\n" + "class ProtectedBase { };\n\n" + "/*! Classe dérivée par héritage privé */\n" + "class PrivateBase { };\n\n" + "/*! Classe utilisée par la classe dérivée */\n" + "class Used { };\n\n" + "/*! Super-classe qui hérite de plusieurs autres classes */\n" + "class Inherited : public PublicBase,\n" + " protected ProtectedBase,\n" + " private PrivateBase,\n" + " public Undocumented\n" + "{\n" + " private:\n" + " Used *m_usedClass;\n" + "};\n" + "\\endcode\n" + "Si la valeur 200 est attribuée au tag \\c MAX_DOT_GRAPH_HEIGHT " + "du fichier de configuration, cela génèrera le graphe suivant:" + "

      \n" + "

      \n" + "Les rectangles du graphe ci-dessus ont la signification suivante:\n" + "

        \n" + "
      • Un rectangle plein noir représente la structure ou la classe pour laquelle " + "le graphe est généré.\n" + "
      • Un rectangle avec un bord noir indique une classe ou une structure documentée.\n" + "
      • Un rectangle avec un bord gris indique une classe ou une structure non documentée.\n" + "
      • Un rectangle avec un bord rouge indique une structure ou une classe documentée\n" + "pour laquelle des relations d'héritage ou de collaboration manquent. Un graphe est " + "tronqué s'il ne rentre pas dans les limites spécifiées." + "
      \n" + "Les flèches ont la signification suivante:\n" + "
        \n" + "
      • Une flèche bleu foncé est utilisée pour visuliser une relation d'héritage public " + "entre deux classes.\n" + "
      • Une flèche vert foncé est utilisée pour une relation d'héritage protégé.\n" + "
      • Une flèche rouge foncé est utilisée pour une relation d'héritage privé.\n" + "
      • Une fléche violette en pointillés est utilisée si une classe est contenue ou " + "utilisée par une autre classe. La flèche est étiquetée avec la ou les variable(s) " + "qui permettent d'acceder à la classe ou structure pointée. \n" + "
      \n"; + } + /*! text for the link to the legend page */ + virtual QCString trLegend() + { + return "Légende"; + } }; #endif diff --git a/src/translator_nl.h b/src/translator_nl.h index d366cc5..c13d96d 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -701,12 +701,12 @@ class TranslatorDutch : public Translator // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// - /*! Used as a marker that is put before a todo item */ + /*! Used as a marker that is put before a test item */ virtual QCString trTest() { return "Test"; } - /*! Used as the header of the todo list */ + /*! Used as the header of the test list */ virtual QCString trTestList() { return "Test Lijst"; diff --git a/src/util.cpp b/src/util.cpp index 5158031..fc1ff20 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -27,7 +27,7 @@ #include "classdef.h" #include "filedef.h" #include "doxygen.h" -#include "scanner.h" +#include "doc.h" #include "outputlist.h" #include "defargs.h" #include "language.h" @@ -36,6 +36,7 @@ #include "example.h" #include "version.h" #include "groupdef.h" +#include "xml.h" #ifndef _WIN32 #include @@ -46,6 +47,63 @@ extern char **environ; #endif +//------------------------------------------------------------------------ +// TextGeneratorOLImpl implementation +//------------------------------------------------------------------------ + +TextGeneratorOLImpl::TextGeneratorOLImpl(OutputList &ol) : m_ol(ol) {} + +void TextGeneratorOLImpl::writeString(const char *s) const +{ + m_ol.docify(s); +} + +void TextGeneratorOLImpl::writeBreak() const +{ + m_ol.pushGeneratorState(); + m_ol.disableAllBut(OutputGenerator::Html); + m_ol.lineBreak(); + m_ol.popGeneratorState(); +} + +void TextGeneratorOLImpl::writeLink(const char *extRef,const char *file, + const char *anchor,const char *text + ) const +{ + m_ol.writeObjectLink(extRef,file,anchor,text); +} + +//------------------------------------------------------------------------ +// TextGeneratorXMLImpl implementation +//------------------------------------------------------------------------ + +TextGeneratorXMLImpl::TextGeneratorXMLImpl(QTextStream &t) : m_t(t) +{ +} + +void TextGeneratorXMLImpl::writeString(const char *s) const +{ + writeXMLString(m_t,s); +} + +void TextGeneratorXMLImpl::writeBreak() const +{ +} + +void TextGeneratorXMLImpl::writeLink(const char *extRef,const char *file, + const char *anchor,const char *text + ) const +{ + if (extRef==0) + { writeXMLLink(m_t,file,anchor,text); } + else // external references are not supported for XML + { writeXMLString(m_t,text); } +} + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + + /*! Implements an interruptable system call on Unix */ int iSystem(const char *command) { @@ -1483,7 +1541,8 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl) bool getDefs(const QCString &scName,const QCString &memberName, const char *args, MemberDef *&md, - ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd) + ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd, + bool forceEmptyScope) { fd=0, md=0, cd=0, nd=0, gd=0; if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */ @@ -1522,7 +1581,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data()); MemberName *mn = memberNameDict[mName]; - if (mn && !(scopeName.isEmpty() && mScope.isEmpty())) + if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty())) { //printf(" >member name found\n"); int scopeOffset=scopeName.length(); @@ -1581,7 +1640,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, // no exact match found, but if args="()" an arbitrary member will do { //printf(" >Searching for arbitrary member\n"); - mmd=mn->last(); + mmd=mn->first(); while (mmd) { if (//(mmd->protection()!=Private || Config::extractPrivateFlag) && @@ -1604,7 +1663,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, md=mmd; } } - mmd=mn->prev(); + mmd=mn->next(); } } //printf(" >Succes=%d\n",mdistmember name found\n"); + if ((mn=functionNameDict[mName])) // name is known { - //printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n", - // scopeName.data(),mScope.data(),mName.data()); - //printf(" >member name found\n"); - if ((mn=functionNameDict[mName])) // name is known + NamespaceDef *fnd=0; + int scopeOffset=scopeName.length(); + do { - NamespaceDef *fnd=0; - int scopeOffset=scopeName.length(); - do + QCString namespaceName = scopeName.left(scopeOffset); + if (!namespaceName.isEmpty() && !mScope.isEmpty()) { - QCString namespaceName = scopeName.left(scopeOffset); - if (!namespaceName.isEmpty() && !mScope.isEmpty()) - { - namespaceName+="::"+mScope; - } - else if (!mScope.isEmpty()) + namespaceName+="::"+mScope; + } + else if (!mScope.isEmpty()) + { + namespaceName=mScope.copy(); + } + if (!namespaceName.isEmpty() && + (fnd=namespaceDict[namespaceName]) && + fnd->isLinkable() + ) + { + //printf("Function inside existing namespace `%s'\n",namespaceName.data()); + bool found=FALSE; + MemberDef *mmd=mn->first(); + while (mmd && !found) { - namespaceName=mScope.copy(); + //printf("mmd->getNamespaceDef()=%p fnd=%p\n", + // mmd->getNamespaceDef(),fnd); + if (mmd->getNamespaceDef()==fnd && + //(mmd->isReference() || mmd->hasDocumentation()) + mmd->isLinkable() + ) + { // namespace is found + bool match=TRUE; + ArgumentList *argList=0; + if (args) + { + argList=new ArgumentList; + stringToArgumentList(args,argList); + match=matchArguments(mmd->argumentList(),argList,0,namespaceName,FALSE); + } + if (match) + { + nd=fnd; + md=mmd; + found=TRUE; + } + if (args) + { + delete argList; argList=0; + } + } + mmd=mn->next(); } - if (!namespaceName.isEmpty() && - (fnd=namespaceDict[namespaceName]) && - fnd->isLinkable() - ) + if (!found && !strcmp(args,"()")) + // no exact match found, but if args="()" an arbitrary + // member will do { - //printf("Function inside existing namespace `%s'\n",namespaceName.data()); - bool found=FALSE; - MemberDef *mmd=mn->first(); + MemberDef *mmd=mn->first(); while (mmd && !found) { - //printf("mmd->getNamespaceDef()=%p fnd=%p\n", - // mmd->getNamespaceDef(),fnd); if (mmd->getNamespaceDef()==fnd && //(mmd->isReference() || mmd->hasDocumentation()) mmd->isLinkable() ) - { // namespace is found + { + nd=fnd; + md=mmd; + found=TRUE; + } + mmd=mn->next(); + } + } + if (found) return TRUE; + } + else // no scope => global function + { + //printf("Function with global scope `%s' args=`%s'\n",namespaceName.data(),args); + md=mn->first(); + while (md) + { + if (md->isLinkable()) + { + fd=md->getFileDef(); + gd=md->getGroupDef(); + //printf("md->name()=`%s' md->args=`%s' fd=%p gd=%p\n", + // md->name().data(),args,fd,gd); + bool inGroup=FALSE; + if ((fd && fd->isLinkable()) || + (inGroup=(gd && gd->isLinkable())) + ) + { + if (inGroup) fd=0; + //printf("fd=%p gd=%p inGroup=`%d' args=`%s'\n",fd,gd,inGroup,args); bool match=TRUE; ArgumentList *argList=0; - if (args) + if (args && !md->isDefine()) { argList=new ArgumentList; stringToArgumentList(args,argList); - match=matchArguments(mmd->argumentList(),argList,0,namespaceName,FALSE); - } - if (match) - { - nd=fnd; - md=mmd; - found=TRUE; - } - if (args) - { + match=matchArguments(md->argumentList(),argList); delete argList; argList=0; } - } - mmd=mn->next(); - } - if (!found && !strcmp(args,"()")) - // no exact match found, but if args="()" an arbitrary - // member will do - { - MemberDef *mmd=mn->last(); // searching backward will get - // the first defined! - while (mmd && !found) - { - if (mmd->getNamespaceDef()==fnd && - //(mmd->isReference() || mmd->hasDocumentation()) - mmd->isLinkable() - ) + if (match) { - nd=fnd; - md=mmd; - found=TRUE; + //printf("Found match!\n"); + return TRUE; } - mmd=mn->prev(); } } - if (found) return TRUE; + md=mn->next(); } - else // no scope => global function + if (!strcmp(args,"()")) { - //printf("Function with global scope `%s' args=`%s'\n",namespaceName.data(),args); - md=mn->first(); + // no exact match found, but if args="()" an arbitrary + // member will do + md=mn->last(); while (md) { - if (md->isLinkable()) + //printf("Found member `%s'\n",md->name().data()); + if (1 /* md->isLinkable() */) { + //printf("member is linkable md->name()=`%s'\n",md->name().data()); fd=md->getFileDef(); gd=md->getGroupDef(); - //printf("md->name()=`%s' md->args=`%s' fd=%p gd=%p\n", - // md->name().data(),args,fd,gd); bool inGroup=FALSE; - if ((fd && fd->isLinkable()) || + if ((fd && fd->isLinkable()) || (inGroup=(gd && gd->isLinkable())) ) { if (inGroup) fd=0; - //printf("fd=%p gd=%p inGroup=`%d' args=`%s'\n",fd,gd,inGroup,args); - bool match=TRUE; - ArgumentList *argList=0; - if (args && !md->isDefine()) - { - argList=new ArgumentList; - stringToArgumentList(args,argList); - match=matchArguments(md->argumentList(),argList); - delete argList; argList=0; - } - if (match) - { - //printf("Found match!\n"); - return TRUE; - } + return TRUE; } } - md=mn->next(); - } - if (!strcmp(args,"()")) - { - // no exact match found, but if args="()" an arbitrary - // member will do - md=mn->last(); - while (md) - { - //printf("Found member `%s'\n",md->name().data()); - if (1 /* md->isLinkable() */) - { - //printf("member is linkable md->name()=`%s'\n",md->name().data()); - fd=md->getFileDef(); - gd=md->getGroupDef(); - bool inGroup=FALSE; - if ((fd && fd->isLinkable()) || - (inGroup=(gd && gd->isLinkable())) - ) - { - if (inGroup) fd=0; - return TRUE; - } - } - md=mn->prev(); - } + md=mn->prev(); } } - if (scopeOffset==0) - { - scopeOffset=-1; - } - else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1) - { - scopeOffset=0; - } - } while (scopeOffset>=0); - } - else - { - //printf("Unknown function `%s'\n",mName.data()); - } + } + if (scopeOffset==0) + { + scopeOffset=-1; + } + else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1) + { + scopeOffset=0; + } + } while (scopeOffset>=0); } + + // no nothing found return FALSE; } @@ -1878,7 +1933,7 @@ bool generateRef(OutputList &ol,const char *scName, cd->getOutputFileBase(),0,linkText); if (!cd->isReference() /*&& !Config::pdfHyperFlag*/) { - writePageRef(ol,cd->name(),0); + writePageRef(ol,cd->getOutputFileBase(),0); } } else // scope matches that of a namespace @@ -1887,7 +1942,7 @@ bool generateRef(OutputList &ol,const char *scName, nd->getOutputFileBase(),0,linkText); if (!nd->getReference() /*&& !Config::pdfHyperFlag*/) { - writePageRef(ol,nd->name(),0); + writePageRef(ol,nd->getOutputFileBase(),0); } } // link has been written, stop now. @@ -1947,10 +2002,11 @@ bool generateRef(OutputList &ol,const char *scName, // scopeStr.data(),nameStr.data(),argsStr.data()); // check if nameStr is a member or global. - if (getDefs(scopeStr,nameStr,argsStr,md,cd,fd,nd,gd)) + if (getDefs(scopeStr,nameStr,argsStr,md,cd,fd,nd,gd,scopePos==0)) { //printf("after getDefs nd=%p\n",nd); - QCString anchor = md->isLinkable() ? md->anchor() : 0; + QCString anchor; + if (md->isLinkable()) anchor = md->anchor(); QCString cName,aName; if (cd) // nameStr is a member of cd { @@ -1958,7 +2014,7 @@ bool generateRef(OutputList &ol,const char *scName, // cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data()); ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), anchor,linkText.stripWhiteSpace()); - cName=cd->name(); + cName=cd->getOutputFileBase(); aName=md->anchor(); } else if (nd) // nameStr is a member of nd @@ -1966,7 +2022,7 @@ bool generateRef(OutputList &ol,const char *scName, //printf("writing namespace link\n"); ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(), anchor,linkText.stripWhiteSpace()); - cName=nd->name(); + cName=nd->getOutputFileBase(); aName=md->anchor(); } else if (fd) // nameStr is a global in file fd @@ -1975,7 +2031,7 @@ bool generateRef(OutputList &ol,const char *scName, // resultName.stripWhiteSpace().data()); ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(), anchor,linkText.stripWhiteSpace()); - cName=fd->name(); + cName=fd->getOutputFileBase(); aName=md->anchor(); } else if (gd) @@ -1984,7 +2040,7 @@ bool generateRef(OutputList &ol,const char *scName, // gd->name().data()); ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(), anchor,linkText.stripWhiteSpace()); - cName=gd->name(); + cName=gd->getOutputFileBase(); aName=md->anchor(); } else // should not be reached @@ -2003,16 +2059,9 @@ bool generateRef(OutputList &ol,const char *scName, } // generate the page reference (for LaTeX) - if (/*!Config::pdfHyperFlag && */(!cName.isEmpty() || !aName.isEmpty())) + if (!cName.isEmpty() || !aName.isEmpty()) { - if ( - (cd && cd->isLinkableInProject()) || - (fd && !fd->isReference()) || - (nd && !nd->isReference()) - ) - { - writePageRef(ol,cName,aName); - } + writePageRef(ol,cName,aName); } return TRUE; } @@ -2051,9 +2100,6 @@ bool generateLink(OutputList &ol,const char *clName, const char *lr,bool inSeeBlock,const char *lt) { QCString linkRef=lr; - //PageInfo *pi=0; - //printf("generateLink(%s,%s,%s) inSeeBlock=%d\n",clName,lr,lt,inSeeBlock); - //FileInfo *fi=0; FileDef *fd; GroupDef *gd; PageInfo *pi; @@ -2066,11 +2112,13 @@ bool generateLink(OutputList &ol,const char *clName, else if ((pi=pageDict[linkRef])) // link to a page { ol.writeObjectLink(0,pi->name,0,lt); + writePageRef(ol,pi->name,0); return TRUE; } else if ((pi=exampleDict[linkRef])) // link to an example { ol.writeObjectLink(0,convertFileName(pi->name)+"-example",0,lt); + writePageRef(ol,convertFileName(pi->name)+"-example",0); return TRUE; } else if ((gd=groupDict[linkRef])) // link to a group @@ -2081,6 +2129,7 @@ bool generateLink(OutputList &ol,const char *clName, else ol.docify(gd->groupTitle()); ol.endTextLink(); + writePageRef(ol,gd->getOutputFileBase(),0); return TRUE; } else if ((fd=findFileDef(inputNameDict,linkRef,ambig)) diff --git a/src/util.h b/src/util.h index 97db3d9..deb5d2a 100644 --- a/src/util.h +++ b/src/util.h @@ -23,8 +23,6 @@ #include #include -#include "outputlist.h" -#include "xml.h" class ClassDef; class FileDef; @@ -41,6 +39,8 @@ class GroupDef; class NamespaceList; class OutputList; +//-------------------------------------------------------------------- + class TextGeneratorIntf { public: @@ -54,22 +54,12 @@ class TextGeneratorIntf class TextGeneratorOLImpl : public TextGeneratorIntf { public: - TextGeneratorOLImpl(OutputList &ol) : m_ol(ol) {} - void writeString(const char *s) const - { m_ol.docify(s); } - void writeBreak() const - { - m_ol.pushGeneratorState(); - m_ol.disableAllBut(OutputGenerator::Html); - m_ol.lineBreak(); - m_ol.popGeneratorState(); - } + TextGeneratorOLImpl(OutputList &ol); + void writeString(const char *s) const; + void writeBreak() const; void writeLink(const char *extRef,const char *file, const char *anchor,const char *text - ) const - { - m_ol.writeObjectLink(extRef,file,anchor,text); - } + ) const; private: OutputList &m_ol; }; @@ -77,25 +67,18 @@ class TextGeneratorOLImpl : public TextGeneratorIntf class TextGeneratorXMLImpl : public TextGeneratorIntf { public: - TextGeneratorXMLImpl(QTextStream &t) : m_t(t) {} - void writeString(const char *s) const - { - writeXMLString(m_t,s); - } - void writeBreak() const {} + TextGeneratorXMLImpl(QTextStream &t); + void writeString(const char *s) const; + void writeBreak() const; void writeLink(const char *extRef,const char *file, const char *anchor,const char *text - ) const - { - if (extRef==0) - { writeXMLLink(m_t,file,anchor,text); } - else // external references are not supported for XML - { writeXMLString(m_t,text); } - } + ) const; private: QTextStream &m_t; }; +//-------------------------------------------------------------------- + extern void linkifyText(const TextGeneratorIntf &ol,const char *clName,const char *name, const char *text,bool autoBreak=FALSE,bool external=TRUE); @@ -105,7 +88,8 @@ extern QCString dateToString(bool); extern bool getDefs(const QCString &scopeName,const QCString &memberName, const char *, MemberDef *&md, ClassDef *&cd,FileDef *&fd, - NamespaceDef *&nd,GroupDef *&gd + NamespaceDef *&nd,GroupDef *&gd, + bool forceEmptyScope=FALSE ); extern bool generateRef(OutputList &ol,const char *, const char *,bool inSeeBlock,const char * =0); -- cgit v0.12