From d84f6a6a5273a62633fa360133356bc68e3ba289 Mon Sep 17 00:00:00 2001 From: dimitri Date: Sun, 17 Sep 2000 18:25:49 +0000 Subject: Release-1.2.1-20000917 --- INSTALL | 4 +- README | 4 +- VERSION | 2 +- doc/language.doc | 4 +- packages/rpm/doxygen.spec | 2 +- src/code.l | 41 ++- src/doc.l | 6 +- src/dot.cpp | 6 +- src/doxygen.cpp | 4 +- src/htmlgen.cpp | 7 +- src/htmlgen.h | 3 +- src/index.cpp | 16 +- src/latexgen.cpp | 20 +- src/latexgen.h | 3 +- src/mangen.h | 3 +- src/outputgen.h | 3 +- src/outputlist.cpp | 1 + src/outputlist.h | 7 +- src/rtfgen.cpp | 624 +++++++++++++++++++++++++++++----------------- src/rtfgen.h | 3 +- src/scanner.l | 31 ++- 21 files changed, 506 insertions(+), 288 deletions(-) diff --git a/INSTALL b/INSTALL index f96948f..b2b9f40 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ -DOXYGEN Version 1.2.1-20000910 +DOXYGEN Version 1.2.1-20000917 Please read the installation section of the manual for instructions. -------- -Dimitri van Heesch (10 September 2000) +Dimitri van Heesch (17 September 2000) diff --git a/README b/README index 1bb9390..2dd17a8 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -DOXYGEN Version 1.2.1-20000910 +DOXYGEN Version 1.2.1-20000917 Please read INSTALL for compilation instructions. @@ -7,4 +7,4 @@ The latest version of doxygen can be obtained at Enjoy, -Dimitri van Heesch (10 September 2000) +Dimitri van Heesch (17 September 2000) diff --git a/VERSION b/VERSION index 80d7a6d..4322162 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.1-20000910 +1.2.1-20000917 diff --git a/doc/language.doc b/doc/language.doc index b75e843..83787e3 100644 --- a/doc/language.doc +++ b/doc/language.doc @@ -248,9 +248,9 @@ Here is a list of the languages and their current maintainers: \hline Russian & Nickolay Semyonov & {\tt snob@int.spb.ru} \\ \hline - Korean & Richard Kim & {\\tt ryk@dspwiz.com} \\ + Korean & Richard Kim & {\tt ryk@dspwiz.com} \\ \hline - Hungarian & Földvári György & {\\tt foldvari@diatronltd.com} \\ + Hungarian & Földvári György & {\tt foldvari@diatronltd.com} \\ \hline Croatian & Boris Bralo & {\tt boris.bralo@zg.tel.hr} \\ \hline diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec index e22a714..2d08df3 100644 --- a/packages/rpm/doxygen.spec +++ b/packages/rpm/doxygen.spec @@ -1,5 +1,5 @@ Name: doxygen -Version: 1.2.1-20000910 +Version: 1.2.1-20000917 Summary: documentation system for C, C++ and IDL Release: 1 Source0: doxygen-%{version}.src.tar.gz diff --git a/src/code.l b/src/code.l index 4086dd3..6253507 100644 --- a/src/code.l +++ b/src/code.l @@ -120,6 +120,8 @@ static bool g_searchingForBody; static bool g_insideBody; static int g_bodyCurlyCount; static ClassDef * g_classVar; +static QCString g_saveName; +static QCString g_saveType; /*! start a new line of code, inserting a line number if g_sourceFileDef * is TRUE. If a definition starts at the current line, then the line @@ -574,18 +576,21 @@ static void generateMemberLink(OutputList &ol,const char *varName, vn=vn.right(vn.length()-vi-2); vmn=memberNameDict[vn]; //printf("Trying name `%s' scope=%s\n",vn.data(),scope.data()); - MemberNameIterator vmni(*vmn); - MemberDef *vmd; - for (;(vmd=vmni.current());++vmni) + if (vmn) { - if ((vmd->isVariable() || vmd->isFunction()) && - vmd->getClassDef()==jcd) + MemberNameIterator vmni(*vmn); + MemberDef *vmd; + for (;(vmd=vmni.current());++vmni) { - //printf("Found variable type=%s\n",vmd->typeString()); - ClassDef *mcd=stripClassName(vmd->typeString()); - if (mcd && mcd->isLinkable()) + if ((vmd->isVariable() || vmd->isFunction()) && + vmd->getClassDef()==jcd) { - if (generateClassMemberLink(ol,mcd,memName)) return; + //printf("Found variable type=%s\n",vmd->typeString()); + ClassDef *mcd=stripClassName(vmd->typeString()); + if (mcd && mcd->isLinkable()) + { + if (generateClassMemberLink(ol,mcd,memName)) return; + } } } } @@ -626,7 +631,7 @@ static void generateFunctionLink(OutputList &ol,char *funcName) if (i>0) { locScope=locFunc.left(i); - locFunc=locFunc.right(locFunc.length()-i-2); + locFunc=locFunc.right(locFunc.length()-i-2).stripWhiteSpace(); int ts=locScope.find('<'); // start of template int te=locScope.findRev('>'); // end of template //printf("ts=%d te=%d\n",ts,te); @@ -636,7 +641,7 @@ static void generateFunctionLink(OutputList &ol,char *funcName) locScope=locScope.left(ts)+locScope.right(locScope.length()-te-1); } } - //printf("generateFunctionLink(%s) classScope=%s\n",locFunc.data(),locScope.data()); + //printf("generateFunctionLink(%s) classScope=`%s'\n",locFunc.data(),locScope.data()); if (!locScope.isEmpty() && (ccd=g_codeClassDict[locScope])) { //printf("using classScope %s\n",g_classScope.data()); @@ -1067,12 +1072,22 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" } [,=;\[] { g_code->codify(yytext); + g_saveName = g_name.copy(); + g_saveType = g_name.copy(); if (!g_type.isEmpty()) + { addVariable(); - g_name.resize(0); + g_name.resize(0); + } if (*yytext!=',') g_type.resize(0); g_args.resize(0); } +"]" { + g_code->codify(yytext); + // TODO: nested arrays like: a[b[0]->func()]->func() + g_name = g_saveName.copy(); + g_type = g_saveType.copy(); + } [0-9]+ { g_code->codify(yytext); } @@ -1121,7 +1136,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" ")"[ \t\n]*[;:] { codifyLines(yytext); g_bracketCount=0; - g_searchingForBody=FALSE; + if (yytext[yyleng-1]==';') g_searchingForBody=FALSE; if (!g_inClass && !g_type.isEmpty()) addVariable(); g_parmType.resize(0);g_parmName.resize(0); diff --git a/src/doc.l b/src/doc.l index c69d4d8..263fd70 100644 --- a/src/doc.l +++ b/src/doc.l @@ -1432,8 +1432,11 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") if ((sec=sectionDict[secName])) { //printf("Title %s\n",sec->title.data()); - outDoc->writeSection(sec->label,sec->title, + outDoc->startSection(sec->label,sec->title, sec->type==SectionInfo::Subsection); + scanString(sec->title); + outDoc->endSection(sec->label, + sec->type==SectionInfo::Subsection); } } {CMD}"anchor "{ID}"\n" { @@ -1510,7 +1513,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") 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); } diff --git a/src/dot.cpp b/src/dot.cpp index 157b62a..1eff927 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -844,7 +844,11 @@ void DotClassGraph::buildGraph(ClassDef *cd,DotNode *n,int distance,bool base) BaseClassDef *bcd; for ( ; (bcd=bcli.current()) ; ++bcli ) { - addClass(bcd->classDef,n,bcd->prot,0,distance,bcd->templSpecifiers,base); + //printf("addClass: base=%s this=%s templ=%s\n",bcd->classDef->name().data(), + // cd->name().data(),bcd->templSpecifiers.data()); + QCString templSpec; + if (base) templSpec = bcd->templSpecifiers; + addClass(bcd->classDef,n,bcd->prot,0,distance,templSpec,base); } if (m_graphType != Inheritance) { diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 56c45ba..af7ed6e 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -4606,7 +4606,9 @@ static void generatePageDocs() if (!pi->title.isEmpty() && !pi->name.isEmpty() && (si=sectionDict[pi->name])!=0) { - outputList->writeSection(si->label,si->title,FALSE); + outputList->startSection(si->label,si->title,FALSE); + outputList->docify(si->title); + outputList->endSection(si->label,FALSE); } outputList->startTextBlock(); parseDoc(*outputList,pi->defFileName,pi->defLine,0,0,pi->doc); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index e8cdc15..9703d81 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -449,11 +449,14 @@ void HtmlGenerator::endGroupHeader() t << "" << endl; } -void HtmlGenerator::writeSection(const char *lab,const char *title,bool sub) +void HtmlGenerator::startSection(const char *lab,const char *,bool sub) { t << ""; if (sub) t << "

"; else t << "

"; - docify(title); +} + +void HtmlGenerator::endSection(const char *,bool sub) +{ if (sub) t << "

"; else t << ""; t << "
" << endl; } diff --git a/src/htmlgen.h b/src/htmlgen.h index 6c6b40c..fbe3468 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -184,7 +184,8 @@ class HtmlGenerator : public OutputGenerator void endDescTitle() {} void writeDescItem() { t << "
" << endl; } void endDescList() { t << ""; } - void writeSection(const char *,const char *,bool); + void startSection(const char *,const char *,bool); + void endSection(const char *,bool); void writeSectionRef(const char *,const char *,const char *); void writeSectionRefItem(const char *,const char *,const char *); void writeSectionRefAnchor(const char *,const char *,const char *); diff --git a/src/index.cpp b/src/index.cpp index 75d5e92..b81f69a 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -972,7 +972,9 @@ void writeMemberList(OutputList &ol,bool useSections) lastChar=cs[0]=tolower(name.at(0));cs[1]='\0'; QCString anchor=(QCString)"index_"+cs; QCString title=(QCString)"- "+cs+" -"; - ol.writeSection(anchor,title,TRUE); + ol.startSection(anchor,title,TRUE); + ol.docify(title); + ol.endSection(anchor,TRUE); ol.startItemList(); first=FALSE; } @@ -1135,7 +1137,9 @@ void writeFileMemberList(OutputList &ol,bool useSections) lastChar=cs[0]=tolower(name.at(0));cs[1]='\0'; QCString anchor=(QCString)"index_"+cs; QCString title=(QCString)"- "+cs+" -"; - ol.writeSection(anchor,title,TRUE); + ol.startSection(anchor,title,TRUE); + ol.docify(title); + ol.endSection(anchor,TRUE); ol.startItemList(); first=FALSE; } @@ -1212,7 +1216,9 @@ void writeNamespaceMemberList(OutputList &ol,bool useSections) lastChar=cs[0]=tolower(name.at(0));cs[1]='\0'; QCString anchor=(QCString)"index_"+cs; QCString title=(QCString)"- "+cs+" -"; - ol.writeSection(anchor,title,TRUE); + ol.startSection(anchor,title,TRUE); + ol.docify(title); + ol.endSection(anchor,TRUE); ol.startItemList(); first=FALSE; } @@ -1842,7 +1848,9 @@ void writeIndex(OutputList &ol) if (!mainPage->title.isEmpty() && !mainPage->name.isEmpty() && (si=sectionDict[mainPage->name])!=0) { - ol.writeSection(si->label,si->title,FALSE); + ol.startSection(si->label,si->title,FALSE); + ol.docify(si->title); + ol.endSection(si->label,FALSE); } ol.startTextBlock(); parseDoc(ol,defFileName,defLine,0,0,mainPage->doc); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 14a797f..0f87add 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -166,16 +166,27 @@ void LatexGenerator::init() t << "\tpdflatex refman.tex" << endl << endl; } else // otherwise use ps2pdf: not as nice :( - // especially from the font point of view { +#if defined(_MSC_VER) + // ps2pdf.bat does not work properly from a makefile using GNU make! + t << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite " + "-sOutputFile=refman.pdf -c save pop -f refman.ps" << endl << endl; +#else t << "\tps2pdf refman.ps refman.pdf" << endl << endl; +#endif } t << "refman_2on1.ps: refman.ps" << endl << "\tpsnup -2 refman.ps >refman_2on1.ps" << endl << endl << "refman_2on1.pdf: refman_2on1.ps" << endl +#if defined(_MSC_VER) + // ps2pdf.bat does not work properly from a makefile using GNU make! + << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite " + "-sOutputFile=refman_2on1.pdf -c save pop -f refman_2on1.ps" << endl +#else << "\tps2pdf refman_2on1.ps refman_2on1.pdf" << endl +#endif << endl << "refman.dvi: refman.tex doxygen.sty" << endl << "\techo \"Running latex...\"" << endl @@ -1069,7 +1080,7 @@ void LatexGenerator::addToIndex(const char *s1,const char *s2) } } -void LatexGenerator::writeSection(const char *lab,const char *title,bool sub) +void LatexGenerator::startSection(const char *lab,const char *,bool sub) { if (Config::pdfHyperFlag) { @@ -1077,7 +1088,10 @@ void LatexGenerator::writeSection(const char *lab,const char *title,bool sub) } t << "\\"; if (sub) t << "subsection{"; else t << "section{"; - docify(title); +} + +void LatexGenerator::endSection(const char *lab,bool) +{ t << "}\\label{" << lab << "}" << endl; } diff --git a/src/latexgen.h b/src/latexgen.h index 8a3a341..b08e7b3 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -180,7 +180,8 @@ class LatexGenerator : public OutputGenerator void endDescTitle() { t << "]"; } void writeDescItem() { t << "\\par" << endl; } void endDescList() { t << "\\end{Desc}" << endl; } - void writeSection(const char *,const char *,bool); + void startSection(const char *,const char *,bool); + void endSection(const char *,bool); void writeSectionRef(const char *,const char *,const char *); void writeSectionRefItem(const char *,const char *,const char *); void writeSectionRefAnchor(const char *,const char *,const char *); diff --git a/src/mangen.h b/src/mangen.h index 7a81bd9..731f35e 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -170,7 +170,8 @@ class ManGenerator : public OutputGenerator void endDescTitle(); void writeDescItem(); void endDescList() {} - void writeSection(const char *,const char *,bool) {} + void startSection(const char *,const char *,bool) {} + void endSection(const char *,bool) {} void writeSectionRef(const char *,const char *,const char *) {} void writeSectionRefItem(const char *,const char *,const char *) {} void writeSectionRefAnchor(const char *,const char *,const char *) {} diff --git a/src/outputgen.h b/src/outputgen.h index d2d0d54..7cc8e18 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -170,7 +170,8 @@ class OutputGenerator virtual void endDescTitle() = 0; virtual void writeDescItem() = 0; virtual void endDescList() = 0; - virtual void writeSection(const char *,const char *,bool) = 0; + virtual void startSection(const char *,const char *,bool) = 0; + virtual void endSection(const char *,bool) = 0; virtual void writeSectionRef(const char *,const char *,const char *) = 0; virtual void writeSectionRefItem(const char *,const char *,const char *) = 0; virtual void writeSectionRefAnchor(const char *,const char *,const char *) = 0; diff --git a/src/outputlist.cpp b/src/outputlist.cpp index 7f84dc9..01f0fc6 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -268,6 +268,7 @@ FORALL2(bool a1,bool a2,a1,a2) FORALL2(int a1,bool a2,a1,a2) FORALL1(IndexSections a1,a1) FORALL2(const char *a1,const char *a2,a1,a2) +FORALL2(const char *a1,bool a2,a1,a2) FORALL3(ClassDiagram &a1,const char *a2,const char *a3,a1,a2,a3) FORALL3(const char *a1,const char *a2,const char *a3,a1,a2,a3) FORALL3(const char *a1,const char *a2,bool a3,a1,a2,a3) diff --git a/src/outputlist.h b/src/outputlist.h index a0e755e..eb7b03c 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -303,8 +303,10 @@ class OutputList { forall(&OutputGenerator::startIndent); } void endIndent() { forall(&OutputGenerator::endIndent); } - void writeSection(const char *lab,const char *title,bool sub) - { forall(&OutputGenerator::writeSection,lab,title,sub); } + void startSection(const char *lab,const char *title,bool sub) + { forall(&OutputGenerator::startSection,lab,title,sub); } + void endSection(const char *lab,bool sub) + { forall(&OutputGenerator::endSection,lab,sub); } void writeSectionRef(const char *page,const char *lab, const char *title) { forall(&OutputGenerator::writeSectionRef,page,lab,title); } void writeSectionRefItem(const char *page,const char *lab, const char *title) @@ -406,6 +408,7 @@ class OutputList #endif FORALLPROTO2(int,bool); FORALLPROTO2(const char *,const char *); + FORALLPROTO2(const char *,bool); FORALLPROTO3(const char *,const char *,bool); FORALLPROTO3(uchar,uchar,uchar); FORALLPROTO3(const char *,const char *,const char *); diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 5dd7aeb..b722d74 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -119,235 +119,307 @@ OutputGenerator *RTFGenerator::copy() return result; } -static const struct +static const char Rtf_Style_Reset[] = "\\pard\\plain "; + +struct Rtf_Style_Default { const char *name; - const char *value; -} Rtf_Style_Default[] = + const char *reference; + const char *definition; +}; + +static const struct Rtf_Style_Default Rtf_Style_Default[] = { - { "Reset", - "\\pard\\plain " - }, { "Heading1", - "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid " + "\\s1\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs36\\kerning36\\cgrid ", + "\\sbasedon0 \\snext0 heading 1" }, { "Heading2", - "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid " + "\\s2\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs28\\kerning28\\cgrid ", + "\\sbasedon0 \\snext0 heading 2" }, { "Heading3", - "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid " + "\\s3\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\cgrid ", + "\\sbasedon0 \\snext0 heading 3" }, { "Heading4", - "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid " + "\\s4\\sb240\\sa60\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ", + "\\sbasedon0 \\snext0 heading 4;}{\\*\\cs10 \\additive Default Paragraph Font" }, { "Title", - "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid " + "\\s15\\qc\\sb240\\sa60\\widctlpar\\outlinelevel0\\adjustright \\b\\f1\\fs32\\kerning28\\cgrid ", + "\\sbasedon0 \\snext15 Title" }, { "SubTitle", - "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid " + "\\s16\\qc\\sa60\\widctlpar\\outlinelevel1\\adjustright \\f1\\cgrid ", + "\\sbasedon0 \\snext16 Subtitle" }, { "BodyText", - "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid " + "\\s17\\sa60\\sb30\\widctlpar\\qj \\fs22\\cgrid ", + "\\sbasedon0 \\snext17 BodyText" }, { "DenseText", - "\\s18\\widctlpar\\fs22\\cgrid " + "\\s18\\widctlpar\\fs22\\cgrid ", + "\\sbasedon0 \\snext18 DenseText" }, { "Header", - "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid " + "\\s28\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext28 header" }, { "Footer", - "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid " + "\\s29\\widctlpar\\tqc\\tx4320\\tqr\\tx8640\\qr\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext29 footer" }, { "GroupHeader", - "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid " + "\\s30\\li360\\sa60\\sb120\\keepn\\widctlpar\\adjustright \\b\\f1\\fs20\\cgrid ", + "\\sbasedon0 \\snext30 GroupHeader" }, { "CodeExample0", - "\\s40\\li0\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s40\\li0\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext41 Code Example 0" }, { "CodeExample1", - "\\s41\\li360\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s41\\li360\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext42 Code Example 1" }, { "CodeExample2", - "\\s42\\li720\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s42\\li720\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext43 Code Example 2" }, { "CodeExample3", - "\\s43\\li1080\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s43\\li1080\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext44 Code Example 3" }, { "CodeExample4", - "\\s44\\li1440\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s44\\li1440\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext45 Code Example 4" }, { "CodeExample5", - "\\s45\\li1800\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s45\\li1800\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext46 Code Example 5" }, { "CodeExample6", - "\\s46\\li2160\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s46\\li2160\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext47 Code Example 6" }, { "CodeExample7", - "\\s47\\li2520\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s47\\li2520\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext48 Code Example 7" }, { "CodeExample8", - "\\s48\\li2880\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s48\\li2880\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext49 Code Example 8" }, { "CodeExample9", - "\\s49\\li3240\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid " + "\\s49\\li3240\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", + "\\sbasedon0 \\snext49 Code Example 9" }, { "ListContinue0", - "\\s50\\li0\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s50\\li0\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext51 List Continue 0" }, { "ListContinue1", - "\\s51\\li360\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s51\\li360\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext52 List Continue 1" }, { "ListContinue2", - "\\s52\\li720\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s52\\li720\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext53 List Continue 2" }, { "ListContinue3", - "\\s53\\li1080\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s53\\li1080\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext54 List Continue 3" }, { "ListContinue4", - "\\s54\\li1440\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s54\\li1440\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext55 List Continue 4" }, { "ListContinue5", - "\\s55\\li1800\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s55\\li1800\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext56 List Continue 5" }, { "ListContinue6", - "\\s56\\li2160\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s56\\li2160\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext57 List Continue 6" }, { "ListContinue7", - "\\s57\\li2520\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s57\\li2520\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext58 List Continue 7" }, { "ListContinue8", - "\\s58\\li2880\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s58\\li2880\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext59 List Continue 8" }, { "ListContinue9", - "\\s59\\li3240\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid " + "\\s59\\li3240\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext59 List Continue 9" }, { "DescContinue0", - "\\s60\\li0\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s60\\li0\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext61 DescContinue 0" }, { "DescContinue1", - "\\s61\\li360\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s61\\li360\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext62 DescContinue 1" }, { "DescContinue2", - "\\s62\\li720\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s62\\li720\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext63 DescContinue 2" }, { "DescContinue3", - "\\s63\\li1080\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s63\\li1080\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext64 DescContinue 3" }, { "DescContinue4", - "\\s64\\li1440\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s64\\li1440\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext65 DescContinue 4" }, { "DescContinue5", - "\\s65\\li1800\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s65\\li1800\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext66 DescContinue 5" }, { "DescContinue6", - "\\s66\\li2160\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s66\\li2160\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext67 DescContinue 6" }, { "DescContinue7", - "\\s67\\li2520\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s67\\li2520\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext68 DescContinue 7" }, { "DescContinue8", - "\\s68\\li2880\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s68\\li2880\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext69 DescContinue 8" }, { "DescContinue9", - "\\s69\\li3240\\widctlpar\\ql\\adjustright \\fs20\\cgrid " + "\\s69\\li3240\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext69 DescContinue 9" }, { "LatexTOC0", - "\\s70\\li0\\sa30\\sb30\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s70\\li0\\sa30\\sb30\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext81 LatexTOC 0" }, { "LatexTOC1", - "\\s71\\li360\\sa27\\sb27\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s71\\li360\\sa27\\sb27\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext82 LatexTOC 1" }, { "LatexTOC2", - "\\s72\\li720\\sa24\\sb24\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s72\\li720\\sa24\\sb24\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext83 LatexTOC 2" }, { "LatexTOC3", - "\\s73\\li1080\\sa21\\sb21\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s73\\li1080\\sa21\\sb21\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext84 LatexTOC 3" }, { "LatexTOC4", - "\\s74\\li1440\\sa18\\sb18\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s74\\li1440\\sa18\\sb18\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext85 LatexTOC 4" }, { "LatexTOC5", - "\\s75\\li1800\\sa15\\sb15\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s75\\li1800\\sa15\\sb15\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext86 LatexTOC 5" }, { "LatexTOC6", - "\\s76\\li2160\\sa12\\sb12\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s76\\li2160\\sa12\\sb12\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext87 LatexTOC 6" }, { "LatexTOC7", - "\\s77\\li2520\\sa9\\sb9\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s77\\li2520\\sa9\\sb9\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext88 LatexTOC 7" }, { "LatexTOC8", - "\\s78\\li2880\\sa6\\sb6\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s78\\li2880\\sa6\\sb6\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 LatexTOC 8" }, { "LatexTOC9", - "\\s79\\li3240\\sa3\\sb3\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid " + "\\s79\\li3240\\sa3\\sb3\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 LatexTOC 9" }, { "ListBullet0", - "\\s80\\fi-360\\li360\\widctlpar\\jclisttab\\tx360{\\*\\pn \\pnlvlbody\\ilvl0\\ls1\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid " + "\\s80\\fi-360\\li360\\widctlpar\\jclisttab\\tx360{\\*\\pn \\pnlvlbody\\ilvl0\\ls1\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext81 \\sautoupd List Bullet 0" }, { "ListBullet1", - "\\s81\\fi-360\\li720\\widctlpar\\jclisttab\\tx720{\\*\\pn \\pnlvlbody\\ilvl0\\ls2\\pnrnot0\\pndec }\\ls2\\adjustright \\fs20\\cgrid " + "\\s81\\fi-360\\li720\\widctlpar\\jclisttab\\tx720{\\*\\pn \\pnlvlbody\\ilvl0\\ls2\\pnrnot0\\pndec }\\ls2\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext82 \\sautoupd List Bullet 1" }, { "ListBullet2", - "\\s82\\fi-360\\li1080\\widctlpar\\jclisttab\\tx1080{\\*\\pn \\pnlvlbody\\ilvl0\\ls3\\pnrnot0\\pndec }\\ls3\\adjustright \\fs20\\cgrid " + "\\s82\\fi-360\\li1080\\widctlpar\\jclisttab\\tx1080{\\*\\pn \\pnlvlbody\\ilvl0\\ls3\\pnrnot0\\pndec }\\ls3\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext83 \\sautoupd List Bullet 2" }, { "ListBullet3", - "\\s83\\fi-360\\li1440\\widctlpar\\jclisttab\\tx1440{\\*\\pn \\pnlvlbody\\ilvl0\\ls4\\pnrnot0\\pndec }\\ls4\\adjustright \\fs20\\cgrid " + "\\s83\\fi-360\\li1440\\widctlpar\\jclisttab\\tx1440{\\*\\pn \\pnlvlbody\\ilvl0\\ls4\\pnrnot0\\pndec }\\ls4\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext84 \\sautoupd List Bullet 3" }, { "ListBullet4", - "\\s84\\fi-360\\li1800\\widctlpar\\jclisttab\\tx1800{\\*\\pn \\pnlvlbody\\ilvl0\\ls5\\pnrnot0\\pndec }\\ls5\\adjustright \\fs20\\cgrid " + "\\s84\\fi-360\\li1800\\widctlpar\\jclisttab\\tx1800{\\*\\pn \\pnlvlbody\\ilvl0\\ls5\\pnrnot0\\pndec }\\ls5\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext85 \\sautoupd List Bullet 4" }, { "ListBullet5", - "\\s85\\fi-360\\li2160\\widctlpar\\jclisttab\\tx2160{\\*\\pn \\pnlvlbody\\ilvl0\\ls6\\pnrnot0\\pndec }\\ls6\\adjustright \\fs20\\cgrid " + "\\s85\\fi-360\\li2160\\widctlpar\\jclisttab\\tx2160{\\*\\pn \\pnlvlbody\\ilvl0\\ls6\\pnrnot0\\pndec }\\ls6\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext86 \\sautoupd List Bullet 5" }, { "ListBullet6", - "\\s86\\fi-360\\li2520\\widctlpar\\jclisttab\\tx2520{\\*\\pn \\pnlvlbody\\ilvl0\\ls7\\pnrnot0\\pndec }\\ls7\\adjustright \\fs20\\cgrid " + "\\s86\\fi-360\\li2520\\widctlpar\\jclisttab\\tx2520{\\*\\pn \\pnlvlbody\\ilvl0\\ls7\\pnrnot0\\pndec }\\ls7\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext87 \\sautoupd List Bullet 6" }, { "ListBullet7", - "\\s87\\fi-360\\li2880\\widctlpar\\jclisttab\\tx2880{\\*\\pn \\pnlvlbody\\ilvl0\\ls8\\pnrnot0\\pndec }\\ls8\\adjustright \\fs20\\cgrid " + "\\s87\\fi-360\\li2880\\widctlpar\\jclisttab\\tx2880{\\*\\pn \\pnlvlbody\\ilvl0\\ls8\\pnrnot0\\pndec }\\ls8\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext88 \\sautoupd List Bullet 7" }, { "ListBullet8", - "\\s88\\fi-360\\li3240\\widctlpar\\jclisttab\\tx3240{\\*\\pn \\pnlvlbody\\ilvl0\\ls9\\pnrnot0\\pndec }\\ls9\\adjustright \\fs20\\cgrid " + "\\s88\\fi-360\\li3240\\widctlpar\\jclisttab\\tx3240{\\*\\pn \\pnlvlbody\\ilvl0\\ls9\\pnrnot0\\pndec }\\ls9\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 \\sautoupd List Bullet 8" }, { "ListBullet9", - "\\s89\\fi-360\\li3600\\widctlpar\\jclisttab\\tx3600{\\*\\pn \\pnlvlbody\\ilvl0\\ls10\\pnrnot0\\pndec }\\ls10\\adjustright \\fs20\\cgrid " + "\\s89\\fi-360\\li3600\\widctlpar\\jclisttab\\tx3600{\\*\\pn \\pnlvlbody\\ilvl0\\ls10\\pnrnot0\\pndec }\\ls10\\adjustright \\fs20\\cgrid ", + "\\sbasedon0 \\snext89 \\sautoupd List Bullet 9" }, { "ListEnum0", - "\\s90\\fi-360\\li360\\widctlpar\\fs20\\cgrid " + "\\s90\\fi-360\\li360\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext91 \\sautoupd List Enum 0" }, { "ListEnum1", - "\\s91\\fi-360\\li720\\widctlpar\\fs20\\cgrid " + "\\s91\\fi-360\\li720\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext92 \\sautoupd List Enum 1" }, { "ListEnum2", - "\\s92\\fi-360\\li1080\\widctlpar\\fs20\\cgrid " + "\\s92\\fi-360\\li1080\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext93 \\sautoupd List Enum 2" }, { "ListEnum3", - "\\s93\\fi-360\\li1440\\widctlpar\\fs20\\cgrid " + "\\s93\\fi-360\\li1440\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext94 \\sautoupd List Enum 3" }, { "ListEnum4", - "\\s94\\fi-360\\li1800\\widctlpar\\fs20\\cgrid " + "\\s94\\fi-360\\li1800\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext95 \\sautoupd List Enum 4" }, { "ListEnum5", - "\\s95\\fi-360\\li2160\\widctlpar\\fs20\\cgrid " + "\\s95\\fi-360\\li2160\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext96 \\sautoupd List Enum 5" }, { "ListEnum6", - "\\s96\\fi-360\\li2520\\widctlpar\\fs20\\cgrid " + "\\s96\\fi-360\\li2520\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext96 \\sautoupd List Enum 5" }, { "ListEnum7", - "\\s97\\fi-360\\li2880\\widctlpar\\fs20\\cgrid " + "\\s97\\fi-360\\li2880\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext98 \\sautoupd List Enum 7" }, { "ListEnum8", - "\\s98\\fi-360\\li3240\\widctlpar\\fs20\\cgrid " + "\\s98\\fi-360\\li3240\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext99 \\sautoupd List Enum 8" }, { "ListEnum9", - "\\s99\\fi-360\\li3600\\widctlpar\\fs20\\cgrid " + "\\s99\\fi-360\\li3600\\widctlpar\\fs20\\cgrid ", + "\\sbasedon0 \\snext99 \\sautoupd List Enum 9" }, { 0, - 0 + 0, + 0 } }; -static QDict Rtf_Style(257); - void RTFGenerator::writeStyleSheetFile(QFile &file) { QTextStream t(&file); @@ -357,14 +429,115 @@ void RTFGenerator::writeStyleSheetFile(QFile &file) t << "# Remove a hash to activate a line.\n\n"; int i; - for (i=0;Rtf_Style_Default[i].name!=0;i++) + for (i=0;Rtf_Style_Default[i].reference!=0;i++) { t << "# " << Rtf_Style_Default[i].name << " = " - << Rtf_Style_Default[i].value << endl; + << Rtf_Style_Default[i].reference + << Rtf_Style_Default[i].definition << endl; + } +} + +struct StyleData +{ + // elements of this type are stored in dictionary Rtf_Style + // + // to define a tag in the header reference + definition is required + // to use a tag in the body of the document only reference is required + + unsigned index; // index in style-sheet, i.e. number in s-clause + char* reference; // everything required to apply the style + char* definition; // aditional tags like \snext and style name + + StyleData(const char* reference, const char* definition); + ~StyleData(); + bool setStyle(const char* s, const char* styleName); + + static const QRegExp s_clause; +}; + +const QRegExp StyleData::s_clause("\\\\s[0-9]+\\s*"); + +StyleData::StyleData(const char* reference, const char* definition) +{ + int start = s_clause.match(reference); ASSERT(start >= 0); + reference += start; + index = (int)atol(reference + 2); ASSERT(index > 0); + + ASSERT(reference != 0); + size_t size = 1 + strlen(reference); + memcpy(this->reference = new char[size], reference, size); + + ASSERT(definition != 0); + size = 1 + strlen(definition); + memcpy(this->definition = new char[size], definition, size); +} + +StyleData::~StyleData() +{ + delete[] reference; + delete[] definition; +} + +bool StyleData::setStyle(const char* s, const char* styleName) +{ + static const QRegExp subgroup("^{[^}]*}\\s*"); + static const QRegExp any_clause("^\\\\[a-z][a-z0-9-]*\\s*"); + + int len; + int start = s_clause.match(s, 0, &len); + if (start < 0) + { + err("Style sheet '%s' contains no '\\s' clause.\n{%s}\n", styleName, s); + return false; + } + s += start; + index = (int)atol(s + 2); ASSERT(index > 0); + + // search for the end of pure formatting codes + const char* end = s + len; + bool haveNewDefinition = true; + for(;;) + { + if (*end == '{') + { + // subgroups are used for \\additive + if (0 != subgroup.match(end, 0, &len)) + break; + else + end += len; + } + else if (*end == '\\') + { + if (0 == strncmp(end, "\\snext", 6)) + break; + if (0 == strncmp(end, "\\sbasedon", 9)) + break; + if (0 != any_clause.match(end, 0, &len)) + break; + end += len; + } + else if (*end == 0) + { // no style-definition part, keep default value + haveNewDefinition = false; + break; + } + else // plain name without leading \\snext + break; + } + delete[] reference; + reference = new char[len + 1]; + memcpy(reference, s, len); reference[len] = 0; + if (haveNewDefinition) + { + delete[] definition; + size_t size = 1 + strlen(end); + definition = new char[size]; + memcpy(definition, end, size); } + return true; } -static void loadStylesheet(const char *name) +static void loadStylesheet(const char *name, QDict& dict) { QFile file(name); if (!file.open(IO_ReadOnly)) @@ -390,21 +563,24 @@ static void loadStylesheet(const char *name) continue; } QCString key=s.left(sepStart); - if (Rtf_Style[key]==0) // not a valid style sheet name + if (dict[key]==0) // not a valid style sheet name { warn(name,lineNr,"Invalid style sheet name %s ignored.\n",key.data()); continue; } + StyleData* styleData = dict.find(key); + if (styleData == 0) + { + warn(name,lineNr,"Unknown style sheet name %s ignored.\n",key.data()); + continue; + } s+=" "; // add command separator - Rtf_Style.remove(key); // remove old key - int l = strlen(s.data()+sepStart+sepLength); - char *value = new char[l+1]; - strcpy(value,s.data()+sepStart+sepLength); - Rtf_Style.insert(key,value); // insert new key + styleData->setStyle(s.data() + sepStart + sepLength, key.data()); lineNr++; } } +static QDict Rtf_Style(257); void RTFGenerator::init() { @@ -415,25 +591,24 @@ void RTFGenerator::init() err("Could not create output directory %s\n",dir.data()); exit(1); } + Rtf_Style.setAutoDelete(true); - Rtf_Style.setAutoDelete(TRUE); - int i=0; - while (Rtf_Style_Default[i].name!=0) + // first duplicate strings of Rtf_Style_Default + const struct Rtf_Style_Default* def = Rtf_Style_Default; + while(def->reference != 0) { - int l = strlen(Rtf_Style_Default[i].value); - char *value = new char[l+1]; - strcpy(value,Rtf_Style_Default[i].value); - Rtf_Style.insert(Rtf_Style_Default[i].name,value); - i++; + if (def->definition == 0) + err("Internal error: Rtf_Style_Default[%s] has no definition.\n", def->name); + StyleData* styleData = new StyleData(def->reference, def->definition); + Rtf_Style.insert(def->name, styleData); + def++; } + // overwrite some (or all) definitions from file if (!Config::rtfStylesheetFile.isEmpty()) - { - loadStylesheet(Config::rtfStylesheetFile); - } + loadStylesheet(Config::rtfStylesheetFile, Rtf_Style); } - static QCString makeIndexName(const char *s,int i) { QCString result=s; @@ -443,7 +618,6 @@ static QCString makeIndexName(const char *s,int i) void RTFGenerator::beginRTFDocument() { - int i; /* all the included RTF files should begin with the * same header */ @@ -475,58 +649,40 @@ void RTFGenerator::beginRTFDocument() t <<"\\red128\\green128\\blue128;"; t <<"\\red192\\green192\\blue192;}" << endl; - DBG_RTF(t <<"{\\comment Begining style list}\n") + DBG_RTF(t <<"{\\comment Beginning style list}\n") t <<"{\\stylesheet\n"; t <<"{\\widctlpar\\adjustright \\fs20\\cgrid \\snext0 Normal;}\n"; - t <<"{" << Rtf_Style["Heading1"] <<"\\sbasedon0 \\snext0 heading 1;}\n"; - t <<"{" << Rtf_Style["Heading2"] <<"\\sbasedon0 \\snext0 heading 2;}\n"; - t <<"{" << Rtf_Style["Heading3"] <<"\\sbasedon0 \\snext0 heading 3;}\n"; - t <<"{" << Rtf_Style["Heading4"] <<"\\sbasedon0 \\snext0 heading 4;}\n"; - t <<"{\\*\\cs10 \\additive Default Paragraph Font;}\n"; - t <<"{" << Rtf_Style["Title"] << "\\sbasedon0 \\snext15 Title;}\n"; - t <<"{" << Rtf_Style["SubTitle"] << "\\sbasedon0 \\snext16 Subtitle;}\n"; - t <<"{" << Rtf_Style["BodyText"] << "\\sbasedon0 \\snext17 BodyText;}\n"; - t <<"{" << Rtf_Style["DenseText"] << "\\sbasedon0 \\snext18 DenseText;}\n"; - t <<"{" << Rtf_Style["Header"] << "\\sbasedon0 \\snext28 header;}\n"; - t <<"{" << Rtf_Style["Footer"] << "\\sbasedon0 \\snext29 footer;}\n"; - t <<"{" << Rtf_Style["GroupHeader"] << "\\sbasedon0 \\snext30 GroupHeader}\n"; - - for (i=0;i array(128); + array.fill(0); + QDictIterator iter(Rtf_Style); + const StyleData* style; + for(; (style = iter.current()); ++iter) { - QCString n=makeIndexName("ListBullet",i); - t <<"{" << Rtf_Style[n] << "\\sbasedon0 \\snext8" - << (QMIN(i+1,indentLevels-1)) << " \\sautoupd List Bullet " << i << ";}\n"; + unsigned index = style->index; + unsigned size = array.size(); + if (index >= size) + { + // +1 to add at least one element, then align up to multiple of 8 + array.resize((index + 1 + 7) & ~7); + array.fill(0, size); + ASSERT(index < array.size()); + } + if (array.at(index) != 0) + msg("Style '%s' redefines \\s%d.\n", iter.currentKey(), index); + array.at(index) = style; } - for (i=0;ireference << style->definition << ";}\n"; } + t <<"}" << endl; // this comment is needed for postprocessing! t <<"{\\comment begin body}" << endl; @@ -537,7 +693,7 @@ void RTFGenerator::beginRTFChapter() { t <<"\n"; DBG_RTF(t << "{\\comment Begin Chapter}\n") - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; // if we are compact, no extra page breaks... if (Config::compactRTFFlag) @@ -550,14 +706,14 @@ void RTFGenerator::beginRTFChapter() t <<"\\sect\\sbkpage\n"; //t <<"\\sect\\sectd\\sbkpage\n"; - t << Rtf_Style["Heading1"] << "\n"; + t << Rtf_Style["Heading1"]->reference << "\n"; } void RTFGenerator::beginRTFSection() { t <<"\n"; DBG_RTF(t << "{\\comment Begin Section}\n") - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; // if we are compact, no extra page breaks... if (Config::compactRTFFlag) @@ -570,7 +726,7 @@ void RTFGenerator::beginRTFSection() t <<"\\sect\\sbkpage\n"; //t <<"\\sect\\sectd\\sbkpage\n"; - t << Rtf_Style["Heading2"] << "\n"; + t << Rtf_Style["Heading2"]->reference << "\n"; } void RTFGenerator::startFile(const char *name,const char *, bool ) @@ -747,14 +903,14 @@ void RTFGenerator::endIndexSection(IndexSections is) "}"; DBG_RTF(t << "{\\comment end of infoblock}\n") // setup for this section - t << Rtf_Style["Reset"] <<"\n"; + t << Rtf_Style_Reset <<"\n"; t <<"\\sectd\\pgnlcrm\n"; - t <<"{\\footer "<reference << "{\\chpgn}}\n"; // the title entry DBG_RTF(t << "{\\comment begin title page}\n") - t << Rtf_Style["Reset"] << Rtf_Style["Title"] << endl; // set to title style + t << Rtf_Style_Reset << Rtf_Style["Title"]->reference << endl; // set to title style t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt TITLE}}\\par" << endl; - t << Rtf_Style["Reset"] << Rtf_Style["SubTitle"] << endl; // set to subtitle style + t << Rtf_Style_Reset << Rtf_Style["SubTitle"]->reference << endl; // set to subtitle style t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par" << endl; t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" "{\\fldrslt CREATEDATE}}\\par"<trMainPage() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"index.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isModuleIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isNamespaceIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isClassHierarchyIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trHierarchicalIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"hierarchy.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isCompoundIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trCompoundIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"annotated.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isFileIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trFileIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"files.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isPageIndex: - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\tc \\v " << theTranslator->trPageIndex() << "}"<< endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"pages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; @@ -812,7 +968,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (gd->countMembers()>0) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << gd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -825,7 +981,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (gd->countMembers()>0) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << gd->getOutputFileBase(); @@ -843,7 +999,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (nd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << nd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -855,7 +1011,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (nd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << nd->getOutputFileBase(); @@ -875,7 +1031,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (cd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << cd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -887,7 +1043,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (cd->isLinkableInProject()) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << cd->getOutputFileBase(); @@ -912,7 +1068,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (isFirst) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << fd->getOutputFileBase(); t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -920,7 +1076,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } else { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << fd->getOutputFileBase(); @@ -941,14 +1097,14 @@ void RTFGenerator::endIndexSection(IndexSections is) PageInfo *pi=pdi.toFirst(); if (pi) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << convertFileName(pi->name); t << "-example.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } for (++pdi;(pi=pdi.current());++pdi) { - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << convertFileName(pi->name); @@ -968,7 +1124,7 @@ void RTFGenerator::endIndexSection(IndexSections is) pageName=pi->name.copy(); else pageName=pi->name.lower(); - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << pageName; t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; @@ -980,7 +1136,7 @@ void RTFGenerator::endIndexSection(IndexSections is) pageName=pi->name.copy(); else pageName=pi->name.lower(); - //t << "\\par " << Rtf_Style["Reset"] << endl; + //t << "\\par " << Rtf_Style_Reset << endl; //beginRTFSection(); t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; t << pageName; @@ -990,9 +1146,9 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isEndIndex: beginRTFChapter(); - t << Rtf_Style["Heading1"]; + t << Rtf_Style["Heading1"]->reference; t << "Index\\par "<< endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "{\\tc \\v Index}" << endl; t << "{\\field\\fldedit {\\*\\fldinst INDEX \\\\c2 \\\\*MERGEFORMAT}{\\fldrslt INDEX}}\n"; @@ -1008,8 +1164,8 @@ void RTFGenerator::lastIndexPage() t <<"\\sect \\sectd \\sbknone \\pgndec\n"; // set footer - t <<"{\\footer "<< Rtf_Style["Footer"] << "{\\chpgn}}\n"; - //t << Rtf_Style["Heading1"] << "\n"; + t <<"{\\footer "<< Rtf_Style["Footer"]->reference << "{\\chpgn}}\n"; + //t << Rtf_Style["Heading1"]->reference << "\n"; } @@ -1034,7 +1190,7 @@ void RTFGenerator::startIndexList() DBG_RTF(t << "{\\comment (startIndexList)}" << endl) t << "{" << endl; incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_LCList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_LCList_DepthStyle() << endl; newParagraph(); m_omitParagraph=TRUE; } @@ -1055,7 +1211,7 @@ void RTFGenerator::startItemList() t << "{"; incrementIndentLevel(); listItemInfo[m_listLevel].isEnum = FALSE; - //t << Rtf_Style["Reset"] << Rtf_BList_DepthStyle(); + //t << Rtf_Style_Reset << Rtf_BList_DepthStyle(); } /*! end bullet list */ @@ -1066,7 +1222,7 @@ void RTFGenerator::endItemList() t << "}"; decrementIndentLevel(); m_omitParagraph=TRUE; - //t << Rtf_Style["Reset"] << styleStack.top() << endl; + //t << Rtf_Style_Reset << styleStack.top() << endl; //printf("RTFGenerator::endItemList() `%s'\n",styleStack.top()); //newParagraph(); } @@ -1079,7 +1235,7 @@ void RTFGenerator::startEnumList() // starts an enumeration list incrementIndentLevel(); listItemInfo[m_listLevel].isEnum = TRUE; listItemInfo[m_listLevel].number = 1; - //t << Rtf_Style["Reset"] << Rtf_EList_DepthStyle() << endl; + //t << Rtf_Style_Reset << Rtf_EList_DepthStyle() << endl; //newParagraph(); //m_omitParagraph=TRUE; @@ -1100,7 +1256,7 @@ void RTFGenerator::writeListItem() { DBG_RTF(t << "{\\comment (writeListItem)}" << endl) newParagraph(); - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; if (listItemInfo[m_listLevel].isEnum) { t << Rtf_EList_DepthStyle() << endl; @@ -1218,14 +1374,14 @@ void RTFGenerator::startSubsection() //beginRTFSubSection(); t <<"\n"; DBG_RTF(t << "{\\comment Begin SubSection}\n") - t << Rtf_Style["Reset"]; - t << Rtf_Style["Heading3"] << "\n"; + t << Rtf_Style_Reset; + t << Rtf_Style["Heading3"]->reference << "\n"; } void RTFGenerator::endSubsection() { newParagraph(); - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; } void RTFGenerator::startSubsubsection() @@ -1234,7 +1390,7 @@ void RTFGenerator::startSubsubsection() t << "\n"; DBG_RTF(t << "{\\comment Begin SubSubSection}\n") t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_Style["Heading4"] << "\n"; + t << Rtf_Style_Reset << Rtf_Style["Heading4"]->reference << "\n"; } void RTFGenerator::endSubsubsection() @@ -1374,13 +1530,13 @@ void RTFGenerator::startTitleHead(const char *) DBG_RTF(t <<"{\\comment startTitleHead}" << endl) // beginRTFSection(); - t << Rtf_Style["Reset"] << Rtf_Style["Heading2"] << endl; + t << Rtf_Style_Reset << Rtf_Style["Heading2"]->reference << endl; } void RTFGenerator::endTitleHead(const char *fileName,const char *name) { DBG_RTF(t <<"{\\comment endTitleHead}" << endl) - t << "\\par " << Rtf_Style["Reset"] << endl; + t << "\\par " << Rtf_Style_Reset << endl; if (name) { // make table of contents entry @@ -1416,8 +1572,8 @@ void RTFGenerator::startGroupHeader() { DBG_RTF(t <<"{\\comment startGroupHeader}" << endl) newParagraph(); - t << Rtf_Style["Reset"]; - t << Rtf_Style["Heading3"]; + t << Rtf_Style_Reset; + t << Rtf_Style["Heading3"]->reference; t << endl; } @@ -1425,7 +1581,7 @@ void RTFGenerator::endGroupHeader() { DBG_RTF(t <<"{\\comment endGroupHeader}" << endl) newParagraph(); - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; } void RTFGenerator::startMemberDoc(const char *clname, @@ -1439,10 +1595,10 @@ void RTFGenerator::startMemberDoc(const char *clname, addToIndex(memname,clname); addToIndex(clname,memname); } - t << Rtf_Style["Reset"] << Rtf_Style["Heading4"]; + t << Rtf_Style_Reset << Rtf_Style["Heading4"]->reference; //styleStack.push(Rtf_Style_Heading4); t << "{" << endl; - //printf("RTFGenerator::startMemberDoc() `%s'\n",Rtf_Style["Heading4"]); + //printf("RTFGenerator::startMemberDoc() `%s'\n",Rtf_Style["Heading4"]->reference); startBold(); t << endl; } @@ -1453,7 +1609,7 @@ void RTFGenerator::endMemberDoc() t << "}" << endl; //const char *style = styleStack.pop(); //printf("RTFGenerator::endMemberDoc() `%s'\n",style); - //ASSERT(style==Rtf_Style["Heading4"]); + //ASSERT(style==Rtf_Style["Heading4"]->reference); endBold(); newParagraph(); } @@ -1509,7 +1665,7 @@ void RTFGenerator::startIndent() incrementIndentLevel(); DBG_RTF(t << "{\\comment (startIndent) }" << endl) t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_CList_DepthStyle() << endl; //styleStack.push(style); } @@ -1525,7 +1681,7 @@ void RTFGenerator::startDescription() { DBG_RTF(t << "{\\comment (startDescription)}" << endl) t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::endDescription() @@ -1554,7 +1710,7 @@ void RTFGenerator::startMemberDescription() DBG_RTF(t << "{\\comment (startMemberDescription)}" << endl) t << "{" << endl; incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); startEmphasis(); } @@ -1578,16 +1734,16 @@ void RTFGenerator::endDescTitle() { DBG_RTF(t << "{\\comment (endDescTitle) }" << endl) newParagraph(); - //t << Rtf_Style["Reset"] << styleStack.top(); + //t << Rtf_Style_Reset << styleStack.top(); incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_DList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_DList_DepthStyle(); } void RTFGenerator::writeDescItem() { DBG_RTF(t << "{\\comment (writeDescItem) }" << endl) // incrementIndentLevel(); - //t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + //t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::endDescList() @@ -1597,18 +1753,18 @@ void RTFGenerator::endDescList() t << "}"; decrementIndentLevel(); m_omitParagraph = TRUE; - //t << Rtf_Style["Reset"] << styleStack.top() << endl; + //t << Rtf_Style_Reset << styleStack.top() << endl; } -void RTFGenerator::writeSection(const char *lab,const char *title,bool sub) +void RTFGenerator::startSection(const char *,const char *title,bool sub) { - DBG_RTF(t << "{\\comment (writeSection)}" << endl) + DBG_RTF(t << "{\\comment (startSection)}" << endl) t << "{"; - t<< Rtf_Style["Reset"]; + t<< Rtf_Style_Reset; if (sub) { // set style - t << Rtf_Style["Heading3"]; + t << Rtf_Style["Heading3"]->reference; // make table of contents entry t << "{\\tc\\tcl3 \\v "; docify(title); @@ -1617,16 +1773,16 @@ void RTFGenerator::writeSection(const char *lab,const char *title,bool sub) else { // set style - t << Rtf_Style["Heading2"]; + t << Rtf_Style["Heading2"]->reference; // make table of contents entry t << "{\\tc\\tcl2 \\v "; docify(title); t << "}" << endl; } +} - // write out actual title - docify(title); - +void RTFGenerator::endSection(const char *lab,bool) +{ newParagraph(); // make bookmark writeAnchor(0,lab); @@ -1741,7 +1897,7 @@ void RTFGenerator::endClassDiagram(ClassDiagram &d, // display the file t << "{" << endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; t << fileName << ".gif"; t << " \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; @@ -1756,7 +1912,7 @@ void RTFGenerator::writeFormula(const char *,const char *text) void RTFGenerator::startMemberItem(int) { DBG_RTF(t <<"{\\comment startMemberItem }" << endl) - t << Rtf_Style["Reset"] << Rtf_BList_DepthStyle() << endl; // set style to apropriate depth + t << Rtf_Style_Reset << Rtf_BList_DepthStyle() << endl; // set style to apropriate depth } void RTFGenerator::endMemberItem(bool) @@ -1786,7 +1942,7 @@ void RTFGenerator::startCodeFragment() { t << "{" << endl; newParagraph(); - t << Rtf_Style["Reset"] << Rtf_Code_DepthStyle(); + t << Rtf_Style_Reset << Rtf_Code_DepthStyle(); //styleStack.push(Rtf_Style_CodeExample); } @@ -1795,7 +1951,7 @@ void RTFGenerator::endCodeFragment() newParagraph(); //styleStack.pop(); //printf("RTFGenerator::endCodeFrament() top=%s\n",styleStack.top()); - //t << Rtf_Style["Reset"] << styleStack.top() << endl; + //t << Rtf_Style_Reset << styleStack.top() << endl; t << "}" << endl; m_omitParagraph = TRUE; } @@ -1842,7 +1998,7 @@ void RTFGenerator::startDescTable() DBG_RTF(t << "{\\comment (startDescTable) }" << endl) t << "{" << endl; //incrementIndentLevel(); - //t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + //t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::endDescTable() @@ -1850,7 +2006,7 @@ void RTFGenerator::endDescTable() //decrementIndentLevel(); DBG_RTF(t << "{\\comment (endDescTable)}" << endl) t << "}" << endl; - //t << Rtf_Style["Reset"] << styleStack.top(); + //t << Rtf_Style_Reset << styleStack.top(); } void RTFGenerator::startDescTableTitle() @@ -1904,54 +2060,54 @@ void RTFGenerator::decrementIndentLevel() const char * RTFGenerator::Rtf_CList_DepthStyle() { QCString n=makeIndexName("ListContinue",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } // a style for list formatted as a "latext style" table of contents const char * RTFGenerator::Rtf_LCList_DepthStyle() { QCString n=makeIndexName("LatexTOC",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } // a style for list formatted as a "bullet" style const char * RTFGenerator::Rtf_BList_DepthStyle() { QCString n=makeIndexName("ListBullet",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } // a style for list formatted as a "enumeration" style const char * RTFGenerator::Rtf_EList_DepthStyle() { QCString n=makeIndexName("ListEnum",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } const char * RTFGenerator::Rtf_DList_DepthStyle() { QCString n=makeIndexName("DescContinue",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } const char * RTFGenerator::Rtf_Code_DepthStyle() { QCString n=makeIndexName("CodeExample",m_listLevel); - return Rtf_Style[n]; + return Rtf_Style[n]->reference; } void RTFGenerator::startTextBlock(bool dense) { DBG_RTF(t << "{\\comment Start TextBlock}" << endl) t << "{" << endl; - t << Rtf_Style["Reset"]; + t << Rtf_Style_Reset; if (dense) // no spacing between "paragraphs" { - t << Rtf_Style["DenseText"]; + t << Rtf_Style["DenseText"]->reference; } else // some spacing { - t << Rtf_Style["BodyText"]; + t << Rtf_Style["BodyText"]->reference; } } @@ -1972,7 +2128,7 @@ void RTFGenerator::newParagraph() void RTFGenerator::startMemberSubtitle() { t << "{" << endl; - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_CList_DepthStyle() << endl; } void RTFGenerator::endMemberSubtitle() @@ -2165,7 +2321,7 @@ void RTFGenerator::endDotGraph(DotClassGraph &g) // display the file t << "{" << endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; t << g.diskName() << ".gif"; t << " \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; @@ -2186,7 +2342,7 @@ void RTFGenerator::endInclDepGraph(DotInclDepGraph &g) // display the file t << "{" << endl; - t << Rtf_Style["Reset"] << endl; + t << Rtf_Style_Reset << endl; t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; t << g.diskName() << ".gif"; t << " \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl; @@ -2246,14 +2402,14 @@ void RTFGenerator::startMemberGroupHeader(bool hasHeader) DBG_RTF(t << "{\\comment startMemberGroupHeader}" << endl) t << "{" << endl; if (hasHeader) incrementIndentLevel(); - t << Rtf_Style["Reset"] << Rtf_Style["GroupHeader"]; + t << Rtf_Style_Reset << Rtf_Style["GroupHeader"]->reference; } void RTFGenerator::endMemberGroupHeader() { DBG_RTF(t << "{\\comment endMemberGroupHeader}" << endl) newParagraph(); - t << Rtf_Style["Reset"] << Rtf_CList_DepthStyle(); + t << Rtf_Style_Reset << Rtf_CList_DepthStyle(); } void RTFGenerator::startMemberGroupDocs() @@ -2272,7 +2428,7 @@ void RTFGenerator::endMemberGroupDocs() void RTFGenerator::startMemberGroup() { DBG_RTF(t << "{\\comment startMemberGroup}" << endl) - t << Rtf_Style["Reset"] << Rtf_BList_DepthStyle() << endl; + t << Rtf_Style_Reset << Rtf_BList_DepthStyle() << endl; } void RTFGenerator::endMemberGroup(bool hasHeader) diff --git a/src/rtfgen.h b/src/rtfgen.h index de873a2..8fc53ad 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -166,7 +166,8 @@ class RTFGenerator : public OutputGenerator void endDescTitle(); void writeDescItem(); void endDescList(); - void writeSection(const char *,const char *,bool); + void startSection(const char *,const char *,bool); + void endSection(const char *,bool); void writeSectionRef(const char *,const char *,const char *); void writeSectionRefItem(const char *,const char *,const char *); void writeSectionRefAnchor(const char *,const char *,const char *); diff --git a/src/scanner.l b/src/scanner.l index 9f419f8..ae07bce 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -309,7 +309,7 @@ static int yyread(char *buf,int max_size) %} CMD ("\\"|"@") -SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup") +SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup"|"latexonly"|"htmlonly") BN [ \t\n\r] BL [ \t\r]*"\n" B [ \t] @@ -1901,7 +1901,10 @@ TITLE [tT][iI][tT][lL][eE] "#" { lastCPPContext = YY_START; BEGIN(SkipCPP); } -[:;{] { +":" { + BEGIN(SkipInits); + } +[;{] { current->name=current->name.simplifyWhiteSpace(); current->type=current->type.simplifyWhiteSpace(); current->args=current->args.simplifyWhiteSpace(); @@ -1983,11 +1986,11 @@ TITLE [tT][iI][tT][lL][eE] curlyCount=0; BEGIN( SkipCurly ) ; } - else if( *yytext == ':' ) - { - //addToBody(yytext); - BEGIN( SkipInits ) ; - } + //else if( *yytext == ':' ) + //{ + // //addToBody(yytext); + // BEGIN( SkipInits ) ; + //} else { if (previous->section!=Entry::VARIABLE_SEC) @@ -1998,9 +2001,11 @@ TITLE [tT][iI][tT][lL][eE] "{" { //addToBody(yytext); - lastCurlyContext = FindMembers; - curlyCount=0; - BEGIN( SkipCurly ) ; + //lastCurlyContext = FindMembers; + //curlyCount=0; + //BEGIN( SkipCurly ) ; + unput('{'); + BEGIN( Function ); } "{" { //addToBody(yytext); @@ -2186,7 +2191,7 @@ TITLE [tT][iI][tT][lL][eE] } ":" { current->type.resize(0); - if (current->section == Entry::INTERFACE_SEC) + if (current->section == Entry::INTERFACE_SEC || current->section == Entry::STRUCT_SEC) baseProt=Public; else baseProt=Private; @@ -2311,7 +2316,7 @@ TITLE [tT][iI][tT][lL][eE] } . { current->program += *yytext ; } -("//"{B}*)?"/*!" { +("//"{B}*)?"/*!" { //printf("Start doc block at %d\n",yyLineNr); removeSlashes=(yytext[1]=='/'); tmpDocType=-1; @@ -2324,7 +2329,7 @@ TITLE [tT][iI][tT][lL][eE] current->inside = current_root->name+"::"; BEGIN( Doc ); } -("//"{B}*)?"/**"/[^/*] { +("//"{B}*)?"/**"/[^/*] { removeSlashes=(yytext[1]=='/'); lastDocContext = YY_START; if (current_root->section & Entry::SCOPE_MASK) -- cgit v0.12