diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.h | 3 | ||||
-rw-r--r-- | src/config.l | 125 | ||||
-rw-r--r-- | src/dot.cpp | 29 | ||||
-rw-r--r-- | src/doxygen.cpp | 21 | ||||
-rw-r--r-- | src/doxygen.h | 2 | ||||
-rw-r--r-- | src/doxygen.pro.in | 2 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 4 | ||||
-rw-r--r-- | src/htmlgen.h | 8 | ||||
-rw-r--r-- | src/language.cpp | 5 | ||||
-rw-r--r-- | src/latexgen.cpp | 92 | ||||
-rw-r--r-- | src/latexgen.h | 4 | ||||
-rw-r--r-- | src/memberdef.cpp | 32 | ||||
-rw-r--r-- | src/memberdef.h | 5 | ||||
-rw-r--r-- | src/memberlist.cpp | 2 | ||||
-rw-r--r-- | src/membername.cpp | 8 | ||||
-rw-r--r-- | src/membername.h | 6 | ||||
-rw-r--r-- | src/outputlist.cpp | 10 | ||||
-rw-r--r-- | src/outputlist.h | 1 | ||||
-rw-r--r-- | src/pre.l | 6 | ||||
-rw-r--r-- | src/scanner.l | 35 | ||||
-rw-r--r-- | src/translator_de.h | 2 | ||||
-rw-r--r-- | src/util.cpp | 43 |
23 files changed, 368 insertions, 79 deletions
diff --git a/src/config.h b/src/config.h index e54866a..05670e9 100644 --- a/src/config.h +++ b/src/config.h @@ -26,6 +26,8 @@ extern void parseConfig(const QCString &config); extern void writeTemplateConfig(QFile *f,bool shortList); extern void checkConfig(); +extern void configStrToVal(); +extern void substituteEnvironmentVars(); struct Config { @@ -68,6 +70,7 @@ struct Config static QStrList predefined; // list of predefined macro names. static QStrList extraPackageList; // list of extra LaTeX packages. static QStrList stripFromPath; // list of candidates to strip from the file path + static QStrList sectionFilterList; // list of section filters to are enabled static bool quietFlag; // generate progress messages flag static bool warningFlag; // generate warnings flag static bool recursiveFlag; // scan directories recursively diff --git a/src/config.l b/src/config.l index b8e92a8..a806aa7 100644 --- a/src/config.l +++ b/src/config.l @@ -28,6 +28,7 @@ #include <qfileinfo.h> #include <qdir.h> #include <qtextstream.h> +#include <qregexp.h> #include "config.h" #include "version.h" @@ -57,6 +58,7 @@ void warn(const char *fmt, ...) #endif #define YY_NEVER_INTERACTIVE 1 +#define YY_NO_UNPUT /* ----------------------------------------------------------------- * @@ -100,6 +102,7 @@ QStrList Config::extDocPathList; QStrList Config::predefined; QStrList Config::extraPackageList; QStrList Config::stripFromPath; +QStrList Config::sectionFilterList; bool Config::quietFlag = FALSE; bool Config::recursiveFlag = FALSE; bool Config::allExtFlag = FALSE; @@ -162,7 +165,7 @@ static QCString * s=0; static bool * b=0; static QStrList * l=0; static int lastState; -static int lastEnvState; +//static int lastEnvState; static QCString elemStr; static QCString tabSizeString; static QCString colsInAlphaIndexString; @@ -238,6 +241,7 @@ static int yyread(char *buf,int max_size) <Start>"PREDEFINED"[ \t]*"=" { BEGIN(GetStrList); l=&Config::predefined; l->clear(); elemStr=""; } <Start>"EXTRA_PACKAGES"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extraPackageList; l->clear(); elemStr=""; } <Start>"STRIP_FROM_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&Config::stripFromPath; l->clear(); elemStr=""; } +<Start>"ENABLED_SECTIONS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::sectionFilterList; l->clear(); elemStr=""; } <Start>"QUIET"[ \t]*"=" { BEGIN(GetBool); b=&Config::quietFlag; } <Start>"WARNINGS"[ \t]*"=" { BEGIN(GetBool); b=&Config::warningFlag; } <Start>"RECURSIVE"[ \t]*"=" { BEGIN(GetBool); b=&Config::recursiveFlag; } @@ -283,6 +287,7 @@ static int yyread(char *buf,int max_size) <Start>"SHOW_INCLUDE_FILES"[ \t]*"=" { BEGIN(GetBool); b=&Config::showIncFileFlag; } <Start>"STRIP_CODE_COMMENTS"[ \t]*"=" { BEGIN(GetBool); b=&Config::stripCommentsFlag; } <Start>"SORT_MEMBER_DOCS"[ \t]*"=" { BEGIN(GetBool); b=&Config::sortMembersFlag; } +<Start>"LATEX_BATCHMODE"[ \t]*"=" { BEGIN(GetBool); b=&Config::latexBatchModeFlag; } <Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); } <GetString,GetBool>\n { yyLineNr++; BEGIN(Start); } <GetStrList>\n { @@ -302,11 +307,12 @@ static int yyread(char *buf,int max_size) } elemStr.resize(0); } -<GetString>[^ \"\$\t\r\n]+ { (*s)+=yytext; } +<GetString>[^ \"\t\r\n]+ { (*s)+=yytext; } <GetString,GetStrList>"\"" { lastState=YY_START; BEGIN(GetQuotedString); tmpString.resize(0); } + /* <GetString,GetStrList,GetQuotedString>"\$\(" { //printf(">> Enter env\n"); lastEnvState=YY_START; @@ -321,6 +327,7 @@ static int yyread(char *buf,int max_size) for (i=l-1;i>=0;i--) unput(env[i]); BEGIN(lastEnvState); } + */ <GetQuotedString>"\""|"\n" { //printf("Quoted String = `%s'\n",tmpString.data()); if (lastState==GetString) @@ -353,7 +360,7 @@ static int yyread(char *buf,int max_size) bs.data(),yyLineNr); } } -<GetStrList>[^ \#\"\$\t\r\n]+ { +<GetStrList>[^ \#\"\t\r\n]+ { elemStr+=yytext; } <SkipComment>\n { yyLineNr++; BEGIN(Start); } @@ -455,6 +462,7 @@ void Config::init() Config::predefined.clear(); Config::extraPackageList.clear(); Config::stripFromPath.clear(); + Config::sectionFilterList.clear(); Config::tabSize=8; Config::colsInAlphaIndex=5; Config::quietFlag = FALSE; @@ -892,6 +900,16 @@ void writeTemplateConfig(QFile *f,bool sl) if (!sl) { t << "\n"; + t << "# The ENABLE_SECTIONS tag can be used to enable conditional\n"; + t << "# documentation sections, marked by \\if sectionname ... \\endif.\n"; + t << "\n"; + } + t << "ENABLED_SECTIONS = "; + writeStringList(t,Config::sectionFilterList); + t << "\n"; + if (!sl) + { + t << "\n"; } t << "#---------------------------------------------------------------------------\n"; t << "# configuration options related to the input files\n"; @@ -1224,10 +1242,7 @@ void writeTemplateConfig(QFile *f,bool sl) t << "# running if errors occur, instead of asking the user for help.\n"; t << "# This option is also used when generating formulas in HTML.\n"; } - if (!sl) - { - t << "LATEX_BATCHMODE = "; - } + t << "LATEX_BATCHMODE = "; writeBoolValue(t,Config::latexBatchModeFlag); t << "\n"; t << "#---------------------------------------------------------------------------\n"; @@ -1574,13 +1589,8 @@ void writeTemplateConfig(QFile *f,bool sl) t << "\n"; } -void checkConfig() +void configStrToVal() { - //if (!projectName.isEmpty()) - //{ - // projectName[0]=toupper(projectName[0]); - //} - if (tabSizeString.isEmpty()) { Config::tabSize=8; @@ -1613,7 +1623,94 @@ void checkConfig() } Config::colsInAlphaIndex=cols; } - +} + +static void substEnvVarsInString(QCString &s) +{ + QRegExp re("\\$([a-z_A-Z0-9]+)"); + int p=0; + int i,l; + //printf("substEnvVarInString(%s) start\n",s.data()); + while ((i=re.match(s,p,&l))!=-1) + { + //printf("Found environment var s.mid(%d,%d)=`%s'\n",i+2,l-3,s.mid(i+2,l-3).data()); + const char *env=getenv(s.mid(i+2,l-3)); + s = s.left(i)+QCString(env)+s.right(s.length()-i-l); + p=i+l; + } + //printf("substEnvVarInString(%s) end\n",s.data()); +} + +static void substEnvVarsInStrList(QStrList &sl) +{ + char *s = sl.first(); + while (s) + { + QCString result(s); + substEnvVarsInString(result); + + // replace the string in the list and go to the next item. + sl.insert(sl.at(),result); // insert new item before current item. + sl.next(); // current item is now the old item + int i=sl.at(); + sl.remove(); // current item index changes if the last element is removed. + if (sl.at()==i) // not last item + s = sl.current(); + else // just removed last item + s = 0; + } +} + + +void substituteEnvironmentVars() +{ + substEnvVarsInString( Config::projectName ); + substEnvVarsInString( Config::projectNumber ); + substEnvVarsInString( Config::outputDir ); + substEnvVarsInString( Config::htmlOutputDir ); + substEnvVarsInString( Config::latexOutputDir ); + substEnvVarsInString( Config::manOutputDir ); + substEnvVarsInString( Config::rtfOutputDir ); + substEnvVarsInString( Config::outputLanguage ); + substEnvVarsInString( Config::headerFile ); + substEnvVarsInString( Config::latexHeaderFile ); + substEnvVarsInString( Config::footerFile ); + substEnvVarsInString( Config::cgiName ); + substEnvVarsInString( Config::cgiURL ); + substEnvVarsInString( Config::docURL ); + substEnvVarsInString( Config::binAbsPath ); + substEnvVarsInString( Config::docAbsPath ); + substEnvVarsInString( Config::perlPath ); + substEnvVarsInString( Config::genTagFile ); + substEnvVarsInString( Config::inputFilter ); + substEnvVarsInString( Config::paperType ); + substEnvVarsInString( Config::manExtension ); + substEnvVarsInString( Config::htmlStyleSheet ); + substEnvVarsInStrList( Config::ignorePrefixList ); + substEnvVarsInStrList( Config::includePath ); + substEnvVarsInStrList( Config::examplePath ); + substEnvVarsInStrList( Config::imagePath ); + substEnvVarsInStrList( Config::inputSources ); + substEnvVarsInStrList( Config::excludeSources ); + substEnvVarsInStrList( Config::filePatternList ); + substEnvVarsInStrList( Config::excludePatternList ); + substEnvVarsInStrList( Config::examplePatternList ); + substEnvVarsInStrList( Config::imagePatternList ); + substEnvVarsInStrList( Config::tagFileList ); + substEnvVarsInStrList( Config::extDocPathList ); + substEnvVarsInStrList( Config::predefined ); + substEnvVarsInStrList( Config::extraPackageList ); + substEnvVarsInStrList( Config::stripFromPath ); + substEnvVarsInStrList( Config::sectionFilterList ); +} + +void checkConfig() +{ + //if (!projectName.isEmpty()) + //{ + // projectName[0]=toupper(projectName[0]); + //} + // set default man page extension if non is given by the user if (Config::manExtension.isEmpty()) { diff --git a/src/dot.cpp b/src/dot.cpp index e1e31c2..724c549 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -273,8 +273,11 @@ void DotNode::deleteNode() void DotNode::writeBox(QTextStream &t,bool hasNonReachableChildren) { - const char *labCol = (hasNonReachableChildren) ? "red" : - (m_url.isEmpty() ? "grey" : "black"); + const char *labCol = + m_url.isEmpty() ? "grey" : // non link + ( + (hasNonReachableChildren) ? "red" : "black" + ); t << " Node" << m_number << " [shape=\"box\",label=\"" << m_label << "\",fontsize=10,height=0.2,width=0.4,fontname=\"doxfont\""; t << ",color=\"" << labCol << "\""; @@ -528,10 +531,23 @@ void DotGfxHierarchyTable::addHierarchy(DotNode *n,ClassDef *cd,bool hideSuper) if (bClass->isVisibleInHierarchy() && hasVisibleRoot(bClass->baseClasses())) { DotNode *bn; - //printf("Found visible class=`%s'\n",bClass->name().data()); + //printf("Node `%s' Found visible class=`%s'\n",n->m_label.data(), + // bClass->name().data()); if ((bn=m_usedNodes->find(bClass->name()))) // node already present { - if (n->m_children==0 || n->m_children->findRef(bn)==0) // no arrow yet + //printf("Base node `%s'\n",bn->m_label.data()); + //if (n->m_children) + //{ + // QListIterator<DotNode> dnli(*n->m_children); + // DotNode *cn; + // for (dnli.toFirst();(cn=dnli.current());++dnli) + // { + // printf("Child node `%s'\n",cn->m_label.data()); + // } + // printf("ref node = %p\n",n->m_children->findRef(bn)); + //} + + if (n->m_children==0 || n->m_children->findRef(bn)==-1) // no arrow yet { n->addChild(bn,bcd->prot); bn->addParent(n); @@ -542,6 +558,10 @@ void DotGfxHierarchyTable::addHierarchy(DotNode *n,ClassDef *cd,bool hideSuper) // bn->m_parents ? bn->m_parents->count() : 0 // ); } + //else + //{ + // printf("Class already has an arrow!\n"); + //} } else { @@ -598,6 +618,7 @@ DotGfxHierarchyTable::DotGfxHierarchyTable() (cd->getReference()+"$"+cd->getOutputFileBase()).data() : 0 ); + //m_usedNodes->clear(); m_usedNodes->insert(cd->name(),n); m_rootNodes->insert(0,n); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 2cb5483..94b25b4 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -84,7 +84,7 @@ StringDict excludeNameDict(1009); // sections FileNameDict includeNameDict(1009); // include names FileNameDict exampleNameDict(1009); // examples FileNameDict imageNameDict(257); // images -DefineDict defineDict(10007); // all defines +//DefineDict defineDict(10007); // all defines StringDict typedefDict(1009); // all typedefs GroupDict groupDict(257); // all groups FormulaDict formulaDict(1009); // all formulas @@ -122,7 +122,7 @@ void clearAll() includeNameDict.clear(); exampleNameDict.clear(); imageNameDict.clear(); - defineDict.clear(); + //defineDict.clear(); typedefDict.clear(); groupDict.clear(); formulaDict.clear(); @@ -475,7 +475,6 @@ static void addMemberToGroups(Entry *root,MemberDef *md) } } - //---------------------------------------------------------------------- // build a list of all classes mentioned in the documentation // and all classes that have a documentation block before their definition. @@ -956,7 +955,11 @@ static MemberDef *addVariableToFile(Entry *root,MemberDef::MemberType mtype, NamespaceDef *nd = 0; if (!scope.isEmpty()) { - nd = namespaceDict[scope]; + QCString nscope=removeAnnonymousScopes(scope); + if (!nscope.isEmpty()) + { + nd = namespaceDict[nscope]; + } } if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') { @@ -3516,7 +3519,7 @@ void generateFileDocs() { fd->writeDocumentation(*outputList); } - if (src && !fd->isReference()) // TODO: can this be TRUE for tag files? + if (src && !fd->isReference()) { fd->writeSource(*outputList); } @@ -3739,6 +3742,7 @@ void findDefineDocumentation(Entry *root) bool ambig; md->setBodyDef(findFileDef(&inputNameDict,root->fileName,ambig)); md->addSectionsToDefinition(root->anchors); + addMemberToGroups(root,md); } md=mn->next(); } @@ -3769,6 +3773,7 @@ void findDefineDocumentation(Entry *root) bool ambig; md->setBodyDef(findFileDef(&inputNameDict,root->fileName,ambig)); md->addSectionsToDefinition(root->anchors); + addMemberToGroups(root,md); } } md=mn->next(); @@ -3969,7 +3974,9 @@ void buildExampleList(Entry *root) else { PageInfo *pi=new PageInfo(root->name,root->doc,root->args); - setFileNameForSections(root->anchors,root->name); + setFileNameForSections(root->anchors, + convertSlashes(pi->name,TRUE)+"-example" + ); exampleList.inSort(pi); exampleDict.insert(root->name,pi); } @@ -4788,6 +4795,7 @@ int main(int argc,char **argv) } parseConfig(config); + configStrToVal(); if (updateConfig) { @@ -4795,6 +4803,7 @@ int main(int argc,char **argv) exit(1); } + substituteEnvironmentVars(); checkConfig(); /************************************************************************** diff --git a/src/doxygen.h b/src/doxygen.h index 626d174..6c620a0 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -97,7 +97,7 @@ extern MemberNameDict functionNameDict; extern StringDict substituteDict; extern FileList fileList; extern FileDict fileDict; -extern DefineDict defineDict; +//extern DefineDict defineDict; extern ClassDef unrelatedClass; extern QTextStream tagFile; extern SectionDict sectionDict; diff --git a/src/doxygen.pro.in b/src/doxygen.pro.in index fdda348..9bc1d0a 100644 --- a/src/doxygen.pro.in +++ b/src/doxygen.pro.in @@ -24,7 +24,7 @@ HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \ namespacedef.h version.h language.h translator.h \ translator_nl.h translator_se.h translator_cz.h translator_fr.h \ translator_it.h formula.h debug.h membergroup.h htmlhelp.h \ - dot.h rtfgen.h + translator_ru.h dot.h rtfgen.h SOURCES = doxygen.cpp scanner.cpp classdef.cpp classlist.cpp memberdef.cpp \ membername.cpp index.cpp memberlist.cpp \ entry.cpp logos.cpp instdox.cpp message.cpp code.cpp \ diff --git a/src/filedef.cpp b/src/filedef.cpp index e6409da..7d45336 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -53,7 +53,7 @@ FileDef::FileDef(const char *p,const char *nm,const char *ref) srcDefDict = 0; srcAnchorDict = 0; usingList = 0; - isSource = Config::extractAllFlag; + isSource = FALSE; /*Config::extractAllFlag*/; docname = nm; if (Config::fullPathNameFlag) { diff --git a/src/groupdef.cpp b/src/groupdef.cpp index a4d7924..925dd78 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -139,6 +139,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startMemberHeader(); parseText(ol,theTranslator->trFiles()); ol.endMemberHeader(); + ol.startMemberList(); FileDef *fd=fileList->first(); while (fd) { @@ -156,6 +157,7 @@ void GroupDef::writeDocumentation(OutputList &ol) } fd=fileList->next(); } + ol.endMemberList(); } if (classList->count()>0) { @@ -168,6 +170,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.startMemberHeader(); parseText(ol,theTranslator->trCompounds()); ol.endMemberHeader(); + ol.startMemberList(); found=TRUE; } QCString type; @@ -193,6 +196,7 @@ void GroupDef::writeDocumentation(OutputList &ol) } cd=classList->next(); } + if (found) ol.endMemberList(); } if (allMemberList->count()>0) { diff --git a/src/htmlgen.h b/src/htmlgen.h index 65ede84..24a42fc 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -107,7 +107,13 @@ class HtmlGenerator : public OutputGenerator void writeAnchor(const char *name) { t << "<a name=\"" << name <<"\"></a>"; } void startCodeFragment() { t << "<div class=\"fragment\"><pre>"; } - void endCodeFragment() { t << "</div></pre>"; } + void endCodeFragment() { t << "</div></pre>"; } // <- I know this is + // ordered the wrong + // way, but it is + // the only way I know + // to prevent an extra + // blank line + // (with netscape) void startCodeLine() { col=0; } void endCodeLine() { codify("\n"); } void writeBoldString(const char *text) diff --git a/src/language.cpp b/src/language.cpp index 771d4be..17f0640 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -25,6 +25,7 @@ #include "translator_jp.h" #include "translator_es.h" #include "translator_fi.h" +#include "translator_ru.h" #endif #define L_EQUAL(a) !stricmp(langName,a) @@ -74,6 +75,10 @@ bool setTranslator(const char *langName) { theTranslator=new TranslatorFinnish; } + else if (L_EQUAL("russian")) + { + theTranslator=new TranslatorRussian; + } #endif else // use the default language (i.e. english) { diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 491530a..1e36877 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -177,10 +177,10 @@ void LatexGenerator::startIndexSection(IndexSections is) t << "}\n"; if (Config::paperType=="a4wide") t << "\\usepackage{a4wide}\n"; t << "\\usepackage{makeidx}\n" - "\\usepackage{fancyheadings}\n" - "\\usepackage{epsfig}\n" - "\\usepackage{float}\n" - "\\usepackage{doxygen}\n"; + "\\usepackage{fancyheadings}\n" + "\\usepackage{epsfig}\n" + "\\usepackage{float}\n" + "\\usepackage{doxygen}\n"; if (Config::pdfHyperFlag) { t << "\\usepackage{times}" << endl @@ -192,8 +192,13 @@ void LatexGenerator::startIndexSection(IndexSections is) } if (!theTranslator->latexBabelPackage().isEmpty()) { + if (theTranslator->latexBabelPackage()=="russian") + { + t << "\\usepackage{inputenc}\n"; + } t << "\\usepackage[" << theTranslator->latexBabelPackage() << "]{babel}\n"; } + const char *s=Config::extraPackageList.first(); while (s) { @@ -619,24 +624,24 @@ void LatexGenerator::writeStyleInfo(int part) t << "\\setlength{\\parindent}{0cm}\n"; t << "\\setlength{\\parskip}{0.2cm}\n"; t << "\\addtocounter{secnumdepth}{1}\n"; - if (!Config::compactLatexFlag) - { - t << "\\renewcommand{\\subsection}{\\@startsection{subsection}{2}{\\z@}\n"; - t << " {-3.25ex \\@plus -1ex \\@minus -.2ex}\n"; - t << " {1.5ex \\@plus.2ex}\n"; - t << " {\\normalfont\\large\\bfseries\\medskip\n"; - t << " \\vspace{0.6cm}\\hrule\\vspace{-0.6cm}}\n"; - t << " }\n"; - } - else - { - t << "\\renewcommand{\\subsubsection}{\\@startsection{subsubsection}{3}{\\z@}\n"; - t << " {-3.25ex \\@plus -1ex \\@minus -.2ex}\n"; - t << " {1.5ex \\@plus.2ex}\n"; - t << " {\\normalfont\\normalsize\\bfseries\\medskip\n"; - t << " \\vspace{0.6cm}\\hrule\\vspace{-0.6cm}}\n"; - t << " }\n"; - } + //if (!Config::compactLatexFlag) + //{ + // t << "\\renewcommand{\\subsection}{\\@startsection{subsection}{2}{\\z@}\n"; + // t << " {-3.25ex \\@plus -1ex \\@minus -.2ex}\n"; + // t << " {1.5ex \\@plus.2ex}\n"; + // t << " {\\normalfont\\large\\bfseries\\medskip\n"; + // t << " \\vspace{0.6cm}\\hrule\\vspace{-0.6cm}}\n"; + // t << " }\n"; + //} + //else + //{ + // t << "\\renewcommand{\\subsubsection}{\\@startsection{subsubsection}{3}{\\z@}\n"; + // t << " {-3.25ex \\@plus -1ex \\@minus -.2ex}\n"; + // t << " {1.5ex \\@plus.2ex}\n"; + // t << " {\\normalfont\\normalsize\\bfseries\\medskip\n"; + // t << " \\vspace{0.6cm}\\hrule\\vspace{-0.6cm}}\n"; + // t << " }\n"; + //} t << "\\sloppy\n"; endPlainFile(); } @@ -678,19 +683,25 @@ void LatexGenerator::writeIndexItem(const char *ref,const char *fn, void LatexGenerator::writeHtmlLink(const char *url,const char *text) { + if (Config::pdfHyperFlag) + { + t << "\\href{"; + t << url; + t << "}"; + } t << "{\\tt "; docify(text); t << "}"; - if (url) - { - // t << " {\\tt ("; - // docify(url); - // t << ")}"; - } } void LatexGenerator::writeMailLink(const char *url) { + if (Config::pdfHyperFlag) + { + t << "\\href{mailto:"; + t << url; + t << "}"; + } t << "{\\tt "; docify(url); t << "}"; @@ -817,6 +828,16 @@ void LatexGenerator::endGroupHeader() t << "}" << endl; } +void LatexGenerator::startMemberHeader() +{ + if (Config::compactLatexFlag) t << "\\subsubsection*{"; else t << "\\subsection*{"; +} + +void LatexGenerator::endMemberHeader() +{ + t << "}" << endl; +} + void LatexGenerator::startMemberDoc(const char *clname, const char *memname, const char *, @@ -942,6 +963,7 @@ void LatexGenerator::writeSectionRefAnchor(const char *,const char *lab, void LatexGenerator::docify(const char *str) { static bool isJapanese = theTranslator->latexBabelPackage()=="a4j"; + static bool isRussian = theTranslator->latexBabelPackage()=="russian"; if (str) { const unsigned char *p=(const unsigned char *)str; @@ -1009,7 +1031,19 @@ void LatexGenerator::docify(const char *str) t << (char)c; } } - else // language is other than japanese + else if (isRussian) + { + if (c>=128) + { + t << (char)c; + } + else + { + if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; + t << (char)c; + } + } + else // language is other than russian or japanese { switch(c) { diff --git a/src/latexgen.h b/src/latexgen.h index ba46e9f..8aaf8b7 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -85,8 +85,8 @@ class LatexGenerator : public OutputGenerator void startMemberSections() {} void endMemberSections() {} - void startMemberHeader() { startGroupHeader(); } - void endMemberHeader() { endGroupHeader(); } + void startMemberHeader(); + void endMemberHeader(); void startMemberSubtitle() {} void endMemberSubtitle() {} void startMemberList(); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 67a3dd3..b4fdc2d 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -99,11 +99,24 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, } } //printf("~~~ %s cName=%s\n",md->name().data(),cName.data()); + + // You can set the next to TRUE to experiment with multiline parameter lists. + // I'll add this in some form in a future release. + bool multiLineArgs = FALSE; /* argList->count()>2; */ while (a) { QRegExp re(")("); int vp; - if (!a->attrib.isEmpty()) + if (multiLineArgs) + { + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + ol.lineBreak(); + ol.writeNonBreakableSpace(); + ol.writeNonBreakableSpace(); + ol.popGeneratorState(); + } + if (!a->attrib.isEmpty()) // argument has an IDL attribute { ol.docify(a->attrib+" "); } @@ -149,6 +162,13 @@ static void writeDefArgumentList(OutputList &ol,ClassDef *cd, a=argList->next(); if (a) ol.docify(", "); // there are more arguments } + if (multiLineArgs) + { + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + ol.lineBreak(); + ol.popGeneratorState(); + } ol.docify(")"); // end argument list if (argList->constSpecifier) { @@ -746,7 +766,7 @@ void MemberDef::writeDeclaration(OutputList &ol, { ol.startMemberDescription(); parseDoc(ol,cname,name(),briefDescription()); - if (!documentation().isEmpty()) + if (/*!documentation().isEmpty()*/ detailsAreVisible()) { ol.disableAllBut(OutputGenerator::Html); ol.endEmphasis(); @@ -1297,7 +1317,8 @@ bool MemberDef::detailsAreVisible() const (!Config::briefMemDescFlag || Config::alwaysDetailsFlag) && Config::repeatBriefFlag // has brief description inside detailed area ) || - (initLines>0 && initLines<maxInitLines) + (initLines>0 && initLines<maxInitLines) || + (argList!=0 && argList->hasDocumentation()) ; } @@ -1305,3 +1326,8 @@ void MemberDef::setEnumDecl(OutputList &ed) { enumDeclList=new OutputList(&ed); } + +bool MemberDef::hasDocumentation() +{ + return Definition::hasDocumentation() || (argList!=0 && argList->hasDocumentation()); +} diff --git a/src/memberdef.h b/src/memberdef.h index 2cce60d..928c039 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -109,9 +109,7 @@ class MemberDef : public Definition void setMemberClass(ClassDef *cd) { classDef=cd; } void makeRelated() { related=TRUE; } void setGroupDef(GroupDef *gd) { group=gd; } - bool hasDocumentation() // overrides hasDocumentation in definition.h - { return Definition::hasDocumentation(); } - + bool hasDocumentation(); // overrides hasDocumentation in definition.h bool isLinkableInProject(); bool isLinkable(); @@ -242,6 +240,7 @@ class MemberDef : public Definition int grpId; // group id QCString grpHeader; // group header MemberGroup *memberGroup; // group's member definition + GroupDef *group; // group in which this member is in // disable copying of member defs diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 03c1d14..1e3057f 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -38,7 +38,7 @@ int MemberList::compareItems(GCI item1, GCI item2) { MemberDef *c1=(MemberDef *)item1; MemberDef *c2=(MemberDef *)item2; - return stricmp(c1->name(),c2->name()); + return strcmp(c1->name(),c2->name()); } void MemberList::countDecMembers() diff --git a/src/membername.cpp b/src/membername.cpp index ff72448..676f149 100644 --- a/src/membername.cpp +++ b/src/membername.cpp @@ -37,9 +37,9 @@ int MemberName::compareItems(GCI item1, GCI item2) FileDef *f1=m1->getFileDef(); FileDef *f2=m2->getFileDef(); if (c1 && c2) - return stricmp(c1->name(),c2->name()); + return strcmp(c1->name(),c2->name()); else if (f1 && f2) - return stricmp(f1->name(),f2->name()); + return strcmp(f1->name(),f2->name()); else return 0; } @@ -59,9 +59,9 @@ int MemberNameInfo::compareItems(GCI item1, GCI item2) FileDef *f1=m1->memberDef->getFileDef(); FileDef *f2=m2->memberDef->getFileDef(); if (c1 && c2) - return stricmp(c1->name(),c2->name()); + return strcmp(c1->name(),c2->name()); else if (f1 && f2) - return stricmp(f1->name(),f2->name()); + return strcmp(f1->name(),f2->name()); else return 0; } diff --git a/src/membername.h b/src/membername.h index 5477e0f..3491de3 100644 --- a/src/membername.h +++ b/src/membername.h @@ -92,9 +92,9 @@ class MemberNameInfoList : public QList<MemberNameInfo> ~MemberNameInfoList() {} int compareItems(GCI item1,GCI item2) { return stricmp( - ((MemberNameInfo *)item1)->memberName(), - ((MemberNameInfo *)item2)->memberName() - ); + ((MemberNameInfo *)item1)->memberName(), + ((MemberNameInfo *)item2)->memberName() + ); } }; diff --git a/src/outputlist.cpp b/src/outputlist.cpp index b404210..22a8008 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -110,6 +110,16 @@ void OutputList::enableAll() } } +void OutputList::disableAll() +{ + OutputGenerator *og=outputs->first(); + while (og) + { + og->disable(); + og=outputs->next(); + } +} + void OutputList::disable(OutputGenerator::OutputType o) { OutputGenerator *og=outputs->first(); diff --git a/src/outputlist.h b/src/outputlist.h index c3ac2a2..71388f4 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -49,6 +49,7 @@ class OutputList void disableAllBut(OutputGenerator::OutputType o); void enableAll(); + void disableAll(); void disable(OutputGenerator::OutputType o); void enable(OutputGenerator::OutputType o); bool isEnabled(OutputGenerator::OutputType o); @@ -779,8 +779,8 @@ void addDefine() mn->append(md); if (g_yyFileDef) g_yyFileDef->insertMember(md); - Define *d; - if ((d=defineDict[g_defName])==0) defineDict.insert(g_defName,newDefine()); + //Define *d; + //if ((d=defineDict[g_defName])==0) defineDict.insert(g_defName,newDefine()); } static void outputChar(char c) @@ -1659,7 +1659,7 @@ void initPreprocessor() addSearchDir("."); //defineNameList.setAutoDelete(TRUE); //defineNameList.clear(); - defineDict.clear(); + //defineDict.clear(); //fileDefineCache = new DefineCache(1009); g_expandedDict = new DefineDict(17); g_fileDefineDict = new DefineDict(1009); diff --git a/src/scanner.l b/src/scanner.l index 6868c56..c5dc210 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -151,6 +151,7 @@ static QCString formulaText; static QCString sectionRef; static bool insideIDL = FALSE; static bool insideCppQuote = FALSE; +static int depthIf; // state variable for reading the argument list of a function static int argRoundCount; @@ -1001,6 +1002,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") %x DocEmphasis %x DocBold %x DocCode +%x DocIf %x DocCodeBlock %x DocInternal %x DocLink @@ -1584,6 +1586,29 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") <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("Warning: documentation block contains \\endif without " + "matching \\if found in documentation of %s!",refName.data()); + } + else + { + outDoc->popGeneratorState(); + } + } +<DocIf>[^\n\t ]+ { + if (Config::sectionFilterList.find(yytext)==-1) + { + outDoc->disableAll(); + } + BEGIN(DocScan); + } <DocRefName>{SCOPENAME} { QCString ref=yytext; SectionInfo *sec; @@ -4153,7 +4178,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") ); BEGIN(lastMemberGroupContext); } -<Doc,PageDoc,JavaDoc,ClassDoc>{CMD}"anchor"{B}+ { +<ExampleDoc,Doc,PageDoc,JavaDoc,ClassDoc>{CMD}"anchor"{B}+ { lastAnchorContext = YY_START; sectionType=SectionInfo::Anchor; BEGIN(AnchorLabel); @@ -4261,7 +4286,8 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") <ExampleDoc,PageDoc,ClassDoc>[a-z_A-Z0-9 \t]+ { current->doc += yytext; } <ExampleDoc,PageDoc,ClassDoc>. { current->doc += yytext; } <Doc,JavaDoc,LineDoc,ExampleDoc,PageDoc,ClassDoc>^{B}*"//" -<Doc,JavaDoc,LineDoc,ExampleDoc,PageDoc,ClassDoc>"//" { current->doc += yytext; } +<Doc,ExampleDoc,PageDoc,ClassDoc>"//" { current->doc += yytext; } +<LineDoc,JavaDoc>"//" { current->brief += yytext; } <Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc>("\\\\"|"@@")"f"[$\[\]] { current->doc += &yytext[1]; } @@ -4695,6 +4721,7 @@ void parseDocument(OutputList &ol,const QCString &docString) { //inParamBlock=inSeeBlock=inReturnBlock=FALSE; curTable = 0; + depthIf = 0; outDoc = new OutputList(&ol); currentIncludeFile.resize(0); includeFileOffset=0; @@ -4732,6 +4759,10 @@ void parseDocument(OutputList &ol,const QCString &docString) "of a list (indent level %d)!\n",currentListIndentLevel); } } + if (depthIf!=0) + { + warn("Warning: Documentation block contains \\if without matching \\endif: %d\n",depthIf); + } ol+=*outDoc; delete outDoc; outDoc=0; return; diff --git a/src/translator_de.h b/src/translator_de.h index 0aa93b3..d39b07c 100644 --- a/src/translator_de.h +++ b/src/translator_de.h @@ -402,7 +402,7 @@ class TranslatorGerman : public Translator QCString trNamespaceList() // used as the title of page containing all the index of all namespaces. - { return ""; } + { return "Liste der Namensbereiche"; } QCString trNamespaceListDescription(bool extractAll) // used as an introduction to the namespace list { diff --git a/src/util.cpp b/src/util.cpp index 7089526..de35573 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -845,6 +845,45 @@ static QCString trimBaseClassScope(BaseClassList *bcl,const QCString &s,int leve return s; } +/*! if either t1 or t2 contains a namespace scope, then remove that + * scope. If neither or both have a namespace scope, t1 and t2 remain + * unchanged. + */ +static void trimNamespaceScope(QCString &t1,QCString &t2) +{ + int p1=t1.length(); + int p2=t2.length(); + for (;;) + { + int i1=t1.findRev("::",p1); + int i2=t2.findRev("::",p2); + if (i1==-1 && i2==-1) + { + return; + } + if (i1!=-1 && i2==-1) // only t1 has a scope + { + QCString scope=t1.left(i1); + if (!scope.isEmpty() && namespaceDict[scope]!=0) // scope is a namespace + { + t1 = t1.right(t1.length()-i1-2); + return; + } + } + else if (i1==-1 && i2!=-1) // only t2 has a scope + { + QCString scope=t2.left(i2); + if (!scope.isEmpty() && namespaceDict[scope]!=0) // scope is a namespace + { + t2 = t2.right(t2.length()-i2-2); + return; + } + } + p1 = QMAX(i1-2,0); + p2 = QMAX(i2-2,0); + } +} + //---------------------------------------------------------------------- // Matches the arguments list srcAl with the argument list dstAl // Returns TRUE if the argument lists are equal. Two argument list are @@ -921,6 +960,10 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, { //printf("scope=`%s': `%s' <=> `%s'\n",className.data(),srcAType.data(),dstAType.data()); + // remove a namespace scope that is only in one type + // (assuming a using statement was used) + trimNamespaceScope(srcAType,dstAType); + QCString srcScope; QCString dstScope; |