diff options
Diffstat (limited to 'src')
42 files changed, 3383 insertions, 2749 deletions
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<void>(17); + containment = TRUE; } ~UsesClassDef() { @@ -218,6 +219,7 @@ struct UsesClassDef ClassDef *classDef; QDict<void> *accessors; QCString templSpecifiers; + bool containment; }; class UsesClassDict : public QDict<UsesClassDef> 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<ClassDef>() { @@ -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 (m<mdist && mmd->getClassDef()->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; } -<Body>{SCOPENAME}{B}*"<"[^\n\>]*">"/{B}* { // A<T> *pt; +<Body>{SCOPENAME}{B}*"<"[^\n\"\>]*">"/{B}* { // A<T> *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 <qstrlist.h> #include <qfile.h> -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 <qdir.h> #include <qtextstream.h> #include <qregexp.h> +#include <qstack.h> #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<ConfigFileState> 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;i<includeStack.count();i++) msg(" "); + msg("@INCLUDE = %s: parsing...\n",inc.data()); +#endif + + // store the state of the old file + ConfigFileState *fs=new ConfigFileState; + fs->oldState=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) <Start>"BIN_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&Config::binAbsPath; s->resize(0); } <Start>"EXT_DOC_PATHS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extDocPathList; l->clear(); elemStr=""; } <Start>"EXT_DOC_PATHS"[ \t]*"+=" { BEGIN(GetStrList); l=&Config::extDocPathList; elemStr=""; } -<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); } + +<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; } + /* include a config file */ +<Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);} +<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { + readIncludeFile(yytext); + BEGIN(Start); + } +<<EOF>> { + //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--; + } + } + +<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); } <GetString,GetBool>\n { yyLineNr++; BEGIN(Start); } <GetStrList>\n { yyLineNr++; @@ -367,22 +500,6 @@ static int yyread(char *buf,int max_size) BEGIN(GetQuotedString); tmpString.resize(0); } - /* -<GetString,GetStrList,GetQuotedString>"\$\(" { - //printf(">> Enter env\n"); - lastEnvState=YY_START; - BEGIN(GetEnvVar); - } -<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); - } - */ <GetQuotedString>"\""|"\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()); } } <GetStrList>[^ \#\"\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 <qregexp.h> 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 << "</map>" << endl; + if (generateMap) t << "</map>" << 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<DiagramRow> 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 <stdio.h> +#include <stdlib.h> +#include <iostream.h> +#include <assert.h> +#include <ctype.h> + +#include "qtbc.h" +#include <qarray.h> +#include <qstack.h> +#include <qregexp.h> + +#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 <unistd.h> +#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<char> 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<TableElem> *elemList; + int curRow; + int curCol; + int rows; + int cols; +}; + +Table::Table() +{ + parentDoc=outDoc; + elemList=new QList<TableElem>; + 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<Table> 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 <table> tags found than </table> " + "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 ( includeFileOffset<includeFileLength && + (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0 + ) s+=c; + if (s.find(key)!=-1) + { + found=TRUE; + ol.writeString(" "); + parseCode(ol,className,s,exampleDoc,exampleName); + ol.writeString("\n"); + } + else if (includeFileOffset==includeFileLength) found=TRUE; + } +} + +static void skipUntil(const char *key) +{ + bool found=FALSE; + while (!found) + { + QCString s; + int i=includeFileOffset; + char c; + while ( i<includeFileLength && + (c=currentIncludeFile[i++])!='\n' && c!=0 + ) s+=c; + if (s.find(key)!=-1 || i==includeFileLength) + { + found=TRUE; + } + else + { + includeFileOffset=i; + } + } +} + +static void showLine(OutputList &ol,const char *key) +{ + QCString s; + char c; + bool found=FALSE; + while (!found) + { + while ( includeFileOffset<includeFileLength && + (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0 + ) s+=c; + if (!s.stripWhiteSpace().isEmpty() || + includeFileOffset==includeFileLength) found=TRUE; + } + if (s.find(key)!=-1) + { + ol.writeString(" "); + parseCode(ol,className,s,exampleDoc,exampleName); + ol.writeString("\n"); + } +} + +static void showUntil(OutputList &ol,const char *key) +{ + bool found=FALSE; + while (!found) + { + QCString s; + char c; + while ( includeFileOffset<includeFileLength && + (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0 + ) s+=c; + if (!s.stripWhiteSpace().isEmpty()) + { + ol.writeString(" "); + parseCode(ol,className,s,exampleDoc,exampleName); + ol.writeString("\n"); + if (s.find(key)!=-1) found=TRUE; + } + if (includeFileOffset==includeFileLength) found=TRUE; + } +} + +//----------------------------------------------------------------- + +struct IndentInfo +{ + public: + IndentInfo(int i,bool e) : indent(i), enumerated(e) {}; + ~IndentInfo() {} + void startList() + { + if (enumerated) outDoc->startEnumList(); else outDoc->startItemList(); + } + void endList() + { + if (enumerated) outDoc->endEnumList(); else outDoc->endItemList(); + } + void writeItem() + { + outDoc->writeListItem(); + } + int indent; + bool enumerated; +}; + +static QStack<IndentInfo> 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;i<dashPos;i++) + { + if (marker[i]=='\t') + { + indent+=Config::tabSize - (indent%Config::tabSize); + } + else + { + indent++; + } + } + //printf("list marker found at column %d enumerated %d\n",indent,enumerated); + if (!insideItemList) + { + listIndentStack.push(new IndentInfo(indent,enumerated)); + listIndentStack.top()->startList(); + 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->indent<indent) // start sub item list + { + listIndentStack.push(new IndentInfo(indent,enumerated)); + listIndentStack.top()->startList(); + 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 +<DocScan>^{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); + } +<DocScan>\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); + } +<DocScan,Text>"©" { outDoc->writeCopyright(); } +<DocScan,Text>""" { outDoc->writeQuote(); } +<DocScan,Text>"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } +<DocScan,Text>"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } +<DocScan,Text>"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } +<DocScan,Text>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } +<DocScan,Text>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } +<DocScan,Text>"ß" { outDoc->writeSharpS(); } +<DocScan,Text>"&[aA]ring;" { outDoc->writeRing(yytext[1]); } +<DocScan,DocHtmlScan,DocLatexScan>"$("[a-z_A-Z]+")" { + QCString envvar=&yytext[2]; + envvar=envvar.left(envvar.length()-1); + outDoc->docify(getenv(envvar)); + } +<DocScan>{CMD}"htmlonly"/[^a-z_A-Z0-9] { + outDoc->pushGeneratorState(); /*storeOutputListState();*/ + outDoc->disableAllBut(OutputGenerator::Html); + BEGIN(DocHtmlScan); + } +<DocHtmlScan>{CMD}"endhtmlonly"/[^a-z_A-Z0-9] { + /*restoreOutputListState();*/ + outDoc->popGeneratorState(); + BEGIN(DocScan); + } +<DocScan>{CMD}"latexonly"/[^a-z_A-Z0-9] { + /*storeOutputListState();*/ + outDoc->pushGeneratorState(); + outDoc->disableAllBut(OutputGenerator::Latex); + BEGIN(DocLatexScan); + } +<DocLatexScan>{CMD}"endlatexonly"/[^a-z_A-Z0-9] { + /*restoreOutputListState();*/ + outDoc->popGeneratorState(); + BEGIN(DocScan); + } +<DocHtmlScan,DocLatexScan>"//"|"/*"|"*/" { + outDoc->writeString(yytext); + } +<DocHtmlScan,DocLatexScan>.|\n { + char c[2]; + c[0]=*yytext;c[1]='\0'; + outDoc->writeString(c); + } +<DocScan>"\\postheader"/{BN} +<DocScan>"\\functionindex"/{BN} { writeMemberList(*outDoc); } +<DocScan>"\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); } +<DocScan>"\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); } +<DocScan>"\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ } +<DocScan>"\\header"/{BN} { BEGIN( DocSkipWord ); } +<DocScan>"\\define"/{BN} { BEGIN( DocSkipWord ); } +<DocScan>{CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); } +<DocVerbInc>{FILE} { + verbIncludeFile(*outDoc,stripQuotes(yytext)); + BEGIN( DocScan ); + } +<DocScan>{CMD}"verbatim"/[^a-z_A-Z0-9] { + outDoc->startCodeFragment(); + insideVerbatim=TRUE; + BEGIN(DocVerbatim); + } +<DocVerbatim>{CMD}"endverbatim"/[^a-z_A-Z0-9] { + outDoc->endCodeFragment(); + insideVerbatim=FALSE; + BEGIN(DocScan); + } +<DocVerbatim>[^\n\\\@]*"\n" { + //printf("docifying: %s\n",yytext); + outDoc->codify(yytext); + } +<DocVerbatim>"\n"|"//"|"/*"|"*/" { + outDoc->codify(yytext); + } +<DocVerbatim>. { + //printf("char %c\n",*yytext); + char c[2];c[0]=*yytext;c[1]='\0'; + outDoc->codify(c); + } +<DocScan>{CMD}"internal"/{BN} { + if (!Config::internalDocsFlag) + { + outDoc->newParagraph(); + scanString(theTranslator->trForInternalUseOnly()+"\n"); + //outDoc->writeString("For internal use only.\n"); + BEGIN( DocInternal ); + } + } +<DocScan>"\\reimp"/{BN} { + outDoc->newParagraph(); + scanString(theTranslator->trReimplementedForInternalReasons()+"\n"); + } +<DocScan>{CMD}"link"/{BN} { BEGIN( DocLink ); } +<DocSkipWord>[a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); } +<DocLink>[a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well! + linkRef = stripKnownExtensions(yytext); + linkText = ""; + BEGIN( DocLinkText ); + } +<DocLinkText>. { linkText += *yytext; } +<DocLinkText>"\n" { linkText += " "; } +<DocLink,DocLinkText>{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 ); + } +<DocScan>{CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr, + "Warning: \\endlink without \\link " + "in documentation." + ); + } +<DocScan>{CMD}"addindex"{B}+ { + BEGIN(DocIndexWord); + } +<DocScan>"\\form#"[0-9]+ { + Formula *formula=formulaNameDict[yytext]; + if (formula) + { + QCString formName; + formName.sprintf("form-%d.gif",formula->getId()); + outDoc->writeFormula(formName,formula->getFormulaText()); + } + } +<DocIndexWord>[^\n]+ { + //printf("Adding %s to index\n",yytext); + outDoc->addToIndex(yytext,0); + BEGIN(DocScan); + } +<DocScan>{CMD}("arg"|"li")/{BN} { + if (insideArgumentList) + { + outDoc->writeListItem(); + } + else + { + outDoc->startItemList(); + outDoc->writeListItem(); + insideArgumentList=TRUE; + } + } +<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"par"{B}* { + BEGIN(DocPar); + } +<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); + } +<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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(); + } + } +<DocScan>"\\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(); + } + } +<DocScan>"\\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(); + } + } +<DocScan>{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(); + } + } +<DocScan>"$"[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(); + } +<DocScan>{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(", "); + } + } +<DocScan>{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(); + } + } +<DocScan>{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(", "); + } + } +<DocScan>(({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); + } +<DocScan>(({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); + } +<DocScan>(({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); + } +<DocScan>"\\capt".* +<DocParam>({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} { + outDoc->startDescTableTitle(); + outDoc->startEmphasis(); + outDoc->docify(substitute(yytext,"\"","")); + outDoc->endEmphasis(); + outDoc->endDescTableTitle(); + outDoc->startDescTableData(); + BEGIN(DocScan); + } +<DocException>{SCOPENAME} { + outDoc->startDescTableTitle(); + outDoc->startEmphasis(); + outDoc->docify(yytext); + outDoc->endEmphasis(); + outDoc->endDescTableTitle(); + outDoc->startDescTableData(); + BEGIN(DocScan); + } +<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); + } + } +<DocScan>{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); + } + } +<DocScan>"\\_internalref"{B}+ { // for internal use only! + internalRefFile.resize(0); + internalRefAnchor.resize(0); + BEGIN(DocInternalRef); + } +<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); + } +<DocInternalRefText>\"[^\n\"]*\" { + QCString text=substitute(yytext,"\"",""); + outDoc->writeObjectLink(0,internalRefFile,internalRefAnchor,text); + BEGIN(DocScan); + } +<DocScan>{CMD}"ref" { + BEGIN(DocRefName); + } +<DocScan>{CMD}"refitem" { + BEGIN(DocRefItem); + } +<DocScan>{CMD}"if"/{BN} { + outDoc->pushGeneratorState(); + depthIf++; + BEGIN(DocIf); + } +<DocScan>{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(); + } + } +<DocIf>[^\n\t ]+ { + if (Config::sectionFilterList.find(yytext)==-1) + { + outDoc->disableAll(); + } + BEGIN(DocScan); + } +<DocRefName>{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); + } +<DocRefName>({SCOPENAME}|{FILE}){B}+/"\"" { + sectionRef=yytext; + sectionRef=sectionRef.stripWhiteSpace(); + BEGIN(DocRefArgStart); + } +<DocRefArgStart>"\"" { + BEGIN(DocRefArg); + } +<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); + } +<DocRefItem>{ID} { + sectionRef=yytext; + BEGIN(DocRefItemName); + } +<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); + } +<DocScan>{CMD}"image"{B}+ { + BEGIN(DocImage); + } +<DocImage>[hH][tT][mM][lL] { + BEGIN(DocHtmlImageName); + } +<DocImage>[lL][aA][tT][eE][xX] { + BEGIN(DocLatexImageName); + } +<DocHtmlImageName>{FILE}|{URLMASK} { + curImageName = findAndCopyImage(stripQuotes(yytext),IT_Html); + curImageCaption.resize(0); + if (curImageName.isEmpty()) + { + BEGIN(DocScan); + } + else + { + BEGIN(DocHtmlImageOpt); + } + } +<DocHtmlImageOpt>\n { + writeImage(IT_Html,0); + BEGIN(DocScan); + } +<DocHtmlImageOpt>\"[^\n"]*\" { + curImageCaption=stripQuotes(yytext); + } +<DocLatexImageName>{FILE} { + curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex); + curImageCaption.resize(0); + if (curImageName.isEmpty()) + BEGIN(DocScan); + else + BEGIN(DocLatexImageOpt); + } +<DocLatexImageOpt>\n { // no width specified + writeImage(IT_Latex,0); + BEGIN(DocScan); + } +<DocLatexImageOpt>\"[^\n"]*\" { + curImageCaption=stripQuotes(yytext); + } +<DocLatexImageOpt>("width"{B}*"="{B}*)(([0-9\.]+({B}*{ID})?)|("\\"{ID})) { + writeImage(IT_Latex,yytext); + BEGIN(DocScan); + } +<DocLatexImageOpt>("height"{B}*"="{B}*)(([0-9\.]+({B}*{ID})?)|("\\"{ID})) { + writeImage(IT_Latex,yytext); + BEGIN(DocScan); + } +<DocImage>[a-z_A-Z0-9\.\-]+ { + warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext); + } +<DocImage,DocHtmlImageName,DocLatexImageName>\n { + warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!"); + outDoc->enableAll(); + BEGIN(DocScan); + } +<DocScan>{CMD}"code"({BN}*"\n"|{B}*) { + outDoc->startCodeFragment(); + codeBlock.resize(0); + BEGIN( DocCodeBlock ); + } +<DocScan>{CMD}"endcode"/[^a-z_A-Z0-9] { + warn(yyFileName,yyLineNr,"Warning: \\endcode without <PRE> or \\code " + "in the documentation."); + } + +<DocScan,DocRefName>{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"? { + generateRef(*outDoc,className,yytext,inSeeBlock); + BEGIN(DocScan); + } +<DocScan,DocRefName>{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" { + generateRef(*outDoc,className,yytext,inSeeBlock); + BEGIN(DocScan); + } +<DocScan,DocRefName>{SCOPEMASK}("()")? { + generateRef(*outDoc,className,yytext,inSeeBlock); + BEGIN(DocScan); + } +<DocScan,DocRefName>({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")" { + QCString oName=yytext; + generateRef(*outDoc,className, + removeRedundantWhiteSpace(oName),inSeeBlock); + BEGIN(DocScan); + } +<DocScan,DocRefName>({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")" { + QCString oName=yytext; + generateRef(*outDoc,className, + removeRedundantWhiteSpace(oName),inSeeBlock); + BEGIN(DocScan); + } +<DocScan>("http:"|"https:"|"ftp:"|"file:"){URLMASK} { outDoc->writeHtmlLink(yytext,yytext); } +<DocScan>[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+ { outDoc->writeMailLink(yytext); } +<DocScan>{FILEMASK} { + generateFileRef(*outDoc,yytext); + } +<DocCodeBlock>{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 ); + } +<DocCodeBlock>"</"{PRE}{ATTR}">" { + parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName); + //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data()); + outDoc->endCodeFragment(); + BEGIN( DocScan ); + } +<DocScan>{CMD}("e"|"em"|"a"){BN}+ { BEGIN( DocEmphasis ); } +<DocScan>{CMD}"b"{BN}+ { BEGIN( DocBold ); } +<DocScan>{CMD}("c"|"p"){BN}+ { BEGIN( DocCode ); } +<DocScan>{CMD}"l"{BN}+ +<DocScan>"\\n"/[^a-z_A-Z0-9] { outDoc->lineBreak(); } +<DocScan>{CMD}"include"{BN}+ { BEGIN( DocInclude ); } +<DocScan>{CMD}"dontinclude"{BN}+ { BEGIN( DocDontInclude ); } +<DocScan>{CMD}"skip"{BN}+ { BEGIN( DocSkipKey ); } +<DocScan>{CMD}"skipline"{BN}+ { BEGIN( DocSkiplineKey ); firstLine=TRUE; } +<DocScan>{CMD}"line"{BN}+ { BEGIN( DocLineKey ); firstLine=TRUE; } +<DocScan>{CMD}"until"{BN}+ { BEGIN( DocUntilKey ); firstLine=TRUE; } +<DocSkipKey>[^ \t\r\n]+ { + if (includeFileLength>0) + skipUntil(yytext); + BEGIN( DocScan ); + } +<DocLineKey>[^ \t\r\n]+ { + if (includeFileLength>0) + { + if (firstLine) outDoc->startCodeFragment(); + firstLine=FALSE; + showLine(*outDoc,yytext); + BEGIN( DocKeyEnd ); + } + else + { + BEGIN( DocScan ); + } + } +<DocSkiplineKey>[^ \t\r\n]+ { + if (includeFileLength>0) + { + if (firstLine) outDoc->startCodeFragment(); + firstLine=FALSE; + skipLine(*outDoc,yytext); + BEGIN( DocKeyEnd ); + } + else + { + BEGIN( DocScan ); + } + } +<DocUntilKey>[^ \t\r\n]+ { + if (includeFileLength>0) + { + if (firstLine) outDoc->startCodeFragment(); + firstLine=FALSE; + showUntil(*outDoc,yytext); + BEGIN( DocKeyEnd ); + } + else + { + BEGIN( DocScan ); + } + } +<DocKeyEnd>{CMD}"line"{BN}+ { BEGIN(DocLineKey); } +<DocKeyEnd>{CMD}"until"{BN}+ { BEGIN(DocUntilKey); } +<DocKeyEnd>{CMD}"skipline"{BN}+ { BEGIN(DocSkiplineKey); } +<DocKeyEnd>\n +<DocKeyEnd><<EOF>> { + if (!firstLine) outDoc->endCodeFragment(); + yyterminate(); + } +<DocKeyEnd>. { + unput(*yytext); + if (!firstLine) outDoc->endCodeFragment(); + BEGIN( DocScan ); + } +<DocScan>"<"{MULTICOL}{ATTR}">" +<DocScan>"</"{MULTICOL}{ATTR}">" +<DocScan>"<"{STRONG}{ATTR}">" { outDoc->startBold(); } +<DocScan>"</"{STRONG}{ATTR}">" { outDoc->endBold(); } +<DocScan>"<"{CENTER}{ATTR}">" { outDoc->startCenter(); } +<DocScan>"</"{CENTER}{ATTR}">" { outDoc->endCenter(); } +<DocScan>"<"{TABLE}{ATTR}">" { startTable(); } +<DocScan>"</"{TABLE}{ATTR}">" { endTable(); } +<DocScan>"<"{INPUT}{ATTR}">" +<DocScan>"<"{SMALL}{ATTR}">" { outDoc->startSmall(); } +<DocScan>"</"{SMALL}{ATTR}">" { outDoc->endSmall(); } +<DocScan>"<"{META}{ATTR}">" +<DocScan>"<"{FORM}{ATTR}">" +<DocScan>"</"{FORM}{ATTR}">" +<DocScan>"<"{HEAD}{ATTR}">" +<DocScan>"</"{HEAD}{ATTR}">" +<DocScan>"<"{BODY}{ATTR}">" +<DocScan>"</"{BODY}{ATTR}">" +<DocScan>"<"{CODE}{ATTR}">" { outDoc->startTypewriter(); } +<DocScan>"</"{CODE}{ATTR}">" { outDoc->endTypewriter(); } +<DocScan>"<"{DFN}{ATTR}">" { outDoc->startTypewriter(); } +<DocScan>"</"{DFN}{ATTR}">" { outDoc->endTypewriter(); } +<DocScan>"<"{VAR}{ATTR}">" { outDoc->startEmphasis(); } +<DocScan>"</"{VAR}{ATTR}">" { outDoc->endEmphasis(); } +<DocScan>"<"{IMG}{ATTR}">" { + /*storeOutputListState();*/ + outDoc->pushGeneratorState(); + outDoc->disableAllBut(OutputGenerator::Html); + outDoc->writeString(yytext); + /*restoreOutputListState();*/ + outDoc->popGeneratorState(); + } +<DocScan>"<"{PRE}{ATTR}">" { + outDoc->startCodeFragment(); + codeBlock.resize(0); + BEGIN( DocCodeBlock ); + } +<DocScan>"</"{PRE}{ATTR}">" { + warn(yyFileName,yyLineNr, + "Warning: </PRE> without <PRE> or \\code" + "in the documentation." + ); + } +<DocScan>"<"{SUB}{ATTR}">" { outDoc->startSubscript(); } +<DocScan>"</"{SUB}{ATTR}">" { outDoc->endSubscript(); } +<DocScan>"<"{SUP}{ATTR}">" { outDoc->startSuperscript(); } +<DocScan>"</"{SUP}{ATTR}">" { outDoc->endSuperscript(); } +<DocScan>"<"{TR}{ATTR}">" { if (curTable) curTable->newRow(); } +<DocScan>"</"{TR}{ATTR}">" +<DocScan>"<"{TD}{ATTR}">" { if (curTable) curTable->newElem(); } +<DocScan>"</"{TD}{ATTR}">" +<DocScan>"<"{OL}{ATTR}">" { outDoc->startEnumList(); + currentListIndent.push("O"); + } +<DocScan>"</"{OL}{ATTR}">" { + if (currentListIndent.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: more </ol> tags than <ol> tags in the documentation." + ); + } + else if (currentListIndent.top()!="O") + { + warn(yyFileName,yyLineNr, + "Warning: </ol> tag does not end a <ol> tag in the documentation." + ); + } + else + { + outDoc->endEnumList(); + currentListIndent.pop(); + } + } +<DocScan>"<"{UL}{ATTR}">" { outDoc->startItemList(); + currentListIndent.push("U"); + } +<DocScan>"</"{UL}{ATTR}">" { + if (currentListIndent.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: more </ul> tags than <ul> tags in the documentation." + ); + } + else if (currentListIndent.top()!="U") + { + warn(yyFileName,yyLineNr, + "Warning: </ul> tag does not end a <ul> tag in the documentation." + ); + } + else + { + outDoc->endItemList(); + currentListIndent.pop(); + } + } +<DocScan>"<"{LI}{ATTR}">" { + if (/*currentListIndent.isEmpty() ||*/ //DvH: I removed this check because I use this in the manual (the <ul> is in a \htmlonly block!) + currentListIndent.top()=="D") + { + warn(yyFileName,yyLineNr, + "Warning: The <li> tag can only be used inside a <ul> ... </ul> or a <ol> ... </ol> block." + ); + } + else + { + outDoc->writeListItem(); + } + } +<DocScan>"</"{LI}{ATTR}">" +<DocScan>"<"{TT}{ATTR}">" { outDoc->startTypewriter(); } +<DocScan>"</"{TT}{ATTR}">" { outDoc->endTypewriter(); } +<DocScan>"<"{EM}{ATTR}">" { outDoc->startEmphasis(); } +<DocScan>"</"{EM}{ATTR}">" { outDoc->endEmphasis(); } +<DocScan>"<"{HR}{ATTR}">" { outDoc->writeRuler(); } +<DocScan>"<"{DL}{ATTR}">" { outDoc->startDescription(); + currentListIndent.push("D"); + } +<DocScan>"</"{DL}{ATTR}">" { + if (currentListIndent.isEmpty()) + { + warn(yyFileName,yyLineNr, + "Warning: more </dl> tags than <dl> tags in the documentation." + ); + } + else if (currentListIndent.top()!="D") + { + warn(yyFileName,yyLineNr, + "Warning: </dl> tag does not end a <dl> tag in the documentation." + ); + } + else + { + outDoc->endDescription(); + currentListIndent.pop(); + } + } +<DocScan>"<"{DT}{ATTR}">" { + if (currentListIndent.isEmpty() || + currentListIndent.top()!="D") + { + warn(yyFileName,yyLineNr, + "Warning: The <dt> tag can only be used inside a <dl> ... </dl> block." + ); + } + else + { + outDoc->startDescItem(); + } + } +<DocScan>"</"{DT}{ATTR}">" +<DocScan>"<"{DD}{ATTR}">" { + if (currentListIndent.isEmpty() || + currentListIndent.top()!="D") + { + warn(yyFileName,yyLineNr, + "Warning: The <dd> tag can only be used inside a <dl> ... </dl> block." + ); + } + else + { + outDoc->endDescItem(); + } + } +<DocScan>"</"{DD}{ATTR}">" +<DocScan>"<"{BR}{ATTR}">" { outDoc->lineBreak(); } +<DocScan>"<"{I}{ATTR}">" { outDoc->startEmphasis(); } +<DocScan>"</"{I}{ATTR}">" { outDoc->endEmphasis(); } +<DocScan>"</"{A}{ATTR}">" +<DocScan>"<"{A} { BEGIN(DocHtmlLink); } +<DocScan>"<"{BOLD}{ATTR}">" { outDoc->startBold(); } +<DocScan>"</"{BOLD}{ATTR}">" { outDoc->endBold(); } +<DocScan>"<"{P}{ATTR}">" { + if (inBlock()) endBlock(); + outDoc->newParagraph(); } +<DocScan>"</"{P}{ATTR}">" +<DocScan>"<"{H1}{ATTR}">" { outDoc->startTitle(); } +<DocScan>"</"{H1}{ATTR}">" { outDoc->endTitle(); } +<DocScan>"<"{H2}{ATTR}">" { outDoc->startSubsection(); } +<DocScan>"</"{H2}{ATTR}">" { outDoc->endSubsection(); } +<DocScan>"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); } +<DocScan>"</"{H3}{ATTR}">" { outDoc->endSubsubsection(); } +<DocHtmlLink>{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); } +<DocHtmlAnchor>[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); } +<DocHtmlLink>{HREF}{BN}*"="{BN}*("\""?) { + htmlUrl.resize(0); + htmlText.resize(0); + BEGIN(DocHtmlHref1); } +<DocHtmlHref1>{URLMASK} { + htmlUrl=yytext; + } +<DocHtmlHref1>">" { BEGIN(DocHtmlHref2); } +<DocHtmlHref2>[^<]* { htmlText+=yytext; } +<DocHtmlHref2>"<" { + outDoc->writeHtmlLink(htmlUrl,htmlText); + unput(*yytext); + BEGIN(DocScan); + } +<DocHtmlLink,DocHtmlAnchor>">" { BEGIN(DocScan); } +<DocScan>{CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") { + outDoc->docify(&yytext[1]); + } +<DocScan>"%"[a-zA-Z_0-9\-]+ { + outDoc->docify(yytext+1); + } +<DocEmphasis>[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 ); + } +<DocEmphasis>{WORD} { + outDoc->startEmphasis(); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + outDoc->endEmphasis(); + BEGIN( DocScan ); + } +<DocBold>[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 ); + } +<DocBold>{WORD} { + outDoc->startBold(); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + outDoc->endBold(); + BEGIN( DocScan ); + } +<DocCode>[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 ); + } +<DocCode>{WORD} { + outDoc->startTypewriter(); + linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); + outDoc->endTypewriter(); + BEGIN( DocScan ); + } +<DocInclude>{FILE} { + includeFile(*outDoc,stripQuotes(yytext),FALSE); + BEGIN( DocScan ); + } +<DocDontInclude>{FILE} { + includeFile(*outDoc,stripQuotes(yytext),TRUE); + BEGIN( DocScan ); + } +<DocCodeBlock>"//" { codeBlock += yytext; } +<DocCodeBlock>"/*" { codeBlock += yytext; } +<DocCodeBlock>\n { codeBlock += '\n'; } +<DocCodeBlock>[^\/\\\<\n]* { codeBlock += yytext; } +<DocCodeBlock>. { codeBlock += *yytext; } +<DocCode,DocEmphasis,DocScan,DocBold>"//" { + outDoc->docify(yytext); + } +<DocCode,DocEmphasis,DocScan,DocBold>"/*" { + outDoc->docify(yytext); + } +<DocCode,DocEmphasis,DocBold>"\n" { outDoc->writeChar('\n'); } +<DocScan>({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); + } +<DocScan>({B}*"\n"){2,}{B}* { // new paragraph + if (insideArgumentList) + { + insideArgumentList=FALSE; + outDoc->endItemList(); + } + else if (insideItemList) + { + forceEndItemList(); + } + else + { + outDoc->newParagraph(); + } + if (inBlock()) endBlock(); + } +<DocScan>{BN}+/\n { + outDoc->writeChar(' '); + } +<DocScan>\n?{B}* { + outDoc->writeChar(' '); + } +<DocCode,DocEmphasis,DocBold,DocScan,Text>[a-z_A-Z0-9]+ { + outDoc->docify(yytext); + } +<DocCode,DocEmphasis,DocBold,DocScan,Text>. { + 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("</ol>"); break; + case 'U': warn_cont("</ul>"); break; + case 'D': warn_cont("</dl>"); 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<QCString> *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 += "<dl><dt>\\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 += "\":</dt>\n<dd>"; - page->doc += item->text; - page->doc += "</dd></dl>\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 += "<dl><dt>\\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 += "\":</dt>\n<dd>"; - page->doc += item->text; - page->doc += "</dd></dl>\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 += "<dl><dt>\\anchor "; + doc += item->listAnchor; + doc += "\n"; + doc += prefix; + doc += " \\_internalref "; + doc += name; + doc += " \""; + doc += title; + doc += "\""; + if (args) doc += args; + doc += "</dt>\n<dd>"; + doc += item->text; + doc += "</dd></dl>\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 += "<dl><dt>\\anchor "; + doc += item->listAnchor; + doc += "\n"; + doc += prefix; + doc += " \\_internalref "; + doc += name; + doc += " \""; + doc += title; + doc += "\""; + if (args) doc += args; + doc += "</dt>\n<dd>"; + doc += item->text; + doc += "</dd></dl>\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<QCString> 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<PageInfo> @@ -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 << "<a name=\"" << anchor << "\" doxytag=\"" << name << "\"></a>"; } -void HtmlGenerator::endDoxyAnchor() +void HtmlGenerator::endDoxyAnchor(const char *,const char *) { } @@ -789,12 +789,11 @@ void HtmlGenerator::endAlphabeticalIndexList() void HtmlGenerator::writeIndexHeading(const char *s) { - //t << "<dt><b><big>" << s << "</big></b><dd>" << endl; t << "<div class=\"ah\"><font color=\"white\"><b> " << s << " </b></font></div>"; } -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 << "<div align=\"center\">" << endl; t << "<img src=\"" << name << "\" alt=\"" << baseName << "\">" << endl; + if (hasCaption) + { + t << "<p><strong>"; + } +} + +void HtmlGenerator::endImage(bool hasCaption) +{ + if (hasCaption) + { + t << "</strong></p>" << endl; + } + t << "</div>" << 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 << "<a name=\"" << label << "\"></a>"; } 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 << "<table border=0 cellspacing=2 cellpadding=0>" << 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<MemberDef>() @@ -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<MemberDef> 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 <stdio.h> -#include <qlist.h> -#include <qintdict.h> - -#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 <unistd.h> @@ -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<TableElem> *elemList; - int curRow; - int curCol; - int rows; - int cols; -}; - -Table::Table() -{ - parentDoc=outDoc; - elemList=new QList<TableElem>; - 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<Table> 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 <table> tags found than </table> " - "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 ( includeFileOffset<includeFileLength && - (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0 - ) s+=c; - if (s.find(key)!=-1) - { - found=TRUE; - ol.writeString(" "); - parseCode(ol,className,s,exampleDoc,exampleName); - ol.writeString("\n"); - } - else if (includeFileOffset==includeFileLength) found=TRUE; - } -} - -static void skipUntil(const char *key) -{ - bool found=FALSE; - while (!found) - { - QCString s; - int i=includeFileOffset; - char c; - while ( i<includeFileLength && - (c=currentIncludeFile[i++])!='\n' && c!=0 - ) s+=c; - if (s.find(key)!=-1 || i==includeFileLength) - { - found=TRUE; - } - else - { - includeFileOffset=i; - } - } -} - -static void showLine(OutputList &ol,const char *key) -{ - QCString s; - char c; - bool found=FALSE; - while (!found) - { - while ( includeFileOffset<includeFileLength && - (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0 - ) s+=c; - if (!s.stripWhiteSpace().isEmpty() || - includeFileOffset==includeFileLength) found=TRUE; - } - if (s.find(key)!=-1) - { - ol.writeString(" "); - parseCode(ol,className,s,exampleDoc,exampleName); - ol.writeString("\n"); - } -} - -static void showUntil(OutputList &ol,const char *key) -{ - bool found=FALSE; - while (!found) - { - QCString s; - char c; - while ( includeFileOffset<includeFileLength && - (c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0 - ) s+=c; - if (!s.stripWhiteSpace().isEmpty()) - { - ol.writeString(" "); - parseCode(ol,className,s,exampleDoc,exampleName); - ol.writeString("\n"); - if (s.find(key)!=-1) found=TRUE; - } - if (includeFileOffset==includeFileLength) found=TRUE; - } -} - static int newMemberGroupId() { static int curGroupId=0; @@ -583,137 +207,8 @@ static int newMemberGroupId() static void newDocState(); - //----------------------------------------------------------------- -struct IndentInfo -{ - public: - IndentInfo(int i,bool e) : indent(i), enumerated(e) {}; - ~IndentInfo() {} - void startList() - { - if (enumerated) outDoc->startEnumList(); else outDoc->startItemList(); - } - void endList() - { - if (enumerated) outDoc->endEnumList(); else outDoc->endItemList(); - } - void writeItem() - { - outDoc->writeListItem(); - } - int indent; - bool enumerated; -}; - -static QStack<IndentInfo> 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;i<dashPos;i++) - { - if (marker[i]=='\t') - { - indent+=Config::tabSize - (indent%Config::tabSize); - } - else - { - indent++; - } - } - //printf("list marker found at column %d enumerated %d\n",indent,enumerated); - if (!insideItemList) - { - listIndentStack.push(new IndentInfo(indent,enumerated)); - listIndentStack.top()->startList(); - 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->indent<indent) // start sub item list - { - listIndentStack.push(new IndentInfo(indent,enumerated)); - listIndentStack.top()->startList(); - 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,128 +256,29 @@ 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; @@ -896,10 +292,6 @@ QCString extractName(const QCString &s) } /* ----------------------------------------------------------------- */ - -//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); @@ -915,7 +307,6 @@ static int yyread(char *buf,int max_size) return c; } -//ATTR ((({BN}+[^\>]+)/">")?) %} CMD ("\\"|"@") @@ -924,64 +315,24 @@ 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\-\+] +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}) -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 @@ -1038,6 +389,7 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") %x ClassDocBrief %x ClassDocOverload %x ClassDefineArgs +%x DocBaseClass %x CppQuote %x EndCppQuote %x GroupDocArg1 @@ -1066,48 +418,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") %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 @@ -1163,1182 +473,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") BEGIN( FindMembers ); } <*>\x0d -<DocScan>^{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); - } -<DocScan>\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); - } -<DocScan,Text>"©" { outDoc->writeCopyright(); } -<DocScan,Text>""" { outDoc->writeQuote(); } -<DocScan,Text>"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); } -<DocScan,Text>"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); } -<DocScan,Text>"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); } -<DocScan,Text>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); } -<DocScan,Text>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); } -<DocScan,Text>"ß" { outDoc->writeSharpS(); } -<DocScan,Text>"&[aA]ring;" { outDoc->writeRing(yytext[1]); } -<DocScan,DocHtmlScan,DocLatexScan>"$("[a-z_A-Z]+")" { - QCString envvar=&yytext[2]; - envvar=envvar.left(envvar.length()-1); - outDoc->docify(getenv(envvar)); - } -<DocScan>{CMD}"htmlonly"/[^a-z_A-Z0-9] { - outDoc->pushGeneratorState(); /*storeOutputListState();*/ - outDoc->disableAllBut(OutputGenerator::Html); - BEGIN(DocHtmlScan); - } -<DocHtmlScan>{CMD}"endhtmlonly"/[^a-z_A-Z0-9] { - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -<DocScan>{CMD}"latexonly"/[^a-z_A-Z0-9] { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - BEGIN(DocLatexScan); - } -<DocLatexScan>{CMD}"endlatexonly"/[^a-z_A-Z0-9] { - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -<DocHtmlScan,DocLatexScan>"//"|"/*"|"*/" { - outDoc->writeString(yytext); - } -<DocHtmlScan,DocLatexScan>.|\n { - char c[2]; - c[0]=*yytext;c[1]='\0'; - outDoc->writeString(c); - } -<DocScan>"\\postheader"/{BN} -<DocScan>"\\functionindex"/{BN} { writeMemberList(*outDoc); } -<DocScan>"\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); } -<DocScan>"\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); } -<DocScan>"\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ } -<DocScan>"\\header"/{BN} { BEGIN( DocSkipWord ); } -<DocScan>"\\define"/{BN} { BEGIN( DocSkipWord ); } -<DocScan>{CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); } -<DocVerbInc>{FILE} { - verbIncludeFile(*outDoc,stripQuotes(yytext)); - BEGIN( DocScan ); - } -<DocScan>{CMD}"verbatim"/[^a-z_A-Z0-9] { - outDoc->startCodeFragment(); - insideVerbatim=TRUE; - BEGIN(DocVerbatim); - } -<DocVerbatim>{CMD}"endverbatim"/[^a-z_A-Z0-9] { - outDoc->endCodeFragment(); - insideVerbatim=FALSE; - BEGIN(DocScan); - } -<DocVerbatim>[^\n\\\@]*"\n" { - //printf("docifying: %s\n",yytext); - outDoc->codify(yytext); - } -<DocVerbatim>"\n"|"//"|"/*"|"*/" { - outDoc->codify(yytext); - } -<DocVerbatim>. { - //printf("char %c\n",*yytext); - char c[2];c[0]=*yytext;c[1]='\0'; - outDoc->codify(c); - } -<DocScan>{CMD}"internal"/{BN} { - if (!Config::internalDocsFlag) - { - outDoc->newParagraph(); - scanString(theTranslator->trForInternalUseOnly()+"\n"); - //outDoc->writeString("For internal use only.\n"); - BEGIN( DocInternal ); - } - } -<DocScan>"\\reimp"/{BN} { - outDoc->newParagraph(); - scanString(theTranslator->trReimplementedForInternalReasons()+"\n"); - } -<DocScan>{CMD}"link"/{BN} { BEGIN( DocLink ); } -<DocSkipWord>[a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); } -<DocLink>[a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well! - linkRef = stripKnownExtensions(yytext); - linkText = ""; - BEGIN( DocLinkText ); - } -<DocLinkText>. { linkText += *yytext; } -<DocLinkText>"\n" { linkText += " "; } -<DocLink,DocLinkText>{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 ); - } - /* -<DocScan>"@ref"{B}+ { - BEGIN(DocRef); - } -<DocRef>{SCOPENAME} { - generateLink(*outDoc,className,yytext,TRUE,0); - BEGIN( DocScan ); - } - */ -<DocScan>{CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr, - "Warning: \\endlink without \\link " - "in documentation." - ); - } -<DocScan>{CMD}"addindex"{B}+ { - BEGIN(DocIndexWord); - } -<DocScan>"\\form#"[0-9]+ { - Formula *formula=formulaNameDict[yytext]; - if (formula) - { - QCString formName; - formName.sprintf("form-%d.gif",formula->getId()); - outDoc->writeFormula(formName,formula->getFormulaText()); - } - } -<DocIndexWord>[^\n]+ { - //printf("Adding %s to index\n",yytext); - outDoc->addToIndex(yytext,0); - BEGIN(DocScan); - } -<DocScan>{CMD}("arg"|"li")/{BN} { - if (insideArgumentList) - { - outDoc->writeListItem(); - } - else - { - outDoc->startItemList(); - outDoc->writeListItem(); - insideArgumentList=TRUE; - } - } -<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"par"{B}* { - BEGIN(DocPar); - } -<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); - } -<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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(); - } - } -<DocScan>"\\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(); - } - } -<DocScan>"\\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(); - } - } -<DocScan>{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(); - } - } -<DocScan>"$"[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(); - } -<DocScan>{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(", "); - } - } -<DocScan>{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(); - } - } -<DocScan>{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(", "); - } - } -<DocScan>(({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); - } -<DocScan>(({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); - } -<DocScan>(({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); - } -<DocScan>"\\capt".* -<DocParam>({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} { - outDoc->startDescTableTitle(); - outDoc->startEmphasis(); - outDoc->docify(substitute(yytext,"\"","")); - outDoc->endEmphasis(); - outDoc->endDescTableTitle(); - outDoc->startDescTableData(); - BEGIN(DocScan); - } -<DocException>{SCOPENAME} { - outDoc->startDescTableTitle(); - outDoc->startEmphasis(); - outDoc->docify(yytext); - outDoc->endEmphasis(); - outDoc->endDescTableTitle(); - outDoc->startDescTableData(); - BEGIN(DocScan); - } -<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); - } - } -<DocScan>{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); - } - } -<DocScan>{CMD}"ref" { - BEGIN(DocRefName); - } -<DocScan>{CMD}"refitem" { - BEGIN(DocRefItem); - } -<DocScan>{CMD}"if"/{BN} { - outDoc->pushGeneratorState(); - depthIf++; - BEGIN(DocIf); - } -<DocScan>{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(); - } - } -<DocIf>[^\n\t ]+ { - if (Config::sectionFilterList.find(yytext)==-1) - { - outDoc->disableAll(); - } - BEGIN(DocScan); - } -<DocRefName>{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); - } -<DocRefName>({SCOPENAME}|{FILE}){B}+/"\"" { - sectionRef=yytext; - sectionRef=sectionRef.stripWhiteSpace(); - BEGIN(DocRefArgStart); - } -<DocRefArgStart>"\"" { - BEGIN(DocRefArg); - } -<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); - } -<DocRefItem>{ID} { - sectionRef=yytext; - BEGIN(DocRefItemName); - } -<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); - } -<DocScan>{CMD}"image"{B}+ { - BEGIN(DocImage); - } -<DocImage>[hH][tT][mM][lL] { - BEGIN(DocHtmlImageName); - } -<DocImage>[lL][aA][tT][eE][xX] { - BEGIN(DocLatexImageName); - } -<DocHtmlImageName>{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); - } -<DocLatexImageName>{FILE} { - curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex); - if (curImageName.isEmpty()) - BEGIN(DocScan); - else - BEGIN(DocLatexImageWidth); - } -<DocLatexImageWidth>\n { // no width specified - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - outDoc->writeImage(curImageName,0,0); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -<DocLatexImageWidth>"width"{B}*"="{B}*[0-9\.]+({B}*{ID})? { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - outDoc->writeImage(curImageName,yytext,0); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -<DocLatexImageWidth>"height"{B}*"="{B}*[0-9\.]+({B}*{ID})? { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Latex); - outDoc->writeImage(curImageName,0,yytext); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - BEGIN(DocScan); - } -<DocImage>[a-z_A-Z0-9\.\-]+ { - warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext); - } -<DocImage,DocHtmlImageName,DocLatexImageName>\n { - warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!"); - outDoc->enableAll(); - BEGIN(DocScan); - } -<DocScan>{CMD}"code"({BN}*"\n"|{B}*) { - outDoc->startCodeFragment(); - codeBlock.resize(0); - BEGIN( DocCodeBlock ); - } -<DocScan>{CMD}"endcode"/[^a-z_A-Z0-9] { - warn(yyFileName,yyLineNr,"Warning: \\endcode without <PRE> or \\code " - "in the documentation."); - } - -<DocScan,DocRefName>{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"? { - generateRef(*outDoc,className,yytext,inSeeBlock); - BEGIN(DocScan); - } -<DocScan,DocRefName>{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" { - generateRef(*outDoc,className,yytext,inSeeBlock); - BEGIN(DocScan); - } -<DocScan,DocRefName>{SCOPEMASK}("()")? { - generateRef(*outDoc,className,yytext,inSeeBlock); - BEGIN(DocScan); - } -<DocScan,DocRefName>({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")" { - QCString oName=yytext; - generateRef(*outDoc,className, - removeRedundantWhiteSpace(oName),inSeeBlock); - BEGIN(DocScan); - } -<DocScan,DocRefName>({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")" { - QCString oName=yytext; - generateRef(*outDoc,className, - removeRedundantWhiteSpace(oName),inSeeBlock); - BEGIN(DocScan); - } -<DocScan>("http:"|"https:"|"ftp:"|"file:"){URLMASK} { outDoc->writeHtmlLink(yytext,yytext); } -<DocScan>[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+ { outDoc->writeMailLink(yytext); } -<DocScan>{FILEMASK} { - generateFileRef(*outDoc,yytext); - } -<DocCodeBlock>{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 ); - } -<DocCodeBlock>"</"{PRE}{ATTR}">" { - parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName); - //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data()); - outDoc->endCodeFragment(); - BEGIN( DocScan ); - } -<DocScan>{CMD}("e"|"em"|"a"){BN}+ { BEGIN( DocEmphasis ); } -<DocScan>{CMD}"b"{BN}+ { BEGIN( DocBold ); } -<DocScan>{CMD}("c"|"p"){BN}+ { BEGIN( DocCode ); } -<DocScan>{CMD}"l"{BN}+ -<DocScan>"\\n"/[^a-z_A-Z0-9] { outDoc->lineBreak(); } -<DocScan>{CMD}"include"{BN}+ { BEGIN( DocInclude ); } -<DocScan>{CMD}"dontinclude"{BN}+ { BEGIN( DocDontInclude ); } -<DocScan>{CMD}"skip"{BN}+ { BEGIN( DocSkipKey ); } -<DocScan>{CMD}"skipline"{BN}+ { BEGIN( DocSkiplineKey ); firstLine=TRUE; } -<DocScan>{CMD}"line"{BN}+ { BEGIN( DocLineKey ); firstLine=TRUE; } -<DocScan>{CMD}"until"{BN}+ { BEGIN( DocUntilKey ); firstLine=TRUE; } -<DocSkipKey>[^ \t\r\n]+ { - if (includeFileLength>0) - skipUntil(yytext); - BEGIN( DocScan ); - } -<DocLineKey>[^ \t\r\n]+ { - if (includeFileLength>0) - { - if (firstLine) outDoc->startCodeFragment(); - firstLine=FALSE; - showLine(*outDoc,yytext); - BEGIN( DocKeyEnd ); - } - else - { - BEGIN( DocScan ); - } - } -<DocSkiplineKey>[^ \t\r\n]+ { - if (includeFileLength>0) - { - if (firstLine) outDoc->startCodeFragment(); - firstLine=FALSE; - skipLine(*outDoc,yytext); - BEGIN( DocKeyEnd ); - } - else - { - BEGIN( DocScan ); - } - } -<DocUntilKey>[^ \t\r\n]+ { - if (includeFileLength>0) - { - if (firstLine) outDoc->startCodeFragment(); - firstLine=FALSE; - showUntil(*outDoc,yytext); - BEGIN( DocKeyEnd ); - } - else - { - BEGIN( DocScan ); - } - } -<DocKeyEnd>{CMD}"line"{BN}+ { BEGIN(DocLineKey); } -<DocKeyEnd>{CMD}"until"{BN}+ { BEGIN(DocUntilKey); } -<DocKeyEnd>{CMD}"skipline"{BN}+ { BEGIN(DocSkiplineKey); } -<DocKeyEnd>\n -<DocKeyEnd><<EOF>> { - if (!firstLine) outDoc->endCodeFragment(); - yyterminate(); - } -<DocKeyEnd>. { - unput(*yytext); - if (!firstLine) outDoc->endCodeFragment(); - BEGIN( DocScan ); - } -<DocScan>"<"{MULTICOL}{ATTR}">" -<DocScan>"</"{MULTICOL}{ATTR}">" -<DocScan>"<"{STRONG}{ATTR}">" { outDoc->startBold(); } -<DocScan>"</"{STRONG}{ATTR}">" { outDoc->endBold(); } -<DocScan>"<"{CENTER}{ATTR}">" { outDoc->startCenter(); } -<DocScan>"</"{CENTER}{ATTR}">" { outDoc->endCenter(); } -<DocScan>"<"{TABLE}{ATTR}">" { startTable(); } -<DocScan>"</"{TABLE}{ATTR}">" { endTable(); } -<DocScan>"<"{INPUT}{ATTR}">" -<DocScan>"<"{SMALL}{ATTR}">" { outDoc->startSmall(); } -<DocScan>"</"{SMALL}{ATTR}">" { outDoc->endSmall(); } -<DocScan>"<"{META}{ATTR}">" -<DocScan>"<"{FORM}{ATTR}">" -<DocScan>"</"{FORM}{ATTR}">" -<DocScan>"<"{HEAD}{ATTR}">" -<DocScan>"</"{HEAD}{ATTR}">" -<DocScan>"<"{BODY}{ATTR}">" -<DocScan>"</"{BODY}{ATTR}">" -<DocScan>"<"{CODE}{ATTR}">" { outDoc->startTypewriter(); } -<DocScan>"</"{CODE}{ATTR}">" { outDoc->endTypewriter(); } -<DocScan>"<"{DFN}{ATTR}">" { outDoc->startTypewriter(); } -<DocScan>"</"{DFN}{ATTR}">" { outDoc->endTypewriter(); } -<DocScan>"<"{VAR}{ATTR}">" { outDoc->startEmphasis(); } -<DocScan>"</"{VAR}{ATTR}">" { outDoc->endEmphasis(); } -<DocScan>"<"{IMG}{ATTR}">" { - /*storeOutputListState();*/ - outDoc->pushGeneratorState(); - outDoc->disableAllBut(OutputGenerator::Html); - outDoc->writeString(yytext); - /*restoreOutputListState();*/ - outDoc->popGeneratorState(); - } -<DocScan>"<"{PRE}{ATTR}">" { - outDoc->startCodeFragment(); - codeBlock.resize(0); - BEGIN( DocCodeBlock ); - } -<DocScan>"</"{PRE}{ATTR}">" { - warn(yyFileName,yyLineNr, - "Warning: </PRE> without <PRE> or \\code" - "in the documentation." - ); - } -<DocScan>"<"{SUB}{ATTR}">" { outDoc->startSubscript(); } -<DocScan>"</"{SUB}{ATTR}">" { outDoc->endSubscript(); } -<DocScan>"<"{SUP}{ATTR}">" { outDoc->startSuperscript(); } -<DocScan>"</"{SUP}{ATTR}">" { outDoc->endSuperscript(); } -<DocScan>"<"{TR}{ATTR}">" { if (curTable) curTable->newRow(); } -<DocScan>"</"{TR}{ATTR}">" -<DocScan>"<"{TD}{ATTR}">" { if (curTable) curTable->newElem(); } -<DocScan>"</"{TD}{ATTR}">" -<DocScan>"<"{OL}{ATTR}">" { outDoc->startEnumList(); - currentListIndentLevel++; - } -<DocScan>"</"{OL}{ATTR}">" { - if (currentListIndentLevel<=0) - { - warn(yyFileName,yyLineNr, - "Warning: more </ol> tags than <ol> tags in the documentation." - ); - } - else - { - outDoc->endEnumList(); - currentListIndentLevel--; - } - } -<DocScan>"<"{UL}{ATTR}">" { outDoc->startItemList(); - currentListIndentLevel++; - } -<DocScan>"</"{UL}{ATTR}">" { - if (currentListIndentLevel<=0) - { - warn(yyFileName,yyLineNr, - "Warning: more </ul> tags than <ul> tags in the documentation." - ); - } - else - { - outDoc->endItemList(); - currentListIndentLevel--; - } - } -<DocScan>"<"{LI}{ATTR}">" { outDoc->writeListItem(); } -<DocScan>"</"{LI}{ATTR}">" -<DocScan>"<"{TT}{ATTR}">" { outDoc->startTypewriter(); } -<DocScan>"</"{TT}{ATTR}">" { outDoc->endTypewriter(); } -<DocScan>"<"{EM}{ATTR}">" { outDoc->startEmphasis(); } -<DocScan>"</"{EM}{ATTR}">" { outDoc->endEmphasis(); } -<DocScan>"<"{HR}{ATTR}">" { outDoc->writeRuler(); } -<DocScan>"<"{DL}{ATTR}">" { outDoc->startDescription(); - currentListIndentLevel++; - } -<DocScan>"</"{DL}{ATTR}">" { - if (currentListIndentLevel<=0) - { - warn(yyFileName,yyLineNr, - "Warning: more </dl> tags than <dl> tags in the documentation." - ); - } - else - { - outDoc->endDescription(); - currentListIndentLevel--; - } - } -<DocScan>"<"{DT}{ATTR}">" { outDoc->startDescItem(); } -<DocScan>"</"{DT}{ATTR}">" -<DocScan>"<"{DD}{ATTR}">" { outDoc->endDescItem(); } -<DocScan>"</"{DD}{ATTR}">" -<DocScan>"<"{BR}{ATTR}">" { outDoc->lineBreak(); } -<DocScan>"<"{I}{ATTR}">" { outDoc->startEmphasis(); } -<DocScan>"</"{I}{ATTR}">" { outDoc->endEmphasis(); } -<DocScan>"</"{A}{ATTR}">" -<DocScan>"<"{A} { BEGIN(DocHtmlLink); } -<DocScan>"<"{BOLD}{ATTR}">" { outDoc->startBold(); } -<DocScan>"</"{BOLD}{ATTR}">" { outDoc->endBold(); } -<DocScan>"<"{P}{ATTR}">" { - if (inBlock()) endBlock(); - outDoc->newParagraph(); } -<DocScan>"</"{P}{ATTR}">" -<DocScan>"<"{H1}{ATTR}">" { outDoc->startTitle(); } -<DocScan>"</"{H1}{ATTR}">" { outDoc->endTitle(); } -<DocScan>"<"{H2}{ATTR}">" { outDoc->startSubsection(); } -<DocScan>"</"{H2}{ATTR}">" { outDoc->endSubsection(); } -<DocScan>"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); } -<DocScan>"</"{H3}{ATTR}">" { outDoc->endSubsubsection(); } -<DocHtmlLink>{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); } -<DocHtmlAnchor>[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); } -<DocHtmlLink>{HREF}{BN}*"="{BN}*("\""?) { - htmlUrl.resize(0); - htmlText.resize(0); - BEGIN(DocHtmlHref1); } -<DocHtmlHref1>{URLMASK} { - htmlUrl=yytext; - } -<DocHtmlHref1>">" { BEGIN(DocHtmlHref2); } -<DocHtmlHref2>[^<]* { htmlText+=yytext; } - /* -<DocHtmlHref2>\n { htmlText+='\n'; } - */ -<DocHtmlHref2>"<" { - outDoc->writeHtmlLink(htmlUrl,htmlText); - unput(*yytext); - BEGIN(DocScan); - } -<DocHtmlLink,DocHtmlAnchor>">" { BEGIN(DocScan); } -<DocScan>{CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") { - outDoc->docify(&yytext[1]); - } -<DocScan>"%"[a-zA-Z_0-9\-]+ { - outDoc->docify(yytext+1); - } -<DocEmphasis>[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 ); - } -<DocEmphasis>{WORD} { - outDoc->startEmphasis(); - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); - outDoc->endEmphasis(); - BEGIN( DocScan ); - } -<DocBold>[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 ); - } -<DocBold>{WORD} { - outDoc->startBold(); - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); - outDoc->endBold(); - BEGIN( DocScan ); - } -<DocCode>[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 ); - } -<DocCode>{WORD} { - outDoc->startTypewriter(); - linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE); - outDoc->endTypewriter(); - BEGIN( DocScan ); - } -<DocInclude>{FILE} { - includeFile(*outDoc,stripQuotes(yytext),FALSE); - BEGIN( DocScan ); - } -<DocDontInclude>{FILE} { - includeFile(*outDoc,stripQuotes(yytext),TRUE); - BEGIN( DocScan ); - } -<DocCodeBlock>"//" { codeBlock += yytext; } -<DocCodeBlock>"/*" { codeBlock += yytext; } -<DocCodeBlock>\n { codeBlock += '\n'; } -<DocCodeBlock>[^\/\\\<\n]* { codeBlock += yytext; } -<DocCodeBlock>. { codeBlock += *yytext; } -<DocCode,DocEmphasis,DocScan,DocBold>"//" { - outDoc->docify(yytext); - } -<DocCode,DocEmphasis,DocScan,DocBold>"/*" { - outDoc->docify(yytext); - } -<DocCode,DocEmphasis,DocBold>"\n" { outDoc->writeChar('\n'); } -<DocScan>({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); - } -<DocScan>({B}*"\n"){2,}{B}* { // new paragraph - if (insideArgumentList) - { - insideArgumentList=FALSE; - outDoc->endItemList(); - } - else if (insideItemList) - { - forceEndItemList(); - } - else - { - outDoc->newParagraph(); - } - if (inBlock()) endBlock(); - } -<DocScan>{BN}+/\n { - outDoc->writeChar(' '); - } -<DocScan>\n?{B}* { - outDoc->writeChar(' '); - } -<DocCode,DocEmphasis,DocBold,DocScan,Text>[a-z_A-Z0-9]+ { - outDoc->docify(yytext); - } -<DocCode,DocEmphasis,DocBold,DocScan,Text>. { - outDoc->writeChar(*yytext); - } <NextSemi>"{" { curlyCount=0; BEGIN(SkipCurlyBlock); @@ -2697,19 +831,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") else BEGIN( EndTemplate ); } - /* -<SkipTemplate>"<" { - sharpCount++; - } -<SkipTemplate>">" { - if (--sharpCount<=0) - { - BEGIN(FindMembers); - } - } -<SkipTemplate>. - */ - <EndTemplate>"<" { 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); } <AfterDoc,AfterDocLine,LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{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); } <TodoParam>\n | @@ -4807,11 +2930,13 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") <Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief>{CMD}"f$" { lastFormulaContext = YY_START; formulaText="$"; + insideFormula=TRUE; BEGIN(ReadFormulaShort); } <Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief>{CMD}"f[" { lastFormulaContext = YY_START; formulaText="\\["; + insideFormula=TRUE; BEGIN(ReadFormulaLong); } <ReadFormulaShort>{CMD}"f$" { @@ -4825,8 +2950,20 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") current->brief += addFormula(); else current->doc += addFormula(); + insideFormula=FALSE; BEGIN(lastFormulaContext); } +<ReadFormulaShort>\n { + formulaText+=" "; + if (lastFormulaContext==LineDoc || + lastFormulaContext==AfterDocLine + ) + { + checkFormula(); + insideFormula=FALSE; + BEGIN(lastFormulaContext); + } + } <ReadFormulaLong>{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); } <ReadFormulaLong,ReadFormulaShort>. { formulaText+=*yytext; } -<ExampleDoc,PageDoc,ClassDocBrief,SkipCode,ClassDoc>{B}*"*/" { +<ExampleDoc,PageDoc,ClassDocBrief,SkipCode,ClassDoc,ReadFormulaShort,ReadFormulaLong>{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.<p>\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:" + "<p><center><img src=\"graph_legend.gif\"></center>\n" + "<p>\n" + "Les rectangles du graphe ci-dessus ont la signification suivante:\n" + "<ul>\n" + "<li>Un rectangle plein noir représente la structure ou la classe pour laquelle " + "le graphe est généré.\n" + "<li>Un rectangle avec un bord noir indique une classe ou une structure documentée.\n" + "<li>Un rectangle avec un bord gris indique une classe ou une structure non documentée.\n" + "<li>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." + "</ul>\n" + "Les flèches ont la signification suivante:\n" + "<ul>\n" + "<li>Une flèche bleu foncé est utilisée pour visuliser une relation d'héritage public " + "entre deux classes.\n" + "<li>Une flèche vert foncé est utilisée pour une relation d'héritage protégé.\n" + "<li>Une flèche rouge foncé est utilisée pour une relation d'héritage privé.\n" + "<li>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" + "</ul>\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 <unistd.h> @@ -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",mdist<maxInheritanceDepth); @@ -1624,164 +1683,160 @@ bool getDefs(const QCString &scName,const QCString &memberName, // unknown or undocumented scope } - else // maybe an namespace, file or group member ? + + // maybe an namespace, file or group member ? + //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 { - //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)) @@ -23,8 +23,6 @@ #include <qtextstream.h> #include <ctype.h> -#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); |