diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2003-09-15 19:52:11 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2003-09-15 19:52:11 (GMT) |
commit | 640babbbb6882ce1b1e52563c0617e2f4213eeb8 (patch) | |
tree | bc73f10ae9a4b60f97e656106d08de380d012457 /src | |
parent | 79ad8414d813c1126e2807f4321ca4c70d6291fa (diff) | |
download | Doxygen-640babbbb6882ce1b1e52563c0617e2f4213eeb8.zip Doxygen-640babbbb6882ce1b1e52563c0617e2f4213eeb8.tar.gz Doxygen-640babbbb6882ce1b1e52563c0617e2f4213eeb8.tar.bz2 |
Release-1.3.3-20030915
Diffstat (limited to 'src')
-rw-r--r-- | src/cmdmapper.cpp | 2 | ||||
-rw-r--r-- | src/cmdmapper.h | 4 | ||||
-rw-r--r-- | src/compound.xsd | 1 | ||||
-rw-r--r-- | src/compound_xsd.h | 1 | ||||
-rw-r--r-- | src/docparser.cpp | 16 | ||||
-rw-r--r-- | src/docparser.h | 4 | ||||
-rw-r--r-- | src/doctokenizer.h | 1 | ||||
-rw-r--r-- | src/doctokenizer.l | 19 | ||||
-rw-r--r-- | src/dot.cpp | 36 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 62 | ||||
-rw-r--r-- | src/htmldocvisitor.h | 1 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 134 | ||||
-rw-r--r-- | src/latexdocvisitor.h | 3 | ||||
-rw-r--r-- | src/latexgen.cpp | 4 | ||||
-rw-r--r-- | src/mandocvisitor.cpp | 1 | ||||
-rw-r--r-- | src/perlmodgen.cpp | 1 | ||||
-rw-r--r-- | src/printdocvisitor.h | 2 | ||||
-rw-r--r-- | src/rtfdocvisitor.cpp | 57 | ||||
-rw-r--r-- | src/rtfdocvisitor.h | 1 | ||||
-rw-r--r-- | src/scanner.l | 70 | ||||
-rw-r--r-- | src/translator_fr.h | 56 | ||||
-rw-r--r-- | src/xmldocvisitor.cpp | 5 |
22 files changed, 377 insertions, 104 deletions
diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index f06c6f1..578af8c 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -101,6 +101,8 @@ CommandMap cmdMap[] = { "%", CMD_PERCENT }, { "~", CMD_LANGSWITCH }, { "_internalref", CMD_INTERNALREF }, + { "dot", CMD_DOT }, + { "enddot", CMD_ENDDOT }, { 0, 0 } }; diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 7623348..44e77ae 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -101,7 +101,9 @@ enum CommandType CMD_VERSION = 67 | SIMPLESECT_BIT, CMD_WARNING = 68 | SIMPLESECT_BIT, CMD_XREFITEM = 69 | SIMPLESECT_BIT, - CMD_XMLONLY = 70 + CMD_XMLONLY = 70, + CMD_DOT = 71, + CMD_ENDDOT = 72 }; enum HtmlTagType diff --git a/src/compound.xsd b/src/compound.xsd index 4937ff0..925f29e 100644 --- a/src/compound.xsd +++ b/src/compound.xsd @@ -313,6 +313,7 @@ <xsd:element name="small" type="docMarkupType" /> <xsd:element name="htmlonly" type="xsd:string" /> <xsd:element name="latexonly" type="xsd:string" /> + <xsd:element name="dot" type="xsd:string" /> <xsd:element name="anchor" type="docAnchorType" /> <xsd:element name="formula" type="docFormulaType" /> <xsd:element name="ref" type="docRefTextType" /> diff --git a/src/compound_xsd.h b/src/compound_xsd.h index 6ec95e1..f434aad 100644 --- a/src/compound_xsd.h +++ b/src/compound_xsd.h @@ -313,6 +313,7 @@ " <xsd:element name=\"small\" type=\"docMarkupType\" />\n" " <xsd:element name=\"htmlonly\" type=\"xsd:string\" />\n" " <xsd:element name=\"latexonly\" type=\"xsd:string\" />\n" +" <xsd:element name=\"dot\" type=\"xsd:string\" />\n" " <xsd:element name=\"anchor\" type=\"docAnchorType\" />\n" " <xsd:element name=\"formula\" type=\"docFormulaType\" />\n" " <xsd:element name=\"ref\" type=\"docRefTextType\" />\n" diff --git a/src/docparser.cpp b/src/docparser.cpp index a66f659..048448d 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -3686,12 +3686,22 @@ int DocPara::handleCommand(const QString &cmdName) doctokenizerYYsetStatePara(); } break; + case CMD_DOT: + { + doctokenizerYYsetStateDot(); + retval = doctokenizerYYlex(); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Dot,g_isExample,g_exampleName)); + if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: dot section ended without end marker"); + doctokenizerYYsetStatePara(); + } + break; case CMD_ENDCODE: case CMD_ENDHTMLONLY: case CMD_ENDLATEXONLY: case CMD_ENDXMLONLY: case CMD_ENDLINK: case CMD_ENDVERBATIM: + case CMD_ENDDOT: warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: unexpected command %s",g_token->name.data()); break; case CMD_PARAM: @@ -4585,6 +4595,7 @@ int DocSection::parse() void DocText::parse() { + DBG(("DocText::parse() start\n")); g_nodeStack.push(this); doctokenizerYYsetStateText(); @@ -4658,6 +4669,7 @@ void DocText::parse() DocNode *n = g_nodeStack.pop(); ASSERT(n==this); + DBG(("DocText::parse() end\n")); } @@ -4665,6 +4677,7 @@ void DocText::parse() void DocRoot::parse() { + DBG(("DocRoot::parse() start\n")); g_nodeStack.push(this); doctokenizerYYsetStatePara(); int retval=0; @@ -4717,7 +4730,7 @@ void DocRoot::parse() } else { - warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: Invalid anchor id `%s'",g_token->sectionId.data()); + warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: Invalid anchor id `%s'; ignoring section",g_token->sectionId.data()); retval = 0; } } @@ -4734,6 +4747,7 @@ void DocRoot::parse() DocNode *n = g_nodeStack.pop(); ASSERT(n==this); + DBG(("DocRoot::parse() end\n")); } //-------------------------------------------------------------------------- diff --git a/src/docparser.h b/src/docparser.h index 6b79220..dc2b890 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -349,7 +349,7 @@ class DocWhiteSpace : public DocNode class DocVerbatim : public DocNode { public: - enum Type { Code, HtmlOnly, LatexOnly, XmlOnly, Verbatim }; + enum Type { Code, HtmlOnly, LatexOnly, XmlOnly, Verbatim, Dot }; DocVerbatim(DocNode *parent,const QString &context, const QString &text, Type t,bool isExample, const QString &exampleFile) : @@ -373,6 +373,7 @@ class DocVerbatim : public DocNode QString m_exampleFile; }; + /*! @brief Node representing an included text block from file */ class DocInclude : public DocNode { @@ -595,7 +596,6 @@ class DocDotFile : public CompAccept<DocDotFile>, public DocNode QString height() const { return m_height; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocDotFile>::accept(this,v); } - private: DocNode *m_parent; QString m_name; diff --git a/src/doctokenizer.h b/src/doctokenizer.h index 6c62815..ce2532d 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -123,6 +123,7 @@ void doctokenizerYYsetStateHtmlOnly(); void doctokenizerYYsetStateLatexOnly(); void doctokenizerYYsetStateXmlOnly(); void doctokenizerYYsetStateVerbatim(); +void doctokenizerYYsetStateDot(); void doctokenizerYYsetStateParam(); void doctokenizerYYsetStateXRefItem(); void doctokenizerYYsetStateFile(); diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 1e4b2d1..81e2afa 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -327,6 +327,7 @@ LABELID [a-z_A-Z][a-z_A-Z0-9\-]* %x St_LatexOnly %x St_XmlOnly %x St_Verbatim +%x St_Dot %x St_Param %x St_XRefItem %x St_XRefItem2 @@ -525,6 +526,14 @@ LABELID [a-z_A-Z][a-z_A-Z0-9\-]* <St_Verbatim>. { /* Verbatim text */ g_token->verb+=yytext; } +<St_Dot>{CMD}"enddot" { + return RetVal_OK; + } +<St_Dot>[^\\@\n]+ | +<St_Dot>\n | +<St_Dot>. { /* dot text */ + g_token->verb+=yytext; + } <St_Title>"\"" { // quoted title BEGIN(St_TitleQ); } @@ -746,6 +755,10 @@ LABELID [a-z_A-Z][a-z_A-Z0-9\-]* g_endMarker="endverbatim"; BEGIN(St_SecSkip); } +<St_Sections>{CMD}"dot" { + g_endMarker="enddot"; + BEGIN(St_SecSkip); + } <St_Sections>{CMD}"htmlonly" { g_endMarker="endhtmlonly"; BEGIN(St_SecSkip); @@ -885,6 +898,12 @@ void doctokenizerYYsetStateVerbatim() BEGIN(St_Verbatim); } +void doctokenizerYYsetStateDot() +{ + g_token->verb=""; + BEGIN(St_Dot); +} + void doctokenizerYYsetStateParam() { BEGIN(St_Param); diff --git a/src/dot.cpp b/src/dot.cpp index a9585bf..d2f852a 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -26,6 +26,7 @@ #include "language.h" #include "scanner.h" #include "defargs.h" +#include "docparser.h" #include <qdir.h> #include <qfile.h> @@ -96,6 +97,8 @@ static bool convertMapFile(QTextStream &t,const char *mapName, const int maxLineLen=1024; char buf[maxLineLen]; char url[maxLineLen]; + char ref[maxLineLen]; + bool isRef = FALSE; int x1,y1,x2,y2; while (!f.atEnd()) { @@ -106,6 +109,13 @@ static bool convertMapFile(QTextStream &t,const char *mapName, { // obtain the url and the coordinates in the order used by graphviz-1.5 sscanf(buf,"rect %s %d,%d %d,%d",url,&x1,&y1,&x2,&y2); + + if ( strcmp(url,"\\ref") == 0 ) + { + isRef = TRUE; + sscanf(buf,"rect %s %s %d,%d %d,%d",ref,url,&x1,&y1,&x2,&y2); + } + // later versions of graphviz corrected the y coordinate order // the rule is that y2>=y1, so test and switch if needed if (y2<y1) @@ -124,9 +134,27 @@ static bool convertMapFile(QTextStream &t,const char *mapName, } if (urlOnly) { - t << "<area href=\"" << url << "\" shape=\"rect\" coords=\"" - << x1 << "," << y1 << "," << x2 << "," << y2 << "\"" - << " alt=\"\">" << endl; + t << "<area href=\""; + + if ( isRef ) + { + // handle doxygen \ref tag URL reference + QCString *dest; + DocRef *df = new DocRef( (DocNode*) 0, url ); + if (!df->ref().isEmpty()) + { + if ((dest=Doxygen::tagDestinationDict[df->ref()])) t << *dest << "/"; + } + if (!df->file().isEmpty()) t << df->file() << Doxygen::htmlFileExtension; + if (!df->anchor().isEmpty()) t << "#" << df->anchor(); + } + else + { + t << url; + } + t << "\" shape=\"rect\" coords=\"" + << x1 << "," << y1 << "," << x2 << "," << y2 << "\"" + << " alt=\"\">" << endl; } else // name and external reference are separated by a $ { @@ -2220,7 +2248,7 @@ QString getDotImageMapFromFile(const QString& inFile, const QString& outDir) QTextOStream tmpout(&result); convertMapFile(tmpout, outFile, TRUE); QDir().remove(outFile); - //printf("result=%s\n",result.data()); +// printf("result=%s\n",result.data()); QDir::setCurrent(oldDir); return result; diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 23c7a6d..9db76aa 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -16,6 +16,7 @@ * */ +#include <qdir.h> #include "htmldocvisitor.h" #include "docparser.h" #include "language.h" @@ -180,6 +181,7 @@ void HtmlDocVisitor::visit(DocStyleChange *s) } } + void HtmlDocVisitor::visit(DocVerbatim *s) { if (m_hide) return; @@ -202,6 +204,31 @@ void HtmlDocVisitor::visit(DocVerbatim *s) case DocVerbatim::XmlOnly: /* nothing */ break; + + case DocVerbatim::Dot: + { + static int dotindex = 1; + QCString fileName(4096); + + fileName.sprintf("%s%d", + (Config_getString("HTML_OUTPUT")+"/inline_dotgraph_").data(), + dotindex++ + ); + QFile file(fileName); + if (!file.open(IO_WriteOnly)) + { + err("Could not open file %s for writing\n",fileName.data()); + } + file.writeBlock( s->text(), s->text().length() ); + file.close(); + + m_t << "<div align=\"center\">" << endl; + writeDotFile(fileName); + m_t << "</div>" << endl; + + file.remove(); + } + break; } } @@ -701,22 +728,8 @@ void HtmlDocVisitor::visitPost(DocImage *img) void HtmlDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; - QString baseName=df->file(); - int i; - if ((i=baseName.findRev('/'))!=-1) - { - baseName=baseName.right(baseName.length()-i-1); - } - QString outDir = Config_getString("HTML_OUTPUT"); - writeDotGraphFromFile(df->file(),outDir,baseName,BITMAP); + writeDotFile(df->file()); m_t << "<div align=\"center\">" << endl; - QString mapName = baseName+".map"; - QString mapFile = df->file()+".map"; - m_t << "<img src=\"" << baseName << "." - << Config_getEnum("DOT_IMAGE_FORMAT") << "\" alt=\"" - << baseName << "\" border=\"0\" usemap=\"#" << mapName << "\">" << endl; - QString imap = getDotImageMapFromFile(df->file(),outDir); - m_t << "<map name=\"" << mapName << "\">" << imap << "</map>" << endl; if (df->hasCaption()) { m_t << "<p><strong>"; @@ -1000,3 +1013,22 @@ void HtmlDocVisitor::popEnabled() delete v; } +void HtmlDocVisitor::writeDotFile(const QString &fileName) +{ + QString baseName=fileName; + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + QString outDir = Config_getString("HTML_OUTPUT"); + writeDotGraphFromFile(fileName,outDir,baseName,BITMAP); + QString mapName = baseName+".map"; + QString mapFile = fileName+".map"; + m_t << "<img src=\"" << baseName << "." + << Config_getEnum("DOT_IMAGE_FORMAT") << "\" alt=\"" + << baseName << "\" border=\"0\" usemap=\"#" << mapName << "\">" << endl; + QString imap = getDotImageMapFromFile(fileName,outDir); + m_t << "<map name=\"" << mapName << "\">" << imap << "</map>" << endl; +} + diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 0ba7d34..b0fd4ef 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -137,6 +137,7 @@ class HtmlDocVisitor : public DocVisitor void startLink(const QString &ref,const QString &file, const QString &anchor); void endLink(); + void writeDotFile(const QString &fileName); void pushEnabled(); void popEnabled(); diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 459fddb..1a6c889 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -263,6 +263,31 @@ void LatexDocVisitor::visit(DocVerbatim *s) case DocVerbatim::LatexOnly: m_t << s->text(); break; + case DocVerbatim::Dot: + { + static int dotindex = 1; + QCString fileName(4096); + + fileName.sprintf("%s%d", + (Config_getString("LATEX_OUTPUT")+"/inline_dotgraph_").data(), + dotindex++ + ); + QFile file(fileName); + if (!file.open(IO_WriteOnly)) + { + err("Could not open file %s for writing\n",fileName.data()); + } + file.writeBlock( s->text(), s->text().length() ); + file.close(); + + m_t << "\\begin{center}\n"; + startDotFile(fileName,"","",FALSE); + endDotFile(FALSE); + m_t << "\\end{center}\n"; + + file.remove(); + } + break; } } @@ -742,58 +767,13 @@ void LatexDocVisitor::visitPost(DocImage *img) void LatexDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; - QString baseName=df->file(); - int i; - if ((i=baseName.findRev('/'))!=-1) - { - baseName=baseName.right(baseName.length()-i-1); - } - if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") - { - baseName=baseName.left(baseName.length()-4); - } - if (baseName.right(4)==".dot") - { - baseName=baseName.left(baseName.length()-4); - } - QString outDir = Config_getString("LATEX_OUTPUT"); - QString name = df->file(); - writeDotGraphFromFile(name,outDir,baseName,EPS); - if (df->hasCaption()) - { - m_t << "\\begin{figure}[H]" << endl; - m_t << "\\begin{center}" << endl; - } - else - { - m_t << "\\mbox{"; - } - m_t << "\\includegraphics"; - if (!df->width().isEmpty()) - { - m_t << "[width=" << df->width() << "]"; - } - else if (!df->height().isEmpty()) - { - m_t << "[height=" << df->height() << "]"; - } - m_t << "{" << baseName << "}"; - - if (df->hasCaption()) - { - m_t << "\\caption{"; - } + startDotFile(df->file(),df->width(),df->height(),df->hasCaption()); } void LatexDocVisitor::visitPost(DocDotFile *df) { if (m_hide) return; - m_t << "}" << endl; // end mbox or caption - if (df->hasCaption()) - { - m_t << "\\end{center}" << endl; - m_t << "\\end{figure}" << endl; - } + endDotFile(df->hasCaption()); } void LatexDocVisitor::visitPre(DocLink *lnk) @@ -1016,3 +996,63 @@ void LatexDocVisitor::popEnabled() delete v; } +void LatexDocVisitor::startDotFile(const QString &fileName, + const QString &width, + const QString &height, + bool hasCaption + ) +{ + QString baseName=fileName; + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") + { + baseName=baseName.left(baseName.length()-4); + } + if (baseName.right(4)==".dot") + { + baseName=baseName.left(baseName.length()-4); + } + QString outDir = Config_getString("LATEX_OUTPUT"); + QString name = fileName; + writeDotGraphFromFile(name,outDir,baseName,EPS); + if (hasCaption) + { + m_t << "\\begin{figure}[H]" << endl; + m_t << "\\begin{center}" << endl; + } + else + { + m_t << "\\mbox{"; + } + m_t << "\\includegraphics"; + if (!width.isEmpty()) + { + m_t << "[width=" << width << "]"; + } + else if (!height.isEmpty()) + { + m_t << "[height=" << height << "]"; + } + m_t << "{" << baseName << "}"; + + if (hasCaption) + { + m_t << "\\caption{"; + } +} + +void LatexDocVisitor::endDotFile(bool hasCaption) +{ + if (m_hide) return; + m_t << "}" << endl; // end mbox or caption + if (hasCaption) + { + m_t << "\\end{center}" << endl; + m_t << "\\end{figure}" << endl; + } +} + diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 0b168d5..7b2d4ff 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -138,6 +138,9 @@ class LatexDocVisitor : public DocVisitor void endLink(const QString &ref,const QString &file, const QString &anchor); QString escapeMakeIndexChars(const char *s); + void startDotFile(const QString &fileName,const QString &width, + const QString &height, bool hasCaption); + void endDotFile(bool hasCaption); void pushEnabled(); void popEnabled(); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index cffcb5b..e330e1e 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -328,8 +328,8 @@ static void writeDefaultStyleSheetPart1(QTextStream &t) t << "\\RequirePackage{calc}\n"; t << "\\RequirePackage{array}\n"; t << "\\pagestyle{fancyplain}\n"; - t << "\\addtolength{\\headwidth}{\\marginparsep}\n"; - t << "\\addtolength{\\headwidth}{\\marginparwidth}\n"; + //t << "\\addtolength{\\headwidth}{\\marginparsep}\n"; + //t << "\\addtolength{\\headwidth}{\\marginparwidth}\n"; t << "\\newcommand{\\clearemptydoublepage}{\\newpage{\\pagestyle{empty}"; t << "\\cleardoublepage}}\n"; if (!Config_getBool("COMPACT_LATEX")) diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 341a50d..f7f8c84 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -201,6 +201,7 @@ void ManDocVisitor::visit(DocVerbatim *s) case DocVerbatim::HtmlOnly: case DocVerbatim::XmlOnly: case DocVerbatim::LatexOnly: + case DocVerbatim::Dot: /* nothing */ break; } diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index bd676ad..5184e66 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -621,6 +621,7 @@ void PerlModDocVisitor::visit(DocVerbatim *s) case DocVerbatim::HtmlOnly: type = "htmlonly"; break; case DocVerbatim::LatexOnly: type = "latexonly"; break; case DocVerbatim::XmlOnly: type = "xmlonly"; break; + case DocVerbatim::Dot: type = "dot"; break; } openItem(type); m_output.addFieldQuotedString("content", s->text()); diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 1241659..4cf0b53 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -143,6 +143,7 @@ class PrintDocVisitor : public DocVisitor case DocVerbatim::HtmlOnly: printf("<htmlonly>"); break; case DocVerbatim::LatexOnly: printf("<latexonly>"); break; case DocVerbatim::XmlOnly: printf("<xmlonly>"); break; + case DocVerbatim::Dot: printf("<dot>"); break; } printf("%s",s->text().data()); switch(s->type()) @@ -152,6 +153,7 @@ class PrintDocVisitor : public DocVisitor case DocVerbatim::HtmlOnly: printf("</htmlonly>"); break; case DocVerbatim::LatexOnly: printf("</latexonly>"); break; case DocVerbatim::XmlOnly: printf("</xmlonly>"); break; + case DocVerbatim::Dot: printf("</dot>"); break; } } void visit(DocAnchor *a) diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 8cbfc4f..36521ca 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -315,6 +315,28 @@ void RTFDocVisitor::visit(DocVerbatim *s) case DocVerbatim::XmlOnly: /* nothing */ break; + case DocVerbatim::Dot: + { + static int dotindex = 1; + QCString fileName(4096); + + fileName.sprintf("%s%d", + (Config_getString("RTF_OUTPUT")+"/inline_dotgraph_").data(), + dotindex++ + ); + QFile file(fileName); + if (!file.open(IO_WriteOnly)) + { + err("Could not open file %s for writing\n",fileName.data()); + } + file.writeBlock( s->text(), s->text().length() ); + file.close(); + m_t << "\\par{\\qc "; // center picture + writeDotFile(fileName); + m_t << "} "; + file.remove(); + } + break; } } @@ -865,21 +887,7 @@ void RTFDocVisitor::visitPost(DocImage *) void RTFDocVisitor::visitPre(DocDotFile *df) { - QString baseName=df->file(); - int i; - if ((i=baseName.findRev('/'))!=-1) - { - baseName=baseName.right(baseName.length()-i-1); - } - QString outDir = Config_getString("RTF_OUTPUT"); - writeDotGraphFromFile(df->file(),outDir,baseName,BITMAP); - m_t << "\\par" << endl; - m_t << "{" << endl; - m_t << rtf_Style_Reset << endl; - m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; - m_t << outDir << "\\" << baseName; - m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; - m_t << "}" << endl; + writeDotFile(df->file()); // hide caption since it is not supported at the moment pushEnabled(); @@ -1199,3 +1207,22 @@ void RTFDocVisitor::popEnabled() delete v; } +void RTFDocVisitor::writeDotFile(const QString &fileName) +{ + QString baseName=fileName; + int i; + if ((i=baseName.findRev('/'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + QString outDir = Config_getString("RTF_OUTPUT"); + writeDotGraphFromFile(fileName,outDir,baseName,BITMAP); + m_t << "\\par" << endl; + m_t << "{" << endl; + m_t << rtf_Style_Reset << endl; + m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; + m_t << outDir << "\\" << baseName; + m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; + m_t << "}" << endl; +} + diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index 96a0736..08fc440 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -142,6 +142,7 @@ class RTFDocVisitor : public DocVisitor void pushEnabled(); void popEnabled(); + void writeDotFile(const QString &fileName); //-------------------------------------- // state variables diff --git a/src/scanner.l b/src/scanner.l index b8f0706..1d519bc 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -495,7 +495,7 @@ static int yyread(char *buf,int max_size) /* start command character */ CMD ("\\"|"@") -SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"xrefitem"|"ingroup"|"callgraph"|"latexonly"|"htmlonly"|"xmlonly"|"{"|"verbatim"|"dotfile"|"defgroup"|"addtogroup"|"weakgroup"|"class"|"namespace"|"union"|"struct"|"fn"|"var"|"details"|"typedef"|"def"|"overload")|("<"{PRE}">") +SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"xrefitem"|"ingroup"|"callgraph"|"latexonly"|"htmlonly"|"xmlonly"|"{"|"verbatim"|"dotfile"|"dot"|"defgroup"|"addtogroup"|"weakgroup"|"class"|"namespace"|"union"|"struct"|"fn"|"var"|"details"|"typedef"|"def"|"overload")|("<"{PRE}">") BN [ \t\n\r] BL [ \t\r]*"\n" B [ \t] @@ -2571,6 +2571,11 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] lineCount() ; current->args += ' ' ; } +<Function,FuncQual,FuncRound,FuncFunc>"#" { if (insidePHP) + REJECT; + lastCPPContext = YY_START; + BEGIN(SkipCPP); + } <FuncQual,FuncRound,FuncFunc>. { current->args += *yytext; } <FuncQual>{BN}*"try"{BN}+ { /* try-function-block */ insideTryBlock=TRUE; @@ -2624,11 +2629,6 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] roundCount=0; BEGIN( FuncRound ) ; } -<Function>"#" { if (insidePHP) - REJECT; - lastCPPContext = YY_START; - BEGIN(SkipCPP); - } <Function>":" { if (!insidePHP) BEGIN(SkipInits); } @@ -3836,22 +3836,22 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] <PageDoc>{CMD}"refitem".*"\n" { current->doc+=yytext; } -<PageDoc>{CMD}"section"{B}+ { +<ExampleDoc,ClassDoc,PageDoc,Doc,JavaDoc>{CMD}"section"{B}+ { //sectionType=SectionInfo::Section; current->doc+=yytext; BEGIN(SectionLabel); } -<PageDoc>{CMD}"subsection"{B}+ { +<ExampleDoc,ClassDoc,PageDoc,Doc,JavaDoc>{CMD}"subsection"{B}+ { //sectionType=SectionInfo::Subsection; current->doc+=yytext; BEGIN(SectionLabel); } -<PageDoc>{CMD}"subsubsection"{B}+ { +<ExampleDoc,ClassDoc,PageDoc,Doc,JavaDoc>{CMD}"subsubsection"{B}+ { //sectionType=SectionInfo::Subsubsection; current->doc+=yytext; BEGIN(SectionLabel); } -<PageDoc>{CMD}"paragraph"{B}+ { +<ExampleDoc,ClassDoc,PageDoc,Doc,JavaDoc>{CMD}"paragraph"{B}+ { //sectionType=SectionInfo::Paragraph; current->doc+=yytext; BEGIN(SectionLabel); @@ -3898,10 +3898,10 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] current->doc+=yytext; BEGIN(AnchorLabel); } -<Doc,PageDoc,ClassDoc>("\\\\"|"@@")("verbatim"|"latexonly"|"htmlonly")/[^a-z_A-Z0-9] { +<Doc,PageDoc,ClassDoc>("\\\\"|"@@")("verbatim"|"latexonly"|"htmlonly"|"dot")/[^a-z_A-Z0-9] { current->doc+=yytext; } -<JavaDoc>("\\\\"|"@@")("verbatim"|"latexonly"|"htmlonly")/[^a-z_A-Z0-9] { +<JavaDoc>("\\\\"|"@@")("verbatim"|"latexonly"|"htmlonly"|"dot")/[^a-z_A-Z0-9] { current->brief+=yytext; } <Doc,PageDoc,ClassDoc>{CMD}"verbatim"/[^a-z_A-Z0-9] { @@ -3956,27 +3956,51 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] lastCodeState=YY_START; current->doc+="\\code"; pSkipDoc=¤t->doc; + g_skipBlockName="code"; BEGIN(SkipCode); } <JavaDoc>{CMD}"code"/[^a-z_A-Z0-9] { lastCodeState=YY_START; current->brief+="\\code"; pSkipDoc=¤t->brief; + g_skipBlockName="code"; BEGIN(SkipCode); } +<Doc,PageDoc,ClassDoc>("\\\\"|"@@")"dot"/[^a-z_A-Z0-9] { + current->doc+="\\\\dot"; + } +<JavaDoc>("\\\\"|"@@")"dot"/[^a-z_A-Z0-9] { + current->brief+="\\\\dot"; + } +<Doc,PageDoc,ClassDoc>{CMD}"dot"/[^a-z_A-Z0-9] { + lastCodeState=YY_START; + current->doc+="\\dot"; + pSkipDoc=¤t->doc; + g_skipBlockName="dot"; + BEGIN(SkipCode); + } +<JavaDoc>{CMD}"dot"/[^a-z_A-Z0-9] { + lastCodeState=YY_START; + current->brief+="\\dot"; + pSkipDoc=¤t->brief; + g_skipBlockName="dot"; + BEGIN(SkipCode); + } <Doc,PageDoc,ClassDoc>"<"{PRE}{ATTR}">" { lastCodeState=YY_START; current->doc+="<PRE>"; pSkipDoc=¤t->doc; + g_skipBlockName="pre"; BEGIN(SkipCode); } <JavaDoc>"<"{PRE}{ATTR}">" { lastCodeState=YY_START; current->brief+="<PRE>"; pSkipDoc=¤t->brief; + g_skipBlockName="pre"; BEGIN(SkipCode); } -<SkipVerbatim>{CMD}("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly")/[^a-z_A-Z0-9] { +<SkipVerbatim>{CMD}("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddot")/[^a-z_A-Z0-9] { current->doc+=yytext; BEGIN(lastVerbState); } @@ -4012,11 +4036,24 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] } <SkipCode>{CMD}"endcode"/[^a-z_A-Z0-9] { *pSkipDoc+="\\endcode"; - BEGIN(lastCodeState); + if (g_skipBlockName=="code") + { + BEGIN(lastCodeState); + } } <SkipCode>"</"{PRE}{ATTR}">" { *pSkipDoc+="</PRE>"; - BEGIN(lastCodeState); + if (g_skipBlockName=="pre") + { + BEGIN(lastCodeState); + } + } +<SkipCode>{CMD}"enddot"/[^a-z_A-Z0-9] { + *pSkipDoc+="\\enddot"; + if (g_skipBlockName=="dot") + { + BEGIN(lastCodeState); + } } <SkipCode>^"//"({B}*"*"+)? { if (!removeSlashes) @@ -4041,7 +4078,8 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] } <SkipCode><<EOF>> { warn(yyFileName,yyLineNr, - "Warning: reached end of file while inside a @code block; check for missing @endcode!" + "Warning: reached end of file while inside a %s block; check for missing end tag!", + g_skipBlockName.data() ); yyterminate(); } diff --git a/src/translator_fr.h b/src/translator_fr.h index 810f934..c6be3a8 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -50,11 +50,13 @@ * -------------+------------------------------------------------------------ * 2003-06-10 | Update for new since 1.3.1 * -------------+------------------------------------------------------------ + * 2003-09-12 | Update for new since 1.3.3 + * -------------+------------------------------------------------------------ */ #ifndef TRANSLATOR_FR_H #define TRANSLATOR_FR_H -class TranslatorFrench : public TranslatorAdapter_1_3_3 +class TranslatorFrench : public Translator { public: QCString idLanguage() @@ -1366,6 +1368,58 @@ class TranslatorFrench : public TranslatorAdapter_1_3_3 return "Voici le graphique d'appel pour cette fonction:"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.3.3 +////////////////////////////////////////////////////////////////////////// + + /*! When the search engine is enabled this text is put in the header + * of each page before the field where one can enter the text to search + * for. + */ + virtual QCString trSearchForIndex() + { + return "Rechercher"; + } + /*! This string is used as the title for the page listing the search + * results. + */ + virtual QCString trSearchResultsTitle() + { + return "Resultats de la recherche"; + } + /*! This string is put just before listing the search results. The + * text can be different depending on the number of documents found. + * Inside the text you can put the special marker $num to insert + * the number representing the actual number of search results. + * The @a numDocuments parameter can be either 0, 1 or 2, where the + * value 2 represents 2 or more matches. HTML markup is allowed inside + * the returned string. + */ + virtual QCString trSearchResults(int numDocuments) + { + if (numDocuments==0) + { + return "Sorry, no documents matching your query."; + } + else if (numDocuments==1) + { + return "Trouvé <b>1</b> document correspondant à votre requète."; + } + else + { + return "Trouvé <b>$num</b> documents correspondant à votre requète.. " + "Classé par ordre de pertinence décroissant."; + } + } + /*! This string is put before the list of matched words, for each search + * result. What follows is the list of words that matched the query. + */ + virtual QCString trSearchMatches() + { + return "Correspondances:"; + } + }; #endif + diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 917bb7a..0bf20af 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -189,6 +189,11 @@ void XmlDocVisitor::visit(DocVerbatim *s) case DocVerbatim::XmlOnly: m_t << s->text(); break; + case DocVerbatim::Dot: + m_t << "<dot>"; + filter(s->text()); + m_t << "</dot>"; + break; } } |