From fa1897b1889f7bf74de68f1ac99cf3be343a7551 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 14 Mar 2021 15:47:59 +0100 Subject: Refactoring: replace QFile/FTextStream with fstream/stringstream --- qtools/qcstring.h | 21 +- src/CMakeLists.txt | 1 - src/cite.cpp | 108 +- src/cite.h | 2 - src/classdef.cpp | 23 +- src/classdef.h | 3 +- src/config.h | 6 +- src/configimpl.h | 51 +- src/configimpl.l | 131 +- src/context.cpp | 127 +- src/defgen.cpp | 217 +- src/definition.cpp | 6 +- src/definition.h | 4 +- src/definitionimpl.h | 4 +- src/dia.h | 7 +- src/diagram.cpp | 47 +- src/diagram.h | 8 +- src/dir.cpp | 10 + src/dir.h | 1 + src/dirdef.cpp | 19 +- src/dirdef.h | 3 +- src/docbookgen.cpp | 177 +- src/docbookgen.h | 12 +- src/docbookvisitor.cpp | 265 +- src/docbookvisitor.h | 13 +- src/docparser.cpp | 30 +- src/docsets.cpp | 247 +- src/docsets.h | 5 +- src/doctokenizer.l | 2 - src/dot.cpp | 18 +- src/dot.h | 3 +- src/dotcallgraph.cpp | 2 +- src/dotcallgraph.h | 3 +- src/dotclassgraph.cpp | 8 +- src/dotclassgraph.h | 10 +- src/dotdirdeps.cpp | 13 +- src/dotdirdeps.h | 2 +- src/dotfilepatcher.cpp | 149 +- src/dotfilepatcher.h | 9 +- src/dotgfxhierarchytable.cpp | 19 +- src/dotgfxhierarchytable.h | 6 +- src/dotgraph.cpp | 94 +- src/dotgraph.h | 16 +- src/dotgroupcollaboration.cpp | 19 +- src/dotgroupcollaboration.h | 8 +- src/dotincldepgraph.cpp | 6 +- src/dotincldepgraph.h | 6 +- src/dotlegendgraph.cpp | 7 +- src/dotnode.cpp | 82 +- src/dotnode.h | 14 +- src/dotrunner.cpp | 32 +- src/doxygen.cpp | 83 +- src/doxygen.h | 2 - src/eclipsehelp.cpp | 84 +- src/eclipsehelp.h | 15 +- src/emoji.cpp | 10 +- src/emoji.h | 9 +- src/entry.cpp | 1 - src/entry.h | 1 - src/filedef.cpp | 25 +- src/filedef.h | 3 +- src/formula.cpp | 114 +- src/fortranscanner.l | 10 +- src/ftextstream.cpp | 260 -- src/ftextstream.h | 76 - src/ftvhelp.cpp | 97 +- src/ftvhelp.h | 11 +- src/groupdef.cpp | 26 +- src/groupdef.h | 3 +- src/htags.cpp | 18 +- src/htmldocvisitor.cpp | 120 +- src/htmldocvisitor.h | 5 +- src/htmlentity.cpp | 3 +- src/htmlentity.h | 5 +- src/htmlgen.cpp | 511 ++-- src/htmlgen.h | 41 +- src/htmlhelp.cpp | 57 +- src/image.cpp | 47 +- src/index.cpp | 70 +- src/index.h | 1 - src/latexdocvisitor.cpp | 85 +- src/latexdocvisitor.h | 5 +- src/latexgen.cpp | 393 ++- src/latexgen.h | 40 +- src/layout.cpp | 6 +- src/mandocvisitor.cpp | 274 +- src/mandocvisitor.h | 6 +- src/mangen.cpp | 105 +- src/mangen.h | 8 +- src/markdown.cpp | 2 +- src/memberdef.cpp | 22 +- src/memberdef.h | 2 +- src/membergroup.cpp | 2 +- src/membergroup.h | 3 +- src/memberlist.cpp | 2 +- src/memberlist.h | 2 +- src/msc.cpp | 54 +- src/msc.h | 13 +- src/namespacedef.cpp | 22 +- src/namespacedef.h | 3 +- src/outputgen.cpp | 18 +- src/outputgen.h | 9 +- src/pagedef.cpp | 14 +- src/pagedef.h | 3 +- src/perlmodgen.cpp | 176 +- src/plantuml.cpp | 14 +- src/portable.cpp | 48 +- src/portable.h | 7 +- src/qhp.cpp | 18 +- src/qhpxmlwriter.cpp | 39 +- src/qhpxmlwriter.h | 10 +- src/reflist.cpp | 3 +- src/resourcemgr.cpp | 37 +- src/rtfdocvisitor.cpp | 254 +- src/rtfdocvisitor.h | 7 +- src/rtfgen.cpp | 693 +++--- src/rtfgen.h | 8 +- src/scanner.l | 2 - src/searchindex.cpp | 203 +- src/sqlite3gen.cpp | 12 +- src/template.cpp | 95 +- src/template.h | 5 +- src/textdocvisitor.cpp | 9 +- src/textdocvisitor.h | 6 +- src/util.cpp | 190 +- src/util.h | 15 +- src/vhdlcode.l | 1 - src/vhdldocgen.cpp | 94 +- src/vhdldocgen.h | 23 +- src/vhdljjparser.h | 1 - src/xmldocvisitor.cpp | 60 +- src/xmldocvisitor.h | 6 +- src/xmlgen.cpp | 454 ++-- src/xmlgen.h | 4 +- templates/latex/tabu_doxygen.sty | 5114 +++++++++++++++++++------------------- 135 files changed, 5871 insertions(+), 6614 deletions(-) delete mode 100644 src/ftextstream.cpp delete mode 100644 src/ftextstream.h diff --git a/qtools/qcstring.h b/qtools/qcstring.h index bdd99f0..fb93246 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -29,6 +29,7 @@ #include #include #include +#include class QGString; @@ -358,16 +359,22 @@ class QCString return m_rep; } - QCString &operator+=( const std::string &str) + QCString &operator+=( const QCString &s) { - m_rep+=str; + m_rep+=s.str(); + return *this; + } + + QCString &operator+=( const std::string &s) + { + m_rep+=s; return *this; } /** Appends string \a str to this string and returns a reference to the result. */ - QCString &operator+=( const char *str ) + QCString &operator+=( const char *s ) { - if (str) m_rep+=str; + if (s) m_rep+=s; return *this; } @@ -521,4 +528,10 @@ inline QCString substitute(const QCString &s,char srcChar,char dstChar) return ss; } +inline std::ostream& operator<<(std::ostream& os, const QCString& s) +{ + os << s.str(); + return os; +} + #endif // QCSTRING_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b99bef5..aaf1978 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -166,7 +166,6 @@ add_library(doxycfg STATIC ${GENERATED_SRC}/settings.h portable.cpp portable_c.c - ftextstream.cpp message.cpp debug.cpp ) diff --git a/src/cite.cpp b/src/cite.cpp index 13465a5..1773831 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -16,7 +16,6 @@ #include "cite.h" #include "config.h" -#include "ftextstream.h" #include "language.h" #include "message.h" #include "portable.h" @@ -26,10 +25,9 @@ #include "fileinfo.h" #include "dir.h" -#include - #include #include +#include const char *bibTmpFile = "bibTmpFile_"; const char *bibTmpDir = "bibTmpDir/"; @@ -118,71 +116,40 @@ void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) err("bib file %s not found!\n",bibFile.data()); return; } - QFile f(bibFile); - if (!f.open(IO_ReadOnly)) + std::ifstream f(bibFile.str(), std::ifstream::in); + if (!f.is_open()) { err("could not open file %s for reading\n",bibFile.data()); return; } - // convert file to string - QCString doc; - QCString input(fi.size()+1); - f.readBlock(input.rawData(),fi.size()); - f.close(); - input.at(fi.size())='\0'; - - int pos=0; - int s; - - // helper lambda function to get the next line of input and update pos accordingly - auto get_next_line = [&input,&pos,&s]() - { - uint prevPos = (uint)pos; - pos=s+1; - return input.mid(prevPos,(uint)(s-prevPos)); - }; - - // helper lambda function to return if the end of the input has reached - auto end_of_input = [&s]() - { - return s==-1; - }; - - // helper lambda function to proceed to the next line in the input, and update s - // to point to the start of the line. Return true as long as there is a new line. - auto has_next_line = [&input,&pos,&s]() - { - s=input.find('\n',pos); - return s!=-1; - }; - // search for citation cross references QCString citeName; - while (has_next_line()) - { - QCString line = get_next_line(); + std::string lineStr; + while (getline(f,lineStr)) + { int i; + QCString line = lineStr; if (line.stripWhiteSpace().startsWith("@")) { // assumption entry like: "@book { name," or "@book { name" (spaces optional) int j = line.find('{'); // when no {, go hunting for it - while (j==-1 && has_next_line()) + while (j==-1 && getline(f,lineStr)) { - line = get_next_line(); + line = lineStr; j = line.find('{'); } // search for the name citeName = ""; - if (!end_of_input() && j!=-1) // to prevent something like "@manual ," and no { found + if (!f.eof() && j!=-1) // to prevent something like "@manual ," and no { found { int k = line.find(',',j); j++; // found a line "@....{.....,...." or "@.....{....." // ^=j ^=k ^=j k=-1 - while (!end_of_input() && citeName.isEmpty()) + while (!f.eof() && citeName.isEmpty()) { if (k!=-1) { @@ -194,9 +161,9 @@ void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) } citeName = citeName.stripWhiteSpace(); j = 0; - if (citeName.isEmpty() && has_next_line()) + if (citeName.isEmpty() && getline(f,lineStr)) { - line = get_next_line(); + line = lineStr; k = line.find(','); } } @@ -232,7 +199,6 @@ void CitationManager::generatePage() bool citeDebug = Debug::isFlagSet(Debug::Cite); // 0. add cross references from the bib files to the cite dictionary - QFile f; const StringVector &citeDataList = Config_getList(CITE_BIB_FILES); for (const auto &bibdata : citeDataList) { @@ -244,23 +210,24 @@ void CitationManager::generatePage() // 1. generate file with markers and citations to OUTPUT_DIRECTORY QCString outputDir = Config_getString(OUTPUT_DIRECTORY); QCString citeListFile = outputDir+"/citelist.doc"; - f.setName(citeListFile); - if (!f.open(IO_WriteOnly)) { - err("could not open file %s for writing\n",citeListFile.data()); - } - FTextStream t(&f); - t << "" << endl; - t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t.close(); } - t << "-->" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - f.close(); // 2. generate bib2xhtml QCString bib2xhtmlFile = outputDir+"/bib2xhtml.pl"; @@ -319,26 +286,19 @@ void CitationManager::generatePage() // 6. read back the file QCString doc; { - f.setName(citeListFile); - if (!f.open(IO_ReadOnly)) + std::ifstream f(citeListFile.str(),std::ifstream::in); + if (!f.is_open()) { err("could not open file %s for reading\n",citeListFile.data()); } - FileInfo fi(citeListFile.str()); - QCString input(fi.size()+1); - f.readBlock(input.rawData(),fi.size()); - f.close(); - input.at(fi.size())='\0'; - bool insideBib=FALSE; - int pos=0,s; //printf("input=[%s]\n",input.data()); - while ((s=input.find('\n',pos))!=-1) + std::string lineStr; + while (getline(f,lineStr)) { - QCString line = input.mid((uint)pos,(uint)(s-pos)); + QCString line = lineStr; //printf("pos=%d s=%d line=[%s]\n",pos,s,line.data()); - pos=s+1; if (line.find("" << endl; // Needed for general formatting with title for other formats + t << " -->\n"; // Needed for general formatting with title for other formats } - t << " " << endl; + t << " \n"; if (hasCaption && !inlineImage) { - t << " " << endl; + t << " \n"; } else { - t << " " << endl; + t << " \n"; } } -DocbookDocVisitor::DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt) +DocbookDocVisitor::DocbookDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci),m_langExt(langExt) { DB_VIS_C - // m_t << "
" << endl; + // m_t << "
\n"; } DocbookDocVisitor::~DocbookDocVisitor() { DB_VIS_C - // m_t << "
" << endl; + // m_t << "
\n"; } //-------------------------------------- @@ -241,9 +242,9 @@ void DocbookDocVisitor::visit(DocLineBreak *) { DB_VIS_C if (m_hide) return; - m_t << endl << "  " << endl; + m_t << "\n  \n"; // gives nicer results but gives problems as it is not allowed in and also problems with dblatex - // m_t << endl << "" << endl; + // m_t << "\n" << "\n"; } void DocbookDocVisitor::visit(DocHorRuler *) @@ -344,22 +345,23 @@ DB_VIS_C QCString baseName(4096); QCString name; QCString stext = s->text(); - m_t << "" << endl; + m_t << "\n"; name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex); baseName.sprintf("%s%d", (Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_").data(), dotindex++ ); - QFile file(baseName+".dot"); - if (!file.open(IO_WriteOnly)) + std::string fileName = baseName.str()+".dot"; + std::ofstream file(fileName,std::ofstream::out | std::ofstream::binary); + if (!file.is_open()) { - err("Could not open file %s.dot for writing\n",baseName.data()); + err("Could not open file %s for writing\n",fileName.c_str()); } - file.writeBlock( stext, stext.length() ); + file.write( stext.data(), stext.length() ); file.close(); writeDotFile(baseName, s); - m_t << "" << endl; - if (Config_getBool(DOT_CLEANUP)) file.remove(); + m_t << "\n"; + if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName); } break; case DocVerbatim::Msc: @@ -368,25 +370,26 @@ DB_VIS_C QCString baseName(4096); QCString name; QCString stext = s->text(); - m_t << "" << endl; + m_t << "\n"; name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex); baseName.sprintf("%s%d", (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(), mscindex++ ); - QFile file(baseName+".msc"); - if (!file.open(IO_WriteOnly)) + std::string fileName = baseName.str()+".msc"; + std::ofstream file(fileName,std::ofstream::out | std::ofstream::binary); + if (!file.is_open()) { - err("Could not open file %s.msc for writing\n",baseName.data()); + err("Could not open file %s for writing\n",fileName.c_str()); } QCString text = "msc {"; text+=stext; text+="}"; - file.writeBlock( text, text.length() ); + file.write( text.data(), text.length() ); file.close(); writeMscFile(baseName,s); - m_t << "" << endl; - if (Config_getBool(DOT_CLEANUP)) file.remove(); + m_t << "\n"; + if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName); } break; case DocVerbatim::PlantUML: @@ -399,9 +402,9 @@ DB_VIS_C { shortName=shortName.right((int)shortName.length()-i-1); } - m_t << "" << endl; + m_t << "\n"; writePlantUMLFile(baseName,s); - m_t << "" << endl; + m_t << "\n"; } break; } @@ -550,7 +553,7 @@ DB_VIS_C } else { - if (!m_hide) m_t << endl; + if (!m_hide) m_t << "\n"; } } @@ -559,14 +562,14 @@ void DocbookDocVisitor::visit(DocFormula *f) DB_VIS_C if (m_hide) return; - if (f->isInline()) m_t << "" << endl; - else m_t << " " << endl; - m_t << " " << endl; + if (f->isInline()) m_t << "\n"; + else m_t << " \n"; + m_t << " \n"; m_t << " relPath() << f->name() << ".png\"/>" << endl; - m_t << " " << endl; - if (f->isInline()) m_t << "" << endl; - else m_t << " " << endl; + m_t << "align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << f->relPath() << f->name() << ".png\"/>\n"; + m_t << " \n"; + if (f->isInline()) m_t << "\n"; + else m_t << " \n"; } void DocbookDocVisitor::visit(DocIndexEntry *ie) @@ -575,7 +578,7 @@ DB_VIS_C if (m_hide) return; m_t << ""; filter(ie->entry()); - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::visit(DocSimpleSectSep *) @@ -643,7 +646,7 @@ void DocbookDocVisitor::visitPre(DocPara *) { DB_VIS_C if (m_hide) return; - m_t << endl; + m_t << "\n"; m_t << ""; } @@ -652,7 +655,7 @@ void DocbookDocVisitor::visitPost(DocPara *) DB_VIS_C if (m_hide) return; m_t << ""; - m_t << endl; + m_t << "\n"; } void DocbookDocVisitor::visitPre(DocRoot *) @@ -676,161 +679,161 @@ DB_VIS_C case DocSimpleSect::See: if (m_insidePre) { - m_t << "" << theTranslator->trSeeAlso() << "" << endl; + m_t << "" << theTranslator->trSeeAlso() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trSeeAlso()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trSeeAlso()) << "\n"; } break; case DocSimpleSect::Return: if (m_insidePre) { - m_t << "" << theTranslator->trReturns()<< "" << endl; + m_t << "" << theTranslator->trReturns()<< "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trReturns()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trReturns()) << "\n"; } break; case DocSimpleSect::Author: if (m_insidePre) { - m_t << "" << theTranslator->trAuthor(TRUE, TRUE) << "" << endl; + m_t << "" << theTranslator->trAuthor(TRUE, TRUE) << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trAuthor(TRUE, TRUE)) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trAuthor(TRUE, TRUE)) << "\n"; } break; case DocSimpleSect::Authors: if (m_insidePre) { - m_t << "" << theTranslator->trAuthor(TRUE, FALSE) << "" << endl; + m_t << "" << theTranslator->trAuthor(TRUE, FALSE) << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trAuthor(TRUE, FALSE)) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trAuthor(TRUE, FALSE)) << "\n"; } break; case DocSimpleSect::Version: if (m_insidePre) { - m_t << "" << theTranslator->trVersion() << "" << endl; + m_t << "" << theTranslator->trVersion() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trVersion()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trVersion()) << "\n"; } break; case DocSimpleSect::Since: if (m_insidePre) { - m_t << "" << theTranslator->trSince() << "" << endl; + m_t << "" << theTranslator->trSince() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trSince()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trSince()) << "\n"; } break; case DocSimpleSect::Date: if (m_insidePre) { - m_t << "" << theTranslator->trDate() << "" << endl; + m_t << "" << theTranslator->trDate() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trDate()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trDate()) << "\n"; } break; case DocSimpleSect::Note: if (m_insidePre) { - m_t << "" << theTranslator->trNote() << "" << endl; + m_t << "" << theTranslator->trNote() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trNote()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trNote()) << "\n"; } break; case DocSimpleSect::Warning: if (m_insidePre) { - m_t << "" << theTranslator->trWarning() << "" << endl; + m_t << "" << theTranslator->trWarning() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trWarning()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trWarning()) << "\n"; } break; case DocSimpleSect::Pre: if (m_insidePre) { - m_t << "" << theTranslator->trPrecondition() << "" << endl; + m_t << "" << theTranslator->trPrecondition() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trPrecondition()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trPrecondition()) << "\n"; } break; case DocSimpleSect::Post: if (m_insidePre) { - m_t << "" << theTranslator->trPostcondition() << "" << endl; + m_t << "" << theTranslator->trPostcondition() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trPostcondition()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trPostcondition()) << "\n"; } break; case DocSimpleSect::Copyright: if (m_insidePre) { - m_t << "" << theTranslator->trCopyright() << "" << endl; + m_t << "" << theTranslator->trCopyright() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trCopyright()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trCopyright()) << "\n"; } break; case DocSimpleSect::Invar: if (m_insidePre) { - m_t << "" << theTranslator->trInvariant() << "" << endl; + m_t << "" << theTranslator->trInvariant() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trInvariant()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trInvariant()) << "\n"; } break; case DocSimpleSect::Remark: // is miising the possibility if (m_insidePre) { - m_t << "<formalpara><title>" << theTranslator->trRemarks() << "" << endl; + m_t << "" << theTranslator->trRemarks() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trRemarks()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trRemarks()) << "\n"; } break; case DocSimpleSect::Attention: if (m_insidePre) { - m_t << "" << theTranslator->trAttention() << "" << endl; + m_t << "" << theTranslator->trAttention() << "\n"; } else { - m_t << "" << convertToDocBook(theTranslator->trAttention()) << "" << endl; + m_t << "" << convertToDocBook(theTranslator->trAttention()) << "\n"; } break; case DocSimpleSect::User: case DocSimpleSect::Rcs: case DocSimpleSect::Unknown: if (s->hasTitle()) - m_t << "" << endl; + m_t << "\n"; else - m_t << "" << endl; + m_t << "\n"; break; } } @@ -845,21 +848,21 @@ DB_VIS_C case DocSimpleSect::Rcs: case DocSimpleSect::Unknown: if (s->hasTitle()) - m_t << "" << endl; + m_t << "\n"; else - m_t << "" << endl; + m_t << "\n"; break; case DocSimpleSect::Note: - m_t << "" << endl; + m_t << "\n"; break; case DocSimpleSect::Attention: - m_t << "" << endl; + m_t << "\n"; break; case DocSimpleSect::Warning: - m_t << "" << endl; + m_t << "\n"; break; default: - m_t << "" << endl; + m_t << "\n"; break; } } @@ -912,10 +915,10 @@ DB_VIS_C if (m_hide) return; m_t << "
file()); if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor(); - m_t << "\">" << endl; + m_t << "\">\n"; m_t << ""; filter(s->title()); - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::visitPost(DocSection *) @@ -1005,8 +1008,8 @@ void DocbookDocVisitor::visitPre(DocHtmlTable *t) DB_VIS_C m_bodySet.push(false); if (m_hide) return; - m_t << "" << endl; - m_t << " numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl; + m_t << "\n"; + m_t << " numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; for (uint i = 0; i numColumns(); i++) { // do something with colwidth based of cell width specification (be aware of possible colspan in the header)? @@ -1018,10 +1021,10 @@ void DocbookDocVisitor::visitPost(DocHtmlTable *) { DB_VIS_C if (m_hide) return; - if (m_bodySet.top()) m_t << " " << endl; + if (m_bodySet.top()) m_t << " \n"; m_bodySet.pop(); - m_t << " " << endl; - m_t << "" << endl; + m_t << " \n"; + m_t << "\n"; } void DocbookDocVisitor::visitPre(DocHtmlRow *tr) @@ -1189,7 +1192,7 @@ DB_VIS_C if (img->type()==DocImage::DocBook) { if (m_hide) return; - m_t << endl; + m_t << "\n"; QCString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) @@ -1226,19 +1229,7 @@ DB_VIS_C { m_file=fd->absFilePath(); } - QFile inImage(m_file); - QFile outImage(Config_getString(DOCBOOK_OUTPUT)+"/"+baseName.data()); - if (inImage.open(IO_ReadOnly)) - { - if (outImage.open(IO_WriteOnly)) - { - char *buffer = new char[inImage.size()]; - inImage.readBlock(buffer,inImage.size()); - outImage.writeBlock(buffer,inImage.size()); - outImage.flush(); - delete[] buffer; - } - } + copyFile(m_file,Config_getString(DOCBOOK_OUTPUT)+"/"+baseName.data()); } else { @@ -1336,30 +1327,30 @@ void DocbookDocVisitor::visitPost(DocSecRefItem *) { DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::visitPre(DocSecRefList *) { DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::visitPost(DocSecRefList *) { DB_VIS_C if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::visitPre(DocParamSect *s) { DB_VIS_C if (m_hide) return; - m_t << endl; - m_t << " " << endl; - m_t << " " << endl; + m_t << "\n"; + m_t << " <formalpara>\n"; + m_t << " <title>\n"; switch(s->type()) { case DocParamSect::Param: m_t << theTranslator->trParameters(); break; @@ -1369,9 +1360,9 @@ DB_VIS_C default: ASSERT(0); } - m_t << " " << endl; - m_t << " " << endl; - m_t << " " << endl; + m_t << " \n"; + m_t << " \n"; + m_t << "
\n"; int ncols = 2; if (s->type() == DocParamSect::Param) { @@ -1380,24 +1371,24 @@ DB_VIS_C if (hasInOutSpecs && hasTypeSpecs) ncols += 2; else if (hasInOutSpecs || hasTypeSpecs) ncols += 1; } - m_t << " " << endl; + m_t << " \n"; for (int i = 1; i <= ncols; i++) { - if (i == ncols) m_t << " " << endl; - else m_t << " " << endl; + if (i == ncols) m_t << " \n"; + else m_t << " \n"; } - m_t << " " << endl; + m_t << " \n"; } void DocbookDocVisitor::visitPost(DocParamSect *) { DB_VIS_C if (m_hide) return; - m_t << " " << endl; - m_t << " " << endl; - m_t << "
" << endl; - m_t << "
" << endl; - m_t << "
" << endl; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; m_t << " "; } @@ -1405,7 +1396,7 @@ void DocbookDocVisitor::visitPre(DocParamList *pl) { DB_VIS_C if (m_hide) return; - m_t << " " << endl; + m_t << " \n"; DocParamSect *sect = 0; if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect) @@ -1458,7 +1449,7 @@ DB_VIS_C if (pl->parameters().empty()) { - m_t << " " << endl; + m_t << " \n"; } else { @@ -1480,7 +1471,7 @@ DB_VIS_C } cnt++; } - m_t << "" << endl; + m_t << "\n"; } m_t << " "; } @@ -1489,8 +1480,8 @@ void DocbookDocVisitor::visitPost(DocParamList *) { DB_VIS_C if (m_hide) return; - m_t << "" << endl; - m_t << " " << endl; + m_t << "\n"; + m_t << " \n"; } void DocbookDocVisitor::visitPre(DocXRefItem *x) @@ -1658,7 +1649,7 @@ DB_VIS_C baseName.prepend("msc_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP); - m_t << "" << endl; + m_t << "\n"; visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height); } @@ -1667,7 +1658,7 @@ void DocbookDocVisitor::endMscFile(bool hasCaption) DB_VIS_C if (m_hide) return; visitPostEnd(m_t, hasCaption); - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s) @@ -1707,7 +1698,7 @@ DB_VIS_C baseName.prepend("dia_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); - m_t << "" << endl; + m_t << "\n"; visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height); } @@ -1716,7 +1707,7 @@ void DocbookDocVisitor::endDiaFile(bool hasCaption) DB_VIS_C if (m_hide) return; visitPostEnd(m_t, hasCaption); - m_t << "" << endl; + m_t << "\n"; } void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s) @@ -1757,7 +1748,7 @@ DB_VIS_C QCString outDir = Config_getString(DOCBOOK_OUTPUT); QCString imgExt = getDotImageExtension(); writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP); - m_t << "" << endl; + m_t << "\n"; visitPreStart(m_t, children, hasCaption, baseName + "." + imgExt, width, height); } @@ -1765,8 +1756,8 @@ void DocbookDocVisitor::endDotFile(bool hasCaption) { DB_VIS_C if (m_hide) return; - m_t << endl; + m_t << "\n"; visitPostEnd(m_t, hasCaption); - m_t << "" << endl; + m_t << "\n"; } diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index ad53116..f1be60a 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -18,10 +18,11 @@ #include "containers.h" #include "docvisitor.h" +#include "docparser.h" + #include -#include +#include -class FTextStream; class CodeOutputInterface; class QCString; @@ -29,7 +30,7 @@ class QCString; class DocbookDocVisitor : public DocVisitor { public: - DocbookDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt); + DocbookDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt); ~DocbookDocVisitor(); //-------------------------------------- // visitor functions for leaf nodes @@ -154,19 +155,19 @@ class DocbookDocVisitor : public DocVisitor void endDotFile(bool hasCaption); void writeDotFile(const QCString &fileName, DocVerbatim *s); void writePlantUMLFile(const QCString &fileName, DocVerbatim *s); - void visitPreStart(FTextStream &t, + void visitPreStart(std::ostream &t, const DocNodeList &children, bool hasCaption, const QCString &name, const QCString &width, const QCString &height, bool inlineImage = FALSE); - void visitPostEnd(FTextStream &t, bool hasCaption, bool inlineImage = FALSE); + void visitPostEnd(std::ostream &t, bool hasCaption, bool inlineImage = FALSE); void visitCaption(const DocNodeList &children); //-------------------------------------- // state variables //-------------------------------------- - FTextStream &m_t; + std::ostream &m_t; CodeOutputInterface &m_ci; bool m_insidePre = false; bool m_hide = false; diff --git a/src/docparser.cpp b/src/docparser.cpp index 36bc8a5..22b7341 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -52,6 +51,7 @@ #include "htmlentity.h" #include "emoji.h" #include "fileinfo.h" +#include "dir.h" #define TK_COMMAND_CHAR(token) ((token)==TK_COMMAND_AT ? '@' : '\\') @@ -317,8 +317,8 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool } QCString inputFile = fd->absFilePath(); - QFile inImage(inputFile); - if (inImage.open(IO_ReadOnly)) + FileInfo infi(inputFile.str()); + if (infi.exists()) { result = fileName; int i; @@ -351,34 +351,18 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool FileInfo outfi(outputFile.str()); if (outfi.isSymLink()) { - QFile::remove(outputFile); + Dir().remove(outputFile.str()); warn_doc_error(g_fileName,getDoctokinizerLineNr(), "destination of image %s is a symlink, replacing with image", qPrint(outputFile)); } if (outputFile!=inputFile) // prevent copying to ourself { - QFile outImage(outputFile.data()); - if (outImage.open(IO_WriteOnly)) // copy the image + if (copyFile(inputFile,outputFile) && type==DocImage::Html) { - char *buffer = new char[inImage.size()]; - inImage.readBlock(buffer,inImage.size()); - outImage.writeBlock(buffer,inImage.size()); - outImage.flush(); - delete[] buffer; - if (type==DocImage::Html) Doxygen::indexList->addImageFile(result); - } - else - { - warn_doc_error(g_fileName,getDoctokinizerLineNr(), - "could not write output image %s",qPrint(outputFile)); + Doxygen::indexList->addImageFile(result); } } - //else - //{ - // warn(g_fileName,getDoctokinizerLineNr(), - // "Prevented to copy file %s onto itself!\n",qPrint(inputFile)); - //} } else { @@ -1780,7 +1764,7 @@ DocEmoji::DocEmoji(DocNode *parent,const QCString &symName) : if (locSymName.at(0)!=':') locSymName.prepend(":"); } m_symName = locSymName; - m_index = EmojiEntityMapper::instance()->symbol2index(m_symName); + m_index = EmojiEntityMapper::instance()->symbol2index(m_symName.str()); if (m_index==-1) { warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Found unsupported emoji symbol '%s'\n",qPrint(m_symName)); diff --git a/src/docsets.cpp b/src/docsets.cpp index f7c8c18..6040277 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -15,8 +15,8 @@ #include #include +#include -#include #include "docsets.h" #include "config.h" #include "message.h" @@ -27,15 +27,12 @@ #include "memberdef.h" #include "namespacedef.h" #include "util.h" -#include "ftextstream.h" struct DocSets::Private { QCString indent(); - QFile nf; - QFile tf; - FTextStream nts; - FTextStream tts; + std::ofstream nts; + std::ofstream tts; std::stack indentStack; std::set scopes; }; @@ -67,135 +64,131 @@ void DocSets::initialize() // -- write Makefile { - QCString mfName = Config_getString(HTML_OUTPUT) + "/Makefile"; - QFile makefile(mfName); - if (!makefile.open(IO_WriteOnly)) - { - term("Could not open file %s for writing\n",mfName.data()); - } - FTextStream ts(&makefile); + QCString mfName = Config_getString(HTML_OUTPUT) + "/Makefile"; + std::ofstream ts(mfName.str(),std::ofstream::out | std::ofstream::binary); + if (!ts.is_open()) + { + term("Could not open file %s for writing\n",mfName.data()); + } - ts << "DOCSET_NAME=" << bundleId << ".docset\n" - "DOCSET_CONTENTS=$(DOCSET_NAME)/Contents\n" - "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n" - "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n" - "DESTDIR=~/Library/Developer/Shared/Documentation/DocSets\n" - "XCODE_INSTALL=\"$(shell xcode-select -print-path)\"\n" - "\n" - "all: docset\n" - "\n" - "docset:\n" - "\tmkdir -p $(DOCSET_DOCUMENTS)\n" - "\tcp Nodes.xml $(DOCSET_RESOURCES)\n" - "\tcp Tokens.xml $(DOCSET_RESOURCES)\n" - "\tcp Info.plist $(DOCSET_CONTENTS)\n" - "\ttar --exclude $(DOCSET_NAME) \\\n" - "\t --exclude Nodes.xml \\\n" - "\t --exclude Tokens.xml \\\n" - "\t --exclude Info.plist \\\n" - "\t --exclude Makefile -c -f - . \\\n" - "\t | (cd $(DOCSET_DOCUMENTS); tar xvf -)\n" - "\t$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)\n" - "\trm -f $(DOCSET_DOCUMENTS)/Nodes.xml\n" - "\trm -f $(DOCSET_DOCUMENTS)/Info.plist\n" - "\trm -f $(DOCSET_DOCUMENTS)/Makefile\n" - "\trm -f $(DOCSET_RESOURCES)/Nodes.xml\n" - "\trm -f $(DOCSET_RESOURCES)/Tokens.xml\n" - "\n" - "clean:\n" - "\trm -rf $(DOCSET_NAME)\n" - "\n" - "install: docset\n" - "\tmkdir -p $(DESTDIR)\n" - "\tcp -R $(DOCSET_NAME) $(DESTDIR)\n" - "\n" - "uninstall:\n" - "\trm -rf $(DESTDIR)/$(DOCSET_NAME)\n" - "\n" - "always:\n"; + ts << "DOCSET_NAME=" << bundleId << ".docset\n" + "DOCSET_CONTENTS=$(DOCSET_NAME)/Contents\n" + "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n" + "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n" + "DESTDIR=~/Library/Developer/Shared/Documentation/DocSets\n" + "XCODE_INSTALL=\"$(shell xcode-select -print-path)\"\n" + "\n" + "all: docset\n" + "\n" + "docset:\n" + "\tmkdir -p $(DOCSET_DOCUMENTS)\n" + "\tcp Nodes.xml $(DOCSET_RESOURCES)\n" + "\tcp Tokens.xml $(DOCSET_RESOURCES)\n" + "\tcp Info.plist $(DOCSET_CONTENTS)\n" + "\ttar --exclude $(DOCSET_NAME) \\\n" + "\t --exclude Nodes.xml \\\n" + "\t --exclude Tokens.xml \\\n" + "\t --exclude Info.plist \\\n" + "\t --exclude Makefile -c -f - . \\\n" + "\t | (cd $(DOCSET_DOCUMENTS); tar xvf -)\n" + "\t$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)\n" + "\trm -f $(DOCSET_DOCUMENTS)/Nodes.xml\n" + "\trm -f $(DOCSET_DOCUMENTS)/Info.plist\n" + "\trm -f $(DOCSET_DOCUMENTS)/Makefile\n" + "\trm -f $(DOCSET_RESOURCES)/Nodes.xml\n" + "\trm -f $(DOCSET_RESOURCES)/Tokens.xml\n" + "\n" + "clean:\n" + "\trm -rf $(DOCSET_NAME)\n" + "\n" + "install: docset\n" + "\tmkdir -p $(DESTDIR)\n" + "\tcp -R $(DOCSET_NAME) $(DESTDIR)\n" + "\n" + "uninstall:\n" + "\trm -rf $(DESTDIR)/$(DOCSET_NAME)\n" + "\n" + "always:\n"; } // -- write Info.plist { - QCString plName = Config_getString(HTML_OUTPUT) + "/Info.plist"; - QFile plist(plName); - if (!plist.open(IO_WriteOnly)) - { - term("Could not open file %s for writing\n",plName.data()); - } - FTextStream ts(&plist); + QCString plName = Config_getString(HTML_OUTPUT) + "/Info.plist"; + std::ofstream ts(plName.str(),std::ofstream::out | std::ofstream::binary); + if (!ts.is_open()) + { + term("Could not open file %s for writing\n",plName.data()); + } - ts << "\n" - "\n" - "\n" - "\n" - " CFBundleName\n" - " " << projectName << "\n" - " CFBundleIdentifier\n" - " " << bundleId << "\n" - " CFBundleVersion\n" - " " << projectNumber << "\n" - " DocSetFeedName\n" - " " << feedName << "\n" - " DocSetPublisherIdentifier\n" - " " << publisherId << "\n" - " DocSetPublisherName\n" - " " << publisherName << "\n" - // markers for Dash - " DashDocSetFamily\n" - " doxy\n" - " DocSetPlatformFamily\n" - " doxygen\n" - "\n" - "\n"; + ts << "\n" + "\n" + "\n" + "\n" + " CFBundleName\n" + " " << projectName << "\n" + " CFBundleIdentifier\n" + " " << bundleId << "\n" + " CFBundleVersion\n" + " " << projectNumber << "\n" + " DocSetFeedName\n" + " " << feedName << "\n" + " DocSetPublisherIdentifier\n" + " " << publisherId << "\n" + " DocSetPublisherName\n" + " " << publisherName << "\n" + // markers for Dash + " DashDocSetFamily\n" + " doxy\n" + " DocSetPlatformFamily\n" + " doxygen\n" + "\n" + "\n"; } // -- start Nodes.xml QCString notes = Config_getString(HTML_OUTPUT) + "/Nodes.xml"; - p->nf.setName(notes); - if (!p->nf.open(IO_WriteOnly)) + p->nts.open(notes.str(),std::ofstream::out | std::ofstream::binary); + if (!p->nts.is_open()) { term("Could not open file %s for writing\n",notes.data()); } //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; - p->nts.setDevice(&p->nf); - p->nts << "" << endl; - p->nts << "" << endl; - p->nts << " " << endl; - p->nts << " " << endl; - p->nts << " Root" << endl; - p->nts << " " << indexName << Doxygen::htmlFileExtension << "" << endl; - p->nts << " " << endl; + p->nts << "\n"; + p->nts << "\n"; + p->nts << " \n"; + p->nts << " \n"; + p->nts << " Root\n"; + p->nts << " " << indexName << Doxygen::htmlFileExtension << "\n"; + p->nts << " \n"; p->indentStack.push(true); QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml"; - p->tf.setName(tokens); - if (!p->tf.open(IO_WriteOnly)) + p->tts.open(tokens.str(),std::ofstream::out | std::ofstream::binary); + if (!p->tts.is_open()) { term("Could not open file %s for writing\n",tokens.data()); } - p->tts.setDevice(&p->tf); - p->tts << "" << endl; - p->tts << "" << endl; + p->tts << "\n"; + p->tts << "\n"; } void DocSets::finalize() { if (!p->indentStack.top()) { - p->nts << p->indent() << " " << endl; + p->nts << p->indent() << " \n"; } p->indentStack.pop(); - p->nts << " " << endl; - p->nts << " " << endl; - p->nts << " " << endl; - p->nts << "" << endl; - p->nf.close(); + p->nts << " \n"; + p->nts << " \n"; + p->nts << " \n"; + p->nts << "\n"; + p->nts.close(); - p->tts << "" << endl; - p->tf.close(); + p->tts << "\n"; + p->tts.close(); } QCString DocSets::Private::indent() @@ -208,7 +201,7 @@ QCString DocSets::Private::indent() void DocSets::incContentsDepth() { //printf("DocSets::incContentsDepth() depth=%zu\n",p->indentStack.size()); - p->nts << p->indent() << "" << endl; + p->nts << p->indent() << "\n"; p->indentStack.push(true); } @@ -216,9 +209,9 @@ void DocSets::decContentsDepth() { if (!p->indentStack.top()) { - p->nts << p->indent() << " " << endl; + p->nts << p->indent() << " \n"; } - p->nts << p->indent() << "" << endl; + p->nts << p->indent() << "\n"; p->indentStack.pop(); //printf("DocSets::decContentsDepth() depth=%zu\n",p->indentStack.size()); } @@ -238,15 +231,15 @@ void DocSets::addContentsItem(bool isDir, { if (!p->indentStack.top()) { - p->nts << p->indent() << " " << endl; + p->nts << p->indent() << " \n"; } p->indentStack.top()=false; - p->nts << p->indent() << " " << endl; - p->nts << p->indent() << " " << convertToXML(name) << "" << endl; + p->nts << p->indent() << " \n"; + p->nts << p->indent() << " " << convertToXML(name) << "\n"; if (file && file[0]=='^') // URL marker { p->nts << p->indent() << " " << convertToXML(&file[1]) - << "" << endl; + << "\n"; } else // relative file { @@ -259,10 +252,10 @@ void DocSets::addContentsItem(bool isDir, { p->nts << file << Doxygen::htmlFileExtension; } - p->nts << "" << endl; + p->nts << "\n"; if (file && anchor) { - p->nts << p->indent() << " " << anchor << "" << endl; + p->nts << p->indent() << " " << anchor << "\n"; } } } @@ -483,7 +476,7 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md, } } -void DocSets::writeToken(FTextStream &t, +void DocSets::writeToken(std::ostream &t, const Definition *d, const QCString &type, const QCString &lang, @@ -491,40 +484,40 @@ void DocSets::writeToken(FTextStream &t, const char *anchor, const char *decl) { - t << " " << endl; - t << " " << endl; + t << " \n"; + t << " \n"; QCString name = d->name(); if (name.right(2)=="-p") name=name.left(name.length()-2); - t << " " << convertToXML(name) << "" << endl; + t << " " << convertToXML(name) << "\n"; if (!lang.isEmpty()) { - t << " " << lang << "" << endl; + t << " " << lang << "\n"; } if (!type.isEmpty()) { - t << " " << type << "" << endl; + t << " " << type << "\n"; } if (scope) { - t << " " << convertToXML(scope) << "" << endl; + t << " " << convertToXML(scope) << "\n"; } - t << " " << endl; + t << " \n"; t << " " << d->getOutputFileBase() - << Doxygen::htmlFileExtension << "" << endl; + << Doxygen::htmlFileExtension << "\n"; if (anchor) { - t << " " << anchor << "" << endl; + t << " " << anchor << "\n"; } QCString tooltip = d->briefDescriptionAsTooltip(); if (!tooltip.isEmpty()) { - t << " " << convertToXML(tooltip) << "" << endl; + t << " " << convertToXML(tooltip) << "\n"; } if (decl) { - t << " " << convertToXML(decl) << "" << endl; + t << " " << convertToXML(decl) << "\n"; } - t << " " << endl; + t << " \n"; } void DocSets::addIndexFile(const char *name) diff --git a/src/docsets.h b/src/docsets.h index 6065cfe..2bdf7ac 100644 --- a/src/docsets.h +++ b/src/docsets.h @@ -17,12 +17,11 @@ #define DOCSETS_H #include +#include #include "index.h" -class QFile; class Definition; -class FTextStream; /** A class that generates docset files. * @@ -55,7 +54,7 @@ class DocSets : public IndexIntf void addStyleSheetFile(const char *) {} private: - void writeToken(FTextStream &t, const Definition *d, + void writeToken(std::ostream &t, const Definition *d, const QCString &type, const QCString &lang, const char *scope=0, const char *anchor=0, const char *decl=0); diff --git a/src/doctokenizer.l b/src/doctokenizer.l index eaf8a43..5debd5f 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -28,8 +28,6 @@ #include #include -#include - #include "doctokenizer.h" #include "cmdmapper.h" #include "config.h" diff --git a/src/dot.cpp b/src/dot.cpp index cc0f070..8deb0d8 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -15,6 +15,7 @@ #include #include +#include #include "config.h" #include "dot.h" @@ -23,7 +24,6 @@ #include "util.h" #include "portable.h" #include "message.h" -#include "ftextstream.h" #include "doxygen.h" #include "language.h" #include "index.h" @@ -319,7 +319,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, * \param context the scope in which this graph is found (for resolving links) * \param graphId a unique id for this graph, use for dynamic sections */ -void writeDotImageMapFromFile(FTextStream &t, +void writeDotImageMapFromFile(std::ostream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context,int graphId) @@ -346,7 +346,7 @@ void writeDotImageMapFromFile(FTextStream &t, if (imgExt=="svg") // vector graphics { - QCString svgName=outDir+"/"+baseName+".svg"; + QCString svgName = outDir+"/"+baseName+".svg"; DotFilePatcher::writeSVGFigureLink(t,relPath,baseName,svgName); DotFilePatcher patcher(svgName); patcher.addSVGConversion("",TRUE,context,TRUE,graphId); @@ -354,17 +354,15 @@ void writeDotImageMapFromFile(FTextStream &t, } else // bitmap graphics { - QGString result; - FTextStream tt(&result); - + std::stringstream tt; t << "\""" << endl; + << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n"; DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context); - if (!result.isEmpty()) + if (tt.tellg()>0) { t << ""; - t << result; - t << "" << endl; + t << tt.str(); + t << "\n"; } } d.remove(absOutFile.str()); diff --git a/src/dot.h b/src/dot.h index c2f9605..65453b1 100644 --- a/src/dot.h +++ b/src/dot.h @@ -23,7 +23,6 @@ #include "dotfilepatcher.h" #include "dotrunner.h" -class FTextStream; class DotRunner; class DotRunnerQueue; @@ -50,7 +49,7 @@ class DotManager void writeDotGraphFromFile(const char *inFile,const char *outDir, const char *outFile,GraphOutputFormat format); -void writeDotImageMapFromFile(FTextStream &t, +void writeDotImageMapFromFile(std::ostream &t, const QCString& inFile, const QCString& outDir, const QCString& relPath,const QCString& baseName, const QCString& context,int graphId=-1); diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index 78e9b9b..efe829f 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -179,7 +179,7 @@ QCString DotCallGraph::getMapLabel() const } QCString DotCallGraph::writeGraph( - FTextStream &out, + std::ostream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, diff --git a/src/dotcallgraph.h b/src/dotcallgraph.h index 1bc8882..ad9006f 100644 --- a/src/dotcallgraph.h +++ b/src/dotcallgraph.h @@ -18,7 +18,6 @@ #include "dotnode.h" #include "dotgraph.h" -#include "ftextstream.h" #include "memberdef.h" /** Representation of an call graph */ @@ -30,7 +29,7 @@ class DotCallGraph : public DotGraph bool isTrivial() const; bool isTooBig() const; int numNodes() const; - QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, + QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName, const char *relPath,bool writeImageMap=TRUE, int graphId=-1); diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index 9146a25..c4f5b48 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -441,7 +441,7 @@ QCString DotClassGraph::getImgAltText() const return ""; } -QCString DotClassGraph::writeGraph(FTextStream &out, +QCString DotClassGraph::writeGraph(std::ostream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, @@ -456,7 +456,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out, //-------------------------------------------------------------------- -void DotClassGraph::writeXML(FTextStream &t) +void DotClassGraph::writeXML(std::ostream &t) { for (const auto &kv : m_usedNodes) { @@ -464,7 +464,7 @@ void DotClassGraph::writeXML(FTextStream &t) } } -void DotClassGraph::writeDocbook(FTextStream &t) +void DotClassGraph::writeDocbook(std::ostream &t) { for (const auto &kv : m_usedNodes) { @@ -472,7 +472,7 @@ void DotClassGraph::writeDocbook(FTextStream &t) } } -void DotClassGraph::writeDEF(FTextStream &t) +void DotClassGraph::writeDEF(std::ostream &t) { for (const auto &kv : m_usedNodes) { diff --git a/src/dotclassgraph.h b/src/dotclassgraph.h index 168d315..5b00098 100644 --- a/src/dotclassgraph.h +++ b/src/dotclassgraph.h @@ -16,6 +16,8 @@ #ifndef DOTCLASSGRAPH_H #define DOTCLASSGRAPH_H +#include + #include "classdef.h" #include "dotnode.h" #include "dotgraph.h" @@ -29,13 +31,13 @@ public: bool isTrivial() const; bool isTooBig() const; int numNodes() const; - QCString writeGraph(FTextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, + QCString writeGraph(std::ostream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool TBRank=TRUE,bool imageMap=TRUE,int graphId=-1); - void writeXML(FTextStream &t); - void writeDocbook(FTextStream &t); - void writeDEF(FTextStream &t); + void writeXML(std::ostream &t); + void writeDocbook(std::ostream &t); + void writeDEF(std::ostream &t); protected: virtual QCString getBaseName() const; diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp index a4e556e..8e203c7 100644 --- a/src/dotdirdeps.cpp +++ b/src/dotdirdeps.cpp @@ -13,9 +13,9 @@ * */ -#include "dotdirdeps.h" +#include -#include "ftextstream.h" +#include "dotdirdeps.h" #include "util.h" #include "doxygen.h" #include "config.h" @@ -29,7 +29,7 @@ using DirDefMap = std::map; * @param[in] fillBackground if the node shall be explicitly filled * @param[in,out] directoriesInGraph lists the directories which have been written to the output stream */ -static void drawDirectory(FTextStream &outStream, const DirDef *const directory, const bool fillBackground, +static void drawDirectory(std::ostream &outStream, const DirDef *const directory, const bool fillBackground, DirDefMap &directoriesInGraph) { outStream << " " << directory->getOutputFileBase() << " [shape=box " @@ -46,7 +46,7 @@ static void drawDirectory(FTextStream &outStream, const DirDef *const directory, directoriesInGraph.insert(std::make_pair(directory->getOutputFileBase().str(), directory)); } -void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations) +void writeDotDirDepGraph(std::ostream &t,const DirDef *dd,bool linkRelations) { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -199,9 +199,10 @@ QCString DotDirDeps::getBaseName() const void DotDirDeps::computeTheGraph() { // compute md5 checksum of the graph were are about to generate - FTextStream md5stream(&m_theGraph); + std::stringstream md5stream; //m_dir->writeDepGraph(md5stream); writeDotDirDepGraph(md5stream,m_dir,m_linkRelations); + m_theGraph = md5stream.str(); } QCString DotDirDeps::getMapLabel() const @@ -214,7 +215,7 @@ QCString DotDirDeps::getImgAltText() const return convertToXML(m_dir->displayName()); } -QCString DotDirDeps::writeGraph(FTextStream &out, +QCString DotDirDeps::writeGraph(std::ostream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, diff --git a/src/dotdirdeps.h b/src/dotdirdeps.h index a71e8f1..ff46db2 100644 --- a/src/dotdirdeps.h +++ b/src/dotdirdeps.h @@ -26,7 +26,7 @@ class DotDirDeps : public DotGraph DotDirDeps(const DirDef *dir); ~DotDirDeps(); bool isTrivial() const; - QCString writeGraph(FTextStream &out, + QCString writeGraph(std::ostream &out, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp index 4960cf4..2d934f0 100644 --- a/src/dotfilepatcher.cpp +++ b/src/dotfilepatcher.cpp @@ -13,13 +13,12 @@ * */ +#include + #include "dotfilepatcher.h" #include "dotrunner.h" - -#include "qstring.h" #include "config.h" #include "message.h" -#include "ftextstream.h" #include "docparser.h" #include "doxygen.h" #include "util.h" @@ -212,40 +211,34 @@ static QCString replaceRef(const QCString &buf,const QCString relPath, * map file was found * \returns TRUE if successful. */ -bool DotFilePatcher::convertMapFile(FTextStream &t,const char *mapName, +bool DotFilePatcher::convertMapFile(std::ostream &t,const char *mapName, const QCString relPath, bool urlOnly, const QCString &context) { - QFile f(mapName); - if (!f.open(IO_ReadOnly)) + std::ifstream f(mapName,std::ifstream::in); + if (!f.is_open()) { err("problems opening map file %s for inclusion in the docs!\n" "If you installed Graphviz/dot after a previous failing run, \n" "try deleting the output directory and rerun doxygen.\n",mapName); return FALSE; } - const int maxLineLen=10240; - while (!f.atEnd()) // foreach line + std::string line; + while (getline(f,line)) // foreach line { - QCString buf(maxLineLen); - int numBytes = f.readLine(buf.rawData(),maxLineLen); - if (numBytes>0) + QCString buf = line+'\n'; + if (buf.left(5)=="0 && (indexE=replBuf.find('"',indexS+4))!=-1) { - QCString replBuf = replaceRef(buf,relPath,urlOnly,context); - // strip id="..." from replBuf since the id's are not needed and not unique. - int indexS = replBuf.find("id=\""), indexE; - if (indexS>0 && (indexE=replBuf.find('"',indexS+4))!=-1) - { - t << replBuf.left(indexS-1) << replBuf.right(replBuf.length() - indexE - 1); - } - else - { - t << replBuf; - } + t << replBuf.left(indexS-1) << replBuf.right(replBuf.length() - indexE - 1); + } + else + { + t << replBuf; } } } @@ -320,40 +313,31 @@ bool DotFilePatcher::run() const err("Failed to rename file %s to %s!\n",m_patchFile.data(),tmpName.c_str()); return FALSE; } - QFile fi(tmpName.c_str()); - QFile fo(patchFile.c_str()); - if (!fi.open(IO_ReadOnly)) + std::ifstream fi(tmpName, std::ifstream::in); + std::ofstream t(patchFile, std::ofstream::out | std::ofstream::binary); + if (!fi.is_open()) { err("problem opening file %s for patching!\n",tmpName.c_str()); thisDir.rename(tmpName,patchFile); return FALSE; } - if (!fo.open(IO_WriteOnly)) + if (!t.is_open()) { err("problem opening file %s for patching!\n",m_patchFile.data()); thisDir.rename(tmpName,patchFile); return FALSE; } - FTextStream t(&fo); - const int maxLineLen=100*1024; - int lineNr=1; int width,height; bool insideHeader=FALSE; bool replacedHeader=FALSE; bool foundSize=FALSE; - while (!fi.atEnd()) // foreach line + int lineNr=1; + std::string lineStr; + while (getline(fi,lineStr)) { - QCString line(maxLineLen); - int numBytes = fi.readLine(line.rawData(),maxLineLen); - if (numBytes<=0) - { - break; - } - line.resize(numBytes+1); - + QCString line = lineStr+'\n'; //printf("line=[%s]\n",line.stripWhiteSpace().data()); int i; - ASSERT(numBytes=0 && mapId<(int)m_maps.size()) { - QGString result; - FTextStream tt(&result); + std::stringstream tt; const Map &map = m_maps.at(mapId); //printf("patching MAP %d in file %s with contents of %s\n", // mapId,m_patchFile.data(),map.mapFile.data()); convertMapFile(tt,map.mapFile,map.relPath,map.urlOnly,map.context); - if (!result.isEmpty()) + if (tt.tellg()>0) { - t << "" << endl; - t << result; - t << "" << endl; + t << "\n"; + t << tt.str(); + t << "\n"; } } else // error invalid map id! @@ -479,36 +462,29 @@ bool DotFilePatcher::run() const { QCString orgName=m_patchFile.left(m_patchFile.length()-4)+"_org.svg"; t << substitute(svgZoomFooter,"$orgname",stripPath(orgName)); - fo.close(); + t.close(); // keep original SVG file so we can refer to it, we do need to replace // dummy link by real ones - fi.setName(tmpName.c_str()); - fo.setName(orgName); - if (!fi.open(IO_ReadOnly)) + fi.open(tmpName,std::ifstream::in); + t.open(orgName,std::ofstream::out); + if (!fi.is_open()) { err("problem opening file %s for reading!\n",tmpName.c_str()); return FALSE; } - if (!fo.open(IO_WriteOnly)) + if (!t.is_open()) { err("problem opening file %s for writing!\n",orgName.data()); return FALSE; } - FTextStream to(&fo); - while (!fi.atEnd()) // foreach line + while (getline(fi,lineStr)) // foreach line { - QCString line(maxLineLen); - int numBytes = fi.readLine(line.rawData(),maxLineLen); - if (numBytes<=0) - { - break; - } - line.resize(numBytes+1); + std::string line = lineStr+'\n'; const Map &map = m_maps.front(); // there is only one 'map' for a SVG file - to << replaceRef(line,map.relPath,map.urlOnly,map.context,"_top"); + t << replaceRef(line.c_str(),map.relPath,map.urlOnly,map.context,"_top"); } fi.close(); - fo.close(); + t.close(); } // remove temporary file thisDir.remove(tmpName); @@ -522,50 +498,37 @@ bool DotFilePatcher::run() const static bool readSVGSize(const QCString &fileName,int *width,int *height) { bool found=FALSE; - QFile f(fileName); - if (!f.open(IO_ReadOnly)) + std::ifstream f(fileName.str(),std::ifstream::in); + if (!f.is_open()) { - return FALSE; + return false; } - const int maxLineLen=4096; - char buf[maxLineLen]; - while (!f.atEnd() && !found) + std::string line; + while (getline(f,line) && !found) { - int numBytes = f.readLine(buf,maxLineLen-1); // read line - if (numBytes>0) + if (qstrncmp(line.c_str(),"" << endl; + t << "\n"; } - if (!m_noDivTag) t << "" << endl; + if (!m_noDivTag) t << "\n"; } else // add link to bitmap file with image map { if (!m_noDivTag) t << "
"; t << "\"""; if (!m_noDivTag) t << "
"; - t << endl; + t << "\n"; if (m_regenerate || !insertMapFile(t, absMapName(), m_relPath, correctId(getMapLabel()))) { int mapId = DotManager::instance()-> createFilePatcher(m_fileName.data())-> addMap(absMapName(), m_relPath, m_urlOnly, QCString(), getMapLabel()); - t << "" << endl; + t << "\n"; } } } @@ -256,12 +255,12 @@ void DotGraph::generateCode(FTextStream &t) int figId = DotManager::instance()-> createFilePatcher(m_fileName.data())-> addFigure(m_baseName,absBaseName(),FALSE /*TRUE*/); - t << endl << "% FIG " << figId << endl; + t << "\n% FIG " << figId << "\n"; } } } -void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) +void DotGraph::writeGraphHeader(std::ostream &t,const QCString &title) { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -274,7 +273,7 @@ void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) { t << "\"" << convertToXML(title) << "\""; } - t << endl << "{" << endl; + t << "\n{\n"; if (Config_getBool(INTERACTIVE_SVG)) // insert a comment to force regeneration when this // option is toggled { @@ -283,7 +282,7 @@ void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) t << " // LATEX_PDF_SIZE\n"; // write placeholder for LaTeX PDF bounding box size replacement if (Config_getBool(DOT_TRANSPARENT)) { - t << " bgcolor=\"transparent\";" << endl; + t << " bgcolor=\"transparent\";\n"; } t << " edge [fontname=\"" << fontName << "\"," "fontsize=\"" << fontSize << "\"," @@ -293,9 +292,9 @@ void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) "fontsize=\"" << fontSize << "\",shape=record];\n"; } -void DotGraph::writeGraphFooter(FTextStream &t) +void DotGraph::writeGraphFooter(std::ostream &t) { - t << "}" << endl; + t << "}\n"; } void DotGraph::computeGraph(DotNode *root, @@ -305,15 +304,14 @@ void DotGraph::computeGraph(DotNode *root, bool renderParents, bool backArrows, const QCString &title, - QGString &graphStr) + QCString &graphStr) { //printf("computeMd5Signature\n"); - QGString buf; - FTextStream md5stream(&buf); + std::stringstream md5stream; writeGraphHeader(md5stream,title); if (!rank.isEmpty()) { - md5stream << " rankdir=\"" << rank << "\";" << endl; + md5stream << " rankdir=\"" << rank << "\";\n"; } root->clearWriteFlag(); root->write(md5stream, gt, format, gt!=CallGraph && gt!=Dependency, TRUE, backArrows); @@ -346,6 +344,6 @@ void DotGraph::computeGraph(DotNode *root, } writeGraphFooter(md5stream); - graphStr=buf.data(); + graphStr=md5stream.str(); } diff --git a/src/dotgraph.h b/src/dotgraph.h index ea3891b..a0b6136 100644 --- a/src/dotgraph.h +++ b/src/dotgraph.h @@ -16,11 +16,11 @@ #ifndef DOTGRAPH_H #define DOTGRAPH_H +#include + #include -#include #include "dir.h" -class FTextStream; class DotNode; enum GraphOutputFormat { GOF_BITMAP, GOF_EPS }; @@ -39,7 +39,7 @@ class DotGraph /** returns node numbers. The Counter is reset by the constructor */ int getNextNodeNumber() { return ++m_curNodeNumber; } - QCString writeGraph(FTextStream &t, + QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, @@ -49,8 +49,8 @@ class DotGraph int graphId=-1 ); - static void writeGraphHeader(FTextStream& t, const QCString& title = QCString()); - static void writeGraphFooter(FTextStream& t); + static void writeGraphHeader(std::ostream& t, const QCString& title = QCString()); + static void writeGraphFooter(std::ostream& t); static void computeGraph(DotNode* root, GraphType gt, GraphOutputFormat format, @@ -58,7 +58,7 @@ class DotGraph bool renderParents, bool backArrows, const QCString& title, - QGString& graphStr + QCString& graphStr ); virtual QCString getBaseName() const = 0; @@ -85,7 +85,7 @@ class DotGraph QCString m_absPath; QCString m_baseName; - QGString m_theGraph; + QCString m_theGraph; bool m_regenerate = false; bool m_doNotAddImageToIndex = false; bool m_noDivTag = false; @@ -97,7 +97,7 @@ class DotGraph DotGraph &operator=(const DotGraph &); bool prepareDotFile(); - void generateCode(FTextStream &t); + void generateCode(std::ostream &t); int m_curNodeNumber = 0; }; diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index 1dc1380..34359dd 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -13,6 +13,8 @@ * */ +#include + #include "dotgroupcollaboration.h" #include "classlist.h" #include "doxygen.h" @@ -207,7 +209,7 @@ QCString DotGroupCollaboration::getBaseName() const void DotGroupCollaboration::computeTheGraph() { - FTextStream md5stream(&m_theGraph); + std::stringstream md5stream; writeGraphHeader(md5stream,m_rootNode->label()); // clean write flags @@ -230,6 +232,7 @@ void DotGroupCollaboration::computeTheGraph() writeGraphFooter(md5stream); + m_theGraph = md5stream.str(); } QCString DotGroupCollaboration::getMapLabel() const @@ -237,7 +240,7 @@ QCString DotGroupCollaboration::getMapLabel() const return escapeCharsInString(m_baseName, FALSE); } -QCString DotGroupCollaboration::writeGraph( FTextStream &t, +QCString DotGroupCollaboration::writeGraph( std::ostream &t, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, const char *fileName, const char *relPath, bool generateImageMap,int graphId) @@ -247,7 +250,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, return DotGraph::writeGraph(t, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId); } -void DotGroupCollaboration::Edge::write( FTextStream &t ) const +void DotGroupCollaboration::Edge::write( std::ostream &t ) const { const char* linkTypeColor[] = { "darkorchid3" @@ -304,7 +307,7 @@ void DotGroupCollaboration::Edge::write( FTextStream &t ) const break; } t << ", " << arrowStyle; - t << "];" << endl; + t << "];\n"; } bool DotGroupCollaboration::isTrivial() const @@ -312,7 +315,7 @@ bool DotGroupCollaboration::isTrivial() const return m_usedNodes.size() <= 1; } -void DotGroupCollaboration::writeGraphHeader(FTextStream &t,const QCString &title) const +void DotGroupCollaboration::writeGraphHeader(std::ostream &t,const QCString &title) const { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -325,11 +328,11 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,const QCString &titl { t << "\"" << convertToXML(title) << "\""; } - t << endl; - t << "{" << endl; + t << "\n"; + t << "{\n"; if (Config_getBool(DOT_TRANSPARENT)) { - t << " bgcolor=\"transparent\";" << endl; + t << " bgcolor=\"transparent\";\n"; } t << " edge [fontname=\"" << fontName << "\",fontsize=\"" << fontSize << "\"," "labelfontname=\"" << fontName << "\",labelfontsize=\"" << fontSize << "\"];\n"; diff --git a/src/dotgroupcollaboration.h b/src/dotgroupcollaboration.h index ebfe6e7..3d83673 100644 --- a/src/dotgroupcollaboration.h +++ b/src/dotgroupcollaboration.h @@ -16,6 +16,8 @@ #ifndef DOTGROUPCOLLABORATION_H #define DOTGROUPCOLLABORATION_H +#include + #include "dotnode.h" #include "dotgraph.h" #include "groupdef.h" @@ -26,7 +28,7 @@ class DotGroupCollaboration : public DotGraph public : DotGroupCollaboration(const GroupDef* gd); ~DotGroupCollaboration(); - QCString writeGraph(FTextStream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef, + QCString writeGraph(std::ostream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path,const char *fileName,const char *relPath, bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; @@ -65,13 +67,13 @@ class DotGroupCollaboration : public DotGraph EdgeType eType; std::vector links; - void write( FTextStream &t ) const; + void write( std::ostream &t ) const; }; void buildGraph(const GroupDef* gd); void addCollaborationMember(const Definition* def, QCString& url, EdgeType eType ); void addMemberList( class MemberList* ml ); - void writeGraphHeader(FTextStream &t,const QCString &title) const; + void writeGraphHeader(std::ostream &t,const QCString &title) const; Edge* addEdge( DotNode* _pNStart, DotNode* _pNEnd, EdgeType _eType, const QCString& _label, const QCString& _url ); diff --git a/src/dotincldepgraph.cpp b/src/dotincldepgraph.cpp index 07b2139..4f6b8c3 100644 --- a/src/dotincldepgraph.cpp +++ b/src/dotincldepgraph.cpp @@ -180,7 +180,7 @@ QCString DotInclDepGraph::getMapLabel() const } } -QCString DotInclDepGraph::writeGraph(FTextStream &out, +QCString DotInclDepGraph::writeGraph(std::ostream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, @@ -207,7 +207,7 @@ int DotInclDepGraph::numNodes() const return (int)m_startNode->children().size(); } -void DotInclDepGraph::writeXML(FTextStream &t) +void DotInclDepGraph::writeXML(std::ostream &t) { for (const auto &kv : m_usedNodes) { @@ -215,7 +215,7 @@ void DotInclDepGraph::writeXML(FTextStream &t) } } -void DotInclDepGraph::writeDocbook(FTextStream &t) +void DotInclDepGraph::writeDocbook(std::ostream &t) { for (const auto &kv : m_usedNodes) { diff --git a/src/dotincldepgraph.h b/src/dotincldepgraph.h index 0105489..f511608 100644 --- a/src/dotincldepgraph.h +++ b/src/dotincldepgraph.h @@ -28,14 +28,14 @@ class DotInclDepGraph : public DotGraph public: DotInclDepGraph(const FileDef *fd,bool inverse); ~DotInclDepGraph(); - QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, + QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName,const char *relPath, bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; bool isTooBig() const; int numNodes() const; - void writeXML(FTextStream &t); - void writeDocbook(FTextStream &t); + void writeXML(std::ostream &t); + void writeDocbook(std::ostream &t); protected: virtual QCString getBaseName() const; diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp index b17a293..c1f800b 100644 --- a/src/dotlegendgraph.cpp +++ b/src/dotlegendgraph.cpp @@ -13,6 +13,8 @@ * */ +#include + #include "dotlegendgraph.h" #include "util.h" #include "config.h" @@ -23,7 +25,7 @@ void DotLegendGraph::writeGraph(const char *path) { - FTextStream ts; + std::stringstream ts; DotGraph::writeGraph(ts, GOF_BITMAP, EOF_Html, path, "", "", FALSE, 0); if (getDotImageExtension()=="svg") @@ -43,7 +45,7 @@ void DotLegendGraph::computeTheGraph() { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); - FTextStream md5stream(&m_theGraph); + std::stringstream md5stream; writeGraphHeader(md5stream,theTranslator->trLegendTitle()); md5stream << " Node9 [shape=\"box\",label=\"Inherited\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",fillcolor=\"grey75\",style=\"filled\" fontcolor=\"black\"];\n"; md5stream << " Node10 -> Node9 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; @@ -63,6 +65,7 @@ void DotLegendGraph::computeTheGraph() md5stream << " Node18 -> Node9 [dir=\"back\",color=\"darkorchid3\",fontsize=\"" << fontSize << "\",style=\"dashed\",label=\"m_usedClass\",fontname=\"" << fontName << "\"];\n"; md5stream << " Node18 [shape=\"box\",label=\"Used\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",color=\"black\"];\n"; writeGraphFooter(md5stream); + m_theGraph = md5stream.str(); } QCString DotLegendGraph::getMapLabel() const diff --git a/src/dotnode.cpp b/src/dotnode.cpp index 318878d..234dff0 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -14,8 +14,6 @@ */ #include "dotnode.h" - -#include "ftextstream.h" #include "classdef.h" #include "config.h" #include "memberlist.h" @@ -139,7 +137,7 @@ static QCString escapeTooltip(const QCString &tooltip) return result; } -static void writeBoxMemberList(FTextStream &t, +static void writeBoxMemberList(std::ostream &t, char prot,const MemberList *ml,const ClassDef *scope, bool isStatic=FALSE,const StringUnorderedSet *skipNames=nullptr) { @@ -378,7 +376,7 @@ void DotNode::deleteNodes(DotNode *node) } } -void DotNode::writeBox(FTextStream &t, +void DotNode::writeBox(std::ostream &t, GraphType gt, GraphOutputFormat /*format*/, bool hasNonReachableChildren) const @@ -500,10 +498,10 @@ void DotNode::writeBox(FTextStream &t, { t << ",tooltip=\" \""; // space in tooltip is required otherwise still something like 'Node0' is used } - t << "];" << endl; + t << "];\n"; } -void DotNode::writeArrow(FTextStream &t, +void DotNode::writeArrow(std::ostream &t, GraphType gt, GraphOutputFormat format, const DotNode *cn, @@ -549,10 +547,10 @@ void DotNode::writeArrow(FTextStream &t, } if (format==GOF_BITMAP) t << ",fontname=\"" << Config_getString(DOT_FONTNAME) << "\""; - t << "];" << endl; + t << "];\n"; } -void DotNode::write(FTextStream &t, +void DotNode::write(std::ostream &t, GraphType gt, GraphOutputFormat format, bool topDown, @@ -603,10 +601,10 @@ void DotNode::write(FTextStream &t, //printf("end DotNode::write(%d) name=%s\n",distance,m_label.data()); } -void DotNode::writeXML(FTextStream &t,bool isClassGraph) const +void DotNode::writeXML(std::ostream &t,bool isClassGraph) const { - t << " " << endl; - t << " " << endl; + t << " \n"; + t << " \n"; if (!m_url.isEmpty()) { QCString url(m_url); @@ -620,7 +618,7 @@ void DotNode::writeXML(FTextStream &t,bool isClassGraph) const { t << " external=\"" << convertToXML(refPtr) << "\""; } - t << "/>" << endl; + t << "/>\n"; } } auto it = m_edgeInfo.begin(); @@ -645,7 +643,7 @@ void DotNode::writeXML(FTextStream &t,bool isClassGraph) const { t << "include"; } - t << "\">" << endl; + t << "\">\n"; if (!edgeInfo.label().isEmpty()) { int p=0; @@ -654,23 +652,23 @@ void DotNode::writeXML(FTextStream &t,bool isClassGraph) const { t << " " << convertToXML(edgeInfo.label().mid(p,ni-p)) - << "" << endl; + << "\n"; p=ni+1; } t << " " << convertToXML(edgeInfo.label().right(edgeInfo.label().length()-p)) - << "" << endl; + << "\n"; } - t << " " << endl; + t << " \n"; ++it; } - t << " " << endl; + t << " \n"; } -void DotNode::writeDocbook(FTextStream &t,bool isClassGraph) const +void DotNode::writeDocbook(std::ostream &t,bool isClassGraph) const { - t << " " << endl; - t << " " << endl; + t << " \n"; + t << " \n"; if (!m_url.isEmpty()) { QCString url(m_url); @@ -684,7 +682,7 @@ void DotNode::writeDocbook(FTextStream &t,bool isClassGraph) const { t << " external=\"" << convertToXML(refPtr) << "\""; } - t << "/>" << endl; + t << "/>\n"; } } auto it = m_edgeInfo.begin(); @@ -709,7 +707,7 @@ void DotNode::writeDocbook(FTextStream &t,bool isClassGraph) const { t << "include"; } - t << "\">" << endl; + t << "\">\n"; if (!edgeInfo.label().isEmpty()) { int p=0; @@ -718,27 +716,27 @@ void DotNode::writeDocbook(FTextStream &t,bool isClassGraph) const { t << " " << convertToXML(edgeInfo.label().mid(p,ni-p)) - << "" << endl; + << "\n"; p=ni+1; } t << " " << convertToXML(edgeInfo.label().right(edgeInfo.label().length()-p)) - << "" << endl; + << "\n"; } - t << " " << endl; + t << " \n"; ++it; } - t << " " << endl; + t << " \n"; } -void DotNode::writeDEF(FTextStream &t) const +void DotNode::writeDEF(std::ostream &t) const { const char* nodePrefix = " node-"; - t << " node = {" << endl; - t << nodePrefix << "id = " << m_number << ';' << endl; - t << nodePrefix << "label = '" << m_label << "';" << endl; + t << " node = {\n"; + t << nodePrefix << "id = " << m_number << ";\n"; + t << nodePrefix << "label = '" << m_label << "';\n"; if (!m_url.isEmpty()) { @@ -748,23 +746,23 @@ void DotNode::writeDEF(FTextStream &t) const if (urlPtr) { *urlPtr++='\0'; - t << nodePrefix << "link = {" << endl << " " - << nodePrefix << "link-id = '" << urlPtr << "';" << endl; + t << nodePrefix << "link = {\n" << " " + << nodePrefix << "link-id = '" << urlPtr << "';\n"; if (*refPtr!='\0') { t << " " << nodePrefix << "link-external = '" - << refPtr << "';" << endl; + << refPtr << "';\n"; } - t << " };" << endl; + t << " };\n"; } } auto it = m_edgeInfo.begin(); for (const auto &childNode : m_children) { const EdgeInfo &edgeInfo = *it; - t << " node-child = {" << endl; - t << " child-id = '" << childNode->number() << "';" << endl; + t << " node-child = {\n"; + t << " child-id = '" << childNode->number() << "';\n"; t << " relation = "; switch (edgeInfo.color()) @@ -777,18 +775,18 @@ void DotNode::writeDEF(FTextStream &t) const case EdgeInfo::Orange2: t << "type-constraint"; break; case EdgeInfo::Grey: ASSERT(0); break; } - t << ';' << endl; + t << ";\n"; if (!edgeInfo.label().isEmpty()) { - t << " edgelabel = <<_EnD_oF_dEf_TeXt_" << endl - << edgeInfo.label() << endl - << "_EnD_oF_dEf_TeXt_;" << endl; + t << " edgelabel = <<_EnD_oF_dEf_TeXt_\n" + << edgeInfo.label() << "\n" + << "_EnD_oF_dEf_TeXt_;\n"; } - t << " }; /* node-child */" << endl; + t << " }; /* node-child */\n"; ++it; } - t << " }; /* node */" << endl; + t << " }; /* node */\n"; } diff --git a/src/dotnode.h b/src/dotnode.h index 2eb3f7d..bfe5af4 100644 --- a/src/dotnode.h +++ b/src/dotnode.h @@ -19,12 +19,12 @@ #include #include #include +#include #include "dotgraph.h" class ClassDef; class DotNode; -class FTextStream; /** Attributes of an edge of a dot graph */ class EdgeInfo @@ -75,14 +75,14 @@ class DotNode void removeParent(DotNode *n); int findParent( DotNode *n ); - void write(FTextStream &t,GraphType gt,GraphOutputFormat f, + void write(std::ostream &t,GraphType gt,GraphOutputFormat f, bool topDown,bool toChildren,bool backArrows) const; - void writeXML(FTextStream &t,bool isClassGraph) const; - void writeDocbook(FTextStream &t,bool isClassGraph) const; - void writeDEF(FTextStream &t) const; - void writeBox(FTextStream &t,GraphType gt,GraphOutputFormat f, + void writeXML(std::ostream &t,bool isClassGraph) const; + void writeDocbook(std::ostream &t,bool isClassGraph) const; + void writeDEF(std::ostream &t) const; + void writeBox(std::ostream &t,GraphType gt,GraphOutputFormat f, bool hasNonReachableChildren) const; - void writeArrow(FTextStream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn, + void writeArrow(std::ostream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn, const EdgeInfo *ei,bool topDown, bool pointBack=TRUE) const; QCString label() const { return m_label; } diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 727b44e..7c31c85 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -16,13 +16,10 @@ #include #include "dotrunner.h" - -#include "qstring.h" #include "util.h" #include "portable.h" #include "dot.h" #include "message.h" -#include "ftextstream.h" #include "config.h" #include "dir.h" @@ -75,42 +72,33 @@ static bool resetPDFSize(const int width,const int height, const char *base) err("Failed to rename file %s to %s!\n",patchFile.data(),tmpName.data()); return FALSE; } - QFile fi(tmpName.c_str()); - QFile fo(patchFile.c_str()); - if (!fi.open(IO_ReadOnly)) + std::ifstream fi(tmpName,std::ifstream::in); + std::ofstream t(patchFile,std::ofstream::out | std::ofstream::binary); + if (!fi.is_open()) { err("problem opening file %s for patching!\n",tmpName.data()); thisDir.rename(tmpName,patchFile); return FALSE; } - if (!fo.open(IO_WriteOnly)) + if (!t.is_open()) { err("problem opening file %s for patching!\n",patchFile.data()); thisDir.rename(tmpName,patchFile); - fi.close(); return FALSE; } - FTextStream t(&fo); - const int maxLineLen=100*1024; - while (!fi.atEnd()) // foreach line + std::string line; + while (getline(fi,line)) // foreach line { - QCString line(maxLineLen); - int numBytes = fi.readLine(line.rawData(),maxLineLen); - if (numBytes<=0) - { - break; - } - line.resize(numBytes+1); - if (line.find("LATEX_PDF_SIZE") != -1) + if (line.find("LATEX_PDF_SIZE") != std::string::npos) { double scale = (width > height ? width : height)/double(MAX_LATEX_GRAPH_INCH); - t << " size=\""< -#include - #include #include #include @@ -8980,12 +8977,11 @@ static QCString fixSlashes(QCString &s) static void generateConfigFile(const char *configFile,bool shortList, bool updateOnly=FALSE) { - QFile f; - bool fileOpened=openOutputFile(configFile,f); + std::ofstream t; + bool fileOpened=openOutputFile(configFile,t); bool writeToStdout=(configFile[0]=='-' && configFile[1]=='\0'); if (fileOpened) { - FTextStream t(&f); Config::writeTemplate(t,shortList,updateOnly); if (!writeToStdout) { @@ -9010,35 +9006,26 @@ static void generateConfigFile(const char *configFile,bool shortList, term("Cannot open file %s for writing\n",configFile); } } + static void compareDoxyfile() { - QFile f; + std::ofstream f; char configFile[2]; configFile[0] = '-'; configFile[1] = '\0'; bool fileOpened=openOutputFile(configFile,f); if (fileOpened) { - FTextStream t(&f); - Config::compareDoxyfile(t); + Config::compareDoxyfile(f); } else { term("Cannot open file %s for writing\n",configFile); } } -//---------------------------------------------------------------------------- -// read and parse a tag file - -//static bool readLineFromFile(QFile &f,QCString &s) -//{ -// char c=0; -// s.resize(0); -// while (!f.atEnd() && (c=f.getch())!='\n') s+=c; -// return f.atEnd(); -//} //---------------------------------------------------------------------------- +// read and parse a tag file static void readTagFile(const std::shared_ptr &root,const char *tl) { @@ -9301,7 +9288,7 @@ static std::shared_ptr parseFile(OutlineParserInterface &parser, } FileInfo fi(fileName.str()); - BufStr preBuf(fi.size()+4096); + BufStr preBuf((uint)fi.size()+4096); if (Config_getBool(ENABLE_PREPROCESSING) && parser.needsPreprocessing(extension)) @@ -9313,7 +9300,7 @@ static std::shared_ptr parseFile(OutlineParserInterface &parser, std::string absPath = FileInfo(s).absFilePath(); preprocessor.addSearchDir(absPath.c_str()); } - BufStr inBuf(fi.size()+4096); + BufStr inBuf((uint)fi.size()+4096); msg("Preprocessing %s...\n",fn); readInputFile(fileName,inBuf); preprocessor.processFile(fileName,inBuf,preBuf); @@ -9891,7 +9878,7 @@ void readAliases() //---------------------------------------------------------------------------- -static void dumpSymbol(FTextStream &t,Definition *d) +static void dumpSymbol(std::ostream &t,Definition *d) { QCString anchor; if (d->definitionType()==Definition::TypeMember) @@ -9910,15 +9897,14 @@ static void dumpSymbol(FTextStream &t,Definition *d) << d->name() << "','" << d->getDefFileName() << "','" << d->getDefLine() - << "');" << endl; + << "');\n"; } static void dumpSymbolMap() { - QFile f("symbols.sql"); - if (f.open(IO_WriteOnly)) + std::ofstream t("symbols.sql",std::ofstream::out | std::ofstream::binary); + if (t.is_open()) { - FTextStream t(&f); for (const auto &kv : Doxygen::symbolMap) { dumpSymbol(t,kv.second); @@ -10247,7 +10233,7 @@ void readConfiguration(int argc, char **argv) cleanUpDoxygen(); exit(1); } - QFile f; + std::ofstream f; if (openOutputFile(argv[optind+1],f)) { RTFGenerator::writeExtensionsFile(f); @@ -10275,7 +10261,7 @@ void readConfiguration(int argc, char **argv) cleanUpDoxygen(); exit(1); } - QFile f; + std::ofstream f; if (openOutputFile(argv[optind+1],f)) { EmojiEntityMapper::instance()->writeEmojiFile(f); @@ -10303,7 +10289,7 @@ void readConfiguration(int argc, char **argv) cleanUpDoxygen(); exit(1); } - QFile f; + std::ofstream f; if (openOutputFile(argv[optind+1],f)) { RTFGenerator::writeStyleSheetFile(f); @@ -10340,7 +10326,7 @@ void readConfiguration(int argc, char **argv) warn_uncond("Output language %s not supported! Using English instead.\n", outputLanguage.data()); } - QFile f; + std::ofstream f; if (openOutputFile(argv[optind+1],f)) { HtmlGenerator::writeHeaderFile(f, argv[optind+3]); @@ -10386,7 +10372,7 @@ void readConfiguration(int argc, char **argv) warn_uncond("Output language %s not supported! Using English instead.\n", outputLanguage.data()); } - QFile f; + std::ofstream f; if (openOutputFile(argv[optind+1],f)) { LatexGenerator::writeHeaderFile(f); @@ -10666,22 +10652,21 @@ static void writeTagFile() QCString generateTagFile = Config_getString(GENERATE_TAGFILE); if (generateTagFile.isEmpty()) return; - QFile tag(generateTagFile); - if (!tag.open(IO_WriteOnly)) + std::ofstream tagFile(generateTagFile.str(),std::ofstream::out); + if (!tagFile.is_open()) { err("cannot open tag file %s for writing\n", generateTagFile.data() ); return; } - FTextStream tagFile(&tag); - tagFile << "" << endl; + tagFile << "\n"; tagFile << "0) { tagFile << " doxygen_gitid=\"" << getGitVersion() << "\""; } - tagFile << ">" << endl; + tagFile << ">\n"; // for each file for (const auto &fn : *Doxygen::inputNameLinkedMap) @@ -10721,27 +10706,7 @@ static void writeTagFile() } if (Doxygen::mainPage) Doxygen::mainPage->writeTagFile(tagFile); - /* - if (Doxygen::mainPage && !Config_getString(GENERATE_TAGFILE).isEmpty()) - { - tagFile << " " << endl - << " " - << convertToXML(Doxygen::mainPage->name()) - << "" << endl - << " " - << convertToXML(Doxygen::mainPage->title()) - << "" << endl - << " " - << convertToXML(Doxygen::mainPage->getOutputFileBase()) - << Doxygen::htmlFileExtension - << "" << endl; - - mainPage->writeDocAnchorsToTagFile(); - tagFile << " " << endl; - } - */ - - tagFile << "" << endl; + tagFile << "\n"; } static void exitDoxygen() @@ -11136,8 +11101,8 @@ void parseInput() defaultLayoutUsed = TRUE; } - QFile layoutFile(layoutFileName); - if (layoutFile.open(IO_ReadOnly)) + FileInfo fi(layoutFileName.str()); + if (fi.exists()) { msg("Parsing layout file %s...\n",layoutFileName.data()); LayoutDocManager::instance().parse(layoutFileName); diff --git a/src/doxygen.h b/src/doxygen.h index 137fb8c..5b136b4 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -17,7 +17,6 @@ #define DOXYGEN_H #include "containers.h" -#include "ftextstream.h" #include "membergroup.h" #include "dirdef.h" #include "memberlist.h" @@ -34,7 +33,6 @@ class PageLinkedMap; class PageDef; class SearchIndexIntf; class ParserManager; -class QFileInfo; class BufStr; class CiteDict; class MemberDef; diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index bbb3b01..d9ef12f 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -17,13 +17,12 @@ #include "config.h" #include "message.h" #include "doxygen.h" -#include -EclipseHelp::EclipseHelp() : m_depth(0), m_endtag(FALSE), m_openTags(0), m_tocfile(0) +EclipseHelp::EclipseHelp() : m_depth(0), m_endtag(FALSE), m_openTags(0) { } -EclipseHelp::~EclipseHelp() +EclipseHelp::~EclipseHelp() { } @@ -38,18 +37,18 @@ void EclipseHelp::indent() void EclipseHelp::closedTag() { - if (m_endtag) + if (m_endtag) { - m_tocstream << "/>" << endl; + m_tocstream << "/>\n"; m_endtag = FALSE; } } void EclipseHelp::openedTag() { - if (m_endtag) + if (m_endtag) { - m_tocstream << ">" << endl; + m_tocstream << ">\n"; m_endtag = FALSE; ++m_openTags; } @@ -61,33 +60,29 @@ void EclipseHelp::openedTag() * This method opens the XML TOC file and writes headers of the files. * \sa finalize() */ -void EclipseHelp::initialize() +void EclipseHelp::initialize() { // -- read path prefix from the configuration //m_pathprefix = Config_getString(ECLIPSE_PATHPREFIX); //if (m_pathprefix.isEmpty()) m_pathprefix = "html/"; - // -- open the contents file + // -- open the contents file QCString name = Config_getString(HTML_OUTPUT) + "/toc.xml"; - m_tocfile = new QFile(name); - if (!m_tocfile->open(IO_WriteOnly)) + m_tocstream.open(name.str(), std::ofstream::out | std::ofstream::binary); + if (!m_tocstream.is_open()) { term("Could not open file %s for writing\n", name.data()); } - // -- initialize its text stream - m_tocstream.setDevice(m_tocfile); - //m_tocstream.setEncoding(FTextStream::UnicodeUTF8); - // -- write the opening tag QCString title = Config_getString(PROJECT_NAME); if (title.isEmpty()) { title = "Doxygen generated documentation"; } - m_tocstream << "" << endl; + m_tocstream << "\n"; ++ m_depth; } @@ -97,38 +92,35 @@ void EclipseHelp::initialize() * This method writes footers of the files and closes them. * \sa initialize() */ -void EclipseHelp::finalize() +void EclipseHelp::finalize() { closedTag(); // -- close previous tag - // -- write ending tag + // -- write ending tag --m_depth; - m_tocstream << "" << endl; + m_tocstream << "\n"; // -- close the content file - m_tocstream.unsetDevice(); - m_tocfile->close(); - delete m_tocfile; m_tocfile = 0; + m_tocstream.close(); QCString name = Config_getString(HTML_OUTPUT) + "/plugin.xml"; - QFile pluginFile(name); - if (pluginFile.open(IO_WriteOnly)) + std::ofstream t(name.str(),std::ofstream::out | std::ofstream::binary); + if (t.is_open()) { QCString docId = Config_getString(ECLIPSE_DOC_ID); - FTextStream t(&pluginFile); - t << "" << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; - t << "" << endl; + t << "\n"; + t << " \n"; + t << " \n"; + t << " \n"; + t << "\n"; } } /*! * \brief Increase the level of content hierarchy */ -void EclipseHelp::incContentsDepth() +void EclipseHelp::incContentsDepth() { openedTag(); ++m_depth; @@ -139,7 +131,7 @@ void EclipseHelp::incContentsDepth() * * It closes currently opened topic tag. */ -void EclipseHelp::decContentsDepth() +void EclipseHelp::decContentsDepth() { // -- end of the opened topic closedTag(); @@ -149,7 +141,7 @@ void EclipseHelp::decContentsDepth() { --m_openTags; indent(); - m_tocstream << "" << endl; + m_tocstream << "\n"; } } @@ -173,12 +165,12 @@ void EclipseHelp::addContentsItem( const char *anchor, bool /* separateIndex */, bool /* addToNavIndex */, - const Definition * /*def*/) + const Definition * /*def*/) { - // -- write the topic tag + // -- write the topic tag closedTag(); - if (file) - { + if (file) + { switch (file[0]) // check for special markers (user defined URLs) { case '^': @@ -195,7 +187,7 @@ void EclipseHelp::addContentsItem( default: indent(); m_tocstream << " + #include "index.h" -#include "ftextstream.h" /* -- forward declarations */ -class QFile; class Definition; /** Generator for Eclipse help files. @@ -37,7 +37,7 @@ class Definition; * These files can be used to generate a help plugin readable * by the Eclipse IDE. */ -class EclipseHelp : public IndexIntf +class EclipseHelp : public IndexIntf { public: EclipseHelp(); @@ -62,8 +62,7 @@ class EclipseHelp : public IndexIntf bool m_endtag; int m_openTags; - QFile * m_tocfile; - FTextStream m_tocstream; + std::ofstream m_tocstream; QCString m_pathprefix; /* -- avoid copying */ diff --git a/src/emoji.cpp b/src/emoji.cpp index a8a2bb8..9871c22 100644 --- a/src/emoji.cpp +++ b/src/emoji.cpp @@ -15,7 +15,6 @@ #include "emoji.h" #include "message.h" -#include "ftextstream.h" #include "util.h" static struct emojiEntityInfo @@ -1555,21 +1554,20 @@ void EmojiEntityMapper::deleteInstance() * @return the code for the requested Emoji entity name, * in case the requested Emoji item does not exist `-1` is returned. */ -int EmojiEntityMapper::symbol2index(const QCString &symName) const +int EmojiEntityMapper::symbol2index(const std::string &symName) const { - auto it = m_name2symGh.find(symName.str()); + auto it = m_name2symGh.find(symName); return it!=m_name2symGh.end() ? it->second : -1; } /*! * @brief Writes the list of supported emojis to the given file. */ -void EmojiEntityMapper::writeEmojiFile(QFile &file) +void EmojiEntityMapper::writeEmojiFile(std::ostream &t) { - FTextStream t(&file); for (int i = 0; i < g_numEmojiEntities; i++) { - t << g_emojiEntities[i].name << endl; + t << g_emojiEntities[i].name << "\n"; } } diff --git a/src/emoji.h b/src/emoji.h index b27b761..a0184f6 100644 --- a/src/emoji.h +++ b/src/emoji.h @@ -17,10 +17,7 @@ #include #include - -#include - -class FTextStream; +#include /** @brief Singleton helper class to map emoji entities to other formats */ class EmojiEntityMapper @@ -30,8 +27,8 @@ class EmojiEntityMapper static void deleteInstance(); const char *name(int index) const; const char *unicode(int index) const; - void writeEmojiFile(QFile &file); - int symbol2index(const QCString &symName) const; + void writeEmojiFile(std::ostream &t); + int symbol2index(const std::string &symName) const; private: EmojiEntityMapper(); diff --git a/src/entry.cpp b/src/entry.cpp index 6e343b0..9962b3f 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -17,7 +17,6 @@ #include #include -#include #include "entry.h" #include "util.h" #include "section.h" diff --git a/src/entry.h b/src/entry.h index d6c0936..f11870a 100644 --- a/src/entry.h +++ b/src/entry.h @@ -28,7 +28,6 @@ #include "reflist.h" class SectionInfo; -class QFile; class FileDef; /** This class stores information about an inheritance relation diff --git a/src/filedef.cpp b/src/filedef.cpp index 0e357d9..18050dd 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -104,7 +104,7 @@ class FileDefImpl : public DefinitionMixin virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; virtual void writeSummaryLinks(OutputList &ol) const; - virtual void writeTagFile(FTextStream &t); + virtual void writeTagFile(std::ostream &t); virtual void writeSourceHeader(OutputList &ol); virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser); virtual void writeSourceFooter(OutputList &ol); @@ -150,7 +150,7 @@ class FileDefImpl : public DefinitionMixin void endMemberDocumentation(OutputList &ol); void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); - void writeClassesToTagFile(FTextStream &t,const ClassLinkedRefMap &list); + void writeClassesToTagFile(std::ostream &t,const ClassLinkedRefMap &list); IncludeInfoMap m_includeMap; IncludeInfoList m_includeList; @@ -307,12 +307,12 @@ bool FileDefImpl::hasDetailedDescription() const ); } -void FileDefImpl::writeTagFile(FTextStream &tagFile) +void FileDefImpl::writeTagFile(std::ostream &tagFile) { - tagFile << " " << endl; - tagFile << " " << convertToXML(name()) << "" << endl; - tagFile << " " << convertToXML(getPath()) << "" << endl; - tagFile << " " << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "" << endl; + tagFile << " \n"; + tagFile << " " << convertToXML(name()) << "\n"; + tagFile << " " << convertToXML(getPath()) << "\n"; + tagFile << " " << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "\n"; for (const auto &ii : m_includeList) { const FileDef *fd=ii.fileDef; @@ -329,8 +329,7 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile) << "local=\"" << locStr << "\" " << "imported=\"" << impStr << "\">" << convertToXML(ii.includeName) - << "" - << endl; + << "\n"; } } for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File)) @@ -363,7 +362,7 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile) { if (nd->isLinkableInProject()) { - tagFile << " " << convertToXML(nd->name()) << "" << endl; + tagFile << " " << convertToXML(nd->name()) << "\n"; } } } @@ -392,7 +391,7 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile) } writeDocAnchorsToTagFile(tagFile); - tagFile << " " << endl; + tagFile << " \n"; } void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) @@ -514,14 +513,14 @@ void FileDefImpl::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void FileDefImpl::writeClassesToTagFile(FTextStream &tagFile, const ClassLinkedRefMap &list) +void FileDefImpl::writeClassesToTagFile(std::ostream &tagFile, const ClassLinkedRefMap &list) { for (const auto &cd : list) { if (cd->isLinkableInProject()) { tagFile << " compoundTypeString() << - "\">" << convertToXML(cd->name()) << "" << endl; + "\">" << convertToXML(cd->name()) << "\n"; } } } diff --git a/src/filedef.h b/src/filedef.h index 7984a78..b3c38ba 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -36,7 +36,6 @@ class NamespaceDef; class NamespaceLinkedRefMap; class PackageDef; class DirDef; -class FTextStream; class ClangTUParser; // --- Set of files @@ -155,7 +154,7 @@ class FileDef : public DefinitionMutable, public Definition virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; virtual void writeSummaryLinks(OutputList &ol) const = 0; - virtual void writeTagFile(FTextStream &t) = 0; + virtual void writeTagFile(std::ostream &t) = 0; virtual void writeSourceHeader(OutputList &ol) = 0; virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) = 0; diff --git a/src/formula.cpp b/src/formula.cpp index 82bcc3f..1237fbd 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -16,15 +16,12 @@ #include "formula.h" #include "message.h" #include "config.h" -#include "ftextstream.h" #include "util.h" #include "portable.h" #include "image.h" #include "fileinfo.h" #include "dir.h" -#include - #include #include #include @@ -73,7 +70,7 @@ FormulaManager &FormulaManager::instance() void FormulaManager::readFormulas(const char *dir,bool doCompare) { - std::ifstream f(std::string(dir)+"/formula.repository"); + std::ifstream f(std::string(dir)+"/formula.repository",std::ifstream::in); if (f.is_open()) { uint formulaCount=0; @@ -105,7 +102,7 @@ void FormulaManager::readFormulas(const char *dir,bool doCompare) formName = formName.substr(0,ei); // keep only the '\_form#' part if (doCompare) { - int formId = stoi(formName.substr(hi+1)); + int formId = std::stoi(formName.substr(hi+1)); std::string storedFormText = FormulaManager::instance().findFormula(formId); if (storedFormText!=formText) { @@ -154,24 +151,23 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // generate a latex file containing one formula per page. QCString texName="_formulas.tex"; IntVector formulasToGenerate; - QFile f(texName); - if (f.open(IO_WriteOnly)) + std::ofstream t(texName.str(),std::ofstream::out | std::ofstream::binary); + if (t.is_open()) { - FTextStream t(&f); - if (Config_getBool(LATEX_BATCHMODE)) t << "\\batchmode" << endl; - t << "\\documentclass{article}" << endl; - t << "\\usepackage{ifthen}" << endl; - t << "\\usepackage{epsfig}" << endl; // for those who want to include images - t << "\\usepackage[utf8]{inputenc}" << endl; // looks like some older distributions with newunicode package 1.1 need this option. + if (Config_getBool(LATEX_BATCHMODE)) t << "\\batchmode\n"; + t << "\\documentclass{article}\n"; + t << "\\usepackage{ifthen}\n"; + t << "\\usepackage{epsfig}\n"; // for those who want to include images + t << "\\usepackage[utf8]{inputenc}\n"; // looks like some older distributions with newunicode package 1.1 need this option. writeExtraLatexPackages(t); writeLatexSpecialFormulaChars(t); if (!macroFile.isEmpty()) { copyFile(macroFile,stripMacroFile); - t << "\\input{" << stripMacroFile << "}" << endl; + t << "\\input{" << stripMacroFile << "}\n"; } - t << "\\pagestyle{empty}" << endl; - t << "\\begin{document}" << endl; + t << "\\pagestyle{empty}\n"; + t << "\\begin{document}\n"; for (int i=0; i<(int)p->formulas.size(); i++) { QCString resultName; @@ -181,13 +177,13 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c if (!fi.exists()) { // we force a pagebreak after each formula - t << p->formulas[i].c_str() << endl << "\\pagebreak\n\n"; + t << p->formulas[i].c_str() << "\n\\pagebreak\n\n"; formulasToGenerate.push_back(i); } Doxygen::indexList->addImageFile(resultName); } - t << "\\end{document}" << endl; - f.close(); + t << "\\end{document}\n"; + t.close(); } if (!formulasToGenerate.empty()) // there are new formulas { @@ -352,30 +348,23 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // read back %s_tmp.eps and replace // bounding box values with x1,y1,x2,y2 and remove the HiResBoundingBox - QFile epsIn(formBase+"_tmp.eps"); - QFile epsOut(formBase+"_tmp_corr.eps"); - if (epsIn.open(IO_ReadOnly) && epsOut.open(IO_WriteOnly)) + std::ifstream epsIn(formBase.str()+"_tmp.eps",std::ifstream::in); + std::ofstream epsOut(formBase.str()+"_tmp_corr.eps",std::ofstream::out); + if (epsIn.is_open() && epsOut.is_open()) { - int maxLineLen=100*1024; - while (!epsIn.atEnd()) + std::string line; + while (getline(epsIn,line)) { - QCString buf(maxLineLen); - FTextStream t(&epsOut); - int numBytes = epsIn.readLine(buf.rawData(),maxLineLen); - if (numBytes>0) + if (line.rfind("%%BoundingBox",0)==0) + { + epsOut << "%%BoundingBox: " << x1 << " " << y1 << " " << x2 << " " << y2 << "\n"; + } + else if (line.rfind("%%HiResBoundingBox",0)==0) // skip this one { - buf.resize(numBytes+1); - if (buf.startsWith("%%BoundingBox")) - { - t << "%%BoundingBox: " << x1 << " " << y1 << " " << x2 << " " << y2 << endl; - } - else if (buf.startsWith("%%HiResBoundingBox")) // skip this one - { - } - else - { - t << buf; - } + } + else + { + epsOut << line << "\n"; } } epsIn.close(); @@ -438,10 +427,9 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // generated images represent (we use this next time to avoid regeneration // of the images, and to avoid forcing the user to delete all images in order // to let a browser refresh the images). - f.setName("formula.repository"); - if (f.open(IO_WriteOnly)) + t.open("formula.repository",std::ofstream::out); + if (t.is_open()) { - FTextStream t(&f); for (int i=0; i<(int)p->formulas.size(); i++) { DisplaySize size = p->getDisplaySize(i); @@ -450,9 +438,9 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c { t << "=" << size.width << "x" << size.height; } - t << ":" << p->formulas[i].c_str() << endl; + t << ":" << p->formulas[i].c_str() << "\n"; } - f.close(); + t.close(); } // reset the directory to the original location. Dir::setCurrent(oldDir); @@ -522,36 +510,18 @@ static int determineInkscapeVersion(Dir &thisDir) } } // read version file and determine major version - QFile inkscapeVersionIn(inkscapeVersionFile); - if (inkscapeVersionIn.open(IO_ReadOnly)) + std::ifstream inkscapeVersionIn(inkscapeVersionFile.str(),std::ifstream::in); + if (inkscapeVersionIn.is_open()) { - int maxLineLen=1024; - while (!inkscapeVersionIn.atEnd()) + std::string line; + while (getline(inkscapeVersionIn,line)) { - QCString buf(maxLineLen); - int numBytes = inkscapeVersionIn.readLine(buf.rawData(),maxLineLen); - if (numBytes>0) + size_t dotPos = line.find('.'); + if (line.rfind("Inkscape ",0)==0 && dotPos>0) { - buf.resize(numBytes+1); - int dotPos = buf.find('.'); - if (buf.startsWith("Inkscape ") && dotPos>0) - { - // get major version - bool ok; - int version = buf.mid(9,dotPos-9).toInt(&ok); - if (!ok) - { - Portable::sysTimerStop(); - return -1; - } - inkscapeVersion = version; - break; - } - } - else - { - Portable::sysTimerStop(); - return -1; + // get major version + inkscapeVersion = std::stoi(line.substr(9,dotPos-9)); + break; } } inkscapeVersionIn.close(); diff --git a/src/fortranscanner.l b/src/fortranscanner.l index cf8a0bb..34ca344 100755 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -56,8 +56,6 @@ #include #include -#include - #include "fortranscanner.h" #include "entry.h" #include "message.h" @@ -837,8 +835,8 @@ private { } {ATTR_SPEC}. { /* update yyextra->current yyextra->modifiers when it is an ATTR_SPEC and not a variable name */ /* buyyextra->625519 */ - QChar chr = yytext[(int)yyleng-1]; - if (chr.isLetter() || chr.isDigit() || (chr == '_')) + char chr = yytext[(int)yyleng-1]; + if (isId(chr)) { yyextra->colNr -= (int)yyleng; REJECT; @@ -1177,7 +1175,7 @@ private { {ID} { //yyextra->current->type not yet available QCString param = yytext; - // std::cout << "3=========> got parameter " << param << std::endl; + // std::cout << "3=========> got parameter " << param << "\n"; yyextra->current->args += param; Argument arg; arg.name = param; @@ -2428,7 +2426,7 @@ static void addInterface(yyscan_t yyscanner,QCString name, InterfaceType type) static Argument *getParameter(yyscan_t yyscanner,const QCString &name) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - // std::cout<<"addFortranParameter(): "<current_root->argList) { diff --git a/src/ftextstream.cpp b/src/ftextstream.cpp deleted file mode 100644 index 3038af3..0000000 --- a/src/ftextstream.cpp +++ /dev/null @@ -1,260 +0,0 @@ -#include "ftextstream.h" -#include - -//---------------------------------------------------------------------------- - -class QGStringBuffer : public QIODevice -{ - public: - QGStringBuffer( QGString* str ); - ~QGStringBuffer(); - bool open( int m ); - void close(); - void flush(); - uint size() const; - int at() const; - bool at( int pos ); - int readBlock( char *, uint) { return -1; } - int writeBlock( const char *p, uint len ); - int getch() { return -1; } - int putch( int ch ); - int ungetch( int ) { return -1; } - - protected: - QGString* m_str; - - private: // Disabled copy constructor and operator= - QGStringBuffer( const QGStringBuffer & ); - QGStringBuffer &operator=( const QGStringBuffer & ); -}; - -QGStringBuffer::QGStringBuffer( QGString* str ) : m_str(str) -{ - //printf("QGStringBuffer::QGStringBuffer(%p)\n",str); -} - -QGStringBuffer::~QGStringBuffer() -{ -} - -bool QGStringBuffer::open( int m ) -{ - if ( !m_str ) - { -#if defined(CHECK_STATE) - qWarning( "QGStringBuffer::open: No string" ); -#endif - return FALSE; - } - if ( isOpen() ) - { // buffer already open -#if defined(CHECK_STATE) - qWarning( "QGStringBuffer::open: Buffer already open" ); -#endif - return FALSE; - } - setMode( m ); - if ( m & IO_Truncate ) - { // truncate buffer - m_str->truncate( 0 ); - } - if ( m & IO_Append ) - { // append to end of buffer - ioIndex = m_str->length(); - } - else - { - ioIndex = 0; - } - setState( IO_Open ); - setStatus( 0 ); - return TRUE; -} - -void QGStringBuffer::close() -{ - if ( isOpen() ) - { - setFlags( IO_Direct ); - ioIndex = 0; - } -} - -void QGStringBuffer::flush() -{ -} - -uint QGStringBuffer::size() const -{ - return m_str ? m_str->length() : 0; -} - -int QGStringBuffer::at() const -{ - return ioIndex; -} - -bool QGStringBuffer::at( int pos ) -{ -#if defined(CHECK_STATE) - if ( !isOpen() ) - { - qWarning( "QGStringBuffer::at: Buffer is not open" ); - return FALSE; - } -#endif - if ( (uint)pos >= m_str->length() ) - { -#if defined(CHECK_RANGE) - qWarning( "QGStringBuffer::at: Index %d out of range", pos ); -#endif - return FALSE; - } - - ioIndex = pos; - return TRUE; -} - -int QGStringBuffer::writeBlock( const char *p, uint len ) -{ - //printf("QGStringBuffer::writeBlock(%p,%d) m_str=%p ioIndex=%d\n",p,len, - // m_str,ioIndex); - m_str->enlarge(ioIndex+len+1); - memcpy(m_str->data()+ioIndex,p,len); - ioIndex+=len; - m_str->data()[ioIndex]='\0'; - m_str->setLen(ioIndex); - return len; -} - -int QGStringBuffer::putch( int ch ) -{ - //printf("QGStringBuffer::putch(%d) m_str=%p ioIndex=%d\n", - // ch,m_str,ioIndex); - m_str->enlarge(ioIndex+2); - m_str->data()[ioIndex] = (char)ch; - ioIndex++; - m_str->data()[ioIndex] = '\0'; - m_str->setLen(ioIndex); - return ch; -} - - -//---------------------------------------------------------------------------- - -FTextStream::FTextStream() -{ - m_dev = 0; - m_owndev = FALSE; -} - -FTextStream::FTextStream( QIODevice *dev ) -{ - m_dev = dev; - m_owndev = FALSE; -} - -FTextStream::FTextStream( QGString *s ) -{ - m_dev = new QGStringBuffer(s); - ((QGStringBuffer*)m_dev)->open( IO_WriteOnly ); - m_owndev = TRUE; -} - -FTextStream::FTextStream( FILE *fh ) -{ - m_dev = new QFile; - ((QFile *)m_dev)->open( IO_WriteOnly, fh); - m_owndev = TRUE; -} - -FTextStream::~FTextStream() -{ - if (m_owndev) delete m_dev; - m_dev = 0; -} - -QIODevice *FTextStream::device() const -{ - return m_dev; -} - -void FTextStream::setDevice( QIODevice *dev ) -{ - if (m_owndev) - { - delete m_dev; - m_owndev = FALSE; - } - m_dev = dev; -} - -void FTextStream::unsetDevice() -{ - setDevice(0); -} - -FTextStream &FTextStream::output_int( ulong n, bool neg ) -{ - char buf[20]; - char *p = &buf[19]; - *p = '\0'; - if ( neg ) - { - n = (ulong)(-(long)n); - } - do - { - *--p = ((int)(n%10)) + '0'; - n /= 10; - } while ( n ); - if ( neg ) *--p = '-'; - return operator<<(p); -} - -FTextStream &FTextStream::operator<<( signed short i ) -{ - return output_int( i, i < 0 ); -} - -FTextStream &FTextStream::operator<<( unsigned short i ) -{ - return output_int( i, FALSE ); -} - -FTextStream &FTextStream::operator<<( signed int i ) -{ - return output_int( i, i < 0 ); -} - -FTextStream &FTextStream::operator<<( unsigned int i ) -{ - return output_int( i, FALSE ); -} - -FTextStream &FTextStream::operator<<( signed long i ) -{ - return output_int( i, i < 0 ); -} - -FTextStream &FTextStream::operator<<( unsigned long i ) -{ - return output_int( i, FALSE ); -} - -FTextStream &FTextStream::operator<<( float f ) -{ - return *this << (double)f; -} - -FTextStream &FTextStream::operator<<( double d ) -{ - char buf[64]; - sprintf(buf,"%f",d); - return *this << buf; -} - - - - - diff --git a/src/ftextstream.h b/src/ftextstream.h deleted file mode 100644 index 8e56174..0000000 --- a/src/ftextstream.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef FTEXTSTREAM_H -#define FTEXTSTREAM_H - -#include - -#include -#include - -/** @brief Simplified and optimized version of QTextStream */ -class FTextStream -{ - public: - FTextStream(); - FTextStream( QIODevice * ); - FTextStream( QGString * ); - FTextStream( FILE * ); - virtual ~FTextStream(); - - QIODevice *device() const; - void setDevice( QIODevice * ); - void unsetDevice(); - - FTextStream &operator<<( char ); - FTextStream &operator<<( const char *); - FTextStream &operator<<( const QCString & ); - FTextStream &operator<<( signed short ); - FTextStream &operator<<( unsigned short ); - FTextStream &operator<<( signed int ); - FTextStream &operator<<( unsigned int ); - FTextStream &operator<<( signed long ); - FTextStream &operator<<( unsigned long ); - FTextStream &operator<<( float ); - FTextStream &operator<<( double ); - - private: - QIODevice *m_dev; - bool m_owndev; - FTextStream &output_int( ulong n, bool neg ); - - private: // Disabled copy constructor and operator= -#if defined(Q_DISABLE_COPY) - FTextStream( const FTextStream & ); - FTextStream &operator=( const FTextStream & ); -#endif -}; - -inline FTextStream &FTextStream::operator<<( char c) -{ - if (m_dev) m_dev->putch(c); - return *this; -} - -inline FTextStream &FTextStream::operator<<( const char* s) -{ - uint len = qstrlen( s ); - if (m_dev) m_dev->writeBlock( s, len ); - return *this; -} - -inline FTextStream &FTextStream::operator<<( const QCString &s) -{ - if (m_dev) m_dev->writeBlock( s, s.length() ); - return *this; -} - -typedef FTextStream & (*FTSFUNC)(FTextStream &);// manipulator function - -inline FTextStream &operator<<( FTextStream &s, FTSFUNC f ) -{ return (*f)( s ); } - -inline FTextStream &endl( FTextStream & s) -{ - return s << '\n'; -} - -#endif // FTEXTSTREAM_H diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 2435cce..572556d 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -279,7 +279,7 @@ QCString FTVHelp::generateIndentLabel(FTVNode *n,int level) return result; } -void FTVHelp::generateIndent(FTextStream &t, FTVNode *n,bool opened) +void FTVHelp::generateIndent(std::ostream &t, FTVNode *n,bool opened) { int indent=0; FTVNode *p = n->parent; @@ -299,7 +299,7 @@ void FTVHelp::generateIndent(FTextStream &t, FTVNode *n,bool opened) } } -void FTVHelp::generateLink(FTextStream &t,FTVNode *n) +void FTVHelp::generateLink(std::ostream &t,FTVNode *n) { //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n", // n->ref.data(),n->file.data(),n->anchor.data()); @@ -344,7 +344,7 @@ void FTVHelp::generateLink(FTextStream &t,FTVNode *n) } } -static void generateBriefDoc(FTextStream &t,const Definition *def) +static void generateBriefDoc(std::ostream &t,const Definition *def) { QCString brief = def->briefDescription(TRUE); //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,def->name().data(),brief.data()); @@ -383,7 +383,7 @@ static char compoundIcon(const ClassDef *cd) return icon; } -void FTVHelp::generateTree(FTextStream &t, const std::vector &nl,int level,int maxLevel,int &index) +void FTVHelp::generateTree(std::ostream &t, const std::vector &nl,int level,int maxLevel,int &index) { for (const auto &n : nl) { @@ -437,7 +437,7 @@ void FTVHelp::generateTree(FTextStream &t, const std::vector &nl,int l { generateBriefDoc(t,n->def); } - t << "" << endl; + t << "\n"; folderId++; generateTree(t,n->children,level+1,maxLevel,index); } @@ -497,7 +497,7 @@ void FTVHelp::generateTree(FTextStream &t, const std::vector &nl,int l { generateBriefDoc(t,n->def); } - t << "" << endl; + t << "\n"; } } } @@ -534,7 +534,7 @@ static bool dupOfParent(const FTVNode *n) return FALSE; } -static void generateJSLink(FTextStream &t,const FTVNode *n) +static void generateJSLink(std::ostream &t,const FTVNode *n) { if (n->file.isEmpty()) // no link { @@ -557,7 +557,7 @@ static QCString convertFileId2Var(const QCString &fileId) return substitute(varId,"-","_"); } -static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t, +static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, const std::vector &nl,int level,bool &first) { static QCString htmlOutput = Config_getString(HTML_OUTPUT); @@ -567,13 +567,13 @@ static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t, for (const auto &n : nl) { // terminate previous entry - if (!first) t << "," << endl; + if (!first) t << ",\n"; first=FALSE; // start entry if (!found) { - t << "[" << endl; + t << "[\n"; } found=TRUE; @@ -615,14 +615,15 @@ static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t, { fileId+="_dup"; } - QFile f(htmlOutput+"/"+fileId+".js"); - if (f.open(IO_WriteOnly)) + QCString fileName = htmlOutput+"/"+fileId+".js"; + std::ofstream tt(fileName,std::ofstream::out | std::ofstream::binary); + if (tt.is_open()) { - FTextStream tt(&f); - tt << "var " << convertFileId2Var(fileId) << " =" << endl; + tt << "var " << convertFileId2Var(fileId) << " =\n"; generateJSTree(navIndex,tt,n->children,1,firstChild); - tt << endl << "];"; + tt << "\n];"; } + tt.close(); t << "\"" << fileId << "\" ]"; } else // no children @@ -639,7 +640,7 @@ static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t, if (emptySection) t << "null ]"; else - t << endl << indentStr << " ] ]"; + t << "\n" << indentStr << " ] ]"; } } return found; @@ -648,17 +649,16 @@ static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t, static void generateJSNavTree(const std::vector &nodeList) { QCString htmlOutput = Config_getString(HTML_OUTPUT); - QFile f(htmlOutput+"/navtreedata.js"); + std::ofstream t(htmlOutput.str()+"/navtreedata.js",std::ofstream::out | std::ofstream::binary); NavIndexEntryList navIndex; - if (f.open(IO_WriteOnly) /*&& fidx.open(IO_WriteOnly)*/) + if (t.is_open()) { - //FTextStream tidx(&fidx); - //tidx << "var NAVTREEINDEX =" << endl; - //tidx << "{" << endl; - FTextStream t(&f); + //std::ostream tidx(&fidx); + //tidx << "var NAVTREEINDEX =\n"; + //tidx << "{\n"; t << JAVASCRIPT_LICENSE_TEXT; - t << "var NAVTREE =" << endl; - t << "[" << endl; + t << "var NAVTREE =\n"; + t << "[\n"; t << " [ "; QCString projName = Config_getString(PROJECT_NAME); if (projName.isEmpty()) @@ -688,10 +688,10 @@ static void generateJSNavTree(const std::vector &nodeList) generateJSTree(navIndex,t,nodeList,1,first); if (first) - t << "]" << endl; + t << "]\n"; else - t << endl << " ] ]" << endl; - t << "];" << endl << endl; + t << "\n ] ]\n"; + t << "];\n\n"; // write the navigation index (and sub-indices) std::sort(navIndex.begin(),navIndex.end(),[](const auto &n1,const auto &n2) @@ -700,16 +700,13 @@ static void generateJSNavTree(const std::vector &nodeList) int subIndex=0; int elemCount=0; const int maxElemCount=250; - //QFile fidx(htmlOutput+"/navtreeindex.js"); - QFile fsidx(htmlOutput+"/navtreeindex0.js"); - if (/*fidx.open(IO_WriteOnly) &&*/ fsidx.open(IO_WriteOnly)) + std::ofstream tsidx(htmlOutput.str()+"/navtreeindex0.js",std::ofstream::out | std::ofstream::binary); + if (tsidx.is_open()) { - //FTextStream tidx(&fidx); - FTextStream tsidx(&fsidx); - t << "var NAVTREEINDEX =" << endl; - t << "[" << endl; - tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl; - tsidx << "{" << endl; + t << "var NAVTREEINDEX =\n"; + t << "[\n"; + tsidx << "var NAVTREEINDEX" << subIndex << " =\n"; + tsidx << "{\n"; first=TRUE; auto it = navIndex.begin(); while (it!=navIndex.end()) @@ -719,7 +716,7 @@ static void generateJSNavTree(const std::vector &nodeList) { if (!first) { - t << "," << endl; + t << ",\n"; } else { @@ -730,27 +727,27 @@ static void generateJSNavTree(const std::vector &nodeList) tsidx << "\"" << e.url << "\":[" << e.path << "]"; ++it; if (it!=navIndex.end() && elemCount=maxElemCount) // switch to new sub-index { - tsidx << "};" << endl; + tsidx << "};\n"; elemCount=0; - fsidx.close(); + tsidx.close(); subIndex++; - fsidx.setName(htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js"); - if (!fsidx.open(IO_WriteOnly)) break; - tsidx.setDevice(&fsidx); - tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl; - tsidx << "{" << endl; + QCString fileName = htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js"; + tsidx.open(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!tsidx.is_open()) break; + tsidx << "var NAVTREEINDEX" << subIndex << " =\n"; + tsidx << "{\n"; } } - tsidx << "};" << endl; - t << endl << "];" << endl; + tsidx << "};\n"; + t << "\n];\n"; } - t << endl << "var SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(FALSE) << "';"; - t << endl << "var SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(TRUE) << "';"; + t << "\nvar SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(FALSE) << "';"; + t << "\nvar SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(TRUE) << "';"; } ResourceMgr::instance().copyResource("navtree.js",htmlOutput); } @@ -782,7 +779,7 @@ void FTVHelp::generateTreeViewScripts() } // write tree inside page -void FTVHelp::generateTreeViewInline(FTextStream &t) +void FTVHelp::generateTreeViewInline(std::ostream &t) { int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES); t << "
\n"; diff --git a/src/ftvhelp.h b/src/ftvhelp.h index b04247c..11317fd 100644 --- a/src/ftvhelp.h +++ b/src/ftvhelp.h @@ -24,13 +24,12 @@ #ifndef FTVHELP_H #define FTVHELP_H +#include #include #include "index.h" -class QFile; class Definition; struct FTVNode; -class FTextStream; /** A class that generates a dynamic tree view side panel. */ @@ -56,14 +55,14 @@ class FTVHelp : public IndexIntf void addImageFile(const char *) {} void addStyleSheetFile(const char *) {} void generateTreeView(); - void generateTreeViewInline(FTextStream &t); + void generateTreeViewInline(std::ostream &t); static void generateTreeViewImages(); void generateTreeViewScripts(); private: - void generateTree(FTextStream &t,const std::vector &nl,int level,int maxLevel,int &index); + void generateTree(std::ostream &t,const std::vector &nl,int level,int maxLevel,int &index); QCString generateIndentLabel(FTVNode *n,int level); - void generateIndent(FTextStream &t,FTVNode *n,bool opened); - void generateLink(FTextStream &t,FTVNode *n); + void generateIndent(std::ostream &t,FTVNode *n,bool opened); + void generateLink(std::ostream &t,FTVNode *n); std::vector< std::vector > m_indentNodes; int m_indent; bool m_topLevelIndex; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 095069e..7e6dca4 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -75,7 +75,7 @@ class GroupDefImpl : public DefinitionMixin virtual void writeDocumentation(OutputList &ol); virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; - virtual void writeTagFile(FTextStream &); + virtual void writeTagFile(std::ostream &); virtual size_t numDocMembers() const; virtual bool isLinkableInProject() const; virtual bool isLinkable() const; @@ -597,12 +597,12 @@ void GroupDefImpl::computeAnchors() m_allMemberList.setAnchors(); } -void GroupDefImpl::writeTagFile(FTextStream &tagFile) +void GroupDefImpl::writeTagFile(std::ostream &tagFile) { - tagFile << " " << endl; - tagFile << " " << convertToXML(name()) << "" << endl; - tagFile << " " << convertToXML(m_title) << "" << endl; - tagFile << " " << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "" << endl; + tagFile << " \n"; + tagFile << " " << convertToXML(name()) << "\n"; + tagFile << " " << convertToXML(m_title) << "\n"; + tagFile << " " << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "\n"; for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Group)) { switch (lde->kind()) @@ -614,7 +614,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) if (cd->isLinkableInProject()) { tagFile << " compoundTypeString() - << "\">" << convertToXML(cd->name()) << "" << endl; + << "\">" << convertToXML(cd->name()) << "\n"; } } } @@ -626,7 +626,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) if (nd->isLinkableInProject()) { tagFile << " " << convertToXML(nd->name()) - << "" << endl; + << "\n"; } } } @@ -637,7 +637,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) { if (fd->isLinkableInProject()) { - tagFile << " " << convertToXML(fd->name()) << "" << endl; + tagFile << " " << convertToXML(fd->name()) << "\n"; } } } @@ -649,7 +649,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) QCString pageName = pd->getOutputFileBase(); if (pd->isLinkableInProject()) { - tagFile << " " << convertToXML(pageName) << "" << endl; + tagFile << " " << convertToXML(pageName) << "\n"; } } } @@ -660,7 +660,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) { if (dd->isLinkableInProject()) { - tagFile << " " << convertToXML(dd->displayName()) << "" << endl; + tagFile << " " << convertToXML(dd->displayName()) << "\n"; } } } @@ -671,7 +671,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) { if (gd->isVisible()) { - tagFile << " " << convertToXML(gd->name()) << "" << endl; + tagFile << " " << convertToXML(gd->name()) << "\n"; } } } @@ -699,7 +699,7 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) } } writeDocAnchorsToTagFile(tagFile); - tagFile << " " << endl; + tagFile << " \n"; } void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) diff --git a/src/groupdef.h b/src/groupdef.h index 94214c4..2d0dafc 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -42,7 +42,6 @@ class DirDef; class FTVHelp; class Entry; class MemberDef; -class FTextStream; /** A model of a group of symbols. */ class GroupDef : public DefinitionMutable, public Definition @@ -70,7 +69,7 @@ class GroupDef : public DefinitionMutable, public Definition virtual void writeDocumentation(OutputList &ol) = 0; virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; - virtual void writeTagFile(FTextStream &) = 0; + virtual void writeTagFile(std::ostream &) = 0; virtual size_t numDocMembers() const = 0; virtual bool isLinkableInProject() const = 0; virtual bool isLinkable() const = 0; diff --git a/src/htags.cpp b/src/htags.cpp index fdde0f3..e59e7c8 100644 --- a/src/htags.cpp +++ b/src/htags.cpp @@ -24,7 +24,6 @@ #include "config.h" #include "portable.h" #include "fileinfo.h" -#include "qdir.h" bool Htags::useHtags = FALSE; @@ -123,16 +122,13 @@ bool Htags::loadFilemap(const QCString &htmlDir) */ if (fi.exists() && fi.isReadable()) { - QFile f(fileMapName); - const int maxlen = 8192; - QCString line(maxlen+1); - line.at(maxlen)='\0'; - if (f.open(IO_ReadOnly)) + std::ifstream f(fileMapName.str(),std::ifstream::in); + if (f.is_open()) { - int len; - while ((len=f.readLine(line.rawData(),maxlen))>0) + std::string lineStr; + while (getline(f,lineStr)) { - line.at(len)='\0'; + QCString line = lineStr; //printf("Read line: %s",line.data()); int sep = line.find('\t'); if (sep!=-1) @@ -145,14 +141,14 @@ bool Htags::loadFilemap(const QCString &htmlDir) //printf("Key/Value=(%s,%s)\n",key.data(),value.data()); } } - return TRUE; + return true; } else { err("file %s cannot be opened\n",fileMapName.data()); } } - return FALSE; + return false; } /*! convert path name into the url in the hypertext generated by htags. diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index a7d8321..73939a0 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -13,7 +13,6 @@ * */ -#include #include "htmldocvisitor.h" #include "docparser.h" #include "language.h" @@ -265,7 +264,7 @@ static QCString htmlAttribsToString(const HtmlAttribList &attribs, QCString *pAl //------------------------------------------------------------------------- -HtmlDocVisitor::HtmlDocVisitor(FTextStream &t,CodeOutputInterface &ci, +HtmlDocVisitor::HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci, const Definition *ctx) : DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_ctx(ctx) @@ -472,20 +471,20 @@ void HtmlDocVisitor::visit(DocStyleChange *s) } -static void visitPreCaption(FTextStream &t, DocVerbatim *s) +static void visitPreCaption(std::ostream &t, DocVerbatim *s) { if (s->hasCaption()) { - t << "
" << endl; + t << "
\n"; } } -static void visitPostCaption(FTextStream &t, DocVerbatim *s) +static void visitPostCaption(std::ostream &t, DocVerbatim *s) { if (s->hasCaption()) { - t << "
" << endl; + t << "
\n"; } } @@ -559,24 +558,25 @@ void HtmlDocVisitor::visit(DocVerbatim *s) dotindex++, ".dot" ); - QFile file(fileName); - if (!file.open(IO_WriteOnly)) + std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!file.is_open()) { err("Could not open file %s for writing\n",fileName.data()); } else { - file.writeBlock( s->text(), s->text().length() ); + QCString stext = s->text(); + file.write( stext.data(), stext.length() ); file.close(); - m_t << "
" << endl; + m_t << "
\n"; writeDotFile(fileName,s->relPath(),s->context()); visitPreCaption(m_t, s); visitCaption(this, s->children()); visitPostCaption(m_t, s); - m_t << "
" << endl; + m_t << "
\n"; - if (Config_getBool(DOT_CLEANUP)) file.remove(); + if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str()); } forceStartParagraph(s); } @@ -592,8 +592,8 @@ void HtmlDocVisitor::visit(DocVerbatim *s) (Config_getString(HTML_OUTPUT)+"/inline_mscgraph_").data(), mscindex++ ); - QFile file(baseName+".msc"); - if (!file.open(IO_WriteOnly)) + std::ofstream file(baseName.str()+".msc",std::ofstream::out | std::ofstream::binary); + if (!file.is_open()) { err("Could not open file %s.msc for writing\n",baseName.data()); } @@ -603,17 +603,17 @@ void HtmlDocVisitor::visit(DocVerbatim *s) text+=s->text(); text+="}"; - file.writeBlock( text, text.length() ); + file.write( text.data(), text.length() ); file.close(); - m_t << "
" << endl; + m_t << "
\n"; writeMscFile(baseName+".msc",s->relPath(),s->context()); visitPreCaption(m_t, s); visitCaption(this, s->children()); visitPostCaption(m_t, s); - m_t << "
" << endl; + m_t << "
\n"; - if (Config_getBool(DOT_CLEANUP)) file.remove(); + if (Config_getBool(DOT_CLEANUP)) Dir().remove(baseName.str()+".msc"); } forceStartParagraph(s); } @@ -629,12 +629,12 @@ void HtmlDocVisitor::visit(DocVerbatim *s) format = PlantumlManager::PUML_SVG; } QCString baseName = PlantumlManager::instance().writePlantUMLSource(htmlOutput,s->exampleFile(),s->text(),format); - m_t << "
" << endl; + m_t << "
\n"; writePlantUMLFile(baseName,s->relPath(),s->context()); visitPreCaption(m_t, s); visitCaption(this, s->children()); visitPostCaption(m_t, s); - m_t << "
" << endl; + m_t << "
\n"; forceStartParagraph(s); } break; @@ -828,7 +828,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op) } else { - if (!m_hide) m_t << endl; + if (!m_hide) m_t << "\n"; } } @@ -839,7 +839,7 @@ void HtmlDocVisitor::visit(DocFormula *f) if (bDisplay) { forceEndParagraph(f); - m_t << "

" << endl; + m_t << "

\n"; } if (Config_getBool(USE_MATHJAX)) @@ -888,7 +888,7 @@ void HtmlDocVisitor::visit(DocFormula *f) } if (bDisplay) { - m_t << endl << "

" << endl; + m_t << "\n

\n"; forceStartParagraph(f); } } @@ -911,8 +911,8 @@ void HtmlDocVisitor::visit(DocIndexEntry *e) void HtmlDocVisitor::visit(DocSimpleSectSep *) { - m_t << "" << endl; - m_t << "
" << endl; + m_t << "
\n"; + m_t << "
\n"; } void HtmlDocVisitor::visit(DocCite *cite) @@ -1437,7 +1437,7 @@ void HtmlDocVisitor::visitPre(DocSection *s) forceEndParagraph(s); m_t << "level() << ">"; m_t << "anchor(); - m_t << "\">" << endl; + m_t << "\">\n"; filter(convertCharEntitiesToUTF8(s->title().data())); m_t << "level() << ">\n"; } @@ -1608,7 +1608,7 @@ void HtmlDocVisitor::visitPre(DocInternal *) { if (m_hide) return; //forceEndParagraph(i); - //m_t << "

" << theTranslator->trForInternalUseOnly() << "

" << endl; + //m_t << "

" << theTranslator->trForInternalUseOnly() << "

\n"; } void HtmlDocVisitor::visitPost(DocInternal *) @@ -1671,7 +1671,7 @@ void HtmlDocVisitor::visitPre(DocImage *img) { baseName=baseName.right(baseName.length()-i-1); } - if (!inlineImage) m_t << "
" << endl; + if (!inlineImage) m_t << "
\n"; QCString sizeAttribs; if (!img->width().isEmpty()) { @@ -1713,7 +1713,7 @@ void HtmlDocVisitor::visitPre(DocImage *img) } else { - m_t << ">" << alt << "" << endl; + m_t << ">" << alt << "\n"; } } else @@ -1736,7 +1736,7 @@ void HtmlDocVisitor::visitPre(DocImage *img) } else { - m_t << "
" << endl; + m_t << "
\n"; } } else if (inlineImage) @@ -1770,7 +1770,7 @@ void HtmlDocVisitor::visitPost(DocImage *img) } if (!inlineImage) // end
{ - m_t << "
" << endl; + m_t << "
\n"; forceStartParagraph(img); } } @@ -1783,11 +1783,11 @@ void HtmlDocVisitor::visitPost(DocImage *img) void HtmlDocVisitor::visitPre(DocDotFile *df) { if (m_hide) return; - m_t << "
" << endl; + m_t << "
\n"; writeDotFile(df->file(),df->relPath(),df->context()); if (df->hasCaption()) { - m_t << "
" << endl; + m_t << "
\n"; } } @@ -1796,19 +1796,19 @@ void HtmlDocVisitor::visitPost(DocDotFile *df) if (m_hide) return; if (df->hasCaption()) { - m_t << "
" << endl; + m_t << "
\n"; } - m_t << "
" << endl; + m_t << "
\n"; } void HtmlDocVisitor::visitPre(DocMscFile *df) { if (m_hide) return; - m_t << "
" << endl; + m_t << "
\n"; writeMscFile(df->file(),df->relPath(),df->context()); if (df->hasCaption()) { - m_t << "
" << endl; + m_t << "
\n"; } } void HtmlDocVisitor::visitPost(DocMscFile *df) @@ -1816,19 +1816,19 @@ void HtmlDocVisitor::visitPost(DocMscFile *df) if (m_hide) return; if (df->hasCaption()) { - m_t << "
" << endl; + m_t << "
\n"; } - m_t << "
" << endl; + m_t << "
\n"; } void HtmlDocVisitor::visitPre(DocDiaFile *df) { if (m_hide) return; - m_t << "
" << endl; + m_t << "
\n"; writeDiaFile(df->file(),df->relPath(),df->context()); if (df->hasCaption()) { - m_t << "
" << endl; + m_t << "
\n"; } } void HtmlDocVisitor::visitPost(DocDiaFile *df) @@ -1836,9 +1836,9 @@ void HtmlDocVisitor::visitPost(DocDiaFile *df) if (m_hide) return; if (df->hasCaption()) { - m_t << "
" << endl; + m_t << "
\n"; } - m_t << "
" << endl; + m_t << "
\n"; } void HtmlDocVisitor::visitPre(DocLink *lnk) @@ -1890,15 +1890,15 @@ void HtmlDocVisitor::visitPre(DocSecRefList *s) { if (m_hide) return; forceEndParagraph(s); - m_t << "
" << endl; - m_t << "
    " << endl; + m_t << "
    \n"; + m_t << "
      \n"; } void HtmlDocVisitor::visitPost(DocSecRefList *s) { if (m_hide) return; - m_t << "
    " << endl; - m_t << "
    " << endl; + m_t << "
\n"; + m_t << "
\n"; forceStartParagraph(s); } @@ -1931,16 +1931,16 @@ void HtmlDocVisitor::visitPre(DocParamSect *s) } m_t << "
"; m_t << heading; - m_t << "
" << endl; - m_t << " " << endl; + m_t << "
\n"; + m_t << "
\n"; } void HtmlDocVisitor::visitPost(DocParamSect *s) { if (m_hide) return; - m_t << "
" << endl; - m_t << "
" << endl; - m_t << "
" << endl; + m_t << " \n"; + m_t << "
\n"; + m_t << "\n"; forceStartParagraph(s); } @@ -2017,7 +2017,7 @@ void HtmlDocVisitor::visitPost(DocParamList *) { //printf("DocParamList::visitPost\n"); if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void HtmlDocVisitor::visitPre(DocXRefItem *x) @@ -2047,7 +2047,7 @@ void HtmlDocVisitor::visitPost(DocXRefItem *x) { if (m_hide) return; if (x->title().isEmpty()) return; - m_t << "" << endl; + m_t << "\n"; forceStartParagraph(x); } @@ -2083,7 +2083,7 @@ void HtmlDocVisitor::visitPre(DocHtmlBlockQuote *b) void HtmlDocVisitor::visitPost(DocHtmlBlockQuote *b) { if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; forceStartParagraph(b); } @@ -2295,7 +2295,7 @@ void HtmlDocVisitor::writeDiaFile(const QCString &fileName, QCString outDir = Config_getString(HTML_OUTPUT); writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); - m_t << "" << endl; + m_t << "\n"; } void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, @@ -2317,15 +2317,15 @@ void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, if (imgExt=="svg") { PlantumlManager::instance().generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_SVG); - //m_t << "" << endl; - m_t << "" << endl; + //m_t << "\n"; + m_t << "\n"; } else { PlantumlManager::instance().generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_BITMAP); - m_t << "" << endl; + m_t << "\n"; } } diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 084482e..44e1597 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -22,14 +22,13 @@ class Definition; class MemberDef; class DocNode; -class FTextStream; class CodeOutputInterface; /*! @brief Concrete visitor implementation for HTML output. */ class HtmlDocVisitor : public DocVisitor { public: - HtmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,const Definition *ctx); + HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const Definition *ctx); //-------------------------------------- // visitor functions for leaf nodes @@ -157,7 +156,7 @@ class HtmlDocVisitor : public DocVisitor // state variables //-------------------------------------- - FTextStream &m_t; + std::ostream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp index 29ff6e3..f5ddd6f 100644 --- a/src/htmlentity.cpp +++ b/src/htmlentity.cpp @@ -15,7 +15,6 @@ #include "htmlentity.h" #include "message.h" -#include "ftextstream.h" //! Number of doxygen commands mapped as if it were HTML entities static const int g_numberHtmlMappedCmds = 11; @@ -474,7 +473,7 @@ DocSymbol::SymType HtmlEntityMapper::name2sym(const QCString &symName) const return it!=m_name2sym.end() ? it->second : DocSymbol::Sym_Unknown; } -void HtmlEntityMapper::writeXMLSchema(FTextStream &t) +void HtmlEntityMapper::writeXMLSchema(std::ostream &t) { for (int i=0;i #include +#include #include "docparser.h" -class FTextStream; - /** @brief Singleton helper class to map html entities to other formats */ class HtmlEntityMapper { @@ -37,7 +36,7 @@ class HtmlEntityMapper const char *man(DocSymbol::SymType symb) const; const char *rtf(DocSymbol::SymType symb) const; const DocSymbol::PerlSymb *perl(DocSymbol::SymType symb) const; - void writeXMLSchema(FTextStream &t); + void writeXMLSchema(std::ostream &t); private: void validate(); HtmlEntityMapper(); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 79bda74..2a7155a 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -1,8 +1,6 @@ /****************************************************************************** * - * - * - * Copyright (C) 1997-2015 by Dimitri van Heesch. + * Copyright (C) 1997-2021 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby @@ -19,6 +17,7 @@ #include #include +#include #include "message.h" #include "htmlgen.h" @@ -64,11 +63,12 @@ static const char *hex="0123456789ABCDEF"; // note: this is only active if DISABLE_INDEX=YES, if DISABLE_INDEX is disabled, this // part will be rendered inside menu.js -static void writeClientSearchBox(FTextStream &t,const char *relPath) +static void writeClientSearchBox(std::ostream &t,const char *relPath) { + const char *rp = relPath ? relPath : ""; t << "
\n"; t << " \n"; - t << " \"\"/\n"; @@ -79,19 +79,20 @@ static void writeClientSearchBox(FTextStream &t,const char *relPath) t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n"; t << " \n"; t << " " - << "\"\"/\n"; + << "\"\"/\n"; t << " \n"; t << "
\n"; } // note: this is only active if DISABLE_INDEX=YES. if DISABLE_INDEX is disabled, this // part will be rendered inside menu.js -static void writeServerSearchBox(FTextStream &t,const char *relPath,bool highlightSearch) +static void writeServerSearchBox(std::ostream &t,const char *relPath,bool highlightSearch) { + const char *rp = relPath ? relPath : ""; bool externalSearch = Config_getBool(EXTERNAL_SEARCH); t << "
\n"; t << "
\n"; - t << "
\n"; - t << " \"\"/\n"; + t << " \"\"/\n"; if (!highlightSearch) { t << " "; } - m_t << "
" << endl; + m_t << "
\n"; } @@ -936,15 +936,14 @@ void HtmlGenerator::init() } { - QFile f(dname+"/dynsections.js"); - if (f.open(IO_WriteOnly)) + std::ofstream t(dname+"/dynsections.js",std::ofstream::out); + if (t.is_open()) { - FTextStream t(&f); t << mgr.getAsString("dynsections.js"); if (Config_getBool(SOURCE_BROWSER) && Config_getBool(SOURCE_TOOLTIPS)) { - t << endl << - "$(document).ready(function() {\n" + t << + "\n$(document).ready(function() {\n" " $('.code,.codeRef').each(function() {\n" " $(this).data('powertip',$('#a'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n" " $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n" @@ -1011,10 +1010,9 @@ void HtmlGenerator::writeSearchData(const char *dname) } QCString searchDirName = dname; - QFile f(searchDirName+"/search.css"); - if (f.open(IO_WriteOnly)) + std::ofstream t(searchDirName.str()+"/search.css",std::ofstream::out); + if (t.is_open()) { - FTextStream t(&f); QCString searchCss; if (Config_getBool(DISABLE_INDEX)) { @@ -1034,23 +1032,20 @@ void HtmlGenerator::writeSearchData(const char *dname) } } -void HtmlGenerator::writeStyleSheetFile(QFile &file) +void HtmlGenerator::writeStyleSheetFile(std::ostream &t) { - FTextStream t(&file); t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); } -void HtmlGenerator::writeHeaderFile(QFile &file, const char * /*cssname*/) +void HtmlGenerator::writeHeaderFile(std::ostream &t, const char * /*cssname*/) { - FTextStream t(&file); - t << "" << endl; + t << "\n"; t << ResourceMgr::instance().getAsString("header.html"); } -void HtmlGenerator::writeFooterFile(QFile &file) +void HtmlGenerator::writeFooterFile(std::ostream &t) { - FTextStream t(&file); - t << "" << endl; + t << "\n"; t << ResourceMgr::instance().getAsString("footer.html"); } @@ -1077,7 +1072,7 @@ void HtmlGenerator::startFile(const char *name,const char *, t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title?title:"")),m_relPath); t << "" << endl; + << getDoxygenVersion() << " -->\n"; //bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); bool searchEngine = Config_getBool(SEARCHENGINE); if (searchEngine /*&& !generateTreeView*/) @@ -1093,7 +1088,7 @@ void HtmlGenerator::startFile(const char *name,const char *, m_sectionCount=0; } -void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &) +void HtmlGenerator::writeSearchInfo(std::ostream &t,const QCString &) { bool searchEngine = Config_getBool(SEARCHENGINE); bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); @@ -1151,7 +1146,7 @@ void HtmlGenerator::writeLogo() t << writeLogoAsString(m_relPath); } -void HtmlGenerator::writePageFooter(FTextStream &t,const QCString &lastTitle, +void HtmlGenerator::writePageFooter(std::ostream &t,const QCString &lastTitle, const QCString &relPath,const QCString &navPath) { t << substituteHtmlKeywords(g_footer,convertToHtml(lastTitle),relPath,navPath); @@ -1188,8 +1183,8 @@ void HtmlGenerator::writeStyleInfo(int part) startPlainFile("doxygen.css"); // alternative, cooler looking titles - //t << "H1 { text-align: center; border-width: thin none thin none;" << endl; - //t << " border-style : double; border-color : blue; padding-left : 1em; padding-right : 1em }" << endl; + //t << "H1 { text-align: center; border-width: thin none thin none;\n"; + //t << " border-style : double; border-color : blue; padding-left : 1em; padding-right : 1em }\n"; t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); endPlainFile(); @@ -1249,20 +1244,20 @@ void HtmlGenerator::endDoxyAnchor(const char *,const char *) //void HtmlGenerator::newParagraph() //{ -// t << endl << "

" << endl; +// t << "\n

\n"; //} void HtmlGenerator::startParagraph(const char *classDef) { if (classDef) - t << endl << "

"; + t << "\n

"; else - t << endl << "

"; + t << "\n

"; } void HtmlGenerator::endParagraph() { - t << "

" << endl; + t << "

\n"; } void HtmlGenerator::writeString(const char *text) @@ -1277,7 +1272,7 @@ void HtmlGenerator::startIndexListItem() void HtmlGenerator::endIndexListItem() { - t << "" << endl; + t << "\n"; } void HtmlGenerator::startIndexItem(const char *ref,const char *f) @@ -1397,15 +1392,15 @@ void HtmlGenerator::endGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "" << endl; + t << "\n"; } else if (extraIndentLevel==1) { - t << "" << endl; + t << "\n"; } else { - t << "" << endl; + t << "\n"; } } @@ -1485,7 +1480,7 @@ void HtmlGenerator::writeChar(char c) //--- helper function for dynamic sections ------------------------- -static void startSectionHeader(FTextStream &t, +static void startSectionHeader(std::ostream &t, const QCString &relPath,int sectionCount) { //t << ""; @@ -1495,23 +1490,23 @@ static void startSectionHeader(FTextStream &t, t << "
" << endl; + "style=\"cursor:pointer;\">\n"; t << " \"+\"/ "; } else { - t << "
" << endl; + t << "
\n"; } } -static void endSectionHeader(FTextStream &t) +static void endSectionHeader(std::ostream &t) { //t << ""; - t << "
" << endl; + t << "
\n"; } -static void startSectionSummary(FTextStream &t,int sectionCount) +static void startSectionSummary(std::ostream &t,int sectionCount) { //t << ""; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1519,21 +1514,21 @@ static void startSectionSummary(FTextStream &t,int sectionCount) { t << "
" << endl; + "style=\"display:block;\">\n"; } } -static void endSectionSummary(FTextStream &t) +static void endSectionSummary(std::ostream &t) { //t << ""; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); if (dynamicSections) { - t << "
" << endl; + t << "
\n"; } } -static void startSectionContent(FTextStream &t,int sectionCount) +static void startSectionContent(std::ostream &t,int sectionCount) { //t << ""; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1541,18 +1536,18 @@ static void startSectionContent(FTextStream &t,int sectionCount) { t << "
" << endl; + "style=\"display:none;\">\n"; } else { - t << "
" << endl; + t << "
\n"; } } -static void endSectionContent(FTextStream &t) +static void endSectionContent(std::ostream &t) { //t << ""; - t << "
" << endl; + t << "
\n"; } //---------------------------- @@ -1565,32 +1560,30 @@ void HtmlGenerator::startClassDiagram() void HtmlGenerator::endClassDiagram(const ClassDiagram &d, const char *fileName,const char *name) { - QGString result; - FTextStream tt(&result); - endSectionHeader(t); startSectionSummary(t,m_sectionCount); endSectionSummary(t); startSectionContent(t,m_sectionCount); + std::stringstream tt; d.writeImage(tt,dir(),m_relPath,fileName); - if (!result.isEmpty()) + if (tt.tellg()>0) { - t << "
" << endl; + t << "
\n"; t << " \"\"/" << endl; + t << "_map\" alt=\"\"/>\n"; t << " " << endl; - t << result; - t << " " << endl; + t << "_map\">\n"; + t << tt.str(); + t << " \n"; t << "
"; } else { - t << "
" << endl; + t << "
\n"; t << " \"\"/" << endl; + t << m_relPath << fileName << ".png\" alt=\"\"/>\n"; t << "
"; } endSectionContent(t); @@ -1600,12 +1593,12 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d, void HtmlGenerator::startMemberList() { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") } void HtmlGenerator::endMemberList() { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") } // anonymous type: @@ -1614,13 +1607,13 @@ void HtmlGenerator::endMemberList() // 2 = single column left aligned void HtmlGenerator::startMemberItem(const char *anchor,int annoType,const char *inheritId) { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") if (m_emptySection) { - t << "" << endl; + t << "
\n"; m_emptySection=FALSE; } - t << ""; - t << endl; + t << "\n"; } void HtmlGenerator::startMemberTemplateParams() @@ -1641,8 +1633,8 @@ void HtmlGenerator::startMemberTemplateParams() void HtmlGenerator::endMemberTemplateParams(const char *anchor,const char *inheritId) { - t << "" << endl; - t << "\n"; + t << "" << endl) + DBG_HTML(t << "\n") QCString className = templ ? "memTemplItemRight" : "memItemRight"; t << " 
"; } @@ -1672,13 +1664,13 @@ void HtmlGenerator::insertMemberAlignLeft(int annoType, bool initTag) void HtmlGenerator::startMemberDescription(const char *anchor,const char *inheritId, bool typ) { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") if (m_emptySection) { - t << "" << endl; + t << "
\n"; m_emptySection=FALSE; } - t << "" << endl) - t << "
" << endl; + DBG_HTML(t << "\n") + t << "
\n"; } void HtmlGenerator::startMemberSections() { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") m_emptySection=TRUE; // we postpone writing
until we actually // write a row to prevent empty tables, which // are not valid XHTML! @@ -1705,16 +1697,16 @@ void HtmlGenerator::startMemberSections() void HtmlGenerator::endMemberSections() { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") if (!m_emptySection) { - t << "
" << endl; + t << "
\n"; } } void HtmlGenerator::startMemberHeader(const char *anchor, int typ) { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") if (!m_emptySection) { t << ""; @@ -1722,42 +1714,42 @@ void HtmlGenerator::startMemberHeader(const char *anchor, int typ) } if (m_emptySection) { - t << "" << endl; + t << "
\n"; m_emptySection=FALSE; } t << "" << endl; + DBG_HTML(t << "\n") + t << "\n"; } void HtmlGenerator::startMemberSubtitle() { - DBG_HTML(t << "" << endl) + DBG_HTML(t << "\n") t << "" << endl; + DBG_HTML(t << "\n") + t << "\n"; } void HtmlGenerator::startIndexList() { - t << "

"; if (anchor) { - t << "" << endl; + t << "\n"; } } void HtmlGenerator::endMemberHeader() { - DBG_HTML(t << "" << endl) - t << "

"; } void HtmlGenerator::endMemberSubtitle() { - DBG_HTML(t << "" << endl) - t << "
" << endl; + t << "
\n"; } void HtmlGenerator::endIndexList() { - t << "
" << endl; + t << "\n"; } void HtmlGenerator::startIndexKey() @@ -1779,24 +1771,24 @@ void HtmlGenerator::startIndexValue(bool) void HtmlGenerator::endIndexValue(const char *,bool) { - t << "" << endl; + t << "\n"; } void HtmlGenerator::startMemberDocList() { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) } void HtmlGenerator::endMemberDocList() { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) } void HtmlGenerator::startMemberDoc( const char *clName, const char *memName, const char *anchor, const char *title, int memCount, int memTotal, bool showInline) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) t << "\n

" << "◆ "; docify(title); @@ -1804,122 +1796,121 @@ void HtmlGenerator::startMemberDoc( const char *clName, const char *memName, { t << " [" << memCount << "/" << memTotal <<"]"; } - t << "

" - << endl; - t << "\n
" << endl; - t << "
" << endl; + t << "\n"; + t << "\n
\n"; + t << "
\n"; } void HtmlGenerator::startMemberDocPrefixItem() { - DBG_HTML(t << "" << endl;) - t << "
" << endl; + DBG_HTML(t << "\n";) + t << "
\n"; } void HtmlGenerator::endMemberDocPrefixItem() { - DBG_HTML(t << "" << endl;) - t << "
" << endl; + DBG_HTML(t << "\n";) + t << "
\n"; } void HtmlGenerator::startMemberDocName(bool /*align*/) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) - t << " " << endl; + t << "
\n"; - t << " " << endl; + t << " \n"; t << " " << endl; + DBG_HTML(t << "\n";) + t << "\n"; } void HtmlGenerator::startParameterList(bool openBracket) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) t << " " << endl; + t << "\n"; } void HtmlGenerator::startParameterType(bool first,const char *key) { if (first) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) t << " " << endl; + DBG_HTML(t << "\n";) + t << " \n"; t << " " << endl; - t << " " << endl; + t << "\n"; + t << " \n"; t << " " << endl; + DBG_HTML(t << "\n";) + t << " \n"; } void HtmlGenerator::startParameterName(bool /*oneArgOnly*/) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) t << " " << endl; + t << "\n"; t << " " << endl; - t << " " << endl; - t << " " << endl; - t << " " << endl; + t << " \n"; + t << " \n"; + t << " \n"; + t << " \n"; t << " " << endl; + t << "\n"; t << " " << endl; - t << " " << endl; + t << "\n"; + t << " \n"; } } void HtmlGenerator::endParameterList() { - DBG_HTML(t << "" << endl;) - t << "" << endl; - t << " " << endl; + DBG_HTML(t << "\n";) + t << "\n"; + t << " \n"; } void HtmlGenerator::exceptionEntry(const char* prefix,bool closeBracket) { - DBG_HTML(t << "" << endl;) - t << "" << endl; - t << " " << endl; - t << " " << endl; + DBG_HTML(t << "\n";) + t << "\n"; + t << " \n"; + t << " \n"; t << " " << endl; + t << " \n"; } - t << "
"; } void HtmlGenerator::endMemberDocName() { - DBG_HTML(t << "" << endl;) - t << ""; if (openBracket) t << "("; - t << ""; } else { - DBG_HTML(t << "" << endl;) - t << "
"; if (key) t << key; - t << ""; } } void HtmlGenerator::endParameterType() { - DBG_HTML(t << "" << endl;) - t << " "; } void HtmlGenerator::endParameterName(bool last,bool emptyList,bool closeBracket) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) if (last) { if (emptyList) { if (closeBracket) t << ")"; - t << ""; } else { - t << " 
"; if (closeBracket) t << ")"; - t << ""; } } else { - t << "
"; // colspan 2 so it gets both parameter type and parameter name columns if (prefix) @@ -1932,13 +1923,13 @@ void HtmlGenerator::exceptionEntry(const char* prefix,bool closeBracket) void HtmlGenerator::endMemberDoc(bool hasArgs) { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) if (!hasArgs) { - t << "
" << endl; - // t << "
" << endl; + t << " \n"; + // t << "
\n"; } void HtmlGenerator::startDotGraph() @@ -2053,7 +2044,7 @@ void HtmlGenerator::startMemberGroupHeader(bool) void HtmlGenerator::endMemberGroupHeader() { - t << "
" << endl; + t << "
\n"; } void HtmlGenerator::startMemberGroupDocs() @@ -2063,7 +2054,7 @@ void HtmlGenerator::startMemberGroupDocs() void HtmlGenerator::endMemberGroupDocs() { - t << "
" << endl; + t << "
\n"; } void HtmlGenerator::startMemberGroup() @@ -2076,15 +2067,15 @@ void HtmlGenerator::endMemberGroup(bool) void HtmlGenerator::startIndent() { - DBG_HTML(t << "" << endl;) + DBG_HTML(t << "\n";) t << "
\n"; } void HtmlGenerator::endIndent() { - DBG_HTML(t << "" << endl;) - t << endl << "
" << endl << "
" << endl; + DBG_HTML(t << "\n";) + t << "\n
\n" << "\n"; } void HtmlGenerator::addIndexItem(const char *,const char *) @@ -2102,12 +2093,12 @@ void HtmlGenerator::writeNonBreakableSpace(int n) void HtmlGenerator::startDescTable(const char *title) { - t << "" << endl + t << "
\n" << ""; } void HtmlGenerator::endDescTable() { - t << "
" << title << "
" << endl; + t << "\n"; } void HtmlGenerator::startDescTableRow() @@ -2117,7 +2108,7 @@ void HtmlGenerator::startDescTableRow() void HtmlGenerator::endDescTableRow() { - t << "" << endl; + t << "\n"; } void HtmlGenerator::startDescTableTitle() @@ -2149,7 +2140,7 @@ void HtmlGenerator::startExamples() void HtmlGenerator::endExamples() { - t << "" << endl; + t << "\n"; } void HtmlGenerator::startParamList(ParamListTypes, @@ -2175,7 +2166,7 @@ void HtmlGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *, //---------------- helpers for index generation ----------------------------- -static void startQuickIndexList(FTextStream &t,bool compact,bool topLevel=TRUE) +static void startQuickIndexList(std::ostream &t,bool compact,bool topLevel=TRUE) { if (compact) { @@ -2195,7 +2186,7 @@ static void startQuickIndexList(FTextStream &t,bool compact,bool topLevel=TRUE) } } -static void endQuickIndexList(FTextStream &t,bool compact) +static void endQuickIndexList(std::ostream &t,bool compact) { if (compact) { @@ -2208,7 +2199,7 @@ static void endQuickIndexList(FTextStream &t,bool compact) } } -static void startQuickIndexItem(FTextStream &t,const char *l, +static void startQuickIndexItem(std::ostream &t,const char *l, bool hl,bool /*compact*/, const QCString &relPath) { @@ -2222,7 +2213,7 @@ static void startQuickIndexItem(FTextStream &t,const char *l, t << ""; } -static void endQuickIndexItem(FTextStream &t,const char *l) +static void endQuickIndexItem(std::ostream &t,const char *l) { t << ""; if (l) t << ""; @@ -2270,7 +2261,7 @@ static bool quickLinkVisible(LayoutNavEntry::Kind kind) return FALSE; } -static void renderQuickLinksAsTree(FTextStream &t,const QCString &relPath,LayoutNavEntry *root) +static void renderQuickLinksAsTree(std::ostream &t,const QCString &relPath,LayoutNavEntry *root) { int count=0; @@ -2299,7 +2290,7 @@ static void renderQuickLinksAsTree(FTextStream &t,const QCString &relPath,Layout } -static void renderQuickLinksAsTabs(FTextStream &t,const QCString &relPath, +static void renderQuickLinksAsTabs(std::ostream &t,const QCString &relPath, LayoutNavEntry *hlEntry,LayoutNavEntry::Kind kind, bool highlightParent,bool highlightSearch) { @@ -2368,7 +2359,7 @@ static void renderQuickLinksAsTabs(FTextStream &t,const QCString &relPath, } } -static void writeDefaultQuickLinks(FTextStream &t,bool compact, +static void writeDefaultQuickLinks(std::ostream &t,bool compact, HighlightedItem hli, const char *file, const QCString &relPath) @@ -2431,16 +2422,16 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact, { searchPage = "search.php"; } - t << "" << endl; - t << "" << endl; - t << "\n"; + t << "\n"; + t << "" << endl; - t << "
" << endl; + t << "\n"; + t << "
\n"; } else if (compact) // && !Config_getBool(HTML_DYNAMIC_MENUS) { @@ -2492,7 +2483,7 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact, void HtmlGenerator::endQuickIndices() { - t << "" << endl; + t << "\n"; } QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpath) @@ -2538,12 +2529,12 @@ void HtmlGenerator::writeNavigationPath(const char *s) void HtmlGenerator::startContents() { - t << "
" << endl; + t << "
\n"; } void HtmlGenerator::endContents() { - t << "
" << endl; + t << "
\n"; } void HtmlGenerator::startPageDoc(const char *pageTitle) @@ -2553,7 +2544,7 @@ void HtmlGenerator::startPageDoc(const char *pageTitle) void HtmlGenerator::endPageDoc() { - t << "" << endl; + t << "\n"; } void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const char *file) @@ -2571,10 +2562,9 @@ void HtmlGenerator::writeSearchPage() // OPENSEARCH_PROVIDER { QCString configFileName = htmlOutput+"/search_config.php"; - QFile cf(configFileName); - if (cf.open(IO_WriteOnly)) + std::ofstream t(configFileName.str(),std::ofstream::out); + if (t.is_open()) { - FTextStream t(&cf); t << " \"" << convertToHtml(projectName) << "\",\n"; @@ -2595,20 +2585,20 @@ void HtmlGenerator::writeSearchPage() t << ");\n\n"; t << "?>\n"; } + t.close(); ResourceMgr::instance().copyResource("search_functions.php",htmlOutput); ResourceMgr::instance().copyResource("search_opensearch.php",htmlOutput); // OPENSEARCH_PROVIDER } QCString fileName = htmlOutput+"/search.php"; - QFile f(fileName); - if (f.open(IO_WriteOnly)) + t.open(fileName.str(),std::ofstream::out); + if (t.is_open()) { - FTextStream t(&f); t << substituteHtmlKeywords(g_header,"Search",""); t << "" << endl; + << getDoxygenVersion() << " -->\n"; t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "
" << endl; - t << "
" << theTranslator->trLoading() << "
" << endl; - t << "
" << endl; // here the results will be inserted - t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "
\n"; + t << "
" << theTranslator->trLoading() << "
\n"; + t << "
\n"; // here the results will be inserted + t << "" << endl; + t << "\n"; t << "
" - << theTranslator->trSearching() << "
" << endl; + << theTranslator->trSearching() << "
\n"; t << "
" - << theTranslator->trNoMatches() << "
" << endl; + << theTranslator->trNoMatches() << "
\n"; - t << "" << endl; - t << "" << endl; // SRIndex - t << "" << endl; - t << "" << endl; + t << "\n"; + t << "\n"; // SRIndex + t << "\n"; + t << "\n"; } - FTextStream ti(&dataOutFile); - ti << "var searchData=" << endl; + ti << "var searchData=\n"; // format // searchData[] = array of items // searchData[x][0] = id @@ -980,7 +974,7 @@ void writeJavaScriptSearchIndex() // searchData[x][1][y+1][1] = 1 => target="_parent" // searchData[x][1][y+1][2] = scope - ti << "[" << endl; + ti << "[\n"; bool firstEntry=TRUE; int childCount=0; @@ -997,7 +991,7 @@ void writeJavaScriptSearchIndex() if (!firstEntry) { ti << "]]]"; - ti << "," << endl; + ti << ",\n"; } firstEntry=FALSE; @@ -1124,9 +1118,9 @@ void writeJavaScriptSearchIndex() } if (!firstEntry) { - ti << "]]]" << endl; + ti << "]]]\n"; } - ti << "];" << endl; + ti << "];\n"; } else { @@ -1137,18 +1131,17 @@ void writeJavaScriptSearchIndex() } { - QFile f(searchDirName+"/searchdata.js"); - if (f.open(IO_WriteOnly)) + std::ofstream t(searchDirName.str()+"/searchdata.js",std::ofstream::out); + if (t.is_open()) { - FTextStream t(&f); - t << "var indexSectionsWithContent =" << endl; - t << "{" << endl; + t << "var indexSectionsWithContent =\n"; + t << "{\n"; int j=0; for (const auto &sii : g_searchIndexInfo) { if (!sii.symbolMap.empty()) { - if (j>0) t << "," << endl; + if (j>0) t << ",\n"; t << " " << j << ": \""; for (const auto &kv : sii.symbolMap) @@ -1161,59 +1154,59 @@ void writeJavaScriptSearchIndex() } } if (j>0) t << "\n"; - t << "};" << endl << endl; - t << "var indexSectionNames =" << endl; - t << "{" << endl; + t << "};\n\n"; + t << "var indexSectionNames =\n"; + t << "{\n"; j=0; for (const auto &sii : g_searchIndexInfo) { if (!sii.symbolMap.empty()) { - if (j>0) t << "," << endl; + if (j>0) t << ",\n"; t << " " << j << ": \"" << sii.name << "\""; j++; } } if (j>0) t << "\n"; - t << "};" << endl << endl; - t << "var indexSectionLabels =" << endl; - t << "{" << endl; + t << "};\n\n"; + t << "var indexSectionLabels =\n"; + t << "{\n"; j=0; for (const auto &sii : g_searchIndexInfo) { if (!sii.symbolMap.empty()) { - if (j>0) t << "," << endl; + if (j>0) t << ",\n"; t << " " << j << ": \"" << convertToXML(sii.getText()) << "\""; j++; } } if (j>0) t << "\n"; - t << "};" << endl << endl; + t << "};\n\n"; } ResourceMgr::instance().copyResource("search.js",searchDirName); } { - QFile f(searchDirName+"/nomatches"+Doxygen::htmlFileExtension); - if (f.open(IO_WriteOnly)) + QCString noMatchesFileName =searchDirName+"/nomatches"+Doxygen::htmlFileExtension; + std::ofstream t(noMatchesFileName.str(), std::ofstream::out | std::ofstream::binary); + if (t.is_open()) { - FTextStream t(&f); t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "" << endl; - t << "
" << endl; + "\"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "\n"; + t << "
\n"; t << "
" - << theTranslator->trNoMatches() << "
" << endl; - t << "
" << endl; - t << "" << endl; - t << "" << endl; + << theTranslator->trNoMatches() << "
\n"; + t << "\n"; + t << "\n"; + t << "\n"; } } Doxygen::indexList->addStyleSheetFile("search/search.js"); diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index de30544..04c0953 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -15,12 +15,13 @@ #include #include +#include + #include "settings.h" #include "message.h" #if USE_SQLITE3 -#include "qtbc.h" #include "sqlite3gen.h" #include "doxygen.h" #include "xmlgen.h" @@ -1382,9 +1383,9 @@ QCString getSQLDocBlock(const Definition *scope, const QCString &fileName, int lineNr) { - QGString s; - if (doc.isEmpty()) return s.data(); - FTextStream t(&s); + if (doc.isEmpty()) return ""; + + std::stringstream t; DocNode *root = validatingParseDoc( fileName, lineNr, @@ -1404,8 +1405,7 @@ QCString getSQLDocBlock(const Definition *scope, root->accept(visitor); delete visitor; delete root; - QCString result = convertCharEntitiesToUTF8(s.data()); - return result.data(); + return convertCharEntitiesToUTF8(t.str().c_str()); } static void getSQLDesc(SqlStmt &s,const char *col,const char *value,const Definition *def) diff --git a/src/template.cpp b/src/template.cpp index ae55fc4..9bfeb23 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -20,10 +20,9 @@ #include #include #include +#include +#include -#include - -#include "ftextstream.h" #include "message.h" #include "util.h" #include "resourcemgr.h" @@ -1661,7 +1660,7 @@ class TemplateNode TemplateNode(TemplateNode *parent) : m_parent(parent) {} virtual ~TemplateNode() {} - virtual void render(FTextStream &ts, TemplateContext *c) = 0; + virtual void render(std::ostream &ts, TemplateContext *c) = 0; TemplateNode *parent() { return m_parent; } @@ -1691,7 +1690,7 @@ using TemplateTokenStream = std::deque< TemplateTokenPtr >; class TemplateNodeList : public std::vector< std::unique_ptr > { public: - void render(FTextStream &ts,TemplateContext *c) + void render(std::ostream &ts,TemplateContext *c) { TRACE(("{TemplateNodeList::render\n")); for (const auto &tn : *this) @@ -2279,7 +2278,7 @@ class TemplateImpl : public TemplateNode, public Template TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data, const QCString &extension); ~TemplateImpl(); - void render(FTextStream &ts, TemplateContext *c); + void render(std::ostream &ts, TemplateContext *c); TemplateEngine *engine() const { return m_engine; } TemplateBlockContext *blockContext() { return &m_blockContext; } @@ -2648,7 +2647,7 @@ class TemplateNodeText : public TemplateNode TRACE(("TemplateNodeText('%s')\n",replace(data,'\n',' ').data())); } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -2702,7 +2701,7 @@ class TemplateNodeVariable : public TemplateNode delete m_var; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -2864,7 +2863,7 @@ class TemplateNodeIf : public TemplateNodeCreator { } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -2927,7 +2926,7 @@ class TemplateNodeRepeat : public TemplateNodeCreator { delete m_expr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3039,7 +3038,7 @@ class TemplateNodeRange : public TemplateNodeCreator delete m_endExpr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3197,7 +3196,7 @@ class TemplateNodeFor : public TemplateNodeCreator delete m_expr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3299,7 +3298,7 @@ class TemplateNodeMsg : public TemplateNodeCreator parser->removeNextToken(); // skip over endmsg TRACE(("}TemplateNodeMsg()\n")); } - void render(FTextStream &, TemplateContext *c) + void render(std::ostream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3308,9 +3307,8 @@ class TemplateNodeMsg : public TemplateNodeCreator ci->setActiveEscapeIntf(0); // avoid escaping things we send to standard out bool enable = ci->spacelessEnabled(); ci->enableSpaceless(FALSE); - FTextStream ts(stdout); - m_nodes.render(ts,c); - ts << endl; + m_nodes.render(std::cout,c); + std::cout << "\n"; ci->setActiveEscapeIntf(escIntf); ci->enableSpaceless(enable); } @@ -3340,7 +3338,7 @@ class TemplateNodeBlock : public TemplateNodeCreator TRACE(("}TemplateNodeBlock(%s)\n",data.data())); } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3353,8 +3351,7 @@ class TemplateNodeBlock : public TemplateNodeCreator if (nb) // block is overruled { ci->push(); - QGString super; - FTextStream ss(&super); + std::stringstream ss; // get super block of block nb TemplateNodeBlock *sb = ci->blockContext()->get(m_blockName); if (sb && sb!=nb && sb!=this) // nb and sb both overrule this block @@ -3365,6 +3362,7 @@ class TemplateNodeBlock : public TemplateNodeCreator { m_nodes.render(ss,c); // render parent of nb to string } + QCString super = ss.str(); // add 'block.super' variable to allow access to parent block content TemplateAutoRef superBlock(TemplateStruct::alloc()); superBlock->set("super",TemplateVariant(super.data(),TRUE)); @@ -3421,7 +3419,7 @@ class TemplateNodeExtend : public TemplateNodeCreator delete m_extendExpr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3498,7 +3496,7 @@ class TemplateNodeInclude : public TemplateNodeCreator { delete m_includeExpr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3537,12 +3535,12 @@ class TemplateNodeInclude : public TemplateNodeCreator //---------------------------------------------------------- -static void stripLeadingWhiteSpace(QGString &s) +static void stripLeadingWhiteSpace(QCString &s) { const char *src = s.data(); if (src) { - char *dst = s.data(); + char *dst = s.rawData(); char c; bool skipSpaces=TRUE; while ((c=*src++)) @@ -3595,7 +3593,7 @@ class TemplateNodeCreate : public TemplateNodeCreator delete m_templateExpr; delete m_fileExpr; } - void render(FTextStream &, TemplateContext *c) + void render(std::ostream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3634,15 +3632,14 @@ class TemplateNodeCreate : public TemplateNodeCreator outputFile.prepend(ci->outputDirectory()+"/"); } //printf("NoteCreate(%s)\n",outputFile.data()); - QFile f(outputFile); - if (f.open(IO_WriteOnly)) + std::ofstream ts(outputFile.str(),std::ofstream::out | std::ofstream::binary); + if (ts.is_open()) { TemplateEscapeIntf *escIntf = ci->escapeIntf(); ci->selectEscapeIntf(extension); - FTextStream ts(&f); - QGString out; - FTextStream os(&out); + std::stringstream os; createTemplate->render(os,c); + QCString out = os.str(); stripLeadingWhiteSpace(out); ts << out; t->engine()->unload(t); @@ -3713,8 +3710,7 @@ class TemplateNodeTree : public TemplateNodeCreator TemplateContext *c = ctx->templateCtx; TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return QCString(); // should not happen - QGString result; - FTextStream ss(&result); + std::stringstream ss; c->push(); TemplateVariant node; TemplateListIntf::ConstIterator *it = ctx->list->createIterator(); @@ -3756,9 +3752,9 @@ class TemplateNodeTree : public TemplateNodeCreator } c->pop(); delete it; - return result.data(); + return ss.str(); } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { //printf("TemplateNodeTree::render()\n"); TemplateContextImpl* ci = dynamic_cast(c); @@ -3830,7 +3826,7 @@ class TemplateNodeIndexEntry : public TemplateNodeCreator(c); if (ci==0) return; // should not happen @@ -3872,7 +3868,7 @@ class TemplateNodeOpenSubIndex : public TemplateNodeCreator(c); if (ci==0) return; // should not happen @@ -3908,7 +3904,7 @@ class TemplateNodeCloseSubIndex : public TemplateNodeCreator(c); if (ci==0) return; // should not happen @@ -3969,7 +3965,7 @@ class TemplateNodeWith : public TemplateNodeCreator ~TemplateNodeWith() { } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4017,7 +4013,7 @@ class TemplateNodeCycle : public TemplateNodeCreator } TRACE(("}TemplateNodeCycle(%s)\n",data.data())); } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); ci->setLocation(m_templateName,m_line); @@ -4091,7 +4087,7 @@ class TemplateNodeSet : public TemplateNodeCreator ~TemplateNodeSet() { } - void render(FTextStream &, TemplateContext *c) + void render(std::ostream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4121,7 +4117,7 @@ class TemplateNodeSpaceless : public TemplateNodeCreator parser->removeNextToken(); // skip over endwith TRACE(("}TemplateNodeSpaceless()\n")); } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4168,7 +4164,7 @@ class TemplateNodeMarkers : public TemplateNodeCreator delete m_listExpr; delete m_patternExpr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4270,7 +4266,7 @@ class TemplateNodeTabbing : public TemplateNodeCreator parser->removeNextToken(); // skip over endtabbing TRACE(("}TemplateNodeTabbing()\n")); } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4319,7 +4315,7 @@ class TemplateNodeResource : public TemplateNodeCreator delete m_resExpr; delete m_asExpr; } - void render(FTextStream &, TemplateContext *c) + void render(std::ostream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4387,7 +4383,7 @@ class TemplateNodeEncoding : public TemplateNodeCreator { delete m_encExpr; } - void render(FTextStream &ts, TemplateContext *c) + void render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4950,7 +4946,7 @@ TemplateImpl::~TemplateImpl() //printf("deleting template %s\n",m_name.data()); } -void TemplateImpl::render(FTextStream &ts, TemplateContext *c) +void TemplateImpl::render(std::ostream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -5009,13 +5005,14 @@ class TemplateEngine::Private if (kv==m_templateCache.end()) // first time template is referenced { QCString filePath = m_templateDirName+"/"+fileName; - QFile f(filePath); - if (f.open(IO_ReadOnly)) // read template from disk + std::ifstream f(filePath.str(),std::ifstream::in | std::ifstream::binary); + if (f.is_open()) // read template from disk { FileInfo fi(filePath.str()); - int size=fi.size(); + int size=(int)fi.size(); QCString data(size+1); - if (f.readBlock(data.rawData(),size)==size) + f.read(data.rawData(),size); + if (!f.fail()) { kv = m_templateCache.insert( std::make_pair(fileName.str(), diff --git a/src/template.h b/src/template.h index c9e9041..d611ec3 100644 --- a/src/template.h +++ b/src/template.h @@ -18,8 +18,7 @@ #include #include - -class FTextStream; +#include class TemplateListIntf; class TemplateStructIntf; @@ -552,7 +551,7 @@ class Template * @param[in] c The context containing data that can be used * when instantiating the template. */ - virtual void render(FTextStream &ts,TemplateContext *c) = 0; + virtual void render(std::ostream &ts,TemplateContext *c) = 0; }; //------------------------------------------------------------------------ diff --git a/src/textdocvisitor.cpp b/src/textdocvisitor.cpp index b6c90e3..c40cbd9 100644 --- a/src/textdocvisitor.cpp +++ b/src/textdocvisitor.cpp @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -16,7 +16,6 @@ * */ -#include #include "textdocvisitor.h" #include "message.h" #include "util.h" @@ -52,7 +51,7 @@ void TextDocVisitor::visit(DocEmoji *s) } void TextDocVisitor::filter(const char *str) -{ +{ if (str==0) return; //printf("TextDocVisitor::filter(%s)\n",str); const char *p=str; diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h index e424529..1fa92cc 100644 --- a/src/textdocvisitor.h +++ b/src/textdocvisitor.h @@ -22,14 +22,12 @@ #include "docvisitor.h" #include "docparser.h" #include -#include "ftextstream.h" - /*! @brief Concrete visitor implementation for TEXT output. */ class TextDocVisitor : public DocVisitor { public: - TextDocVisitor(FTextStream &t) : DocVisitor(DocVisitor_Text), m_t(t) {} + TextDocVisitor(std::ostream &t) : DocVisitor(DocVisitor_Text), m_t(t) {} //-------------------------------------- // visitor functions for leaf nodes @@ -137,7 +135,7 @@ class TextDocVisitor : public DocVisitor void filter(const char *str); - FTextStream &m_t; + std::ostream &m_t; }; #endif diff --git a/src/util.cpp b/src/util.cpp index 3cdcdfe..b2f8e56 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -28,12 +28,10 @@ #include #include #include +#include #include "md5.h" -#include -#include - #include "regex.h" #include "util.h" #include "message.h" @@ -72,6 +70,7 @@ #include "htmlentity.h" #include "symbolresolver.h" #include "fileinfo.h" +#include "dir.h" #define ENABLE_TRACINGSUPPORT 0 @@ -1404,29 +1403,17 @@ QCString transcodeCharacterStringToUTF8(const QCString &input) QCString fileToString(const char *name,bool filter,bool isSourceCode) { if (name==0 || name[0]==0) return 0; - QFile f; - - bool fileOpened=FALSE; + bool fileOpened=false; if (name[0]=='-' && name[1]==0) // read from stdin { - fileOpened=f.open(IO_ReadOnly,stdin); - if (fileOpened) + fileOpened=true; + std::string contents; + std::string line; + while (getline(std::cin,line)) { - const int bSize=4096; - QCString contents(bSize+1); - int totalSize=0; - int size; - while ((size=f.readBlock(contents.rawData()+totalSize,bSize))==bSize) - { - totalSize+=bSize; - contents.resize(totalSize+bSize+1); - } - totalSize = filterCRLF(contents.rawData(),totalSize+size)+2; - contents.resize(totalSize); - contents.at(totalSize-2)='\n'; // to help the scanner - contents.at(totalSize-1)='\0'; - return contents; + contents+=line+'\n'; } + return contents; } else // read from file { @@ -1436,7 +1423,7 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode) err("file '%s' not found\n",name); return ""; } - BufStr buf(fi.size()); + BufStr buf((uint)fi.size()); fileOpened=readInputFile(name,buf,filter,isSourceCode); if (fileOpened) { @@ -4244,9 +4231,9 @@ QCString convertToPSString(const char *s) QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces) { - QGString result; - FTextStream t(&result); + std::stringstream t; filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces); + QCString result = t.str(); return result.data(); } @@ -4984,7 +4971,7 @@ void addGroupListToTitle(OutputList &ol,const Definition *d) recursivelyAddGroupListToTitle(ol,d,TRUE); } -void filterLatexString(FTextStream &t,const char *str, +void filterLatexString(std::ostream &t,const char *str, bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces) { if (str==0) return; @@ -5139,9 +5126,8 @@ void filterLatexString(FTextStream &t,const char *str, QCString latexEscapeLabelName(const char *s) { if (s==0) return ""; - QGString result; QCString tmp(qstrlen(s)+1); - FTextStream t(&result); + std::stringstream t; const char *p=s; char c; int i; @@ -5177,15 +5163,14 @@ QCString latexEscapeLabelName(const char *s) break; } } - return result.data(); + return t.str(); } QCString latexEscapeIndexChars(const char *s) { if (s==0) return ""; - QGString result; QCString tmp(qstrlen(s)+1); - FTextStream t(&result); + std::stringstream t; const char *p=s; char c; int i; @@ -5222,14 +5207,13 @@ QCString latexEscapeIndexChars(const char *s) break; } } - return result.data(); + return t.str(); } QCString latexEscapePDFString(const char *s) { if (s==0) return ""; - QGString result; - FTextStream t(&result); + std::stringstream t; const char *p=s; char c; while ((c=*p++)) @@ -5247,14 +5231,13 @@ QCString latexEscapePDFString(const char *s) break; } } - return result.data(); + return t.str(); } QCString latexFilterURL(const char *s) { if (s==0) return ""; - QGString result; - FTextStream t(&result); + std::stringstream t; const signed char *p=(const signed char*)s; char c; while ((c=*p++)) @@ -5277,7 +5260,7 @@ QCString latexFilterURL(const char *s) break; } } - return result.data(); + return t.str(); } static std::mutex g_rtfFormatMutex; @@ -5712,33 +5695,34 @@ bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const char return FALSE; } -const char *writeUtf8Char(FTextStream &t,const char *s) +const char *writeUtf8Char(std::ostream &t,const char *s) { + const char *p = s; uchar c=(uchar)*s++; - t << (char)c; if (c>=0x80) // multibyte character { if (((uchar)c&0xE0)==0xC0) { - t << *s++; // 11xx.xxxx: >=2 byte character + s++; // 11xx.xxxx: >=2 byte character } if (((uchar)c&0xF0)==0xE0) { - t << *s++; // 111x.xxxx: >=3 byte character + s++; // 111x.xxxx: >=3 byte character } if (((uchar)c&0xF8)==0xF0) { - t << *s++; // 1111.xxxx: >=4 byte character + s++; // 1111.xxxx: >=4 byte character } if (((uchar)c&0xFC)==0xF8) { - t << *s++; // 1111.1xxx: >=5 byte character + s++; // 1111.1xxx: >=5 byte character } if (((uchar)c&0xFE)==0xFC) { - t << *s++; // 1111.1xxx: 6 byte character + s++; // 1111.1xxx: 6 byte character } } + t.write(p,s-p); return s; } @@ -5811,10 +5795,9 @@ int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos) QCString parseCommentAsText(const Definition *scope,const MemberDef *md, const QCString &doc,const QCString &fileName,int lineNr) { - QGString s; - if (doc.isEmpty()) return s.data(); + if (doc.isEmpty()) return ""; //printf("parseCommentAsText(%s)\n",doc.data()); - FTextStream t(&s); + std::stringstream t; DocNode *root = validatingParseDoc(fileName,lineNr, (Definition*)scope,(MemberDef*)md,doc,FALSE,FALSE, 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); @@ -5822,7 +5805,7 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md, root->accept(visitor); delete visitor; delete root; - QCString result = convertCharEntitiesToUTF8(s.data()).stripWhiteSpace(); + QCString result = convertCharEntitiesToUTF8(t.str().c_str()).stripWhiteSpace(); int i=0; int charCnt=0; int l=result.length(); @@ -6235,24 +6218,23 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC { // try to open file int size=0; - //uint oldPos = dest.curPos(); - //printf(".......oldPos=%d\n",oldPos); FileInfo fi(fileName); if (!fi.exists()) return FALSE; QCString filterName = getFileFilter(fileName,isSourceCode); if (filterName.isEmpty() || !filter) { - QFile f(fileName); - if (!f.open(IO_ReadOnly)) + std::ifstream f(fileName,std::ifstream::in | std::ifstream::binary); + if (!f.is_open()) { err("could not open file %s\n",fileName); return FALSE; } - size=fi.size(); + size=(int)fi.size(); // read the file inBuf.skip(size); - if (f.readBlock(inBuf.data()/*+oldPos*/,size)!=size) + f.read(inBuf.data(),size); + if (f.fail()) { err("problems while reading file %s\n",fileName); return FALSE; @@ -6384,7 +6366,9 @@ bool patternMatch(const FileInfo &fi,const StringVector &patList) afp = QCString(afp).lower().str(); } reg::Ex re(pattern,reg::Ex::Mode::Wildcard); - found = re.isValid() && (reg::match(fn,re) || reg::match(fp,re) || reg::match(afp,re)); + found = re.isValid() && (reg::match(fn,re) || + (fn!=fp && reg::match(fp,re)) || + (fn!=afp && fp!=afp && reg::match(afp,re))); if (found) break; //printf("Matching '%s' against pattern '%s' found=%d\n", // fi->fileName().data(),pattern.data(),found); @@ -6394,49 +6378,6 @@ bool patternMatch(const FileInfo &fi,const StringVector &patList) return found; } -bool patternMatch(const QFileInfo &fi,const StringVector &patList) -{ - bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES); - bool found = FALSE; - - // For platforms where the file system is non case sensitive overrule the setting - if (!Portable::fileSystemIsCaseSensitive()) - { - caseSenseNames = FALSE; - } - - if (!patList.empty()) - { - std::string fn = fi.fileName().utf8().data(); - std::string fp = fi.filePath().utf8().data(); - std::string afp= fi.absFilePath().utf8().data(); - - for (auto pattern: patList) - { - if (!pattern.empty()) - { - size_t i=pattern.find('='); - if (i!=std::string::npos) pattern=pattern.substr(0,i); // strip of the extension specific filter name - - if (!caseSenseNames) - { - pattern = QCString(pattern).lower().str(); - fn = QCString(fn).lower().str(); - fp = QCString(fp).lower().str(); - afp = QCString(afp).lower().str(); - } - reg::Ex re(pattern,reg::Ex::Mode::Wildcard); - found = re.isValid() && (reg::match(fn,re) || reg::match(fp,re) || reg::match(afp,re)); - if (found) break; - //printf("Matching '%s' against pattern '%s' found=%d\n", - // fi->fileName().data(),pattern.data(),found); - } - } - } - return found; -} - - QCString externalLinkTarget(const bool parent) { static bool extLinksInWindow = Config_getBool(EXT_LINKS_IN_WINDOW); @@ -6486,14 +6427,9 @@ void writeColoredImgData(const char *dir,ColoredImgDataItem data[]) { QCString fileName; fileName=(QCString)dir+"/"+data->name; - QFile f(fileName); - if (f.open(IO_WriteOnly)) - { - ColoredImage img(data->width,data->height,data->content,data->alpha, - sat,hue,gamma); - img.save(fileName); - } - else + ColoredImage img(data->width,data->height,data->content,data->alpha, + sat,hue,gamma); + if (!img.save(fileName)) { fprintf(stderr,"Warning: Cannot open file %s for writing\n",data->name); } @@ -6561,31 +6497,12 @@ QCString replaceColorMarkers(const char *str) */ bool copyFile(const QCString &src,const QCString &dest) { - QFile sf(src); - if (sf.open(IO_ReadOnly)) + if (!Dir().copy(src.str(),dest.str())) { - FileInfo fi(src.str()); - QFile df(dest); - if (df.open(IO_WriteOnly)) - { - char *buffer = new char[fi.size()]; - sf.readBlock(buffer,fi.size()); - df.writeBlock(buffer,fi.size()); - df.flush(); - delete[] buffer; - } - else - { - err("could not write to file %s\n",dest.data()); - return FALSE; - } - } - else - { - err("could not open user specified file %s\n",src.data()); - return FALSE; + err("could not copy file %s to %s\n",src.data(),dest.data()); + return false; } - return TRUE; + return true; } /** Returns the section of text, in between a pair of markers. @@ -7237,13 +7154,14 @@ QCString getDotImageExtension() return i==-1 ? imgExt : imgExt.left(i); } -bool openOutputFile(const char *outFile,QFile &f) +bool openOutputFile(const char *outFile,std::ofstream &f) { bool fileOpened=FALSE; bool writeToStdout=(outFile[0]=='-' && outFile[1]=='\0'); if (writeToStdout) // write to stdout { - fileOpened = f.open(IO_WriteOnly,stdout); + f.basic_ios::rdbuf(std::cout.rdbuf()); + fileOpened = true; } else // write to file { @@ -7256,13 +7174,13 @@ bool openOutputFile(const char *outFile,QFile &f) dir.remove(backup.fileName()); dir.rename(fi.fileName(),fi.fileName()+".bak"); } - f.setName(outFile); - fileOpened = f.open(IO_WriteOnly|IO_Translate); + f.open(outFile,std::ofstream::out | std::ofstream::binary); + fileOpened = f.is_open(); } return fileOpened; } -void writeExtraLatexPackages(FTextStream &t) +void writeExtraLatexPackages(std::ostream &t) { // User-specified packages const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES); @@ -7280,7 +7198,7 @@ void writeExtraLatexPackages(FTextStream &t) } } -void writeLatexSpecialFormulaChars(FTextStream &t) +void writeLatexSpecialFormulaChars(std::ostream &t) { unsigned char minus[4]; // Superscript minus char *pminus = (char *)minus; diff --git a/src/util.h b/src/util.h index f57b827..7f5513d 100644 --- a/src/util.h +++ b/src/util.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "types.h" @@ -56,9 +57,6 @@ class SectionInfo; class Definition; class BufStr; class FileInfo; -class QFileInfo; -class FTextStream; -class QFile; //-------------------------------------------------------------------- @@ -317,7 +315,7 @@ QCString unescapeCharsInString(const char *s); void addGroupListToTitle(OutputList &ol,const Definition *d); -void filterLatexString(FTextStream &t,const char *str, +void filterLatexString(std::ostream &t,const char *str, bool insideTabbing, bool insidePre, bool insideItem, @@ -391,12 +389,11 @@ bool readInputFile(const char *fileName,BufStr &inBuf, QCString filterTitle(const std::string &title); bool patternMatch(const FileInfo &fi,const StringVector &patList); -bool patternMatch(const QFileInfo &fi,const StringVector &patList); QCString externalLinkTarget(const bool parent = false); QCString externalRef(const QCString &relPath,const QCString &ref,bool href); int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos); -const char *writeUtf8Char(FTextStream &t,const char *s); +const char *writeUtf8Char(std::ostream &t,const char *s); void writeMarkerList(OutputList &ol,const std::string &markerText,size_t numMarkers, std::function replaceFunc); @@ -456,9 +453,9 @@ void convertProtectionLevel( ); bool mainPageHasTitle(); -bool openOutputFile(const char *outFile,QFile &f); -void writeExtraLatexPackages(FTextStream &t); -void writeLatexSpecialFormulaChars(FTextStream &t); +bool openOutputFile(const char *outFile,std::ofstream &f); +void writeExtraLatexPackages(std::ostream &t); +void writeLatexSpecialFormulaChars(std::ostream &t); StringVector split(const std::string &s,const std::string &delimiter); StringVector split(const std::string &s,const reg::Ex &delimiter); diff --git a/src/vhdlcode.l b/src/vhdlcode.l index c363a23..29a8e0b 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -37,7 +37,6 @@ #include #include #include -#include #include #include "vhdlcode.h" diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 7c21e47..87dcd72 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -72,15 +72,15 @@ static void addInstance(ClassDefMutable* entity, ClassDefMutable* arch, ClassDef //---------- create svg ------------------------------------------------------------- static void createSVG(); -static void startDot(FTextStream &t); -static void startTable(FTextStream &t,const QCString &className); +static void startDot(std::ostream &t); +static void startTable(std::ostream &t,const QCString &className); static std::vector getPorts(const ClassDef *cd); -static void writeVhdlEntityToolTip(FTextStream& t,ClassDef *cd); -static void endDot(FTextStream &t); -static void writeTable(const std::vector &portList,FTextStream & t); -static void endTable(FTextStream &t); -static void writeClassToDot(FTextStream &t,ClassDef* cd); -static void writeVhdlDotLink(FTextStream &t,const QCString &a,const QCString &b,const QCString &style); +static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd); +static void endDot(std::ostream &t); +static void writeTable(const std::vector &portList,std::ostream & t); +static void endTable(std::ostream &t); +static void writeClassToDot(std::ostream &t,ClassDef* cd); +static void writeVhdlDotLink(std::ostream &t,const QCString &a,const QCString &b,const QCString &style); static const MemberDef *flowMember=0; void VhdlDocGen::setFlowMember( const MemberDef* mem) @@ -96,7 +96,7 @@ void VhdlDocGen::setFlowMember( const MemberDef* mem) //-------------------------------------------------------------------------------------------------- -static void codify(FTextStream &t,const char *str) +static void codify(std::ostream &t,const char *str) { if (str) { @@ -188,10 +188,8 @@ void VhdlDocGen::writeOverview() QCString ov =Config_getString(HTML_OUTPUT); QCString fileName=ov+"/vhdl_design.dot"; - QFile f(fileName); - FTextStream t(&f); - - if (!f.open(IO_WriteOnly)) + std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!t.is_open()) { err("Warning: Cannot open file %s for writing\n",fileName.data()); return; @@ -233,13 +231,13 @@ void VhdlDocGen::writeOverview() endDot(t); // writePortLinks(t); - f.close(); + t.close(); createSVG(); } //------------------------------------------------------------------------------------------------------------------------------------------------------ -static void startDot(FTextStream &t) +static void startDot(std::ostream &t) { t << " digraph G { \n"; t << "rankdir=LR \n"; @@ -247,18 +245,18 @@ static void startDot(FTextStream &t) t << "stylesheet=\"doxygen.css\"\n"; } -static void endDot(FTextStream &t) +static void endDot(std::ostream &t) { t <<" } \n"; } -static void startTable(FTextStream &t,const QCString &className) +static void startTable(std::ostream &t,const QCString &className) { t << className <<" [ shape=none , fontname=\"arial\", fontcolor=\"blue\" , \n"; t << "label=<\n"; } -static void writeVhdlDotLink(FTextStream &t, +static void writeVhdlDotLink(std::ostream &t, const QCString &a,const QCString &b,const QCString &style) { t << a << "->" << b; @@ -288,7 +286,7 @@ static QCString formatBriefNote(const QCString &brief,ClassDef * cd) return vForm; } -static void writeVhdlEntityToolTip(FTextStream& t,ClassDef *cd) +static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd) { QCString brief=cd->briefDescription(); @@ -309,7 +307,7 @@ static void writeVhdlEntityToolTip(FTextStream& t,ClassDef *cd) writeVhdlDotLink(t,dotn,node,"dotted"); } -static void writeColumn(FTextStream &t,const MemberDef *md,bool start) +static void writeColumn(std::ostream &t,const MemberDef *md,bool start) { QCString toolTip; @@ -392,13 +390,13 @@ static void writeColumn(FTextStream &t,const MemberDef *md,bool start) } } -static void endTable(FTextStream &t) +static void endTable(std::ostream &t) { t << "
>\n"; t << "] \n"; } -static void writeClassToDot(FTextStream &t,ClassDef* cd) +static void writeClassToDot(std::ostream &t,ClassDef* cd) { t << " getPorts(const ClassDef *cd) return portList; } -//writeColumn(FTextStream &t,QCString name,bool start) +//writeColumn(std::ostream &t,QCString name,bool start) -static void writeTable(const std::vector &portList,FTextStream & t) +static void writeTable(const std::vector &portList,std::ostream & t) { std::vector inPorts; std::vector outPorts; @@ -1691,7 +1689,7 @@ bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit return hasParams; } -void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,FTextStream &tagFile) +void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,std::ostream &tagFile) { tagFile << " " << endl; - tagFile << " " << convertToXML(mdef->typeString()) << "" << endl; - tagFile << " " << convertToXML(mdef->name()) << "" << endl; - tagFile << " " << convertToXML(mdef->getOutputFileBase()) << Doxygen::htmlFileExtension << "" << endl; - tagFile << " " << convertToXML(mdef->anchor()) << "" << endl; + tagFile << "\">\n"; + tagFile << " " << convertToXML(mdef->typeString()) << "\n"; + tagFile << " " << convertToXML(mdef->name()) << "\n"; + tagFile << " " << convertToXML(mdef->getOutputFileBase()) << Doxygen::htmlFileExtension << "\n"; + tagFile << " " << convertToXML(mdef->anchor()) << "\n"; if (VhdlDocGen::isVhdlFunction(mdef)) - tagFile << " " << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),TRUE)) << "" << endl; + tagFile << " " << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),TRUE)) << "\n"; else if (VhdlDocGen::isProcedure(mdef)) - tagFile << " " << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),FALSE)) << "" << endl; + tagFile << " " << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),FALSE)) << "\n"; else - tagFile << " " << convertToXML(mdef->argsString()) << "" << endl; + tagFile << " " << convertToXML(mdef->argsString()) << "\n"; mdef->writeDocAnchorsToTagFile(tagFile); - tagFile << " " << endl; + tagFile << " \n"; } /* writes a vhdl type declaration */ @@ -3051,7 +3049,7 @@ void FlowChart::delFlowList() flowList.clear(); } -void FlowChart::alignCommentNode(FTextStream &t,QCString com) +void FlowChart::alignCommentNode(std::ostream &t,QCString com) { uint max=0; QCString s; @@ -3087,7 +3085,7 @@ void FlowChart::alignCommentNode(FTextStream &t,QCString com) } -void FlowChart::buildCommentNodes(FTextStream & t) +void FlowChart::buildCommentNodes(std::ostream & t) { size_t size=flowList.size(); bool begin=false; @@ -3172,7 +3170,7 @@ void FlowChart::buildCommentNodes(FTextStream & t) }// for; } -void FlowChart::codify(FTextStream &t,const char *str) +void FlowChart::codify(std::ostream &t,const char *str) { if (str) { @@ -3398,7 +3396,7 @@ void FlowChart::createSVG() } } -void FlowChart::startDot(FTextStream &t) +void FlowChart::startDot(std::ostream &t) { t << " digraph G { \n"; t << "rankdir=TB \n"; @@ -3406,7 +3404,7 @@ void FlowChart::startDot(FTextStream &t) t << "stylesheet=\"doxygen.css\"\n"; } -void FlowChart::endDot(FTextStream &t) +void FlowChart::endDot(std::ostream &t) { t << " } \n"; } @@ -3417,10 +3415,8 @@ void FlowChart::writeFlowChart() QCString ov = Config_getString(HTML_OUTPUT); QCString fileName = ov+"/flow_design.dot"; - QFile f(fileName); - FTextStream t(&f); - - if (!f.open(IO_WriteOnly)) + std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!t.is_open()) { err("Cannot open file %s for writing\n",fileName.data()); return; @@ -3437,7 +3433,7 @@ void FlowChart::writeFlowChart() { printUmlTree(); delFlowList(); - f.close(); + t.close(); return; } @@ -3451,11 +3447,11 @@ void FlowChart::writeFlowChart() FlowChart::endDot(t); delFlowList(); - f.close(); + t.close(); FlowChart::createSVG(); }// writeFlowChart -void FlowChart::writeShape(FTextStream &t,const FlowChart &fl) +void FlowChart::writeShape(std::ostream &t,const FlowChart &fl) { if (fl.type & EEND) return; QCString var; @@ -3557,7 +3553,7 @@ void FlowChart::writeShape(FTextStream &t,const FlowChart &fl) } -void FlowChart::writeEdge(FTextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) +void FlowChart::writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) { bool b=fl_from.type & STARTL; bool c=fl_to.type & STARTL; @@ -3575,7 +3571,7 @@ void FlowChart::writeEdge(FTextStream &t,const FlowChart &fl_from,const FlowChar writeEdge(t,fl_from.id,fl_to.id,i,b,c); } -void FlowChart::writeEdge(FTextStream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) +void FlowChart::writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) { QCString label,col; @@ -3767,7 +3763,7 @@ size_t FlowChart::getNextIfLink(const FlowChart &fl,size_t index) return getNextNode(endifNode,stamp); } -void FlowChart::writeFlowLinks(FTextStream &t) +void FlowChart::writeFlowLinks(std::ostream &t) { size_t size=flowList.size(); if (size<2) return; diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index 3a55b45..04a8489 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -31,7 +31,6 @@ class ClassDef; class MemberList; class MemberDef; class MemberDefMutable; -class FTextStream; class OutputList; class Definition; class GroupDef; @@ -142,7 +141,7 @@ class VhdlDocGen static QCString getClassTitle(const ClassDef*); static void writeInlineClassLink(const ClassDef*, OutputList &ol); - static void writeTagFile(MemberDefMutable *mdef,FTextStream &tagFile); + static void writeTagFile(MemberDefMutable *mdef,std::ostream &tagFile); static bool isConstraint(const MemberDef *mdef); static bool isConfig(const MemberDef *mdef); @@ -229,7 +228,7 @@ class VhdlDocGen // flowcharts static void createFlowChart(const MemberDef*); - //static void addFlowImage(const FTextStream &,const QCString &); + //static void addFlowImage(const std::ostream &,const QCString &); static void setFlowMember( const MemberDef *flowMember); static const MemberDef *getFlowMember(); @@ -289,13 +288,13 @@ class FlowChart //---------- create svg ------------------------------------------------------------- static void createSVG(); - static void startDot(FTextStream &t); - static void endDot(FTextStream &t); - static void codify(FTextStream &t,const char *str); - static void writeShape(FTextStream &t,const FlowChart &fl); - static void writeEdge(FTextStream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE); - static void writeEdge(FTextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i); - static void writeFlowLinks(FTextStream &t); + static void startDot(std::ostream &t); + static void endDot(std::ostream &t); + static void codify(std::ostream &t,const char *str); + static void writeShape(std::ostream &t,const FlowChart &fl); + static void writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE); + static void writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i); + static void writeFlowLinks(std::ostream &t); static QCString getNodeName(int n); static void colTextNodes(); @@ -318,8 +317,8 @@ class FlowChart static QCString convertNameToFileName(); static void printNode(const FlowChart& n); static void printFlowTree(); - static void buildCommentNodes(FTextStream &t); - static void alignCommentNode(FTextStream &t,QCString com); + static void buildCommentNodes(std::ostream &t); + static void alignCommentNode(std::ostream &t,QCString com); static void printUmlTree(); static QCString printPlantUmlNode(const FlowChart &flo,bool,bool); diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index 6942aa0..249842e 100755 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -12,7 +12,6 @@ #include #include -#include #include "types.h" #include "entry.h" #include "vhdldocgen.h" diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 7387a78..a356682 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -35,7 +35,7 @@ static void visitCaption(XmlDocVisitor *parent, const DocNodeList &children) for (const auto &n : children) n->accept(parent); } -static void visitPreStart(FTextStream &t, const char *cmd, bool doCaption, +static void visitPreStart(std::ostream &t, const char *cmd, bool doCaption, XmlDocVisitor *parent, const DocNodeList &children, const QCString &name, bool writeType, DocImage::Type type, const QCString &width, const QCString &height, const QCString &alt = QCString(""), bool inlineImage = FALSE) @@ -82,12 +82,12 @@ static void visitPreStart(FTextStream &t, const char *cmd, bool doCaption, t << ">"; } -static void visitPostEnd(FTextStream &t, const char *cmd) +static void visitPostEnd(std::ostream &t, const char *cmd) { - t << "" << endl; + t << "\n"; } -XmlDocVisitor::XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt) +XmlDocVisitor::XmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt) : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_langExt(langExt) { @@ -499,7 +499,7 @@ void XmlDocVisitor::visit(DocIncOperator *op) } else { - if (!m_hide) m_t << endl; + if (!m_hide) m_t << "\n"; } } @@ -590,7 +590,7 @@ void XmlDocVisitor::visitPre(DocPara *) void XmlDocVisitor::visitPost(DocPara *) { if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void XmlDocVisitor::visitPre(DocRoot *) @@ -695,10 +695,10 @@ void XmlDocVisitor::visitPre(DocSection *s) if (m_hide) return; m_t << "level() << " id=\"" << s->file(); if (!s->anchor().isEmpty()) m_t << "_1" << s->anchor(); - m_t << "\">" << endl; + m_t << "\">\n"; m_t << ""; filter(convertCharEntitiesToUTF8(s->title())); - m_t << "" << endl; + m_t << "\n"; } void XmlDocVisitor::visitPost(DocSection *s) @@ -883,7 +883,7 @@ void XmlDocVisitor::visitPre(DocInternal *) void XmlDocVisitor::visitPost(DocInternal *) { if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void XmlDocVisitor::visitPre(DocHRef *href) @@ -937,19 +937,7 @@ void XmlDocVisitor::visitPre(DocImage *img) bool ambig; if (url.isEmpty() && (fd=findFileDef(Doxygen::imageNameLinkedMap,img->name(),ambig))) { - QFile inImage(fd->absFilePath()); - QFile outImage(Config_getString(XML_OUTPUT)+"/"+baseName.data()); - if (inImage.open(IO_ReadOnly)) - { - if (outImage.open(IO_WriteOnly)) - { - char *buffer = new char[inImage.size()]; - inImage.readBlock(buffer,inImage.size()); - outImage.writeBlock(buffer,inImage.size()); - outImage.flush(); - delete[] buffer; - } - } + copyFile(fd->absFilePath(),Config_getString(XML_OUTPUT)+"/"+baseName.data()); } } @@ -1033,19 +1021,19 @@ void XmlDocVisitor::visitPre(DocSecRefItem *ref) void XmlDocVisitor::visitPost(DocSecRefItem *) { if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void XmlDocVisitor::visitPre(DocSecRefList *) { if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } void XmlDocVisitor::visitPost(DocSecRefList *) { if (m_hide) return; - m_t << "" << endl; + m_t << "\n"; } //void XmlDocVisitor::visitPre(DocLanguage *l) @@ -1057,7 +1045,7 @@ void XmlDocVisitor::visitPost(DocSecRefList *) //void XmlDocVisitor::visitPost(DocLanguage *) //{ // if (m_hide) return; -// m_t << "" << endl; +// m_t << "\n"; //} void XmlDocVisitor::visitPre(DocParamSect *s) @@ -1083,14 +1071,14 @@ void XmlDocVisitor::visitPre(DocParamSect *s) void XmlDocVisitor::visitPost(DocParamSect *) { if (m_hide) return; - m_t << "
" << endl; + m_t << "\n"; } void XmlDocVisitor::visitPre(DocParamList *pl) { if (m_hide) return; - m_t << "" << endl; - m_t << "" << endl; + m_t << "\n"; + m_t << "\n"; for (const auto ¶m : pl->parameters()) { if (!pl->paramTypes().empty()) @@ -1108,11 +1096,11 @@ void XmlDocVisitor::visitPre(DocParamList *pl) } else if (type->kind()==DocNode::Kind_Sep) { - m_t << "" << endl; + m_t << "\n"; m_t << ""; } } - m_t << "" << endl; + m_t << "\n"; } m_t << "direction()!=DocParamSect::Unspecified) @@ -1141,17 +1129,17 @@ void XmlDocVisitor::visitPre(DocParamList *pl) { visit((DocLinkedWord*)param.get()); } - m_t << "" << endl; + m_t << "\n"; } - m_t << "" << endl; - m_t << "" << endl; + m_t << "\n"; + m_t << "\n"; } void XmlDocVisitor::visitPost(DocParamList *) { if (m_hide) return; - m_t << "" << endl; - m_t << "" << endl; + m_t << "\n"; + m_t << "\n"; } void XmlDocVisitor::visitPre(DocXRefItem *x) diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 60270b8..66d0dd4 100644 --- a/src/xmldocvisitor.h +++ b/src/xmldocvisitor.h @@ -21,8 +21,8 @@ #include "docvisitor.h" #include +#include -class FTextStream; class CodeOutputInterface; class QCString; @@ -30,7 +30,7 @@ class QCString; class XmlDocVisitor : public DocVisitor { public: - XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,const char *langExt); + XmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -153,7 +153,7 @@ class XmlDocVisitor : public DocVisitor // state variables //-------------------------------------- - FTextStream &m_t; + std::ostream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index a4881af..512405c 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -15,8 +15,6 @@ #include -#include - #include "xmlgen.h" #include "doxygen.h" #include "message.h" @@ -107,12 +105,12 @@ static const char *xmlSectionMapper(MemberListType ml) } -inline void writeXMLString(FTextStream &t,const char *s) +inline void writeXMLString(std::ostream &t,const char *s) { t << convertToXML(s); } -inline void writeXMLCodeString(FTextStream &t,const char *s, int &col) +inline void writeXMLCodeString(std::ostream &t,const char *s, int &col) { char c; while ((c=*s++)) @@ -146,28 +144,26 @@ inline void writeXMLCodeString(FTextStream &t,const char *s, int &col) } -static void writeXMLHeader(FTextStream &t) +static void writeXMLHeader(std::ostream &t) { - t << "" << endl;; + t << "\n";; t << "trISOLang() << "\""; - t << ">" << endl; + t << ">\n"; } static void writeCombineScript() { QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/combine.xslt"; - QFile f(fileName); - if (!f.open(IO_WriteOnly)) + std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!t.is_open()) { err("Cannot open file %s for writing!\n",fileName.data()); return; } - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); t << "")!=-1) { - FTextStream t(&f); HtmlEntityMapper::instance()->writeXMLSchema(t); } else { - f.writeBlock(startLine,len); + t.write(startLine,len); } } startLine=endLine; } - f.close(); + t.close(); fileName=outputDirectory+"/index.xml"; - f.setName(fileName); - if (!f.open(IO_WriteOnly)) + t.open(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!t.is_open()) { err("Cannot open file %s for writing!\n",fileName.data()); return; } - FTextStream t(&f); - //t.setEncoding(FTextStream::UnicodeUTF8); + //t.setEncoding(std::ostream::UnicodeUTF8); // write index header - t << "" << endl;; + t << "\n";; t << "trISOLang() << "\""; - t << ">" << endl; + t << ">\n"; for (const auto &cd : *Doxygen::classLinkedMap) { @@ -1935,8 +1917,8 @@ void generateXML() generateXMLForPage(Doxygen::mainPage.get(),t,FALSE); } - //t << " " << endl; - t << "" << endl; + //t << " \n"; + t << "\n"; writeCombineScript(); } diff --git a/src/xmlgen.h b/src/xmlgen.h index 27bb10b..58f9a64 100644 --- a/src/xmlgen.h +++ b/src/xmlgen.h @@ -19,7 +19,7 @@ class XMLCodeGenerator : public CodeOutputInterface { public: - XMLCodeGenerator(FTextStream &t) : m_t(t), m_lineNumber(-1), m_isMemberRef(FALSE), m_col(0), + XMLCodeGenerator(std::ostream &t) : m_t(t), m_lineNumber(-1), m_isMemberRef(FALSE), m_col(0), m_insideCodeLine(FALSE), m_normalHLNeedStartTag(TRUE), m_insideSpecialHL(FALSE) {} virtual ~XMLCodeGenerator() { } @@ -45,7 +45,7 @@ class XMLCodeGenerator : public CodeOutputInterface void finish(); private: - FTextStream &m_t; + std::ostream &m_t; QCString m_refId; QCString m_external; int m_lineNumber; diff --git a/templates/latex/tabu_doxygen.sty b/templates/latex/tabu_doxygen.sty index 60fd7e8..3f17d1d 100755 --- a/templates/latex/tabu_doxygen.sty +++ b/templates/latex/tabu_doxygen.sty @@ -1,2557 +1,2557 @@ -%% -%% This is file `tabu.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% tabu.dtx (with options: `package') -%% -%% This is a generated file. -%% Copyright (FC) 2010-2011 - lppl -%% -%% tabu : 2011/02/26 v2.8 - tabu : Flexible LaTeX tabulars -%% -%% ********************************************************************************************** -%% \begin{tabu} { preamble } => default target: \linewidth or \linegoal -%% \begin{tabu} to { preamble } => target specified -%% \begin{tabu} spread { preamble } => target relative to the ``natural width'' -%% -%% tabu works in text and in math modes. -%% -%% X columns: automatic width adjustment + horizontal and vertical alignment -%% \begin{tabu} { X[4c] X[1c] X[-2ml] } -%% -%% Horizontal lines and / or leaders: -%% \hline\hline => double horizontal line -%% \firsthline\hline => for nested tabulars -%% \lasthline\hline => for nested tabulars -%% \tabucline[line spec]{column-column} => ``funny'' lines (dash/leader) -%% Automatic lines / leaders : -%% \everyrow{\hline\hline} -%% -%% Vertical lines and / or leaders: -%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt blue] } -%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt on 2pt off 4pt blue] } -%% -%% Fixed vertical spacing adjustment: -%% \extrarowheight= \extrarowdepth= -%% or: \extrarowsep= => may be prefixed by \global -%% -%% Dynamic vertical spacing adjustment: -%% \abovetabulinesep= \belowtabulinesep= -%% or: \tabulinesep= => may be prefixed by \global -%% -%% delarray.sty shortcuts: in math and text modes -%% \begin{tabu} .... \({ preamble }\) -%% -%% Algorithms reports: -%% \tracingtabu=1 \tracingtabu=2 -%% -%% ********************************************************************************************** -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either -%% version 1.3 of this license or (at your option) any later -%% version. The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% -%% This work consists of the main source file tabu.dtx -%% and the derived files -%% tabu.sty, tabu.pdf, tabu.ins -%% -%% tabu : Flexible LaTeX tabulars -%% lppl copyright 2010-2011 by FC -%% - -\NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{tabu_doxygen}[2011/02/26 v2.8 - flexible LaTeX tabulars (FC), frozen version for doxygen] -\RequirePackage{array}[2008/09/09] -\RequirePackage{varwidth}[2009/03/30] -\AtEndOfPackage{\tabu@AtEnd \let\tabu@AtEnd \@undefined} -\let\tabu@AtEnd\@empty -\def\TMP@EnsureCode#1={% - \edef\tabu@AtEnd{\tabu@AtEnd - \catcode#1 \the\catcode#1}% - \catcode#1=% -}% \TMP@EnsureCode -\TMP@EnsureCode 33 = 12 % ! -\TMP@EnsureCode 58 = 12 % : (for siunitx) -\TMP@EnsureCode124 = 12 % | -\TMP@EnsureCode 36 = 3 % $ = math shift -\TMP@EnsureCode 38 = 4 % & = tab alignment character -\TMP@EnsureCode 32 = 10 % space -\TMP@EnsureCode 94 = 7 % ^ -\TMP@EnsureCode 95 = 8 % _ -%% Constants -------------------------------------------------------- -\newcount \c@taburow \def\thetaburow {\number\c@taburow} -\newcount \tabu@nbcols -\newcount \tabu@cnt -\newcount \tabu@Xcol -\let\tabu@start \@tempcnta -\let\tabu@stop \@tempcntb -\newcount \tabu@alloc \tabu@alloc=\m@ne -\newcount \tabu@nested -\def\tabu@alloc@{\global\advance\tabu@alloc \@ne \tabu@nested\tabu@alloc} -\newdimen \tabu@target -\newdimen \tabu@spreadtarget -\newdimen \tabu@naturalX -\newdimen \tabucolX -\let\tabu@DELTA \@tempdimc -\let\tabu@thick \@tempdima -\let\tabu@on \@tempdimb -\let\tabu@off \@tempdimc -\newdimen \tabu@Xsum -\newdimen \extrarowdepth -\newdimen \abovetabulinesep -\newdimen \belowtabulinesep -\newdimen \tabustrutrule \tabustrutrule \z@ -\newtoks \tabu@thebody -\newtoks \tabu@footnotes -\newsavebox \tabu@box -\newsavebox \tabu@arstrutbox -\newsavebox \tabu@hleads -\newsavebox \tabu@vleads -\newif \iftabu@colortbl -\newif \iftabu@siunitx -\newif \iftabu@measuring -\newif \iftabu@spread -\newif \iftabu@negcoef -\newif \iftabu@everyrow -\def\tabu@everyrowtrue {\global\let\iftabu@everyrow \iftrue} -\def\tabu@everyrowfalse{\global\let\iftabu@everyrow \iffalse} -\newif \iftabu@long -\newif \iftabuscantokens -\def\tabu@rescan {\tabu@verbatim \scantokens } -%% Utilities (for internal usage) ----------------------------------- -\def\tabu@gobblespace #1 {#1} -\def\tabu@gobbletoken #1#2{#1} -\def\tabu@gobbleX{\futurelet\@let@token \tabu@gobblex} -\def\tabu@gobblex{\if ^^J\noexpand\@let@token \expandafter\@gobble - \else\ifx \@sptoken\@let@token - \expandafter\tabu@gobblespace\expandafter\tabu@gobbleX - \fi\fi -}% \tabu@gobblex -\def\tabu@X{^^J} -{\obeyspaces -\global\let\tabu@spxiii= % saves an active space (for \ifx) -\gdef\tabu@@spxiii{ }} -\def\tabu@ifenvir {% only for \multicolumn - \expandafter\tabu@if@nvir\csname\@currenvir\endcsname -}% \tabu@ifenvir -\def\tabu@if@nvir #1{\csname @\ifx\tabu#1first\else - \ifx\longtabu#1first\else - second\fi\fi oftwo\endcsname -}% \tabu@ifenvir -\def\tabu@modulo #1#2{\numexpr\ifnum\numexpr#1=\z@ 0\else #1-(#1-(#2-1)/2)/(#2)*(#2)\fi} -{\catcode`\&=3 -\gdef\tabu@strtrim #1{% #1 = control sequence to trim - \ifodd 1\ifx #1\@empty \else \ifx #1\space \else 0\fi \fi - \let\tabu@c@l@r \@empty \let#1\@empty - \else \expandafter \tabu@trimspaces #1\@nnil - \fi -}% \tabu@strtrim -\gdef\tabu@trimspaces #1\@nnil{\let\tabu@c@l@r=#2\tabu@firstspace .#1& }% -\gdef\tabu@firstspace #1#2#3 &{\tabu@lastspace #2#3&} -\gdef\tabu@lastspace #1{\def #3{#1}% - \ifx #3\tabu@c@l@r \def\tabu@c@l@r{\protect\color{#1}}\expandafter\remove@to@nnil \fi - \tabu@trimspaces #1\@nnil} -}% \catcode -\def\tabu@sanitizearg #1#2{{% - \csname \ifcsname if@safe@actives\endcsname % - @safe@activestrue\else - relax\fi \endcsname - \edef#2{#1}\tabu@strtrim#2\@onelevel@sanitize#2% - \expandafter}\expandafter\def\expandafter#2\expandafter{#2}% -}% \tabu@sanitizearg -\def\tabu@textbar #1{\begingroup \endlinechar\m@ne \scantokens{\def\:{|}}% - \expandafter\endgroup \expandafter#1\:% !!! semi simple group !!! -}% \tabu@textbar -\def\tabu@everyrow@bgroup{\iftabu@everyrow \begingroup \else \noalign{\ifnum0=`}\fi \fi} -\def\tabu@everyrow@egroup{% - \iftabu@everyrow \expandafter \endgroup \the\toks@ - \else \ifnum0=`{\fi}% - \fi -}% \tabu@everyrow@egroup -\def\tabu@arstrut {\global\setbox\@arstrutbox \hbox{\vrule - height \arraystretch \dimexpr\ht\strutbox+\extrarowheight - depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth - width \z@}% -}% \tabu@arstrut -\def\tabu@rearstrut {% - \@tempdima \arraystretch\dimexpr\ht\strutbox+\extrarowheight \relax - \@tempdimb \arraystretch\dimexpr\dp\strutbox+\extrarowdepth \relax - \ifodd 1\ifdim \ht\@arstrutbox=\@tempdima - \ifdim \dp\@arstrutbox=\@tempdimb 0 \fi\fi - \tabu@mkarstrut - \fi -}% \tabu@rearstrut -\def\tabu@@DBG #1{\ifdim\tabustrutrule>\z@ \color{#1}\fi} -\def\tabu@DBG@arstrut {\global\setbox\@arstrutbox - \hbox to\z@{\hbox to\z@{\hss - {\tabu@DBG{cyan}\vrule - height \arraystretch \dimexpr\ht\strutbox+\extrarowheight - depth \z@ - width \tabustrutrule}\kern-\tabustrutrule - {\tabu@DBG{pink}\vrule - height \z@ - depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth - width \tabustrutrule}}}% -}% \tabu@DBG@arstrut -\def\tabu@save@decl{\toks\count@ \expandafter{\the\toks\expandafter\count@ - \@nextchar}}% -\def\tabu@savedecl{\ifcat$\d@llarend\else - \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode -}% \tabu@savedecl -\def\tabu@finalstrut #1{\unskip\ifhmode\nobreak\fi\vrule height\z@ depth\z@ width\z@} -\newcommand*\tabuDisableCommands {\g@addto@macro\tabu@trialh@@k } -\let\tabu@trialh@@k \@empty -\def\tabu@nowrite #1#{{\afterassignment}\toks@} -\let\tabu@write\write -\let\tabu@immediate\immediate -\def\tabu@WRITE{\begingroup - \def\immediate\write{\aftergroup\endgroup - \tabu@immediate\tabu@write}% -}% \tabu@WRITE -\expandafter\def\expandafter\tabu@GenericError\expandafter{% - \expandafter\tabu@WRITE\GenericError} -\def\tabu@warn{\tabu@WRITE\PackageWarning{tabu}} -\def\tabu@noxfootnote [#1]{\@gobble} -\def\tabu@nocolor #1#{\@gobble} -\newcommand*\tabu@norowcolor[2][]{} -\def\tabu@maybesiunitx #1{\def\tabu@temp{#1}% - \futurelet\@let@token \tabu@m@ybesiunitx} -\def\tabu@m@ybesiunitx #1{\def\tabu@m@ybesiunitx {% - \ifx #1\@let@token \let\tabu@cellleft \@empty \let\tabu@cellright \@empty \fi - \tabu@temp}% \tabu@m@ybesiunitx -}\expandafter\tabu@m@ybesiunitx \csname siunitx_table_collect_begin:Nn\endcsname -\def\tabu@celllalign@def #1{\def\tabu@celllalign{\tabu@maybesiunitx{#1}}}% -%% Fixed vertical spacing adjustment: \extrarowsep ------------------ -\newcommand*\extrarowsep{\edef\tabu@C@extra{\the\numexpr\tabu@C@extra+1}% - \iftabu@everyrow \aftergroup\tabu@Gextra - \else \aftergroup\tabu@n@Gextra - \fi - \@ifnextchar={\tabu@gobbletoken\tabu@extra} \tabu@extra -}% \extrarowsep -\def\tabu@extra {\@ifnextchar_% - {\tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}} - {\ifx ^\@let@token \def\tabu@temp{% - \tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}}% - \else \let\tabu@temp \@empty - \afterassignment \tabu@setextrasep \extrarowdepth - \fi \tabu@temp}% -}% \tabu@extra -\def\tabu@setextra #1#2{\def\tabu@temp{\tabu@extr@#1#2}\afterassignment\tabu@temp#2} -\def\tabu@extr@ #1#2{\@ifnextchar^% - {\tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}} - {\ifx _\@let@token \def\tabu@temp{% - \tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}}% - \else \let\tabu@temp \@empty - \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth - \fi \tabu@temp}% -}% \tabu@extr@ -\def\tabu@setextrasep {\extrarowheight=\extrarowdepth - \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth -}% \tabu@setextrasep -\def\tabu@Gextra{\ifx \tabu@G@extra\@empty \else {\tabu@Rextra}\fi} -\def\tabu@n@Gextra{\ifx \tabu@G@extra\@empty \else \noalign{\tabu@Rextra}\fi} -\def\tabu@Rextra{\tabu@Grestore \tabu@G@extra \tabu@C@extra} -\let\tabu@C@extra \z@ -\let\tabu@G@extra \@empty -%% Dynamic vertical spacing adjustment: \tabulinesep ---------------- -\newcommand*\tabulinesep{\edef\tabu@C@linesep{\the\numexpr\tabu@C@linesep+1}% - \iftabu@everyrow \aftergroup\tabu@Glinesep - \else \aftergroup\tabu@n@Glinesep - \fi - \@ifnextchar={\tabu@gobbletoken\tabu@linesep} \tabu@linesep -}% \tabulinesep -\def\tabu@linesep {\@ifnextchar_% - {\tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}} - {\ifx ^\@let@token \def\tabu@temp{% - \tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}}% - \else \let\tabu@temp \@empty - \afterassignment \tabu@setlinesep \abovetabulinesep - \fi \tabu@temp}% -}% \tabu@linesep -\def\tabu@setsep #1#2{\def\tabu@temp{\tabu@sets@p#1#2}\afterassignment\tabu@temp#2} -\def\tabu@sets@p #1#2{\@ifnextchar^% - {\tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}} - {\ifx _\@let@token \def\tabu@temp{% - \tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}}% - \else \let\tabu@temp \@empty - \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep - \fi \tabu@temp}% -}% \tabu@sets@p -\def\tabu@setlinesep {\belowtabulinesep=\abovetabulinesep - \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep -}% \tabu@setlinesep -\def\tabu@Glinesep{\ifx \tabu@G@linesep\@empty \else {\tabu@Rlinesep}\fi} -\def\tabu@n@Glinesep{\ifx \tabu@G@linesep\@empty \else \noalign{\tabu@Rlinesep}\fi} -\def\tabu@Rlinesep{\tabu@Grestore \tabu@G@linesep \tabu@C@linesep} -\let\tabu@C@linesep \z@ -\let\tabu@G@linesep \@empty -%% \global\extrarowsep and \global\tabulinesep ------------------- -\def\tabu@Gsave #1#2#3#4{\xdef#1{#1% - \toks#2{\toks\the\currentgrouplevel{\global#3\the#3\global#4\the#4}}}% -}% \tabu@Gsave -\def\tabu@Grestore#1#2{% - \toks#2{}#1\toks\currentgrouplevel\expandafter{\expandafter}\the\toks#2\relax - \ifcat$\the\toks\currentgrouplevel$\else - \global\let#1\@empty \global\let#2\z@ - \the\toks\currentgrouplevel - \fi -}% \tabu@Grestore -%% Setting code for every row --------------------------------------- -\newcommand*\everyrow{\tabu@everyrow@bgroup - \tabu@start \z@ \tabu@stop \z@ \tabu@evrstartstop -}% \everyrow -\def\tabu@evrstartstop {\@ifnextchar^% - {\afterassignment \tabu@evrstartstop \tabu@stop=}% - {\ifx ^\@let@token - \afterassignment\tabu@evrstartstop \tabu@start=% - \else \afterassignment\tabu@everyr@w \toks@ - \fi}% -}% \tabu@evrstartstop -\def\tabu@everyr@w {% - \xdef\tabu@everyrow{% - \noexpand\tabu@everyrowfalse - \let\noalign \relax - \noexpand\tabu@rowfontreset - \iftabu@colortbl \noexpand\tabu@rc@ \fi % \taburowcolors - \let\noexpand\tabu@docline \noexpand\tabu@docline@evr - \the\toks@ - \noexpand\tabu@evrh@@k - \noexpand\tabu@rearstrut - \global\advance\c@taburow \@ne}% - \iftabu@everyrow \toks@\expandafter - {\expandafter\def\expandafter\tabu@evr@L\expandafter{\the\toks@}\ignorespaces}% - \else \xdef\tabu@evr@G{\the\toks@}% - \fi - \tabu@everyrow@egroup -}% \tabu@everyr@w -\def\tabu@evr {\def\tabu@evrh@@k} % for internal use only -\tabu@evr{} -%% line style and leaders ------------------------------------------- -\newcommand*\newtabulinestyle [1]{% - {\@for \@tempa :=#1\do{\expandafter\tabu@newlinestyle \@tempa==\@nil}}% -}% \newtabulinestyle -\def\tabu@newlinestyle #1=#2=#3\@nil{\tabu@getline {#2}% - \tabu@sanitizearg {#1}\@tempa - \ifodd 1\ifx \@tempa\@empty \ifdefined\tabu@linestyle@ 0 \fi\fi - \global\expandafter\let - \csname tabu@linestyle@\@tempa \endcsname =\tabu@thestyle \fi -}% \tabu@newlinestyle -\newcommand*\tabulinestyle [1]{\tabu@everyrow@bgroup \tabu@getline{#1}% - \iftabu@everyrow - \toks@\expandafter{\expandafter \def \expandafter - \tabu@ls@L\expandafter{\tabu@thestyle}\ignorespaces}% - \gdef\tabu@ls@{\tabu@ls@L}% - \else - \global\let\tabu@ls@G \tabu@thestyle - \gdef\tabu@ls@{\tabu@ls@G}% - \fi - \tabu@everyrow@egroup -}% \tabulinestyle -\newcommand*\taburulecolor{\tabu@everyrow@bgroup \tabu@textbar \tabu@rulecolor} -\def\tabu@rulecolor #1{\toks@{}% - \def\tabu@temp #1##1#1{\tabu@ruledrsc{##1}}\@ifnextchar #1% - \tabu@temp - \tabu@rulearc -}% \tabu@rulecolor -\def\tabu@ruledrsc #1{\edef\tabu@temp{#1}\tabu@strtrim\tabu@temp - \ifx \tabu@temp\@empty \def\tabu@temp{\tabu@rule@drsc@ {}{}}% - \else \edef\tabu@temp{\noexpand\tabu@rule@drsc@ {}{\tabu@temp}}% - \fi - \tabu@temp -}% \tabu@ruledrsc@ -\def\tabu@ruledrsc@ #1#{\tabu@rule@drsc@ {#1}} -\def\tabu@rule@drsc@ #1#2{% - \iftabu@everyrow - \ifx \\#1#2\\\toks@{\let\CT@drsc@ \relax}% - \else \toks@{\def\CT@drsc@{\color #1{#2}}}% - \fi - \else - \ifx \\#1#2\\\global\let\CT@drsc@ \relax - \else \gdef\CT@drsc@{\color #1{#2}}% - \fi - \fi - \tabu@rulearc -}% \tabu@rule@drsc@ -\def\tabu@rulearc #1#{\tabu@rule@arc@ {#1}} -\def\tabu@rule@arc@ #1#2{% - \iftabu@everyrow - \ifx \\#1#2\\\toks@\expandafter{\the\toks@ \def\CT@arc@{}}% - \else \toks@\expandafter{\the\toks@ \def\CT@arc@{\color #1{#2}}}% - \fi - \toks@\expandafter{\the\toks@ - \let\tabu@arc@L \CT@arc@ - \let\tabu@drsc@L \CT@drsc@ - \ignorespaces}% - \else - \ifx \\#1#2\\\gdef\CT@arc@{}% - \else \gdef\CT@arc@{\color #1{#2}}% - \fi - \global\let\tabu@arc@G \CT@arc@ - \global\let\tabu@drsc@G \CT@drsc@ - \fi - \tabu@everyrow@egroup -}% \tabu@rule@arc@ -\def\taburowcolors {\tabu@everyrow@bgroup \@testopt \tabu@rowcolors 1} -\def\tabu@rowcolors [#1]#2#{\tabu@rowc@lors{#1}{#2}} -\def\tabu@rowc@lors #1#2#3{% - \toks@{}\@defaultunits \count@ =\number0#2\relax \@nnil - \@defaultunits \tabu@start =\number0#1\relax \@nnil - \ifnum \count@<\tw@ \count@=\tw@ \fi - \advance\tabu@start \m@ne - \ifnum \tabu@start<\z@ \tabu@start \z@ \fi - \tabu@rowcolorseries #3\in@..\in@ \@nnil -}% \tabu@rowcolors -\def\tabu@rowcolorseries #1..#2\in@ #3\@nnil {% - \ifx \in@#1\relax - \iftabu@everyrow \toks@{\def\tabu@rc@{}\let\tabu@rc@L \tabu@rc@}% - \else \gdef\tabu@rc@{}\global\let\tabu@rc@G \tabu@rc@ - \fi - \else - \ifx \\#2\\\tabu@rowcolorserieserror \fi - \tabu@sanitizearg{#1}\tabu@temp - \tabu@sanitizearg{#2}\@tempa - \advance\count@ \m@ne - \iftabu@everyrow - \def\tabu@rc@ ##1##2##3##4{\def\tabu@rc@{% - \ifnum ##2=\c@taburow - \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{##3}{##4}\fi - \ifnum \c@taburow<##2 \else - \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\z@ - \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi - \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% - \rowcolor{tabu@rc@\the\tabu@nested}\fi}% - }\edef\x{\noexpand\tabu@rc@ {\the\count@} - {\the\tabu@start} - {\tabu@temp} - {\@tempa}% - }\x - \toks@\expandafter{\expandafter\def\expandafter\tabu@rc@\expandafter{\tabu@rc@}}% - \toks@\expandafter{\the\toks@ \let\tabu@rc@L \tabu@rc@ \ignorespaces}% - \else % inside \noalign - \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{\tabu@temp}{\@tempa}% - \expandafter\resetcolorseries\expandafter[\the\count@]{tabu@rcseries@\the\tabu@nested}% - \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% - \let\noalign \relax \rowcolor{tabu@rc@\the\tabu@nested}% - \def\tabu@rc@ ##1##2{\gdef\tabu@rc@{% - \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\@ne - \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi - \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% - \rowcolor{tabu@rc@\the\tabu@nested}}% - }\edef\x{\noexpand\tabu@rc@{\the\count@}{\the\c@taburow}}\x - \global\let\tabu@rc@G \tabu@rc@ - \fi - \fi - \tabu@everyrow@egroup -}% \tabu@rowcolorseries -\tabuDisableCommands {\let\tabu@rc@ \@empty } -\def\tabu@rowcolorserieserror {\PackageError{tabu} - {Invalid syntax for \string\taburowcolors - \MessageBreak Please look at the documentation!}\@ehd -}% \tabu@rowcolorserieserror -\newcommand*\tabureset {% - \tabulinesep=\z@ \extrarowsep=\z@ \extratabsurround=\z@ - \tabulinestyle{}\everyrow{}\taburulecolor||{}\taburowcolors{}% -}% \tabureset -%% Parsing the line styles ------------------------------------------ -\def\tabu@getline #1{\begingroup - \csname \ifcsname if@safe@actives\endcsname % - @safe@activestrue\else - relax\fi \endcsname - \edef\tabu@temp{#1}\tabu@sanitizearg{#1}\@tempa - \let\tabu@thestyle \relax - \ifcsname tabu@linestyle@\@tempa \endcsname - \edef\tabu@thestyle{\endgroup - \def\tabu@thestyle{\expandafter\noexpand - \csname tabu@linestyle@\@tempa\endcsname}% - }\tabu@thestyle - \else \expandafter\tabu@definestyle \tabu@temp \@nil - \fi -}% \tabu@getline -\def\tabu@definestyle #1#2\@nil {\endlinechar \m@ne \makeatletter - \tabu@thick \maxdimen \tabu@on \maxdimen \tabu@off \maxdimen - \let\tabu@c@lon \@undefined \let\tabu@c@loff \@undefined - \ifodd 1\ifcat .#1\else\ifcat\relax #1\else 0\fi\fi % catcode 12 or non expandable cs - \def\tabu@temp{\tabu@getparam{thick}}% - \else \def\tabu@temp{\tabu@getparam{thick}\maxdimen}% - \fi - {% - \let\tabu@ \relax - \def\:{\obeyspaces \tabu@oXIII \tabu@commaXIII \edef\:}% (space active \: happy ;-)) - \scantokens{\:{\tabu@temp #1#2 \tabu@\tabu@}}% - \expandafter}\expandafter - \def\expandafter\:\expandafter{\:}% line spec rewritten now ;-) - \def\;{\def\:}% - \scantokens\expandafter{\expandafter\;\expandafter{\:}}% space is now inactive (catcode 10) - \let\tabu@ \tabu@getcolor \:% all arguments are ready now ;-) - \ifdefined\tabu@c@lon \else \let\tabu@c@lon\@empty \fi - \ifx \tabu@c@lon\@empty \def\tabu@c@lon{\CT@arc@}\fi - \ifdefined\tabu@c@loff \else \let\tabu@c@loff \@empty \fi - \ifdim \tabu@on=\maxdimen \ifdim \tabu@off<\maxdimen - \tabu@on \tabulineon \fi\fi - \ifdim \tabu@off=\maxdimen \ifdim \tabu@on<\maxdimen - \tabu@off \tabulineoff \fi\fi - \ifodd 1\ifdim \tabu@off=\maxdimen \ifdim \tabu@on=\maxdimen 0 \fi\fi - \in@true % - \else \in@false % - \fi - \ifdim\tabu@thick=\maxdimen \def\tabu@thick{\arrayrulewidth}% - \else \edef\tabu@thick{\the\tabu@thick}% - \fi - \edef \tabu@thestyle ##1##2{\endgroup - \def\tabu@thestyle{% - \ifin@ \noexpand\tabu@leadersstyle {\tabu@thick} - {\the\tabu@on}{##1} - {\the\tabu@off}{##2}% - \else \noexpand\tabu@rulesstyle - {##1\vrule width \tabu@thick}% - {##1\leaders \hrule height \tabu@thick \hfil}% - \fi}% - }\expandafter \expandafter - \expandafter \tabu@thestyle \expandafter - \expandafter \expandafter - {\expandafter\tabu@c@lon\expandafter}\expandafter{\tabu@c@loff}% -}% \tabu@definestyle -{\catcode`\O=\active \lccode`\O=`\o \catcode`\,=\active - \lowercase{\gdef\tabu@oXIII {\catcode`\o=\active \let O=\tabu@oxiii}} - \gdef\tabu@commaXIII {\catcode`\,=\active \let ,=\space} -}% \catcode -\def\tabu@oxiii #1{% - \ifcase \ifx n#1\z@ \else - \ifx f#1\@ne\else - \tw@ \fi\fi - \expandafter\tabu@onxiii - \or \expandafter\tabu@ofxiii - \else o% - \fi#1}% -\def\tabu@onxiii #1#2{% - \ifcase \ifx !#2\tw@ \else - \ifcat.\noexpand#2\z@ \else - \ifx \tabu@spxiii#2\@ne\else - \tw@ \fi\fi\fi - \tabu@getparam{on}#2\expandafter\@gobble - \or \expandafter\tabu@onxiii % (space is active) - \else o\expandafter\@firstofone - \fi{#1#2}}% -\def\tabu@ofxiii #1#2{% - \ifx #2f\expandafter\tabu@offxiii - \else o\expandafter\@firstofone - \fi{#1#2}} -\def\tabu@offxiii #1#2{% - \ifcase \ifx !#2\tw@ \else - \ifcat.\noexpand#2\z@ \else - \ifx\tabu@spxiii#2\@ne \else - \tw@ \fi\fi\fi - \tabu@getparam{off}#2\expandafter\@gobble - \or \expandafter\tabu@offxiii % (space is active) - \else o\expandafter\@firstofone - \fi{#1#2}} -\def\tabu@getparam #1{\tabu@ \csname tabu@#1\endcsname=} -\def\tabu@getcolor #1{% \tabu@ <- \tabu@getcolor after \edef - \ifx \tabu@#1\else % no more spec - \let\tabu@theparam=#1\afterassignment \tabu@getc@l@r #1\fi -}% \tabu@getcolor -\def\tabu@getc@l@r #1\tabu@ {% - \def\tabu@temp{#1}\tabu@strtrim \tabu@temp - \ifx \tabu@temp\@empty - \else%\ifcsname \string\color@\tabu@temp \endcsname % if the color exists - \ifx \tabu@theparam \tabu@off \let\tabu@c@loff \tabu@c@l@r - \else \let\tabu@c@lon \tabu@c@l@r - \fi - %\else \tabu@warncolour{\tabu@temp}% - \fi%\fi - \tabu@ % next spec -}% \tabu@getc@l@r -\def\tabu@warncolour #1{\PackageWarning{tabu} - {Color #1 is not defined. Default color used}% -}% \tabu@warncolour -\def\tabu@leadersstyle #1#2#3#4#5{\def\tabu@leaders{{#1}{#2}{#3}{#4}{#5}}% - \ifx \tabu@leaders\tabu@leaders@G \else - \tabu@LEADERS{#1}{#2}{#3}{#4}{#5}\fi -}% \tabu@leadersstyle -\def\tabu@rulesstyle #1#2{\let\tabu@leaders \@undefined - \gdef\tabu@thevrule{#1}\gdef\tabu@thehrule{#2}% -}% \tabu@rulesstyle -%% The leaders boxes ------------------------------------------------ -\def\tabu@LEADERS #1#2#3#4#5{%% width, dash, dash color, gap, gap color - {\let\color \tabu@color % => during trials -> \color = \tabu@nocolor - {% % but the leaders boxes should have colors ! - \def\@therule{\vrule}\def\@thick{height}\def\@length{width}% - \def\@box{\hbox}\def\@unbox{\unhbox}\def\@elt{\wd}% - \def\@skip{\hskip}\def\@ss{\hss}\def\tabu@leads{\tabu@hleads}% - \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}% - \global\let\tabu@thehleaders \tabu@theleaders - }% - {% - \def\@therule{\hrule}\def\@thick{width}\def\@length{height}% - \def\@box{\vbox}\def\@unbox{\unvbox}\def\@elt{\ht}% - \def\@skip{\vskip}\def\@ss{\vss}\def\tabu@leads{\tabu@vleads}% - \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}% - \global\let\tabu@thevleaders \tabu@theleaders - }% - \gdef\tabu@leaders@G{{#1}{#2}{#3}{#4}{#5}}% - }% -}% \tabu@LEADERS -\def\tabu@therule #1#2{\@therule \@thick#1\@length\dimexpr#2/2 \@depth\z@} -\def\tabu@l@@d@rs #1#2#3#4#5{%% width, dash, dash color, gap, gap color - \global\setbox \tabu@leads=\@box{% - {#3\tabu@therule{#1}{#2}}% - \ifx\\#5\\\@skip#4\else{#5\tabu@therule{#1}{#4*2}}\fi - {#3\tabu@therule{#1}{#2}}}% - \global\setbox\tabu@leads=\@box to\@elt\tabu@leads{\@ss - {#3\tabu@therule{#1}{#2}}\@unbox\tabu@leads}% - \edef\tabu@theleaders ##1{\def\noexpand\tabu@theleaders {% - {##1\tabu@therule{#1}{#2}}% - \xleaders \copy\tabu@leads \@ss - \tabu@therule{0pt}{-#2}{##1\tabu@therule{#1}{#2}}}% - }\tabu@theleaders{#3}% -}% \tabu@l@@d@rs -%% \tabu \endtabu \tabu* \longtabu \endlongtabu \longtabu* ---------- -\newcommand*\tabu {\tabu@longfalse - \ifmmode \def\tabu@ {\array}\def\endtabu {\endarray}% - \else \def\tabu@ {\tabu@tabular}\def\endtabu {\endtabular}\fi - \expandafter\let\csname tabu*\endcsname \tabu - \expandafter\def\csname endtabu*\endcsname{\endtabu}% - \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget -}% {tabu} -\let\tabu@tabular \tabular % -\expandafter\def\csname tabu*\endcsname{\tabuscantokenstrue \tabu} -\newcommand*\longtabu {\tabu@longtrue - \ifmmode\PackageError{tabu}{longtabu not allowed in math mode}\fi - \def\tabu@{\longtable}\def\endlongtabu{\endlongtable}% - \LTchunksize=\@M - \expandafter\let\csname tabu*\endcsname \tabu - \expandafter\def\csname endlongtabu*\endcsname{\endlongtabu}% - \let\LT@startpbox \tabu@LT@startpbox % \everypar{ array struts } - \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget -}% {longtabu} -\expandafter\def\csname longtabu*\endcsname{\tabuscantokenstrue \longtabu} -\def\tabu@nolongtabu{\PackageError{tabu} - {longtabu requires the longtable package}\@ehd} -%% Read the target and then : \tabular or \@array ------------------ -\def\tabu@settarget {\futurelet\@let@token \tabu@sett@rget } -\def\tabu@sett@rget {\tabu@target \z@ - \ifcase \ifx \bgroup\@let@token \z@ \else - \ifx \@sptoken\@let@token \@ne \else - \if t\@let@token \tw@ \else - \if s\@let@token \thr@@\else - \z@\fi\fi\fi\fi - \expandafter\tabu@begin - \or \expandafter\tabu@gobblespace\expandafter\tabu@settarget - \or \expandafter\tabu@to - \or \expandafter\tabu@spread - \fi -}% \tabu@sett@rget -\def\tabu@to to{\def\tabu@halignto{to}\tabu@gettarget} -\def\tabu@spread spread{\tabu@spreadtrue\def\tabu@halignto{spread}\tabu@gettarget} -\def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target } -\def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoalt@rget } -\def\tabu@linegoalt@rget {% - \ifx \tabu@temp\LNGL@setlinegoal - \LNGL@setlinegoal \expandafter \@firstoftwo \fi % @gobbles \LNGL@setlinegoal - \tabu@begin -}% \tabu@linegoalt@rget -\def\tabu@begin #1#{% - \iftabu@measuring \expandafter\tabu@nestedmeasure \fi - \ifdim \tabu@target=\z@ \let\tabu@halignto \@empty - \else \edef\tabu@halignto{\tabu@halignto\the\tabu@target}% - \fi - \@testopt \tabu@tabu@ \tabu@aligndefault #1\@nil -}% \tabu@begin -\long\def\tabu@tabu@ [#1]#2\@nil #3{\tabu@setup - \def\tabu@align {#1}\def\tabu@savedpream{\NC@find #3}% - \tabu@ [\tabu@align ]#2{#3\tabu@rewritefirst }% -}% \tabu@tabu@ -\def\tabu@nestedmeasure {% - \ifodd 1\iftabu@spread \else \ifdim\tabu@target=\z@ \else 0 \fi\fi\relax - \tabu@spreadtrue - \else \begingroup \iffalse{\fi \ifnum0=`}\fi - \toks@{}\def\tabu@stack{b}% - \expandafter\tabu@collectbody\expandafter\tabu@quickrule - \expandafter\endgroup - \fi -}% \tabu@nestedmeasure -\def\tabu@quickrule {\indent\vrule height\z@ depth\z@ width\tabu@target} -%% \tabu@setup \tabu@init \tabu@indent -\def\tabu@setup{\tabu@alloc@ - \ifcase \tabu@nested - \ifmmode \else \iftabu@spread\else \ifdim\tabu@target=\z@ - \let\tabu@afterendpar \par - \fi\fi\fi - \def\tabu@aligndefault{c}\tabu@init \tabu@indent - \else % - \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth - \fi - \let\tabu@thetarget \tabudefaulttarget \let\tabu@restored \@undefined - \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do \tabu@rewritefirst}% - \everycr{}\let\@startpbox \tabu@startpbox % for nested tabu inside longtabu... - \let\@endpbox \tabu@endpbox % idem " " " " " " - \let\@tabarray \tabu@tabarray % idem " " " " " " - \tabu@setcleanup \tabu@setreset -}% \tabu@setup -\def\tabu@init{\tabu@starttimer \tabu@measuringfalse - \edef\tabu@hfuzz {\the\dimexpr\hfuzz+1sp}\global\tabu@footnotes{}% - \let\firsthline \tabu@firsthline \let\lasthline \tabu@lasthline - \let\firstline \tabu@firstline \let\lastline \tabu@lastline - \let\hline \tabu@hline \let\@xhline \tabu@xhline - \let\color \tabu@color \let\@arstrutbox \tabu@arstrutbox - \iftabu@colortbl\else\let\LT@@hline \tabu@LT@@hline \fi - \tabu@trivlist % - \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext - \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering - \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft - \let\tabudecimal \tabu@tabudecimal \let\Centering \tabu@Centering - \let\RaggedRight \tabu@RaggedRight \let\RaggedLeft \tabu@RaggedLeft - \let\justifying \tabu@justifying \let\rowfont \tabu@rowfont - \let\fbox \tabu@fbox \let\color@b@x \tabu@color@b@x - \let\tabu@@everycr \everycr \let\tabu@@everypar \everypar - \let\tabu@prepnext@tokORI \prepnext@tok\let\prepnext@tok \tabu@prepnext@tok - \let\tabu@multicolumnORI\multicolumn \let\multicolumn \tabu@multicolumn - \let\tabu@startpbox \@startpbox % for nested tabu inside longtabu pfff !!! - \let\tabu@endpbox \@endpbox % idem " " " " " " " - \let\tabu@tabarray \@tabarray % idem " " " " " " " - \tabu@adl@fix \let\endarray \tabu@endarray % colortbl & arydshln (delarray) - \iftabu@colortbl\CT@everycr\expandafter{\expandafter\iftabu@everyrow \the\CT@everycr \fi}\fi -}% \tabu@init -\def\tabu@indent{% correction for indentation - \ifdim \parindent>\z@\ifx \linewidth\tabudefaulttarget - \everypar\expandafter{% - \the\everypar\everypar\expandafter{\the\everypar}% - \setbox\z@=\lastbox - \ifdim\wd\z@>\z@ \edef\tabu@thetarget - {\the\dimexpr -\wd\z@+\tabudefaulttarget}\fi - \box\z@}% - \fi\fi -}% \tabu@indent -\def\tabu@setcleanup {% saves last global assignments - \ifodd 1\ifmmode \else \iftabu@long \else 0\fi\fi\relax - \def\tabu@aftergroupcleanup{% - \def\tabu@aftergroupcleanup{\aftergroup\tabu@cleanup}}% - \else - \def\tabu@aftergroupcleanup{% - \aftergroup\aftergroup\aftergroup\tabu@cleanup - \let\tabu@aftergroupcleanup \relax}% - \fi - \let\tabu@arc@Gsave \tabu@arc@G - \let\tabu@arc@G \tabu@arc@L % - \let\tabu@drsc@Gsave \tabu@drsc@G - \let\tabu@drsc@G \tabu@drsc@L % - \let\tabu@ls@Gsave \tabu@ls@G - \let\tabu@ls@G \tabu@ls@L % - \let\tabu@rc@Gsave \tabu@rc@G - \let\tabu@rc@G \tabu@rc@L % - \let\tabu@evr@Gsave \tabu@evr@G - \let\tabu@evr@G \tabu@evr@L % - \let\tabu@celllalign@save \tabu@celllalign - \let\tabu@cellralign@save \tabu@cellralign - \let\tabu@cellleft@save \tabu@cellleft - \let\tabu@cellright@save \tabu@cellright - \let\tabu@@celllalign@save \tabu@@celllalign - \let\tabu@@cellralign@save \tabu@@cellralign - \let\tabu@@cellleft@save \tabu@@cellleft - \let\tabu@@cellright@save \tabu@@cellright - \let\tabu@rowfontreset@save \tabu@rowfontreset - \let\tabu@@rowfontreset@save\tabu@@rowfontreset - \let\tabu@rowfontreset \@empty - \edef\tabu@alloc@save {\the\tabu@alloc}% restore at \tabu@reset - \edef\c@taburow@save {\the\c@taburow}% - \edef\tabu@naturalX@save {\the\tabu@naturalX}% - \let\tabu@naturalXmin@save \tabu@naturalXmin - \let\tabu@naturalXmax@save \tabu@naturalXmax - \let\tabu@mkarstrut@save \tabu@mkarstrut - \edef\tabu@clarstrut{% - \extrarowheight \the\dimexpr \ht\@arstrutbox-\ht\strutbox \relax - \extrarowdepth \the\dimexpr \dp\@arstrutbox-\dp\strutbox \relax - \let\noexpand\@arraystretch \@ne \noexpand\tabu@rearstrut}% -}% \tabu@setcleanup -\def\tabu@cleanup {\begingroup - \globaldefs\@ne \tabu@everyrowtrue - \let\tabu@arc@G \tabu@arc@Gsave - \let\CT@arc@ \tabu@arc@G - \let\tabu@drsc@G \tabu@drsc@Gsave - \let\CT@drsc@ \tabu@drsc@G - \let\tabu@ls@G \tabu@ls@Gsave - \let\tabu@ls@ \tabu@ls@G - \let\tabu@rc@G \tabu@rc@Gsave - \let\tabu@rc@ \tabu@rc@G - \let\CT@do@color \relax - \let\tabu@evr@G \tabu@evr@Gsave - \let\tabu@celllalign \tabu@celllalign@save - \let\tabu@cellralign \tabu@cellralign@save - \let\tabu@cellleft \tabu@cellleft@save - \let\tabu@cellright \tabu@cellright@save - \let\tabu@@celllalign \tabu@@celllalign@save - \let\tabu@@cellralign \tabu@@cellralign@save - \let\tabu@@cellleft \tabu@@cellleft@save - \let\tabu@@cellright \tabu@@cellright@save - \let\tabu@rowfontreset \tabu@rowfontreset@save - \let\tabu@@rowfontreset \tabu@@rowfontreset@save - \tabu@naturalX =\tabu@naturalX@save - \let\tabu@naturalXmax \tabu@naturalXmax@save - \let\tabu@naturalXmin \tabu@naturalXmin@save - \let\tabu@mkarstrut \tabu@mkarstrut@save - \c@taburow =\c@taburow@save - \ifcase \tabu@nested \tabu@alloc \m@ne\fi - \endgroup % - \ifcase \tabu@nested - \the\tabu@footnotes \global\tabu@footnotes{}% - \tabu@afterendpar \tabu@elapsedtime - \fi - \tabu@clarstrut - \everyrow\expandafter {\tabu@evr@G}% -}% \tabu@cleanup -\let\tabu@afterendpar \relax -\def\tabu@setreset {% - \edef\tabu@savedparams {% \relax for \tabu@message@save - \ifmmode \col@sep \the\arraycolsep - \else \col@sep \the\tabcolsep \fi \relax - \arrayrulewidth \the\arrayrulewidth \relax - \doublerulesep \the\doublerulesep \relax - \extratabsurround \the\extratabsurround \relax - \extrarowheight \the\extrarowheight \relax - \extrarowdepth \the\extrarowdepth \relax - \abovetabulinesep \the\abovetabulinesep \relax - \belowtabulinesep \the\belowtabulinesep \relax - \def\noexpand\arraystretch{\arraystretch}% - \ifdefined\minrowclearance \minrowclearance\the\minrowclearance\relax\fi}% - \begingroup - \@temptokena\expandafter{\tabu@savedparams}% => only for \savetabu / \usetabu - \ifx \tabu@arc@L\relax \else \tabu@setsave \tabu@arc@L \fi - \ifx \tabu@drsc@L\relax \else \tabu@setsave \tabu@drsc@L \fi - \tabu@setsave \tabu@ls@L \tabu@setsave \tabu@evr@L - \expandafter \endgroup \expandafter - \def\expandafter\tabu@saved@ \expandafter{\the\@temptokena - \let\tabu@arc@G \tabu@arc@L - \let\tabu@drsc@G \tabu@drsc@L - \let\tabu@ls@G \tabu@ls@L - \let\tabu@rc@G \tabu@rc@L - \let\tabu@evr@G \tabu@evr@L}% - \def\tabu@reset{\tabu@savedparams - \tabu@everyrowtrue \c@taburow \z@ - \let\CT@arc@ \tabu@arc@L - \let\CT@drsc@ \tabu@drsc@L - \let\tabu@ls@ \tabu@ls@L - \let\tabu@rc@ \tabu@rc@L - \global\tabu@alloc \tabu@alloc@save - \everyrow\expandafter{\tabu@evr@L}}% -}% \tabu@reset -\def\tabu@setsave #1{\expandafter\tabu@sets@ve #1\@nil{#1}} -\long\def\tabu@sets@ve #1\@nil #2{\@temptokena\expandafter{\the\@temptokena \def#2{#1}}} -%% The Rewriting Process ------------------------------------------- -\def\tabu@newcolumntype #1{% - \expandafter\tabu@new@columntype - \csname NC@find@\string#1\expandafter\endcsname - \csname NC@rewrite@\string#1\endcsname - {#1}% -}% \tabu@newcolumntype -\def\tabu@new@columntype #1#2#3{% - \def#1##1#3{\NC@{##1}}% - \let#2\relax \newcommand*#2% -}% \tabu@new@columntype -\def\tabu@privatecolumntype #1{% - \expandafter\tabu@private@columntype - \csname NC@find@\string#1\expandafter\endcsname - \csname NC@rewrite@\string#1\expandafter\endcsname - \csname tabu@NC@find@\string#1\expandafter\endcsname - \csname tabu@NC@rewrite@\string#1\endcsname - {#1}% -}% \tabu@privatecolumntype -\def\tabu@private@columntype#1#2#3#4{% - \g@addto@macro\tabu@privatecolumns{\let#1#3\let#2#4}% - \tabu@new@columntype#3#4% -}% \tabu@private@columntype -\let\tabu@privatecolumns \@empty -\newcommand*\tabucolumn [1]{\expandafter \def \expandafter - \tabu@highprioritycolumns\expandafter{\tabu@highprioritycolumns - \NC@do #1}}% -\let\tabu@highprioritycolumns \@empty -%% The | ``column'' : rewriting process -------------------------- -\tabu@privatecolumntype |{\tabu@rewritevline} -\newcommand*\tabu@rewritevline[1][]{\tabu@vlinearg{#1}% - \expandafter \NC@find \tabu@rewritten} -\def\tabu@lines #1{% - \ifx|#1\else \tabu@privatecolumntype #1{\tabu@rewritevline}\fi - \NC@list\expandafter{\the\NC@list \NC@do #1}% -}% \tabu@lines@ -\def\tabu@vlinearg #1{% - \ifx\\#1\\\def\tabu@thestyle {\tabu@ls@}% - \else\tabu@getline {#1}% - \fi - \def\tabu@rewritten ##1{\def\tabu@rewritten{!{##1\tabu@thevline}}% - }\expandafter\tabu@rewritten\expandafter{\tabu@thestyle}% - \expandafter \tabu@keepls \tabu@thestyle \@nil -}% \tabu@vlinearg -\def\tabu@keepls #1\@nil{% - \ifcat $\@cdr #1\@nil $% - \ifx \relax#1\else - \ifx \tabu@ls@#1\else - \let#1\relax - \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer - \tabu@savels\noexpand#1}\fi\fi\fi -}% \tabu@keepls -\def\tabu@thevline {\begingroup - \ifdefined\tabu@leaders - \setbox\@tempboxa=\vtop to\dimexpr - \ht\@arstrutbox+\dp\@arstrutbox{{\tabu@thevleaders}}% - \ht\@tempboxa=\ht\@arstrutbox \dp\@tempboxa=\dp\@arstrutbox - \box\@tempboxa - \else - \tabu@thevrule - \fi \endgroup -}% \tabu@thevline -\def\tabu@savels #1{% - \expandafter\let\csname\string#1\endcsname #1% - \expandafter\def\expandafter\tabu@reset\expandafter{\tabu@reset - \tabu@resetls#1}}% -\def\tabu@resetls #1{\expandafter\let\expandafter#1\csname\string#1\endcsname}% -%% \multicolumn inside tabu environment ----------------------------- -\tabu@newcolumntype \tabu@rewritemulticolumn{% - \aftergroup \tabu@endrewritemulticolumn % after \@mkpream group - \NC@list{\NC@do *}\tabu@textbar \tabu@lines - \tabu@savedecl - \tabu@privatecolumns - \NC@list\expandafter{\the\expandafter\NC@list \tabu@NC@list}% - \let\tabu@savels \relax - \NC@find -}% \tabu@rewritemulticolumn -\def\tabu@endrewritemulticolumn{\gdef\tabu@mkpreambuffer{}\endgroup} -\def\tabu@multicolumn{\tabu@ifenvir \tabu@multic@lumn \tabu@multicolumnORI} -\long\def\tabu@multic@lumn #1#2#3{\multispan{#1}\begingroup - \tabu@everyrowtrue - \NC@list{\NC@do \tabu@rewritemulticolumn}% - \expandafter\@gobbletwo % gobbles \multispan{#1} - \tabu@multicolumnORI{#1}{\tabu@rewritemulticolumn #2}% - {\iftabuscantokens \tabu@rescan \else \expandafter\@firstofone \fi - {#3}}% -}% \tabu@multic@lumn -%% The X column(s): rewriting process ----------------------------- -\tabu@privatecolumntype X[1][]{\begingroup \tabu@siunitx{\endgroup \tabu@rewriteX {#1}}} -\def\tabu@nosiunitx #1{#1{}{}\expandafter \NC@find \tabu@rewritten } -\def\tabu@siunitx #1{\@ifnextchar \bgroup - {\tabu@rewriteX@Ss{#1}} - {\tabu@nosiunitx{#1}}} -\def\tabu@rewriteX@Ss #1#2{\@temptokena{}% - \@defaultunits \let\tabu@temp =#2\relax\@nnil - \ifodd 1\ifx S\tabu@temp \else \ifx s\tabu@temp \else 0 \fi\fi - \def\NC@find{\def\NC@find >####1####2<####3\relax{#1 {####1}{####3}% - }\expandafter\NC@find \the\@temptokena \relax - }\expandafter\NC@rewrite@S \@gobble #2\relax - \else \tabu@siunitxerror - \fi - \expandafter \NC@find \tabu@rewritten -}% \tabu@rewriteX@Ss -\def\tabu@siunitxerror {\PackageError{tabu}{Not a S nor s column ! - \MessageBreak X column can only embed siunitx S or s columns}\@ehd -}% \tabu@siunitxerror -\def\tabu@rewriteX #1#2#3{\tabu@Xarg {#1}{#2}{#3}% - \iftabu@measuring - \else \tabu@measuringtrue % first X column found in the preamble - \let\@halignto \relax \let\tabu@halignto \relax - \iftabu@spread \tabu@spreadtarget \tabu@target \tabu@target \z@ - \else \tabu@spreadtarget \z@ \fi - \ifdim \tabu@target=\z@ - \setlength\tabu@target \tabu@thetarget - \tabu@message{\tabu@message@defaulttarget}% - \else \tabu@message{\tabu@message@target}\fi - \fi -}% \tabu@rewriteX -\def\tabu@rewriteXrestore #1#2#3{\let\@halignto \relax - \def\tabu@rewritten{l}} -\def\tabu@Xarg #1#2#3{% - \advance\tabu@Xcol \@ne \let\tabu@Xlcr \@empty - \let\tabu@Xdisp \@empty \let\tabu@Xmath \@empty - \ifx\\#1\\% - \def\tabu@rewritten{p}\tabucolX \p@ % - \else - \let\tabu@rewritten \@empty \let\tabu@temp \@empty \tabucolX \z@ - \tabu@Xparse {}#1\relax - \fi - \tabu@Xrewritten{#2}{#3}% -}% \tabu@Xarg -\def\tabu@Xparse #1{\futurelet\@let@token \tabu@Xtest} -\expandafter\def\expandafter\tabu@Xparsespace\space{\tabu@Xparse{}} -\def\tabu@Xtest{% - \ifcase \ifx \relax\@let@token \z@ \else - \if ,\@let@token \m@ne\else - \if p\@let@token 1\else - \if m\@let@token 2\else - \if b\@let@token 3\else - \if l\@let@token 4\else - \if c\@let@token 5\else - \if r\@let@token 6\else - \if j\@let@token 7\else - \if L\@let@token 8\else - \if C\@let@token 9\else - \if R\@let@token 10\else - \if J\@let@token 11\else - \ifx \@sptoken\@let@token 12\else - \if .\@let@token 13\else - \if -\@let@token 13\else - \ifcat $\@let@token 14\else - 15\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax - \or \tabu@Xtype {p}% - \or \tabu@Xtype {m}% - \or \tabu@Xtype {b}% - \or \tabu@Xalign \raggedright\relax - \or \tabu@Xalign \centering\relax - \or \tabu@Xalign \raggedleft\relax - \or \tabu@Xalign \tabu@justify\relax - \or \tabu@Xalign \RaggedRight\raggedright - \or \tabu@Xalign \Centering\centering - \or \tabu@Xalign \RaggedLeft\raggedleft - \or \tabu@Xalign \justifying\tabu@justify - \or \expandafter \tabu@Xparsespace - \or \expandafter \tabu@Xcoef - \or \expandafter \tabu@Xm@th - \or \tabu@Xcoef{}% - \else\expandafter \tabu@Xparse - \fi -}% \tabu@Xtest -\def\tabu@Xalign #1#2{% - \ifx \tabu@Xlcr\@empty \else \PackageWarning{tabu} - {Duplicate horizontal alignment specification}\fi - \ifdefined#1\def\tabu@Xlcr{#1}\let#1\relax - \else \def\tabu@Xlcr{#2}\let#2\relax\fi - \expandafter\tabu@Xparse -}% \tabu@Xalign -\def\tabu@Xtype #1{% - \ifx \tabu@rewritten\@empty \else \PackageWarning{tabu} - {Duplicate vertical alignment specification}\fi - \def\tabu@rewritten{#1}\expandafter\tabu@Xparse -}% \tabu@Xtype -\def\tabu@Xcoef#1{\edef\tabu@temp{\tabu@temp#1}% - \afterassignment\tabu@Xc@ef \tabu@cnt\number\if-#10\fi -}% \tabu@Xcoef -\def\tabu@Xc@ef{\advance\tabucolX \tabu@temp\the\tabu@cnt\p@ - \tabu@Xparse{}% -}% \tabu@Xc@ef -\def\tabu@Xm@th #1{\futurelet \@let@token \tabu@Xd@sp} -\def\tabu@Xd@sp{\let\tabu@Xmath=$% - \ifx $\@let@token \def\tabu@Xdisp{\displaystyle}% - \expandafter\tabu@Xparse - \else \expandafter\tabu@Xparse\expandafter{\expandafter}% - \fi -}% \tabu@Xd@sp -\def\tabu@Xrewritten {% - \ifx \tabu@rewritten\@empty \def\tabu@rewritten{p}\fi - \ifdim \tabucolX<\z@ \tabu@negcoeftrue - \else\ifdim \tabucolX=\z@ \tabucolX \p@ - \fi\fi - \edef\tabu@temp{{\the\tabu@Xcol}{\tabu@strippt\tabucolX}}% - \edef\tabu@Xcoefs{\tabu@Xcoefs \tabu@ \tabu@temp}% - \edef\tabu@rewritten ##1##2{\def\noexpand\tabu@rewritten{% - >{\tabu@Xlcr \ifx$\tabu@Xmath$\tabu@Xdisp\fi ##1}% - \tabu@rewritten {\tabu@hsize \tabu@temp}% - <{##2\ifx$\tabu@Xmath$\fi}}% - }\tabu@rewritten -}% \tabu@Xrewritten -\def\tabu@hsize #1#2{% - \ifdim #2\p@<\z@ - \ifdim \tabucolX=\maxdimen \tabu@wd{#1}\else - \ifdim \tabu@wd{#1}<-#2\tabucolX \tabu@wd{#1}\else -#2\tabucolX\fi - \fi - \else #2\tabucolX - \fi -}% \tabu@hsize -%% \usetabu and \preamble: rewriting process --------------------- -\tabu@privatecolumntype \usetabu [1]{% - \ifx\\#1\\\tabu@saveerr{}\else - \@ifundefined{tabu@saved@\string#1} - {\tabu@saveerr{#1}} - {\let\tabu@rewriteX \tabu@rewriteXrestore - \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\@ne}% - \fi -}% \NC@rewrite@\usetabu -\tabu@privatecolumntype \preamble [1]{% - \ifx\\#1\\\tabu@saveerr{}\else - \@ifundefined{tabu@saved@\string#1} - {\tabu@saveerr{#1}} - {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}% - \fi -}% \NC@rewrite@\preamble -%% Controlling the rewriting process ------------------------------- -\tabu@newcolumntype \tabu@rewritefirst{% - \iftabu@long \aftergroup \tabu@longpream % - \else \aftergroup \tabu@pream - \fi - \let\tabu@ \relax \let\tabu@hsize \relax - \let\tabu@Xcoefs \@empty \let\tabu@savels \relax - \tabu@Xcol \z@ \tabu@cnt \tw@ - \gdef\tabu@mkpreambuffer{\tabu@{}}\tabu@measuringfalse - \global\setbox\@arstrutbox \box\@arstrutbox - \NC@list{\NC@do *}\tabu@textbar \tabu@lines - \NC@list\expandafter{\the\NC@list \NC@do X}% - \iftabu@siunitx % - \NC@list\expandafter{\the\NC@list \NC@do S\NC@do s}\fi - \NC@list\expandafter{\the\expandafter\NC@list \tabu@highprioritycolumns}% - \expandafter\def\expandafter\tabu@NC@list\expandafter{% - \the\expandafter\NC@list \tabu@NC@list}% % * | X S - \NC@list\expandafter{\expandafter \NC@do \expandafter\usetabu - \expandafter \NC@do \expandafter\preamble - \the\NC@list \NC@do \tabu@rewritemiddle - \NC@do \tabu@rewritelast}% - \tabu@savedecl - \tabu@privatecolumns - \edef\tabu@prev{\the\@temptokena}\NC@find \tabu@rewritemiddle -}% NC@rewrite@\tabu@rewritefirst -\tabu@newcolumntype \tabu@rewritemiddle{% - \edef\tabu@temp{\the\@temptokena}\NC@find \tabu@rewritelast -}% \NC@rewrite@\tabu@rewritemiddle -\tabu@newcolumntype \tabu@rewritelast{% - \ifx \tabu@temp\tabu@prev \advance\tabu@cnt \m@ne - \NC@list\expandafter{\tabu@NC@list \NC@do \tabu@rewritemiddle - \NC@do \tabu@rewritelast}% - \else \let\tabu@prev\tabu@temp - \fi - \ifcase \tabu@cnt \expandafter\tabu@endrewrite - \else \expandafter\NC@find \expandafter\tabu@rewritemiddle - \fi -}% \NC@rewrite@\tabu@rewritelast -%% Choosing the strategy -------------------------------------------- -\def\tabu@endrewrite {% - \let\tabu@temp \NC@find - \ifx \@arrayright\relax \let\@arrayright \@empty \fi - \count@=% - \ifx \@finalstrut\tabu@finalstrut \z@ % outer in mode 0 print - \iftabu@measuring - \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer - \tabu@target \csname tabu@\the\tabu@nested.T\endcsname - \tabucolX \csname tabu@\the\tabu@nested.X\endcsname - \edef\@halignto {\ifx\@arrayright\@empty to\tabu@target\fi}}% - \fi - \else\iftabu@measuring 4 % X columns - \xdef\tabu@mkpreambuffer{\tabu@{\tabu@mkpreambuffer - \tabu@target \the\tabu@target - \tabu@spreadtarget \the\tabu@spreadtarget}% - \def\noexpand\tabu@Xcoefs{\tabu@Xcoefs}% - \edef\tabu@halignto{\ifx \@arrayright\@empty to\tabu@target\fi}}% - \let\tabu@Xcoefs \relax - \else\ifcase\tabu@nested \thr@@ % outer, no X - \global\let\tabu@afterendpar \relax - \else \@ne % inner, no X, outer in mode 1 or 2 - \fi - \ifdefined\tabu@usetabu - \else \ifdim\tabu@target=\z@ - \else \let\tabu@temp \tabu@extracolsep - \fi\fi - \fi - \fi - \xdef\tabu@mkpreambuffer{\count@ \the\count@ \tabu@mkpreambuffer}% - \tabu@temp -}% \tabu@endrewrite -\def\tabu@extracolsep{\@defaultunits \expandafter\let - \expandafter\tabu@temp \expandafter=\the\@temptokena \relax\@nnil - \ifx \tabu@temp\@sptoken - \expandafter\tabu@gobblespace \expandafter\tabu@extracolsep - \else - \edef\tabu@temp{\noexpand\NC@find - \if |\noexpand\tabu@temp @% - \else\if !\noexpand\tabu@temp @% - \else !% - \fi\fi - {\noexpand\extracolsep\noexpand\@flushglue}}% - \fi - \tabu@temp -}% \tabu@extrac@lsep -%% Implementing the strategy ---------------------------------------- -\long\def\tabu@pream #1\@preamble {% - \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup - \NC@list\expandafter {\tabu@NC@list}% in case of nesting... - \ifdefined\tabu@usetabu \tabu@usetabu \tabu@target \z@ \fi - \let\tabu@savedpreamble \@preamble - \global\let\tabu@elapsedtime \relax - \tabu@thebody ={#1\tabu@aftergroupcleanup}% - \tabu@thebody =\expandafter{\the\expandafter\tabu@thebody - \@preamble}% - \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens ) - \tabu@select -}% \tabu@pream -\long\def\tabu@longpream #1\LT@bchunk #2\LT@bchunk{% - \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup - \NC@list\expandafter {\tabu@NC@list}% in case of nesting... - \let\tabu@savedpreamble \@preamble - \global\let\tabu@elapsedtime \relax - \tabu@thebody ={#1\LT@bchunk #2\tabu@aftergroupcleanup \LT@bchunk}% - \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens ) - \tabu@select -}% \tabu@longpream -\def\tabu@select {% - \ifnum\tabu@nested>\z@ \tabuscantokensfalse \fi - \ifnum \count@=\@ne \iftabu@measuring \count@=\tw@ \fi\fi - \ifcase \count@ - \global\let\tabu@elapsedtime \relax - \tabu@seteverycr - \expandafter \tabuthepreamble % vertical adjustment (inherited from outer) - \or % exit in vertical measure + struts per cell because no X and outer in mode 3 - \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}% - \def\tabu@cellralign{\tabu@verticalspacing}% - \tabu@seteverycr - \expandafter \tabuthepreamble - \or % exit without measure because no X and outer in mode 4 - \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty - \tabu@seteverycr - \expandafter \tabuthepreamble - \else % needs trials - \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty - \tabu@savecounters - \expandafter \tabu@setstrategy - \fi -}% \tabu@select -\def\tabu@@ {\gdef\tabu@mkpreambuffer} -%% Protections to set up before trials ------------------------------ -\def\tabu@setstrategy {\begingroup % - \tabu@trialh@@k \tabu@cnt \z@ % number of trials - \hbadness \@M \let\hbadness \@tempcnta - \hfuzz \maxdimen \let\hfuzz \@tempdima - \let\write \tabu@nowrite\let\GenericError \tabu@GenericError - \let\savetabu \@gobble \let\tabudefaulttarget \linewidth - \let\@footnotetext \@gobble \let\@xfootnote \tabu@xfootnote - \let\color \tabu@nocolor\let\rowcolor \tabu@norowcolor - \let\tabu@aftergroupcleanup \relax % only after the last trial - \tabu@mkpreambuffer - \ifnum \count@>\thr@@ \let\@halignto \@empty \tabucolX@init - \def\tabu@lasttry{\m@ne\p@}\fi - \begingroup \iffalse{\fi \ifnum0=`}\fi - \toks@{}\def\tabu@stack{b}\iftabuscantokens \endlinechar=10 \obeyspaces \fi % - \tabu@collectbody \tabu@strategy % -}% \tabu@setstrategy -\def\tabu@savecounters{% - \def\@elt ##1{\csname c@##1\endcsname\the\csname c@##1\endcsname}% - \edef\tabu@clckpt {\begingroup \globaldefs=\@ne \cl@@ckpt \endgroup}\let\@elt \relax -}% \tabu@savecounters -\def\tabucolX@init {% \tabucolX <= \tabu@target / (sum coefs > 0) - \dimen@ \z@ \tabu@Xsum \z@ \tabucolX \z@ \let\tabu@ \tabu@Xinit \tabu@Xcoefs - \ifdim \dimen@>\z@ - \@tempdima \dimexpr \tabu@target *\p@/\dimen@ + \tabu@hfuzz\relax - \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi - \fi -}% \tabucolX@init -\def\tabu@Xinit #1#2{\tabu@Xcol #1 \advance \tabu@Xsum - \ifdim #2\p@>\z@ #2\p@ \advance\dimen@ #2\p@ - \else -#2\p@ \tabu@negcoeftrue - \@tempdima \dimexpr \tabu@target*\p@/\dimexpr-#2\p@\relax \relax - \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi - \tabu@wddef{#1}{0pt}% - \fi -}% \tabu@Xinit -%% Collecting the environment body ---------------------------------- -\long\def\tabu@collectbody #1#2\end #3{% - \edef\tabu@stack{\tabu@pushbegins #2\begin\end\expandafter\@gobble\tabu@stack}% - \ifx \tabu@stack\@empty - \toks@\expandafter{\expandafter\tabu@thebody\expandafter{\the\toks@ #2}% - \def\tabu@end@envir{\end{#3}}% - \iftabuscantokens - \iftabu@long \def\tabu@endenvir {\end{#3}\tabu@gobbleX}% - \else \def\tabu@endenvir {\let\endarray \@empty - \end{#3}\tabu@gobbleX}% - \fi - \else \def\tabu@endenvir {\end{#3}}\fi}% - \let\tabu@collectbody \tabu@endofcollect - \else\def\tabu@temp{#3}% - \ifx \tabu@temp\@empty \toks@\expandafter{\the\toks@ #2\end }% - \else \ifx\tabu@temp\tabu@@spxiii \toks@\expandafter{\the\toks@ #2\end #3}% - \else \ifx\tabu@temp\tabu@X \toks@\expandafter{\the\toks@ #2\end #3}% - \else \toks@\expandafter{\the\toks@ #2\end{#3}}% - \fi\fi\fi - \fi - \tabu@collectbody{#1}% -}% \tabu@collectbody -\long\def\tabu@pushbegins#1\begin#2{\ifx\end#2\else b\expandafter\tabu@pushbegins\fi}% -\def\tabu@endofcollect #1{\ifnum0=`{}\fi - \expandafter\endgroup \the\toks@ #1% -}% \tabu@endofcollect -%% The trials: switching between strategies ------------------------- -\def\tabu@strategy {\relax % stops \count@ assignment ! - \ifcase\count@ % case 0 = print with vertical adjustment (outer is finished) - \expandafter \tabu@endoftrials - \or % case 1 = exit in vertical measure (outer in mode 3) - \expandafter\xdef\csname tabu@\the\tabu@nested.T\endcsname{\the\tabu@target}% - \expandafter\xdef\csname tabu@\the\tabu@nested.X\endcsname{\the\tabucolX}% - \expandafter \tabu@endoftrials - \or % case 2 = exit with a rule replacing the table (outer in mode 4) - \expandafter \tabu@quickend - \or % case 3 = outer is in mode 3 because of no X - \begingroup - \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}% - \def\tabu@cellralign{\tabu@verticalspacing}% - \expandafter \tabu@measuring - \else % case 4 = horizontal measure - \begingroup - \global\let\tabu@elapsedtime \tabu@message@etime - \long\def\multicolumn##1##2##3{\multispan{##1}}% - \let\tabu@startpboxORI \@startpbox - \iftabu@spread - \def\tabu@naturalXmax {\z@}% - \let\tabu@naturalXmin \tabu@naturalXmax - \tabu@evr{\global\tabu@naturalX \z@}% - \let\@startpbox \tabu@startpboxmeasure - \else\iftabu@negcoef - \let\@startpbox \tabu@startpboxmeasure - \else \let\@startpbox \tabu@startpboxquick - \fi\fi - \expandafter \tabu@measuring - \fi -}% \tabu@strategy -\def\tabu@measuring{\expandafter \tabu@trial \expandafter - \count@ \the\count@ \tabu@endtrial -}% \tabu@measuring -\def\tabu@trial{\iftabu@long \tabu@longtrial \else \tabu@shorttrial \fi} -\def\tabu@shorttrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr - \ifx \tabu@savecounters\relax \else - \let\tabu@savecounters \relax \tabu@clckpt \fi - $\iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi - \expandafter{\expandafter \tabuthepreamble - \the\tabu@thebody - \csname tabu@adl@endtrial\endcsname - \endarray}$\egroup % got \tabu@box -}% \tabu@shorttrial -\def\tabu@longtrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr - \ifx \tabu@savecounters\relax \else - \let\tabu@savecounters \relax \tabu@clckpt \fi - \iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi - \expandafter{\expandafter \tabuthepreamble - \the\tabu@thebody - \tabuendlongtrial}\egroup % got \tabu@box -}% \tabu@longtrial -\def\tabuendlongtrial{% no @ allowed for \scantokens - \LT@echunk \global\setbox\@ne \hbox{\unhbox\@ne}\kern\wd\@ne - \LT@get@widths -}% \tabuendlongtrial -\def\tabu@adl@endtrial{% - \crcr \noalign{\global\adl@ncol \tabu@nbcols}}% anything global is crap, junky and fails ! -\def\tabu@seteverycr {\tabu@reset - \everycr \expandafter{\the\everycr \tabu@everycr}% - \let\everycr \tabu@noeverycr % -}% \tabu@seteverycr -\def\tabu@noeverycr{{\aftergroup\tabu@restoreeverycr \afterassignment}\toks@} -\def\tabu@restoreeverycr {\let\everycr \tabu@@everycr} -\def\tabu@everycr {\iftabu@everyrow \noalign{\tabu@everyrow}\fi} -\def\tabu@endoftrials {% - \iftabuscantokens \expandafter\@firstoftwo - \else \expandafter\@secondoftwo - \fi - {\expandafter \tabu@closetrialsgroup \expandafter - \tabu@rescan \expandafter{% - \expandafter\tabuthepreamble - \the\expandafter\tabu@thebody - \iftabu@long \else \endarray \fi}} - {\expandafter\tabu@closetrialsgroup \expandafter - \tabuthepreamble - \the\tabu@thebody}% - \tabu@endenvir % Finish ! -}% \tabu@endoftrials -\def\tabu@closetrialsgroup {% - \toks@\expandafter{\tabu@endenvir}% - \edef\tabu@bufferX{\endgroup - \tabucolX \the\tabucolX - \tabu@target \the\tabu@target - \tabu@cnt \the\tabu@cnt - \def\noexpand\tabu@endenvir{\the\toks@}% - %Quid de \@halignto = \tabu@halignto ?? - }% \tabu@bufferX - \tabu@bufferX - \ifcase\tabu@nested % print out (outer in mode 0) - \global\tabu@cnt \tabu@cnt - \tabu@evr{\tabu@verticaldynamicadjustment}% - \tabu@celllalign@def{\everypar{}}\let\tabu@cellralign \@empty - \let\@finalstrut \tabu@finalstrut - \else % vertical measure of nested tabu - \tabu@evr{\tabu@verticalinit}% - \tabu@celllalign@def{\tabu@verticalmeasure}% - \def\tabu@cellralign{\tabu@verticalspacing}% - \fi - \tabu@clckpt \let\@halignto \tabu@halignto - \let\@halignto \@empty - \tabu@seteverycr - \ifdim \tabustrutrule>\z@ \ifnum\tabu@nested=\z@ - \setbox\@arstrutbox \box\voidb@x % force \@arstrutbox to be rebuilt (visible struts) - \fi\fi -}% \tabu@closetrialsgroup -\def\tabu@quickend {\expandafter \endgroup \expandafter - \tabu@target \the\tabu@target \tabu@quickrule - \let\endarray \relax \tabu@endenvir -}% \tabu@quickend -\def\tabu@endtrial {\relax % stops \count@ assignment ! - \ifcase \count@ \tabu@err % case 0 = impossible here - \or \tabu@err % case 1 = impossible here - \or \tabu@err % case 2 = impossible here - \or % case 3 = outer goes into mode 0 - \def\tabu@bufferX{\endgroup}\count@ \z@ - \else % case 4 = outer goes into mode 3 - \iftabu@spread \tabu@spreadarith % inner into mode 1 (outer in mode 3) - \else \tabu@arith % or 2 (outer in mode 4) - \fi - \count@=% - \ifcase\tabu@nested \thr@@ % outer goes into mode 3 - \else\iftabu@measuring \tw@ % outer is in mode 4 - \else \@ne % outer is in mode 3 - \fi\fi - \edef\tabu@bufferX{\endgroup - \tabucolX \the\tabucolX - \tabu@target \the\tabu@target}% - \fi - \expandafter \tabu@bufferX \expandafter - \count@ \the\count@ \tabu@strategy -}% \tabu@endtrial -\def\tabu@err{\errmessage{(tabu) Internal impossible error! (\count@=\the\count@)}} -%% The algorithms: compute the widths / stop or go on --------------- -\def\tabu@arithnegcoef {% - \@tempdima \z@ \dimen@ \z@ \let\tabu@ \tabu@arith@negcoef \tabu@Xcoefs -}% \tabu@arithnegcoef -\def\tabu@arith@negcoef #1#2{% - \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ % saturated by definition - \advance\@tempdima #2\tabucolX - \else - \ifdim -#2\tabucolX <\tabu@wd{#1}% c_i X < natural width <= \tabu@target-> saturated - \advance\dimen@ -#2\p@ - \advance\@tempdima -#2\tabucolX - \else - \advance\@tempdima \tabu@wd{#1}% natural width <= c_i X => neutralised - \ifdim \tabu@wd{#1}<\tabu@target \else % neutralised - \advance\dimen@ -#2\p@ % saturated (natural width = tabu@target) - \fi - \fi - \fi -}% \tabu@arith@negcoef -\def\tabu@givespace #1#2{% here \tabu@DELTA < \z@ - \ifdim \@tempdima=\z@ - \tabu@wddef{#1}{\the\dimexpr -\tabu@DELTA*\p@/\tabu@Xsum}% - \else - \tabu@wddef{#1}{\the\dimexpr \tabu@hsize{#1}{#2} - *(\p@ -\tabu@DELTA*\p@/\@tempdima)/\p@\relax}% - \fi -}% \tabu@givespace -\def\tabu@arith {\advance\tabu@cnt \@ne - \ifnum \tabu@cnt=\@ne \tabu@message{\tabu@titles}\fi - \tabu@arithnegcoef - \@tempdimb \dimexpr \wd\tabu@box -\@tempdima \relax % - \tabu@DELTA = \dimexpr \wd\tabu@box - \tabu@target \relax - \tabu@message{\tabu@message@arith}% - \ifdim \tabu@DELTA <\tabu@hfuzz - \ifdim \tabu@DELTA<\z@ % wd (tabu)<\tabu@target ? - \let\tabu@ \tabu@givespace \tabu@Xcoefs - \advance\@tempdima \@tempdimb \advance\@tempdima -\tabu@DELTA % for message - \else % already converged: nothing to do but nearly impossible... - \fi - \tabucolX \maxdimen - \tabu@measuringfalse - \else % need for narrower X columns - \tabucolX =\dimexpr (\@tempdima -\tabu@DELTA) *\p@/\tabu@Xsum \relax - \tabu@measuringtrue - \@whilesw \iftabu@measuring\fi {% - \advance\tabu@cnt \@ne - \tabu@arithnegcoef - \tabu@DELTA =\dimexpr \@tempdima+\@tempdimb -\tabu@target \relax % always < 0 here - \tabu@message{\tabu@header - \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@ - \tabu@msgalign \@tempdima+\@tempdimb { }{ }{ }{ }{ }\@@ - \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@ - \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@ - \ifdim -\tabu@DELTA<\tabu@hfuzz \tabu@spaces target ok\else - \tabu@msgalign \dimexpr -\tabu@DELTA *\p@/\dimen@ {}{}{}{}{}\@@ - \fi}% - \ifdim -\tabu@DELTA<\tabu@hfuzz - \advance\@tempdima \@tempdimb % for message - \tabu@measuringfalse - \else - \advance\tabucolX \dimexpr -\tabu@DELTA *\p@/\dimen@ \relax - \fi - }% - \fi - \tabu@message{\tabu@message@reached}% - \edef\tabu@bufferX{\endgroup \tabu@cnt \the\tabu@cnt - \tabucolX \the\tabucolX - \tabu@target \the\tabu@target}% -}% \tabu@arith -\def\tabu@spreadarith {% - \dimen@ \z@ \@tempdima \tabu@naturalXmax \let\tabu@ \tabu@spread@arith \tabu@Xcoefs - \edef\tabu@naturalXmin {\the\dimexpr\tabu@naturalXmin*\dimen@/\p@}% - \@tempdimc =\dimexpr \wd\tabu@box -\tabu@naturalXmax+\tabu@naturalXmin \relax - \iftabu@measuring - \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax - \edef\tabu@bufferX{\endgroup \tabucolX \the\tabucolX \tabu@target\the\tabu@target}% - \else - \tabu@message{\tabu@message@spreadarith}% - \ifdim \dimexpr \@tempdimc+\tabu@spreadtarget >\tabu@target - \tabu@message{(tabu) spread - \ifdim \@tempdimc>\tabu@target useless here: default target used% - \else too large: reduced to fit default target\fi.}% - \else - \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax - \tabu@message{(tabu) spread: New target set to \the\tabu@target^^J}% - \fi - \begingroup \let\tabu@wddef \@gobbletwo - \@tempdimb \@tempdima - \tabucolX@init - \tabu@arithnegcoef - \wd\tabu@box =\dimexpr \wd\tabu@box +\@tempdima-\@tempdimb \relax - \expandafter\endgroup \expandafter\tabucolX \the\tabucolX - \tabu@arith - \fi -}% \tabu@spreadarith -\def\tabu@spread@arith #1#2{% - \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ - \else \advance\@tempdima \tabu@wd{#1}\relax - \fi -}% \tabu@spread@arith -%% Reporting in the .log file --------------------------------------- -\def\tabu@message@defaulttarget{% - \ifnum\tabu@nested=\z@^^J(tabu) Default target: - \ifx\tabudefaulttarget\linewidth \string\linewidth - \ifdim \tabu@thetarget=\linewidth \else - -\the\dimexpr\linewidth-\tabu@thetarget\fi = - \else\ifx\tabudefaulttarget\linegoal\string\linegoal= - \fi\fi - \else (tabu) Default target (nested): \fi - \the\tabu@target \on@line - \ifnum\tabu@nested=\z@ , page \the\c@page\fi} -\def\tabu@message@target {^^J(tabu) Target specified: - \the\tabu@target \on@line, page \the\c@page} -\def\tabu@message@arith {\tabu@header - \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@ - \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{ }\@@ - \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@ - \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@ - \ifdim \tabu@DELTA<\tabu@hfuzz giving space\else - \tabu@msgalign \dimexpr (\@tempdima-\tabu@DELTA) *\p@/\tabu@Xsum -\tabucolX {}{}{}{}{}\@@ - \fi -}% \tabu@message@arith -\def\tabu@message@spreadarith {\tabu@spreadheader - \tabu@msgalign \tabu@spreadtarget { }{ }{ }{ }{}\@@ - \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{}\@@ - \tabu@msgalign -\tabu@naturalXmax { }{}{}{}{}\@@ - \tabu@msgalign \tabu@naturalXmin { }{ }{ }{ }{}\@@ - \tabu@msgalign \ifdim \dimexpr\@tempdimc>\tabu@target \tabu@target - \else \@tempdimc+\tabu@spreadtarget \fi - {}{}{}{}{}\@@} -\def\tabu@message@negcoef #1#2{ - \tabu@spaces\tabu@spaces\space * #1. X[\rem@pt#2]: - \space width = \tabu@wd {#1} - \expandafter\string\csname tabu@\the\tabu@nested.W\number#1\endcsname - \ifdim -\tabu@pt#2\tabucolX<\tabu@target - < \number-\rem@pt#2 X - = \the\dimexpr -\tabu@pt#2\tabucolX \relax - \else - <= \the\tabu@target\space < \number-\rem@pt#2 X\fi} -\def\tabu@message@reached{\tabu@header - ******* Reached Target: - hfuzz = \tabu@hfuzz\on@line\space *******} -\def\tabu@message@etime{\edef\tabu@stoptime{\the\pdfelapsedtime}% - \tabu@message{(tabu)\tabu@spaces Time elapsed during measure: - \the\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax sec - \the\numexpr\numexpr(\tabu@stoptime-\tabu@starttime) - -\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax*65536\relax - *1000/65536\relax ms \tabu@spaces(\the\tabu@cnt\space - cycle\ifnum\tabu@cnt>\@ne s\fi)^^J^^J}} -\def\tabu@message@verticalsp {% - \ifdim \@tempdima>\tabu@ht - \ifdim \@tempdimb>\tabu@dp - \expandafter\expandafter\expandafter\string\tabu@ht = - \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@ - \expandafter\expandafter\expandafter\string\tabu@dp = - \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J% - \else - \expandafter\expandafter\expandafter\string\tabu@ht = - \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@^^J% - \fi - \else\ifdim \@tempdimb>\tabu@dp - \tabu@spaces\tabu@spaces\tabu@spaces - \expandafter\expandafter\expandafter\string\tabu@dp = - \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J\fi - \fi -}% \tabu@message@verticalsp -\edef\tabu@spaces{\@spaces} -\def\tabu@strippt{\expandafter\tabu@pt\the} -{\@makeother\P \@makeother\T\lowercase{\gdef\tabu@pt #1PT{#1}}} -\def\tabu@msgalign{\expandafter\tabu@msg@align\the\dimexpr} -\def\tabu@msgalign@PT{\expandafter\tabu@msg@align\romannumeral-`\0\tabu@strippt} -\def\do #1{% - \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{% - \ifnum##1<10 #1 #1\else - \ifnum##1<100 #1 \else - \ifnum##1<\@m #1\fi\fi\fi - ##1.##2##3##4##5##6##7##8#1}% - \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) }% - \def\tabu@titles{\ifnum \tabu@nested=\z@ - (tabu) Try#1 #1 tabu X #1 #1 #1tabu Width #1 #1 Target - #1 #1 #1 Coefs #1 #1 #1 Update^^J\fi}% - \def\tabu@spreadheader{% - (tabu) Try#1 #1 Spread #1 #1 tabu Width #1 #1 #1 Nat. X #1 #1 #1 #1Nat. Min. - #1 New Target^^J% - (tabu) sprd} - \def\tabu@message@save {\begingroup - \def\x ####1{\tabu@msg@align ####1{ }{ }{ }{ }{}\@@} - \def\z ####1{\expandafter\x\expandafter{\romannumeral-`\0\tabu@strippt - \dimexpr####1\p@{ }{ }}}% - \let\color \relax \def\tabu@rulesstyle ####1####2{\detokenize{####1}}% - \let\CT@arc@ \relax \let\@preamble \@gobble - \let\tabu@savedpream \@firstofone - \let\tabu@savedparams \@firstofone - \def\tabu@target ####1\relax {(tabu) target #1 #1 #1 #1 #1 = \x{####1}^^J}% - \def\tabucolX ####1\relax {(tabu) X columns width#1 = \x{####1}^^J}% - \def\tabu@nbcols ####1\relax {(tabu) Number of columns: \z{####1}^^J}% - \def\tabu@aligndefault ####1{(tabu) Default alignment: #1 #1 ####1^^J}% - \def\col@sep ####1\relax {(tabu) column sep #1 #1 #1 = \x{####1}^^J}% - \def\arrayrulewidth ####1\relax{(tabu) arrayrulewidth #1 = \x{####1}}% - \def\doublerulesep ####1\relax { doublerulesep = \x{####1}^^J}% - \def\extratabsurround####1\relax{(tabu) extratabsurround = \x{####1}^^J}% - \def\extrarowheight ####1\relax{(tabu) extrarowheight #1 = \x{####1}}% - \def\extrarowdepth ####1\relax {extrarowdepth = \x{####1}^^J}% - \def\abovetabulinesep####1\relax{(tabu) abovetabulinesep=\x{####1} }% - \def\belowtabulinesep####1\relax{ belowtabulinesep=\x{####1}^^J}% - \def\arraystretch ####1{(tabu) arraystretch #1 #1 = \z{####1}^^J}% - \def\minrowclearance####1\relax{(tabu) minrowclearance #1 = \x{####1}^^J}% - \def\tabu@arc@L ####1{(tabu) taburulecolor #1 #1 = ####1^^J}% - \def\tabu@drsc@L ####1{(tabu) tabudoublerulecolor= ####1^^J}% - \def\tabu@evr@L ####1{(tabu) everyrow #1 #1 #1 #1 = \detokenize{####1}^^J}% - \def\tabu@ls@L ####1{(tabu) line style = \detokenize{####1}^^J}% - \def\NC@find ####1\@nil{(tabu) tabu preamble#1 #1 = \detokenize{####1}^^J}% - \def\tabu@wddef####1####2{(tabu) Natural width ####1 = \x{####2}^^J}% - \let\edef \@gobbletwo \let\def \@empty \let\let \@gobbletwo - \tabu@message{% - (tabu) \string\savetabu{\tabu@temp}: \on@line^^J% - \tabu@usetabu \@nil^^J}% - \endgroup} -}\do{ } -%% Measuring the natural width (varwidth) - store the results ------- -\def\tabu@startpboxmeasure #1{\bgroup % entering \vtop - \edef\tabu@temp{\expandafter\@secondoftwo \ifx\tabu@hsize #1\else\relax\fi}% - \ifodd 1\ifx \tabu@temp\@empty 0 \else % starts with \tabu@hsize ? - \iftabu@spread \else % if spread -> measure - \ifdim \tabu@temp\p@>\z@ 0 \fi\fi\fi% if coef>0 -> do not measure - \let\@startpbox \tabu@startpboxORI % restore immediately (nesting) - \tabu@measuringtrue % for the quick option... - \tabu@Xcol =\expandafter\@firstoftwo\ifx\tabu@hsize #1\fi - \ifdim \tabu@temp\p@>\z@ \ifdim \tabu@temp\tabucolX<\tabu@target - \tabu@target=\tabu@temp\tabucolX \fi\fi - \setbox\tabu@box \hbox \bgroup - \begin{varwidth}\tabu@target - \let\FV@ListProcessLine \tabu@FV@ListProcessLine % \hbox to natural width... - \narrowragged \arraybackslash \parfillskip \@flushglue - \ifdefined\pdfadjustspacing \pdfadjustspacing\z@ \fi - \bgroup \aftergroup\tabu@endpboxmeasure - \ifdefined \cellspacetoplimit \tabu@cellspacepatch \fi - \else \expandafter\@gobble - \tabu@startpboxquick{#1}% \@gobble \bgroup - \fi -}% \tabu@startpboxmeasure -\def\tabu@cellspacepatch{\def\bcolumn##1\@nil{}\let\ecolumn\@empty - \bgroup\color@begingroup} -\def\tabu@endpboxmeasure {% - \@finalstrut \@arstrutbox - \end{varwidth}\egroup % - \ifdim \tabu@temp\p@ <\z@ % neg coef - \ifdim \tabu@wd\tabu@Xcol <\wd\tabu@box - \tabu@wddef\tabu@Xcol {\the\wd\tabu@box}% - \tabu@debug{\tabu@message@endpboxmeasure}% - \fi - \else % spread coef>0 - \global\advance \tabu@naturalX \wd\tabu@box - \@tempdima =\dimexpr \wd\tabu@box *\p@/\dimexpr \tabu@temp\p@\relax \relax - \ifdim \tabu@naturalXmax <\tabu@naturalX - \xdef\tabu@naturalXmax {\the\tabu@naturalX}\fi - \ifdim \tabu@naturalXmin <\@tempdima - \xdef\tabu@naturalXmin {\the\@tempdima}\fi - \fi - \box\tabu@box \egroup % end of \vtop (measure) restore \tabu@target -}% \tabu@endpboxmeasure -\def\tabu@wddef #1{\expandafter\xdef - \csname tabu@\the\tabu@nested.W\number#1\endcsname} -\def\tabu@wd #1{\csname tabu@\the\tabu@nested.W\number#1\endcsname} -\def\tabu@message@endpboxmeasure{\tabu@spaces\tabu@spaces<-> % <-> save natural wd - \the\tabu@Xcol. X[\tabu@temp]: - target = \the\tabucolX \space - \expandafter\expandafter\expandafter\string\tabu@wd\tabu@Xcol - =\tabu@wd\tabu@Xcol -}% \tabu@message@endpboxmeasure -\def\tabu@startpboxquick {\bgroup - \let\@startpbox \tabu@startpboxORI % restore immediately - \let\tabu \tabu@quick % \begin is expanded before... - \expandafter\@gobble \@startpbox % gobbles \bgroup -}% \tabu@startpboxquick -\def\tabu@quick {\begingroup \iffalse{\fi \ifnum0=`}\fi - \toks@{}\def\tabu@stack{b}\tabu@collectbody \tabu@endquick -}% \tabu@quick -\def\tabu@endquick {% - \ifodd 1\ifx\tabu@end@envir\tabu@endtabu \else - \ifx\tabu@end@envir\tabu@endtabus \else 0\fi\fi\relax - \endgroup - \else \let\endtabu \relax - \tabu@end@envir - \fi -}% \tabu@quick -\def\tabu@endtabu {\end{tabu}} -\def\tabu@endtabus {\end{tabu*}} -%% Measuring the heights and depths - store the results ------------- -\def\tabu@verticalmeasure{\everypar{}% - \ifnum \currentgrouptype>12 % 14=semi-simple, 15=math shift group - \setbox\tabu@box =\hbox\bgroup - \let\tabu@verticalspacing \tabu@verticalsp@lcr - \d@llarbegin % after \hbox ... - \else - \edef\tabu@temp{\ifnum\currentgrouptype=5\vtop - \else\ifnum\currentgrouptype=12\vcenter - \else\vbox\fi\fi}% - \setbox\tabu@box \hbox\bgroup$\tabu@temp \bgroup - \let\tabu@verticalspacing \tabu@verticalsp@pmb - \fi -}% \tabu@verticalmeasure -\def\tabu@verticalsp@lcr{% - \d@llarend \egroup % - \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep - \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax - \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi - \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi - \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi - \noindent\vrule height\@tempdima depth\@tempdimb -}% \tabu@verticalsp@lcr -\def\tabu@verticalsp@pmb{% inserts struts as needed - \par \expandafter\egroup - \expandafter$\expandafter - \egroup \expandafter - \@tempdimc \the\prevdepth - \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep - \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax - \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi - \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi - \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi - \let\@finalstrut \@gobble - \hrule height\@tempdima depth\@tempdimb width\hsize -%% \box\tabu@box -}% \tabu@verticalsp@pmb - -\def\tabu@verticalinit{% - \ifnum \c@taburow=\z@ \tabu@rearstrut \fi % after \tabu@reset ! - \advance\c@taburow \@ne - \tabu@htdef{\the\ht\@arstrutbox}\tabu@dpdef{\the\dp\@arstrutbox}% - \advance\c@taburow \m@ne -}% \tabu@verticalinit -\def\tabu@htdef {\expandafter\xdef \csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname} -\def\tabu@ht {\csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname} -\def\tabu@dpdef {\expandafter\xdef \csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname} -\def\tabu@dp {\csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname} -\def\tabu@verticaldynamicadjustment {% - \advance\c@taburow \@ne - \extrarowheight \dimexpr\tabu@ht - \ht\strutbox - \extrarowdepth \dimexpr\tabu@dp - \dp\strutbox - \let\arraystretch \@empty - \advance\c@taburow \m@ne -}% \tabu@verticaldynamicadjustment -\def\tabuphantomline{\crcr \noalign{% - {\globaldefs \@ne - \setbox\@arstrutbox \box\voidb@x - \let\tabu@@celllalign \tabu@celllalign - \let\tabu@@cellralign \tabu@cellralign - \let\tabu@@cellleft \tabu@cellleft - \let\tabu@@cellright \tabu@cellright - \let\tabu@@thevline \tabu@thevline - \let\tabu@celllalign \@empty - \let\tabu@cellralign \@empty - \let\tabu@cellright \@empty - \let\tabu@cellleft \@empty - \let\tabu@thevline \relax}% - \edef\tabu@temp{\tabu@multispan \tabu@nbcols{\noindent &}}% - \toks@\expandafter{\tabu@temp \noindent\tabu@everyrowfalse \cr - \noalign{\tabu@rearstrut - {\globaldefs\@ne - \let\tabu@celllalign \tabu@@celllalign - \let\tabu@cellralign \tabu@@cellralign - \let\tabu@cellleft \tabu@@cellleft - \let\tabu@cellright \tabu@@cellright - \let\tabu@thevline \tabu@@thevline}}}% - \expandafter}\the\toks@ -}% \tabuphantomline -%% \firsthline and \lasthline corrections --------------------------- -\def\tabu@firstline {\tabu@hlineAZ \tabu@firsthlinecorrection {}} -\def\tabu@firsthline{\tabu@hlineAZ \tabu@firsthlinecorrection \hline} -\def\tabu@lastline {\tabu@hlineAZ \tabu@lasthlinecorrection {}} -\def\tabu@lasthline {\tabu@hlineAZ \tabu@lasthlinecorrection \hline} -\def\tabu@hline {% replaces \hline if no colortbl (see \AtBeginDocument) - \noalign{\ifnum0=`}\fi - {\CT@arc@\hrule height\arrayrulewidth}% - \futurelet \tabu@temp \tabu@xhline -}% \tabu@hline -\def\tabu@xhline{% - \ifx \tabu@temp \hline - {\ifx \CT@drsc@\relax \vskip - \else\ifx \CT@drsc@\@empty \vskip - \else \CT@drsc@\hrule height - \fi\fi - \doublerulesep}% - \fi - \ifnum0=`{\fi}% -}% \tabu@xhline -\def\tabu@hlineAZ #1#2{\noalign{\ifnum0=`}\fi \dimen@ \z@ \count@ \z@ - \toks@{}\def\tabu@hlinecorrection{#1}\def\tabu@temp{#2}% - \tabu@hlineAZsurround -}% \tabu@hlineAZ -\newcommand*\tabu@hlineAZsurround[1][\extratabsurround]{% - \extratabsurround #1\let\tabucline \tabucline@scan - \let\hline \tabu@hlinescan \let\firsthline \hline - \let\cline \tabu@clinescan \let\lasthline \hline - \expandafter \futurelet \expandafter \tabu@temp - \expandafter \tabu@nexthlineAZ \tabu@temp -}% \tabu@hlineAZsurround -\def\tabu@hlinescan {\tabu@thick \arrayrulewidth \tabu@xhlineAZ \hline} -\def\tabu@clinescan #1{\tabu@thick \arrayrulewidth \tabu@xhlineAZ {\cline{#1}}} -\def\tabucline@scan{\@testopt \tabucline@sc@n {}} -\def\tabucline@sc@n #1[#2]{\tabu@xhlineAZ {\tabucline[{#1}]{#2}}} -\def\tabu@nexthlineAZ{% - \ifx \tabu@temp\hline \else - \ifx \tabu@temp\cline \else - \ifx \tabu@temp\tabucline \else - \tabu@hlinecorrection - \fi\fi\fi -}% \tabu@nexthlineAZ -\def\tabu@xhlineAZ #1{% - \toks@\expandafter{\the\toks@ #1}% - \@tempdimc \tabu@thick % The last line width - \ifcase\count@ \@tempdimb \tabu@thick % The first line width - \else \advance\dimen@ \dimexpr \tabu@thick+\doublerulesep \relax - \fi - \advance\count@ \@ne \futurelet \tabu@temp \tabu@nexthlineAZ -}% \tabu@xhlineAZ -\def\tabu@firsthlinecorrection{% \count@ = number of \hline -1 - \@tempdima \dimexpr \ht\@arstrutbox+\dimen@ - \edef\firsthline{% - \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule - height \the\dimexpr\@tempdima+\extratabsurround - depth \dp\@arstrutbox - width \tabustrutrule}\hss}\cr - \noalign{\vskip -\the\dimexpr \@tempdima+\@tempdimb - +\dp\@arstrutbox \relax}% - \the\toks@ - }\ifnum0=`{\fi - \expandafter}\firsthline % we are then ! -}% \tabu@firsthlinecorrection -\def\tabu@lasthlinecorrection{% - \@tempdima \dimexpr \dp\@arstrutbox+\dimen@+\@tempdimb+\@tempdimc - \edef\lasthline{% - \the\toks@ - \noalign{\vskip -\the\dimexpr\dimen@+\@tempdimb+\dp\@arstrutbox}% - \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule - depth \the\dimexpr \dp\@arstrutbox+\@tempdimb+\dimen@ - +\extratabsurround-\@tempdimc - height \z@ - width \tabustrutrule}\hss}\cr - }\ifnum0=`{\fi - \expandafter}\lasthline % we are then ! -}% \tabu@lasthlinecorrection -\def\tabu@LT@@hline{% - \ifx\LT@next\hline - \global\let\LT@next \@gobble - \ifx \CT@drsc@\relax - \gdef\CT@LT@sep{% - \noalign{\penalty-\@medpenalty\vskip\doublerulesep}}% - \else - \gdef\CT@LT@sep{% - \multispan\LT@cols{% - \CT@drsc@\leaders\hrule\@height\doublerulesep\hfill}\cr}% - \fi - \else - \global\let\LT@next\empty - \gdef\CT@LT@sep{% - \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}% - \fi - \ifnum0=`{\fi}% - \multispan\LT@cols - {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr - \CT@LT@sep - \multispan\LT@cols - {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr - \noalign{\penalty\@M}% - \LT@next -}% \tabu@LT@@hline -%% Horizontal lines : \tabucline ------------------------------------ -\let\tabu@start \@tempcnta -\let\tabu@stop \@tempcntb -\newcommand*\tabucline{\noalign{\ifnum0=`}\fi \tabu@cline} -\newcommand*\tabu@cline[2][]{\tabu@startstop{#2}% - \ifnum \tabu@stop<\z@ \toks@{}% - \else \tabu@clinearg{#1}\tabu@thestyle - \edef\tabucline{\toks@{% - \ifnum \tabu@start>\z@ \omit - \tabu@multispan\tabu@start {\span\omit}&\fi - \omit \tabu@multispan\tabu@stop {\span\omit}% - \tabu@thehline\cr - }}\tabucline - \tabu@tracinglines{(tabu:tabucline) Style: #1^^J\the\toks@^^J^^J}% - \fi - \futurelet \tabu@temp \tabu@xcline -}% \tabu@cline -\def\tabu@clinearg #1{% - \ifx\\#1\\\let\tabu@thestyle \tabu@ls@ - \else \@defaultunits \expandafter\let\expandafter\@tempa - \romannumeral-`\0#1\relax \@nnil - \ifx \hbox\@tempa \tabu@clinebox{#1}% - \else\ifx \box\@tempa \tabu@clinebox{#1}% - \else\ifx \vbox\@tempa \tabu@clinebox{#1}% - \else\ifx \vtop\@tempa \tabu@clinebox{#1}% - \else\ifx \copy\@tempa \tabu@clinebox{#1}% - \else\ifx \leaders\@tempa \tabu@clineleads{#1}% - \else\ifx \cleaders\@tempa \tabu@clineleads{#1}% - \else\ifx \xleaders\@tempa \tabu@clineleads{#1}% - \else\tabu@getline {#1}% - \fi\fi\fi\fi\fi\fi\fi\fi - \fi -}% \tabu@clinearg -\def\tabu@clinebox #1{\tabu@clineleads{\xleaders#1\hss}} -\def\tabu@clineleads #1{% - \let\tabu@thestyle \relax \let\tabu@leaders \@undefined - \gdef\tabu@thehrule{#1}} -\def\tabu@thehline{\begingroup - \ifdefined\tabu@leaders - \noexpand\tabu@thehleaders - \else \noexpand\tabu@thehrule - \fi \endgroup -}% \tabu@thehline -\def\tabu@xcline{% - \ifx \tabu@temp\tabucline - \toks@\expandafter{\the\toks@ \noalign - {\ifx\CT@drsc@\relax \vskip - \else \CT@drsc@\hrule height - \fi - \doublerulesep}}% - \fi - \tabu@docline -}% \tabu@xcline -\def\tabu@docline {\ifnum0=`{\fi \expandafter}\the\toks@} -\def\tabu@docline@evr {\xdef\tabu@doclineafter{\the\toks@}% - \ifnum0=`{\fi}\aftergroup\tabu@doclineafter} -\def\tabu@multispan #1#2{% - \ifnum\numexpr#1>\@ne #2\expandafter\tabu@multispan - \else \expandafter\@gobbletwo - \fi {#1-1}{#2}% -}% \tabu@multispan -\def\tabu@startstop #1{\tabu@start@stop #1\relax 1-\tabu@nbcols \@nnil} -\def\tabu@start@stop #1-#2\@nnil{% - \@defaultunits \tabu@start\number 0#1\relax \@nnil - \@defaultunits \tabu@stop \number 0#2\relax \@nnil - \tabu@stop \ifnum \tabu@start>\tabu@nbcols \m@ne - \else\ifnum \tabu@stop=\z@ \tabu@nbcols - \else\ifnum \tabu@stop>\tabu@nbcols \tabu@nbcols - \else \tabu@stop - \fi\fi\fi - \advance\tabu@start \m@ne - \ifnum \tabu@start>\z@ \advance\tabu@stop -\tabu@start \fi -}% \tabu@start@stop -%% Numbers: siunitx S columns (and \tabudecimal) ------------------- -\def\tabu@tabudecimal #1{% - \def\tabu@decimal{#1}\@temptokena{}% - \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces - \tabu@scandecimal -}% \tabu@tabudecimal -\def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@} -\def\tabu@skipdecimal#1{#1\tabu@scandecimal} -\def\tabu@getdecimal@ignorespaces{% - \ifcase 0\ifx\tabu@temp\ignorespaces\else - \ifx\tabu@temp\@sptoken1\else - 2\fi\fi\relax - \let\tabu@getdecimal@ \tabu@getdecimal - \expandafter\tabu@skipdecimal - \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal - \else \expandafter\tabu@skipdecimal - \fi -}% \tabu@getdecimal@ignorespaces -\def\tabu@get@decimal#1{\@temptokena\expandafter{\the\@temptokena #1}% - \tabu@scandecimal} -\def\do#1{% - \def\tabu@get@decimalspace#1{% - \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}% -}\do{ } -\let\tabu@@tabudecimal \tabu@tabudecimal -\def\tabu@getdecimal{% - \ifcase 0\ifx 0\tabu@temp\else - \ifx 1\tabu@temp\else - \ifx 2\tabu@temp\else - \ifx 3\tabu@temp\else - \ifx 4\tabu@temp\else - \ifx 5\tabu@temp\else - \ifx 6\tabu@temp\else - \ifx 7\tabu@temp\else - \ifx 8\tabu@temp\else - \ifx 9\tabu@temp\else - \ifx .\tabu@temp\else - \ifx ,\tabu@temp\else - \ifx -\tabu@temp\else - \ifx +\tabu@temp\else - \ifx e\tabu@temp\else - \ifx E\tabu@temp\else - \ifx\tabu@cellleft\tabu@temp1\else - \ifx\ignorespaces\tabu@temp1\else - \ifx\@sptoken\tabu@temp2\else - 3\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax - \expandafter\tabu@get@decimal - \or \expandafter\tabu@skipdecimal - \or \expandafter\tabu@get@decimalspace - \else\expandafter\tabu@printdecimal - \fi -}% \tabu@getdecimal -\def\tabu@printdecimal{% - \edef\tabu@temp{\the\@temptokena}% - \ifx\tabu@temp\@empty\else - \ifx\tabu@temp\space\else - \expandafter\tabu@decimal\expandafter{\the\@temptokena}% - \fi\fi -}% \tabu@printdecimal -%% Verbatim inside X columns ---------------------------------------- -\def\tabu@verbatim{% - \let\verb \tabu@verb - \let\FV@DefineCheckEnd \tabu@FV@DefineCheckEnd -}% \tabu@verbatim -\let\tabu@ltx@verb \verb -\def\tabu@verb{\@ifstar {\tabu@ltx@verb*} \tabu@ltx@verb} -\def\tabu@fancyvrb {% - \def\tabu@FV@DefineCheckEnd ##1{% - \def\tabu@FV@DefineCheckEnd{% - ##1% - \let\FV@CheckEnd \tabu@FV@CheckEnd - \let\FV@@CheckEnd \tabu@FV@@CheckEnd - \let\FV@@@CheckEnd \tabu@FV@@@CheckEnd - \edef\FV@EndScanning{% - \def\noexpand\next{\noexpand\end{\FV@EnvironName}}% - \global\let\noexpand\FV@EnvironName\relax - \noexpand\next}% - \xdef\FV@EnvironName{\detokenize\expandafter{\FV@EnvironName}}}% - }\expandafter\tabu@FV@DefineCheckEnd\expandafter{\FV@DefineCheckEnd} -}% \tabu@fancyvrb -\def\tabu@FV@CheckEnd #1{\expandafter\FV@@CheckEnd \detokenize{#1\end{}}\@nil} -\edef\tabu@FV@@@CheckEnd {\detokenize{\end{}}} -\begingroup -\catcode`\[1 \catcode`\]2 -\@makeother\{ \@makeother\} - \edef\x[\endgroup - \def\noexpand\tabu@FV@@CheckEnd ##1\detokenize[\end{]##2\detokenize[}]##3% - ]\x \@nil{\def\@tempa{#2}\def\@tempb{#3}} -\def\tabu@FV@ListProcessLine #1{% - \hbox {%to \hsize{% - \kern\leftmargin - \hbox {%to \linewidth{% - \FV@LeftListNumber - \FV@LeftListFrame - \FancyVerbFormatLine{#1}\hss -%% DG/SR modification begin - Jan. 28, 1998 (for numbers=right add-on) -%% \FV@RightListFrame}% - \FV@RightListFrame - \FV@RightListNumber}% -%% DG/SR modification end - \hss}} -%% \savetabu -------------------------------------------------------- -\newcommand*\savetabu[1]{\noalign{% - \tabu@sanitizearg{#1}\tabu@temp - \ifx \tabu@temp\@empty \tabu@savewarn{}{The tabu will not be saved}\else - \@ifundefined{tabu@saved@\tabu@temp}{}{\tabu@savewarn{#1}{Overwriting}}% - \ifdefined\tabu@restored \expandafter\let - \csname tabu@saved@\tabu@temp \endcsname \tabu@restored - \else {\tabu@save}% - \fi - \fi}% -}% \savetabu -\def\tabu@save {% - \toks0\expandafter{\tabu@saved@}% - \iftabu@negcoef - \let\tabu@wddef \relax \let\tabu@ \tabu@savewd \edef\tabu@savewd{\tabu@Xcoefs}% - \toks0\expandafter{\the\toks\expandafter0\tabu@savewd}\fi - \toks1\expandafter{\tabu@savedpream}% - \toks2\expandafter{\tabu@savedpreamble}% - \let\@preamble \relax - \let\tabu@savedpream \relax \let\tabu@savedparams \relax - \edef\tabu@preamble{% - \def\noexpand\tabu@aligndefault{\tabu@align}% - \def\tabu@savedparams {\noexpand\the\toks0}% - \def\tabu@savedpream {\noexpand\the\toks1}}% - \edef\tabu@usetabu{% - \def\@preamble {\noexpand\the\toks2}% - \tabu@target \the\tabu@target \relax - \tabucolX \the\tabucolX \relax - \tabu@nbcols \the\tabu@nbcols \relax - \def\noexpand\tabu@aligndefault{\tabu@align}% - \def\tabu@savedparams {\noexpand\the\toks0}% - \def\tabu@savedpream {\noexpand\the\toks1}}% - \let\tabu@aligndefault \relax \let\@sharp \relax - \edef\@tempa{\noexpand\tabu@s@ved - {\tabu@usetabu} - {\tabu@preamble} - {\the\toks1}}\@tempa - \tabu@message@save -}% \tabu@save -\long\def\tabu@s@ved #1#2#3{% - \def\tabu@usetabu{#1}% - \expandafter\gdef\csname tabu@saved@\tabu@temp\endcsname ##1{% - \ifodd ##1% \usetabu - \tabu@measuringfalse \tabu@spreadfalse % Just in case... - \gdef\tabu@usetabu {% - \ifdim \tabu@target>\z@ \tabu@warn@usetabu \fi - \global\let\tabu@usetabu \@undefined - \def\@halignto {to\tabu@target}% - #1% - \ifx \tabu@align\tabu@aligndefault@text - \ifnum \tabu@nested=\z@ - \let\tabu@align \tabu@aligndefault \fi\fi}% - \else % \preamble - \gdef\tabu@preamble {% - \global\let\tabu@preamble \@undefined - #2% - \ifx \tabu@align\tabu@aligndefault@text - \ifnum \tabu@nested=\z@ - \let\tabu@align \tabu@aligndefault \fi\fi}% - \fi - #3}% -}% \tabu@s@ved -\def\tabu@aligndefault@text {\tabu@aligndefault}% -\def\tabu@warn@usetabu {\PackageWarning{tabu} - {Specifying a target with \string\usetabu\space is useless - \MessageBreak The target cannot be changed!}} -\def\tabu@savewd #1#2{\ifdim #2\p@<\z@ \tabu@wddef{#1}{\tabu@wd{#1}}\fi} -\def\tabu@savewarn#1#2{\PackageInfo{tabu} - {User-name `#1' already used for \string\savetabu - \MessageBreak #2}}% -\def\tabu@saveerr#1{\PackageError{tabu} - {User-name `#1' is unknown for \string\usetabu - \MessageBreak I cannot restore an unknown preamble!}\@ehd} -%% \rowfont --------------------------------------------------------- -\newskip \tabu@cellskip -\def\tabu@rowfont{\ifdim \baselineskip=\z@\noalign\fi - {\ifnum0=`}\fi \tabu@row@font} -\newcommand*\tabu@row@font[2][]{% - \ifnum7=\currentgrouptype - \global\let\tabu@@cellleft \tabu@cellleft - \global\let\tabu@@cellright \tabu@cellright - \global\let\tabu@@celllalign \tabu@celllalign - \global\let\tabu@@cellralign \tabu@cellralign - \global\let\tabu@@rowfontreset\tabu@rowfontreset - \fi - \global\let\tabu@rowfontreset \tabu@rowfont@reset - \expandafter\gdef\expandafter\tabu@cellleft\expandafter{\tabu@cellleft #2}% - \ifcsname tabu@cell@#1\endcsname % row alignment - \csname tabu@cell@#1\endcsname \fi - \ifnum0=`{\fi}% end of group / noalign group -}% \rowfont -\def\tabu@ifcolorleavevmode #1{\let\color \tabu@leavevmodecolor #1\let\color\tabu@color}% -\def\tabu@rowfont@reset{% - \global\let\tabu@rowfontreset \tabu@@rowfontreset - \global\let\tabu@cellleft \tabu@@cellleft - \global\let\tabu@cellright \tabu@@cellright - \global\let\tabu@cellfont \@empty - \global\let\tabu@celllalign \tabu@@celllalign - \global\let\tabu@cellralign \tabu@@cellralign -}% \tabu@@rowfontreset -\let\tabu@rowfontreset \@empty % overwritten \AtBeginDocument if colortbl -%% \tabu@prepnext@tok ----------------------------------------------- -\newif \iftabu@cellright -\def\tabu@prepnext@tok{% - \ifnum \count@<\z@ % - \@tempcnta \@M % - \tabu@nbcols\z@ - \let\tabu@fornoopORI \@fornoop - \tabu@cellrightfalse - \else - \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left - \advance \tabu@nbcols \@ne - \iftabu@cellright % before-previous token is right and is finished - \tabu@cellrightfalse % - \tabu@righttok - \fi - \tabu@lefttok - \or % (case 1) previous token is right - \tabu@cellrighttrue \let\@fornoop \tabu@lastnoop - \else % special column: do not change the token - \iftabu@cellright % before-previous token is right - \tabu@cellrightfalse - \tabu@righttok - \fi - \fi % \ifcase - \fi - \tabu@prepnext@tokORI -}% \tabu@prepnext@tok -\long\def\tabu@lastnoop#1\@@#2#3{\tabu@lastn@@p #2\@nextchar \in@\in@@} -\def\tabu@lastn@@p #1\@nextchar #2#3\in@@{% - \ifx \in@#2\else - \let\@fornoop \tabu@fornoopORI - \xdef\tabu@mkpreambuffer{\tabu@nbcols\the\tabu@nbcols \tabu@mkpreambuffer}% - \toks0\expandafter{\expandafter\tabu@everyrowtrue \the\toks0}% - \expandafter\prepnext@tok - \fi -}% \tabu@lastnoop -\def\tabu@righttok{% - \advance \count@ \m@ne - \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}% - \advance \count@ \@ne -}% \tabu@righttok -\def\tabu@lefttok{\toks\count@\expandafter{\expandafter\tabu@celllalign - \the\toks\count@ \tabu@cellleft}% after because of $ -}% \tabu@lefttok -%% Neutralisation of glues ------------------------------------------ -\let\tabu@cellleft \@empty -\let\tabu@cellright \@empty -\tabu@celllalign@def{\tabu@cellleft}% -\let\tabu@cellralign \@empty -\def\tabu@cell@align #1#2#3{% - \let\tabu@maybesiunitx \toks@ \tabu@celllalign - \global \expandafter \tabu@celllalign@def \expandafter {\the\toks@ #1}% - \toks@\expandafter{\tabu@cellralign #2}% - \xdef\tabu@cellralign{\the\toks@}% - \toks@\expandafter{\tabu@cellleft #3}% - \xdef\tabu@cellleft{\the\toks@}% -}% \tabu@cell@align -\def\tabu@cell@l{% force alignment to left - \tabu@cell@align - {\tabu@removehfil \raggedright \tabu@cellleft}% left - {\tabu@flush1\tabu@ignorehfil}% right - \raggedright -}% \tabu@cell@l -\def\tabu@cell@c{% force alignment to center - \tabu@cell@align - {\tabu@removehfil \centering \tabu@flush{.5}\tabu@cellleft} - {\tabu@flush{.5}\tabu@ignorehfil} - \centering -}% \tabu@cell@c -\def\tabu@cell@r{% force alignment to right - \tabu@cell@align - {\tabu@removehfil \raggedleft \tabu@flush1\tabu@cellleft} - \tabu@ignorehfil - \raggedleft -}% \tabu@cell@r -\def\tabu@cell@j{% force justification (for p, m, b columns) - \tabu@cell@align - {\tabu@justify\tabu@cellleft} - {} - \tabu@justify -}% \tabu@cell@j -\def\tabu@justify{% - \leftskip\z@skip \@rightskip\leftskip \rightskip\@rightskip - \parfillskip\@flushglue -}% \tabu@justify -%% ragged2e settings -\def\tabu@cell@L{% force alignment to left (ragged2e) - \tabu@cell@align - {\tabu@removehfil \RaggedRight \tabu@cellleft} - {\tabu@flush 1\tabu@ignorehfil} - \RaggedRight -}% \tabu@cell@L -\def\tabu@cell@C{% force alignment to center (ragged2e) - \tabu@cell@align - {\tabu@removehfil \Centering \tabu@flush{.5}\tabu@cellleft} - {\tabu@flush{.5}\tabu@ignorehfil} - \Centering -}% \tabu@cell@C -\def\tabu@cell@R{% force alignment to right (ragged2e) - \tabu@cell@align - {\tabu@removehfil \RaggedLeft \tabu@flush 1\tabu@cellleft} - \tabu@ignorehfil - \RaggedLeft -}% \tabu@cell@R -\def\tabu@cell@J{% force justification (ragged2e) - \tabu@cell@align - {\justifying \tabu@cellleft} - {} - \justifying -}% \tabu@cell@J -\def\tabu@flush#1{% - \iftabu@colortbl % colortbl uses \hfill rather than \hfil - \hskip \ifnum13<\currentgrouptype \stretch{#1}% - \else \ifdim#1pt<\p@ \tabu@cellskip - \else \stretch{#1} - \fi\fi \relax - \else % array.sty - \ifnum 13<\currentgrouptype - \hfil \hskip1sp \relax \fi - \fi -}% \tabu@flush -\let\tabu@hfil \hfil -\let\tabu@hfill \hfill -\let\tabu@hskip \hskip -\def\tabu@removehfil{% - \iftabu@colortbl - \unkern \tabu@cellskip =\lastskip - \ifnum\gluestretchorder\tabu@cellskip =\tw@ \hskip-\tabu@cellskip - \else \tabu@cellskip \z@skip - \fi - \else - \ifdim\lastskip=1sp\unskip\fi - \ifnum\gluestretchorder\lastskip =\@ne - \hfilneg % \hfilneg for array.sty but not for colortbl... - \fi - \fi -}% \tabu@removehfil -\def\tabu@ignorehfil{\aftergroup \tabu@nohfil} -\def\tabu@nohfil{% \hfil -> do nothing + restore original \hfil - \def\hfil{\let\hfil \tabu@hfil}% local to (alignment template) group -}% \tabu@nohfil -\def\tabu@colortblalignments {% if colortbl - \def\tabu@nohfil{% - \def\hfil {\let\hfil \tabu@hfil}% local to (alignment template) group - \def\hfill {\let\hfill \tabu@hfill}% (colortbl uses \hfill) pfff... - \def\hskip ####1\relax{\let\hskip \tabu@hskip}}% local -}% \tabu@colortblalignments -%% Taking care of footnotes and hyperfootnotes ---------------------- -\long\def\tabu@footnotetext #1{% - \edef\@tempa{\the\tabu@footnotes - \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}% - \global\tabu@footnotes\expandafter{\@tempa {#1}}}% -\long\def\tabu@xfootnotetext [#1]#2{% - \global\tabu@footnotes\expandafter{\the\tabu@footnotes - \footnotetext [{#1}]{#2}}} -\let\tabu@xfootnote \@xfootnote -\long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }} -\long\def\tabu@Hy@xfootnote [#1]{% - \begingroup - \value\@mpfn #1\relax - \protected@xdef \@thefnmark {\thempfn}% - \endgroup - \@footnotemark \tabu@Hy@ftntxt {#1}% -}% \tabu@Hy@xfootnote -\long\def\tabu@Hy@ftntxt #1#2{% - \edef\@tempa{% - \the\tabu@footnotes - \begingroup - \value\@mpfn #1\relax - \noexpand\protected@xdef\noexpand\@thefnmark {\noexpand\thempfn}% - \expandafter \noexpand \expandafter - \tabu@Hy@footnotetext \expandafter{\Hy@footnote@currentHref}% - }% - \global\tabu@footnotes\expandafter{\@tempa {#2}% - \endgroup}% -}% \tabu@Hy@ftntxt -\long\def\tabu@Hy@footnotetext #1#2{% - \H@@footnotetext{% - \ifHy@nesting - \hyper@@anchor {#1}{#2}% - \else - \Hy@raisedlink{% - \hyper@@anchor {#1}{\relax}% - }% - \def\@currentHref {#1}% - \let\@currentlabelname \@empty - #2% - \fi - }% -}% \tabu@Hy@footnotetext -%% No need for \arraybackslash ! ------------------------------------ -\def\tabu@latextwoe {% -\def\tabu@temp##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}} -\tabu@temp \tabu@centering \centering \arraybackslash -\tabu@temp \tabu@raggedleft \raggedleft \arraybackslash -\tabu@temp \tabu@raggedright \raggedright \arraybackslash -}% \tabu@latextwoe -\def\tabu@raggedtwoe {% -\def\tabu@temp ##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}} -\tabu@temp \tabu@Centering \Centering \arraybackslash -\tabu@temp \tabu@RaggedLeft \RaggedLeft \arraybackslash -\tabu@temp \tabu@RaggedRight \RaggedRight \arraybackslash -\tabu@temp \tabu@justifying \justifying \arraybackslash -}% \tabu@raggedtwoe -\def\tabu@normalcrbackslash{\let\\\@normalcr} -\def\tabu@trivlist{\expandafter\def\expandafter\@trivlist\expandafter{% - \expandafter\tabu@normalcrbackslash \@trivlist}} -%% Utilities: \fbox \fcolorbox and \tabudecimal ------------------- -\def\tabu@fbox {\leavevmode\afterassignment\tabu@beginfbox \setbox\@tempboxa\hbox} -\def\tabu@beginfbox {\bgroup \kern\fboxsep - \bgroup\aftergroup\tabu@endfbox} -\def\tabu@endfbox {\kern\fboxsep\egroup\egroup - \@frameb@x\relax} -\def\tabu@color@b@x #1#2{\leavevmode \bgroup - \def\tabu@docolor@b@x{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}% - \afterassignment\tabu@begincolor@b@x \setbox\z@ \hbox -}% \tabu@color@b@x -\def\tabu@begincolor@b@x {\kern\fboxsep \bgroup - \aftergroup\tabu@endcolor@b@x \set@color} -\def\tabu@endcolor@b@x {\kern\fboxsep \egroup - \dimen@\ht\z@ \advance\dimen@ \fboxsep \ht\z@ \dimen@ - \dimen@\dp\z@ \advance\dimen@ \fboxsep \dp\z@ \dimen@ - \tabu@docolor@b@x \egroup -}% \tabu@endcolor@b@x -%% Corrections (arydshln, delarray, colortbl) ----------------------- -\def\tabu@fix@arrayright {%% \@arrayright is missing from \endarray - \iftabu@colortbl - \ifdefined\adl@array % - \def\tabu@endarray{% - \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup % - \@arrayright % - \gdef\@preamble{}}% - \else % - \def\tabu@endarray{% - \crcr \egroup \egroup % - \@arrayright % - \gdef\@preamble{}\CT@end}% - \fi - \else - \ifdefined\adl@array % - \def\tabu@endarray{% - \adl@endarray \egroup \adl@arrayrestore \egroup % - \@arrayright % - \gdef\@preamble{}}% - \else % - \PackageWarning{tabu} - {\string\@arrayright\space is missing from the - \MessageBreak definition of \string\endarray. - \MessageBreak Compatibility with delarray.sty is broken.}% - \fi\fi -}% \tabu@fix@arrayright -\def\tabu@adl@xarraydashrule #1#2#3{% - \ifnum\@lastchclass=\adl@class@start\else - \ifnum\@lastchclass=\@ne\else - \ifnum\@lastchclass=5 \else % @-arg (class 5) and !-arg (class 1) - \adl@leftrulefalse \fi\fi % must be treated the same - \fi - \ifadl@zwvrule\else \ifadl@inactive\else - \@addtopreamble{\vrule\@width\arrayrulewidth - \@height\z@ \@depth\z@}\fi \fi - \ifadl@leftrule - \@addtopreamble{\adl@vlineL{\CT@arc@}{\adl@dashgapcolor}% - {\number#1}#3}% - \else \@addtopreamble{\adl@vlineR{\CT@arc@}{\adl@dashgapcolor}% - {\number#2}#3} - \fi -}% \tabu@adl@xarraydashrule -\def\tabu@adl@act@endpbox {% - \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox - \egroup \egroup - \adl@colhtdp \box\adl@box \hfil -}% \tabu@adl@act@endpbox -\def\tabu@adl@fix {% - \let\adl@xarraydashrule \tabu@adl@xarraydashrule % arydshln - \let\adl@act@endpbox \tabu@adl@act@endpbox % arydshln - \let\adl@act@@endpbox \tabu@adl@act@endpbox % arydshln - \let\@preamerror \@preamerr % arydshln -}% \tabu@adl@fix -%% Correction for longtable' \@startbox definition ------------------ -%% => \everypar is ``missing'' : TeX should be in vertical mode -\def\tabu@LT@startpbox #1{% - \bgroup - \let\@footnotetext\LT@p@ftntext - \setlength\hsize{#1}% - \@arrayparboxrestore - \everypar{% - \vrule \@height \ht\@arstrutbox \@width \z@ - \everypar{}}% -}% \tabu@LT@startpbox -%% \tracingtabu and the package options ------------------ -\DeclareOption{delarray}{\AtEndOfPackage{\RequirePackage{delarray}}} -\DeclareOption{linegoal}{% - \AtEndOfPackage{% - \RequirePackage{linegoal}[2010/12/07]% - \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX -}} -\DeclareOption{scantokens}{\tabuscantokenstrue} -\DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu=\tw@}} -\def\tracingtabu {\begingroup\@ifnextchar=% - {\afterassignment\tabu@tracing\count@} - {\afterassignment\tabu@tracing\count@1\relax}} -\def\tabu@tracing{\expandafter\endgroup - \expandafter\tabu@tr@cing \the\count@ \relax -}% \tabu@tracing -\def\tabu@tr@cing #1\relax {% - \ifnum#1>\thr@@ \let\tabu@tracinglines\message - \else \let\tabu@tracinglines\@gobble - \fi - \ifnum#1>\tw@ \let\tabu@DBG \tabu@@DBG - \def\tabu@mkarstrut {\tabu@DBG@arstrut}% - \tabustrutrule 1.5\p@ - \else \let\tabu@DBG \@gobble - \def\tabu@mkarstrut {\tabu@arstrut}% - \tabustrutrule \z@ - \fi - \ifnum#1>\@ne \let\tabu@debug \message - \else \let\tabu@debug \@gobble - \fi - \ifnum#1>\z@ - \let\tabu@message \message - \let\tabu@tracing@save \tabu@message@save - \let\tabu@starttimer \tabu@pdftimer - \else - \let\tabu@message \@gobble - \let\tabu@tracing@save \@gobble - \let\tabu@starttimer \relax - \fi -}% \tabu@tr@cing -%% Setup \AtBeginDocument -\AtBeginDocument{\tabu@AtBeginDocument} -\def\tabu@AtBeginDocument{\let\tabu@AtBeginDocument \@undefined - \ifdefined\arrayrulecolor \tabu@colortbltrue % - \tabu@colortblalignments % different glues are used - \else \tabu@colortblfalse \fi - \ifdefined\CT@arc@ \else \let\CT@arc@ \relax \fi - \ifdefined\CT@drsc@\else \let\CT@drsc@ \relax \fi - \let\tabu@arc@L \CT@arc@ \let\tabu@drsc@L \CT@drsc@ - \ifodd 1\ifcsname siunitx_table_collect_begin:Nn\endcsname % - \expandafter\ifx - \csname siunitx_table_collect_begin:Nn\endcsname\relax 0\fi\fi\relax - \tabu@siunitxtrue - \else \let\tabu@maybesiunitx \@firstofone % - \let\tabu@siunitx \tabu@nosiunitx - \tabu@siunitxfalse - \fi - \ifdefined\adl@array % - \else \let\tabu@adl@fix \relax - \let\tabu@adl@endtrial \@empty \fi - \ifdefined\longtable % - \else \let\longtabu \tabu@nolongtabu \fi - \ifdefined\cellspacetoplimit \tabu@warn@cellspace\fi - \csname\ifcsname ifHy@hyperfootnotes\endcsname % - ifHy@hyperfootnotes\else iffalse\fi\endcsname - \let\tabu@footnotetext \tabu@Hy@ftntext - \let\tabu@xfootnote \tabu@Hy@xfootnote \fi - \ifdefined\FV@DefineCheckEnd% - \tabu@fancyvrb \fi - \ifdefined\color % - \let\tabu@color \color - \def\tabu@leavevmodecolor ##1{% - \def\tabu@leavevmodecolor {\leavevmode ##1}% - }\expandafter\tabu@leavevmodecolor\expandafter{\color}% - \else - \let\tabu@color \tabu@nocolor - \let\tabu@leavevmodecolor \@firstofone \fi - \tabu@latextwoe - \ifdefined\@raggedtwoe@everyselectfont % - \tabu@raggedtwoe - \else - \let\tabu@cell@L \tabu@cell@l - \let\tabu@cell@R \tabu@cell@r - \let\tabu@cell@C \tabu@cell@c - \let\tabu@cell@J \tabu@cell@j \fi - \expandafter\in@ \expandafter\@arrayright \expandafter{\endarray}% - \ifin@ \let\tabu@endarray \endarray - \else \tabu@fix@arrayright \fi% - \everyrow{}% -}% \tabu@AtBeginDocument -\def\tabu@warn@cellspace{% - \PackageWarning{tabu}{% - Package cellspace has some limitations - \MessageBreak And redefines some macros of array.sty. - \MessageBreak Please use \string\tabulinesep\space to control - \MessageBreak vertical spacing of lines inside tabu environment}% -}% \tabu@warn@cellspace -%% tabu Package initialisation -\tabuscantokensfalse -\let\tabu@arc@G \relax -\let\tabu@drsc@G \relax -\let\tabu@evr@G \@empty -\let\tabu@rc@G \@empty -\def\tabu@ls@G {\tabu@linestyle@}% -\let\tabu@@rowfontreset \@empty % -\let\tabu@@celllalign \@empty -\let\tabu@@cellralign \@empty -\let\tabu@@cellleft \@empty -\let\tabu@@cellright \@empty -\def\tabu@naturalXmin {\z@} -\def\tabu@naturalXmax {\z@} -\let\tabu@rowfontreset \@empty -\def\tabulineon {4pt}\let\tabulineoff \tabulineon -\tabu@everyrowtrue -\ifdefined\pdfelapsedtime % - \def\tabu@pdftimer {\xdef\tabu@starttime{\the\pdfelapsedtime}}% -\else \let\tabu@pdftimer \relax \let\tabu@message@etime \relax -\fi -\tracingtabu=\z@ -\newtabulinestyle {=\maxdimen}% creates the 'factory' settings \tabu@linestyle@ -\tabulinestyle{} -\taburowcolors{} -\let\tabudefaulttarget \linewidth -\ProcessOptions* % \ProcessOptions* is quicker ! -\endinput -%% -%% End of file `tabu.sty'. +%% +%% This is file `tabu.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tabu.dtx (with options: `package') +%% +%% This is a generated file. +%% Copyright (FC) 2010-2011 - lppl +%% +%% tabu : 2011/02/26 v2.8 - tabu : Flexible LaTeX tabulars +%% +%% ********************************************************************************************** +%% \begin{tabu} { preamble } => default target: \linewidth or \linegoal +%% \begin{tabu} to { preamble } => target specified +%% \begin{tabu} spread { preamble } => target relative to the ``natural width'' +%% +%% tabu works in text and in math modes. +%% +%% X columns: automatic width adjustment + horizontal and vertical alignment +%% \begin{tabu} { X[4c] X[1c] X[-2ml] } +%% +%% Horizontal lines and / or leaders: +%% \hline\hline => double horizontal line +%% \firsthline\hline => for nested tabulars +%% \lasthline\hline => for nested tabulars +%% \tabucline[line spec]{column-column} => ``funny'' lines (dash/leader) +%% Automatic lines / leaders : +%% \everyrow{\hline\hline} +%% +%% Vertical lines and / or leaders: +%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt blue] } +%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt on 2pt off 4pt blue] } +%% +%% Fixed vertical spacing adjustment: +%% \extrarowheight= \extrarowdepth= +%% or: \extrarowsep= => may be prefixed by \global +%% +%% Dynamic vertical spacing adjustment: +%% \abovetabulinesep= \belowtabulinesep= +%% or: \tabulinesep= => may be prefixed by \global +%% +%% delarray.sty shortcuts: in math and text modes +%% \begin{tabu} .... \({ preamble }\) +%% +%% Algorithms reports: +%% \tracingtabu=1 \tracingtabu=2 +%% +%% ********************************************************************************************** +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file tabu.dtx +%% and the derived files +%% tabu.sty, tabu.pdf, tabu.ins +%% +%% tabu : Flexible LaTeX tabulars +%% lppl copyright 2010-2011 by FC +%% + +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{tabu_doxygen}[2011/02/26 v2.8 - flexible LaTeX tabulars (FC), frozen version for doxygen] +\RequirePackage{array}[2008/09/09] +\RequirePackage{varwidth}[2009/03/30] +\AtEndOfPackage{\tabu@AtEnd \let\tabu@AtEnd \@undefined} +\let\tabu@AtEnd\@empty +\def\TMP@EnsureCode#1={% + \edef\tabu@AtEnd{\tabu@AtEnd + \catcode#1 \the\catcode#1}% + \catcode#1=% +}% \TMP@EnsureCode +\TMP@EnsureCode 33 = 12 % ! +\TMP@EnsureCode 58 = 12 % : (for siunitx) +\TMP@EnsureCode124 = 12 % | +\TMP@EnsureCode 36 = 3 % $ = math shift +\TMP@EnsureCode 38 = 4 % & = tab alignment character +\TMP@EnsureCode 32 = 10 % space +\TMP@EnsureCode 94 = 7 % ^ +\TMP@EnsureCode 95 = 8 % _ +%% Constants -------------------------------------------------------- +\newcount \c@taburow \def\thetaburow {\number\c@taburow} +\newcount \tabu@nbcols +\newcount \tabu@cnt +\newcount \tabu@Xcol +\let\tabu@start \@tempcnta +\let\tabu@stop \@tempcntb +\newcount \tabu@alloc \tabu@alloc=\m@ne +\newcount \tabu@nested +\def\tabu@alloc@{\global\advance\tabu@alloc \@ne \tabu@nested\tabu@alloc} +\newdimen \tabu@target +\newdimen \tabu@spreadtarget +\newdimen \tabu@naturalX +\newdimen \tabucolX +\let\tabu@DELTA \@tempdimc +\let\tabu@thick \@tempdima +\let\tabu@on \@tempdimb +\let\tabu@off \@tempdimc +\newdimen \tabu@Xsum +\newdimen \extrarowdepth +\newdimen \abovetabulinesep +\newdimen \belowtabulinesep +\newdimen \tabustrutrule \tabustrutrule \z@ +\newtoks \tabu@thebody +\newtoks \tabu@footnotes +\newsavebox \tabu@box +\newsavebox \tabu@arstrutbox +\newsavebox \tabu@hleads +\newsavebox \tabu@vleads +\newif \iftabu@colortbl +\newif \iftabu@siunitx +\newif \iftabu@measuring +\newif \iftabu@spread +\newif \iftabu@negcoef +\newif \iftabu@everyrow +\def\tabu@everyrowtrue {\global\let\iftabu@everyrow \iftrue} +\def\tabu@everyrowfalse{\global\let\iftabu@everyrow \iffalse} +\newif \iftabu@long +\newif \iftabuscantokens +\def\tabu@rescan {\tabu@verbatim \scantokens } +%% Utilities (for internal usage) ----------------------------------- +\def\tabu@gobblespace #1 {#1} +\def\tabu@gobbletoken #1#2{#1} +\def\tabu@gobbleX{\futurelet\@let@token \tabu@gobblex} +\def\tabu@gobblex{\if ^^J\noexpand\@let@token \expandafter\@gobble + \else\ifx \@sptoken\@let@token + \expandafter\tabu@gobblespace\expandafter\tabu@gobbleX + \fi\fi +}% \tabu@gobblex +\def\tabu@X{^^J} +{\obeyspaces +\global\let\tabu@spxiii= % saves an active space (for \ifx) +\gdef\tabu@@spxiii{ }} +\def\tabu@ifenvir {% only for \multicolumn + \expandafter\tabu@if@nvir\csname\@currenvir\endcsname +}% \tabu@ifenvir +\def\tabu@if@nvir #1{\csname @\ifx\tabu#1first\else + \ifx\longtabu#1first\else + second\fi\fi oftwo\endcsname +}% \tabu@ifenvir +\def\tabu@modulo #1#2{\numexpr\ifnum\numexpr#1=\z@ 0\else #1-(#1-(#2-1)/2)/(#2)*(#2)\fi} +{\catcode`\&=3 +\gdef\tabu@strtrim #1{% #1 = control sequence to trim + \ifodd 1\ifx #1\@empty \else \ifx #1\space \else 0\fi \fi + \let\tabu@c@l@r \@empty \let#1\@empty + \else \expandafter \tabu@trimspaces #1\@nnil + \fi +}% \tabu@strtrim +\gdef\tabu@trimspaces #1\@nnil{\let\tabu@c@l@r=#2\tabu@firstspace .#1& }% +\gdef\tabu@firstspace #1#2#3 &{\tabu@lastspace #2#3&} +\gdef\tabu@lastspace #1{\def #3{#1}% + \ifx #3\tabu@c@l@r \def\tabu@c@l@r{\protect\color{#1}}\expandafter\remove@to@nnil \fi + \tabu@trimspaces #1\@nnil} +}% \catcode +\def\tabu@sanitizearg #1#2{{% + \csname \ifcsname if@safe@actives\endcsname % + @safe@activestrue\else + relax\fi \endcsname + \edef#2{#1}\tabu@strtrim#2\@onelevel@sanitize#2% + \expandafter}\expandafter\def\expandafter#2\expandafter{#2}% +}% \tabu@sanitizearg +\def\tabu@textbar #1{\begingroup \endlinechar\m@ne \scantokens{\def\:{|}}% + \expandafter\endgroup \expandafter#1\:% !!! semi simple group !!! +}% \tabu@textbar +\def\tabu@everyrow@bgroup{\iftabu@everyrow \begingroup \else \noalign{\ifnum0=`}\fi \fi} +\def\tabu@everyrow@egroup{% + \iftabu@everyrow \expandafter \endgroup \the\toks@ + \else \ifnum0=`{\fi}% + \fi +}% \tabu@everyrow@egroup +\def\tabu@arstrut {\global\setbox\@arstrutbox \hbox{\vrule + height \arraystretch \dimexpr\ht\strutbox+\extrarowheight + depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth + width \z@}% +}% \tabu@arstrut +\def\tabu@rearstrut {% + \@tempdima \arraystretch\dimexpr\ht\strutbox+\extrarowheight \relax + \@tempdimb \arraystretch\dimexpr\dp\strutbox+\extrarowdepth \relax + \ifodd 1\ifdim \ht\@arstrutbox=\@tempdima + \ifdim \dp\@arstrutbox=\@tempdimb 0 \fi\fi + \tabu@mkarstrut + \fi +}% \tabu@rearstrut +\def\tabu@@DBG #1{\ifdim\tabustrutrule>\z@ \color{#1}\fi} +\def\tabu@DBG@arstrut {\global\setbox\@arstrutbox + \hbox to\z@{\hbox to\z@{\hss + {\tabu@DBG{cyan}\vrule + height \arraystretch \dimexpr\ht\strutbox+\extrarowheight + depth \z@ + width \tabustrutrule}\kern-\tabustrutrule + {\tabu@DBG{pink}\vrule + height \z@ + depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth + width \tabustrutrule}}}% +}% \tabu@DBG@arstrut +\def\tabu@save@decl{\toks\count@ \expandafter{\the\toks\expandafter\count@ + \@nextchar}}% +\def\tabu@savedecl{\ifcat$\d@llarend\else + \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode +}% \tabu@savedecl +\def\tabu@finalstrut #1{\unskip\ifhmode\nobreak\fi\vrule height\z@ depth\z@ width\z@} +\newcommand*\tabuDisableCommands {\g@addto@macro\tabu@trialh@@k } +\let\tabu@trialh@@k \@empty +\def\tabu@nowrite #1#{{\afterassignment}\toks@} +\let\tabu@write\write +\let\tabu@immediate\immediate +\def\tabu@WRITE{\begingroup + \def\immediate\write{\aftergroup\endgroup + \tabu@immediate\tabu@write}% +}% \tabu@WRITE +\expandafter\def\expandafter\tabu@GenericError\expandafter{% + \expandafter\tabu@WRITE\GenericError} +\def\tabu@warn{\tabu@WRITE\PackageWarning{tabu}} +\def\tabu@noxfootnote [#1]{\@gobble} +\def\tabu@nocolor #1#{\@gobble} +\newcommand*\tabu@norowcolor[2][]{} +\def\tabu@maybesiunitx #1{\def\tabu@temp{#1}% + \futurelet\@let@token \tabu@m@ybesiunitx} +\def\tabu@m@ybesiunitx #1{\def\tabu@m@ybesiunitx {% + \ifx #1\@let@token \let\tabu@cellleft \@empty \let\tabu@cellright \@empty \fi + \tabu@temp}% \tabu@m@ybesiunitx +}\expandafter\tabu@m@ybesiunitx \csname siunitx_table_collect_begin:Nn\endcsname +\def\tabu@celllalign@def #1{\def\tabu@celllalign{\tabu@maybesiunitx{#1}}}% +%% Fixed vertical spacing adjustment: \extrarowsep ------------------ +\newcommand*\extrarowsep{\edef\tabu@C@extra{\the\numexpr\tabu@C@extra+1}% + \iftabu@everyrow \aftergroup\tabu@Gextra + \else \aftergroup\tabu@n@Gextra + \fi + \@ifnextchar={\tabu@gobbletoken\tabu@extra} \tabu@extra +}% \extrarowsep +\def\tabu@extra {\@ifnextchar_% + {\tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}} + {\ifx ^\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}}% + \else \let\tabu@temp \@empty + \afterassignment \tabu@setextrasep \extrarowdepth + \fi \tabu@temp}% +}% \tabu@extra +\def\tabu@setextra #1#2{\def\tabu@temp{\tabu@extr@#1#2}\afterassignment\tabu@temp#2} +\def\tabu@extr@ #1#2{\@ifnextchar^% + {\tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}} + {\ifx _\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}}% + \else \let\tabu@temp \@empty + \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth + \fi \tabu@temp}% +}% \tabu@extr@ +\def\tabu@setextrasep {\extrarowheight=\extrarowdepth + \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth +}% \tabu@setextrasep +\def\tabu@Gextra{\ifx \tabu@G@extra\@empty \else {\tabu@Rextra}\fi} +\def\tabu@n@Gextra{\ifx \tabu@G@extra\@empty \else \noalign{\tabu@Rextra}\fi} +\def\tabu@Rextra{\tabu@Grestore \tabu@G@extra \tabu@C@extra} +\let\tabu@C@extra \z@ +\let\tabu@G@extra \@empty +%% Dynamic vertical spacing adjustment: \tabulinesep ---------------- +\newcommand*\tabulinesep{\edef\tabu@C@linesep{\the\numexpr\tabu@C@linesep+1}% + \iftabu@everyrow \aftergroup\tabu@Glinesep + \else \aftergroup\tabu@n@Glinesep + \fi + \@ifnextchar={\tabu@gobbletoken\tabu@linesep} \tabu@linesep +}% \tabulinesep +\def\tabu@linesep {\@ifnextchar_% + {\tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}} + {\ifx ^\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}}% + \else \let\tabu@temp \@empty + \afterassignment \tabu@setlinesep \abovetabulinesep + \fi \tabu@temp}% +}% \tabu@linesep +\def\tabu@setsep #1#2{\def\tabu@temp{\tabu@sets@p#1#2}\afterassignment\tabu@temp#2} +\def\tabu@sets@p #1#2{\@ifnextchar^% + {\tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}} + {\ifx _\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}}% + \else \let\tabu@temp \@empty + \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep + \fi \tabu@temp}% +}% \tabu@sets@p +\def\tabu@setlinesep {\belowtabulinesep=\abovetabulinesep + \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep +}% \tabu@setlinesep +\def\tabu@Glinesep{\ifx \tabu@G@linesep\@empty \else {\tabu@Rlinesep}\fi} +\def\tabu@n@Glinesep{\ifx \tabu@G@linesep\@empty \else \noalign{\tabu@Rlinesep}\fi} +\def\tabu@Rlinesep{\tabu@Grestore \tabu@G@linesep \tabu@C@linesep} +\let\tabu@C@linesep \z@ +\let\tabu@G@linesep \@empty +%% \global\extrarowsep and \global\tabulinesep ------------------- +\def\tabu@Gsave #1#2#3#4{\xdef#1{#1% + \toks#2{\toks\the\currentgrouplevel{\global#3\the#3\global#4\the#4}}}% +}% \tabu@Gsave +\def\tabu@Grestore#1#2{% + \toks#2{}#1\toks\currentgrouplevel\expandafter{\expandafter}\the\toks#2\relax + \ifcat$\the\toks\currentgrouplevel$\else + \global\let#1\@empty \global\let#2\z@ + \the\toks\currentgrouplevel + \fi +}% \tabu@Grestore +%% Setting code for every row --------------------------------------- +\newcommand*\everyrow{\tabu@everyrow@bgroup + \tabu@start \z@ \tabu@stop \z@ \tabu@evrstartstop +}% \everyrow +\def\tabu@evrstartstop {\@ifnextchar^% + {\afterassignment \tabu@evrstartstop \tabu@stop=}% + {\ifx ^\@let@token + \afterassignment\tabu@evrstartstop \tabu@start=% + \else \afterassignment\tabu@everyr@w \toks@ + \fi}% +}% \tabu@evrstartstop +\def\tabu@everyr@w {% + \xdef\tabu@everyrow{% + \noexpand\tabu@everyrowfalse + \let\noalign \relax + \noexpand\tabu@rowfontreset + \iftabu@colortbl \noexpand\tabu@rc@ \fi % \taburowcolors + \let\noexpand\tabu@docline \noexpand\tabu@docline@evr + \the\toks@ + \noexpand\tabu@evrh@@k + \noexpand\tabu@rearstrut + \global\advance\c@taburow \@ne}% + \iftabu@everyrow \toks@\expandafter + {\expandafter\def\expandafter\tabu@evr@L\expandafter{\the\toks@}\ignorespaces}% + \else \xdef\tabu@evr@G{\the\toks@}% + \fi + \tabu@everyrow@egroup +}% \tabu@everyr@w +\def\tabu@evr {\def\tabu@evrh@@k} % for internal use only +\tabu@evr{} +%% line style and leaders ------------------------------------------- +\newcommand*\newtabulinestyle [1]{% + {\@for \@tempa :=#1\do{\expandafter\tabu@newlinestyle \@tempa==\@nil}}% +}% \newtabulinestyle +\def\tabu@newlinestyle #1=#2=#3\@nil{\tabu@getline {#2}% + \tabu@sanitizearg {#1}\@tempa + \ifodd 1\ifx \@tempa\@empty \ifdefined\tabu@linestyle@ 0 \fi\fi + \global\expandafter\let + \csname tabu@linestyle@\@tempa \endcsname =\tabu@thestyle \fi +}% \tabu@newlinestyle +\newcommand*\tabulinestyle [1]{\tabu@everyrow@bgroup \tabu@getline{#1}% + \iftabu@everyrow + \toks@\expandafter{\expandafter \def \expandafter + \tabu@ls@L\expandafter{\tabu@thestyle}\ignorespaces}% + \gdef\tabu@ls@{\tabu@ls@L}% + \else + \global\let\tabu@ls@G \tabu@thestyle + \gdef\tabu@ls@{\tabu@ls@G}% + \fi + \tabu@everyrow@egroup +}% \tabulinestyle +\newcommand*\taburulecolor{\tabu@everyrow@bgroup \tabu@textbar \tabu@rulecolor} +\def\tabu@rulecolor #1{\toks@{}% + \def\tabu@temp #1##1#1{\tabu@ruledrsc{##1}}\@ifnextchar #1% + \tabu@temp + \tabu@rulearc +}% \tabu@rulecolor +\def\tabu@ruledrsc #1{\edef\tabu@temp{#1}\tabu@strtrim\tabu@temp + \ifx \tabu@temp\@empty \def\tabu@temp{\tabu@rule@drsc@ {}{}}% + \else \edef\tabu@temp{\noexpand\tabu@rule@drsc@ {}{\tabu@temp}}% + \fi + \tabu@temp +}% \tabu@ruledrsc@ +\def\tabu@ruledrsc@ #1#{\tabu@rule@drsc@ {#1}} +\def\tabu@rule@drsc@ #1#2{% + \iftabu@everyrow + \ifx \\#1#2\\\toks@{\let\CT@drsc@ \relax}% + \else \toks@{\def\CT@drsc@{\color #1{#2}}}% + \fi + \else + \ifx \\#1#2\\\global\let\CT@drsc@ \relax + \else \gdef\CT@drsc@{\color #1{#2}}% + \fi + \fi + \tabu@rulearc +}% \tabu@rule@drsc@ +\def\tabu@rulearc #1#{\tabu@rule@arc@ {#1}} +\def\tabu@rule@arc@ #1#2{% + \iftabu@everyrow + \ifx \\#1#2\\\toks@\expandafter{\the\toks@ \def\CT@arc@{}}% + \else \toks@\expandafter{\the\toks@ \def\CT@arc@{\color #1{#2}}}% + \fi + \toks@\expandafter{\the\toks@ + \let\tabu@arc@L \CT@arc@ + \let\tabu@drsc@L \CT@drsc@ + \ignorespaces}% + \else + \ifx \\#1#2\\\gdef\CT@arc@{}% + \else \gdef\CT@arc@{\color #1{#2}}% + \fi + \global\let\tabu@arc@G \CT@arc@ + \global\let\tabu@drsc@G \CT@drsc@ + \fi + \tabu@everyrow@egroup +}% \tabu@rule@arc@ +\def\taburowcolors {\tabu@everyrow@bgroup \@testopt \tabu@rowcolors 1} +\def\tabu@rowcolors [#1]#2#{\tabu@rowc@lors{#1}{#2}} +\def\tabu@rowc@lors #1#2#3{% + \toks@{}\@defaultunits \count@ =\number0#2\relax \@nnil + \@defaultunits \tabu@start =\number0#1\relax \@nnil + \ifnum \count@<\tw@ \count@=\tw@ \fi + \advance\tabu@start \m@ne + \ifnum \tabu@start<\z@ \tabu@start \z@ \fi + \tabu@rowcolorseries #3\in@..\in@ \@nnil +}% \tabu@rowcolors +\def\tabu@rowcolorseries #1..#2\in@ #3\@nnil {% + \ifx \in@#1\relax + \iftabu@everyrow \toks@{\def\tabu@rc@{}\let\tabu@rc@L \tabu@rc@}% + \else \gdef\tabu@rc@{}\global\let\tabu@rc@G \tabu@rc@ + \fi + \else + \ifx \\#2\\\tabu@rowcolorserieserror \fi + \tabu@sanitizearg{#1}\tabu@temp + \tabu@sanitizearg{#2}\@tempa + \advance\count@ \m@ne + \iftabu@everyrow + \def\tabu@rc@ ##1##2##3##4{\def\tabu@rc@{% + \ifnum ##2=\c@taburow + \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{##3}{##4}\fi + \ifnum \c@taburow<##2 \else + \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\z@ + \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi + \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% + \rowcolor{tabu@rc@\the\tabu@nested}\fi}% + }\edef\x{\noexpand\tabu@rc@ {\the\count@} + {\the\tabu@start} + {\tabu@temp} + {\@tempa}% + }\x + \toks@\expandafter{\expandafter\def\expandafter\tabu@rc@\expandafter{\tabu@rc@}}% + \toks@\expandafter{\the\toks@ \let\tabu@rc@L \tabu@rc@ \ignorespaces}% + \else % inside \noalign + \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{\tabu@temp}{\@tempa}% + \expandafter\resetcolorseries\expandafter[\the\count@]{tabu@rcseries@\the\tabu@nested}% + \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% + \let\noalign \relax \rowcolor{tabu@rc@\the\tabu@nested}% + \def\tabu@rc@ ##1##2{\gdef\tabu@rc@{% + \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\@ne + \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi + \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% + \rowcolor{tabu@rc@\the\tabu@nested}}% + }\edef\x{\noexpand\tabu@rc@{\the\count@}{\the\c@taburow}}\x + \global\let\tabu@rc@G \tabu@rc@ + \fi + \fi + \tabu@everyrow@egroup +}% \tabu@rowcolorseries +\tabuDisableCommands {\let\tabu@rc@ \@empty } +\def\tabu@rowcolorserieserror {\PackageError{tabu} + {Invalid syntax for \string\taburowcolors + \MessageBreak Please look at the documentation!}\@ehd +}% \tabu@rowcolorserieserror +\newcommand*\tabureset {% + \tabulinesep=\z@ \extrarowsep=\z@ \extratabsurround=\z@ + \tabulinestyle{}\everyrow{}\taburulecolor||{}\taburowcolors{}% +}% \tabureset +%% Parsing the line styles ------------------------------------------ +\def\tabu@getline #1{\begingroup + \csname \ifcsname if@safe@actives\endcsname % + @safe@activestrue\else + relax\fi \endcsname + \edef\tabu@temp{#1}\tabu@sanitizearg{#1}\@tempa + \let\tabu@thestyle \relax + \ifcsname tabu@linestyle@\@tempa \endcsname + \edef\tabu@thestyle{\endgroup + \def\tabu@thestyle{\expandafter\noexpand + \csname tabu@linestyle@\@tempa\endcsname}% + }\tabu@thestyle + \else \expandafter\tabu@definestyle \tabu@temp \@nil + \fi +}% \tabu@getline +\def\tabu@definestyle #1#2\@nil {\endlinechar \m@ne \makeatletter + \tabu@thick \maxdimen \tabu@on \maxdimen \tabu@off \maxdimen + \let\tabu@c@lon \@undefined \let\tabu@c@loff \@undefined + \ifodd 1\ifcat .#1\else\ifcat\relax #1\else 0\fi\fi % catcode 12 or non expandable cs + \def\tabu@temp{\tabu@getparam{thick}}% + \else \def\tabu@temp{\tabu@getparam{thick}\maxdimen}% + \fi + {% + \let\tabu@ \relax + \def\:{\obeyspaces \tabu@oXIII \tabu@commaXIII \edef\:}% (space active \: happy ;-)) + \scantokens{\:{\tabu@temp #1#2 \tabu@\tabu@}}% + \expandafter}\expandafter + \def\expandafter\:\expandafter{\:}% line spec rewritten now ;-) + \def\;{\def\:}% + \scantokens\expandafter{\expandafter\;\expandafter{\:}}% space is now inactive (catcode 10) + \let\tabu@ \tabu@getcolor \:% all arguments are ready now ;-) + \ifdefined\tabu@c@lon \else \let\tabu@c@lon\@empty \fi + \ifx \tabu@c@lon\@empty \def\tabu@c@lon{\CT@arc@}\fi + \ifdefined\tabu@c@loff \else \let\tabu@c@loff \@empty \fi + \ifdim \tabu@on=\maxdimen \ifdim \tabu@off<\maxdimen + \tabu@on \tabulineon \fi\fi + \ifdim \tabu@off=\maxdimen \ifdim \tabu@on<\maxdimen + \tabu@off \tabulineoff \fi\fi + \ifodd 1\ifdim \tabu@off=\maxdimen \ifdim \tabu@on=\maxdimen 0 \fi\fi + \in@true % + \else \in@false % + \fi + \ifdim\tabu@thick=\maxdimen \def\tabu@thick{\arrayrulewidth}% + \else \edef\tabu@thick{\the\tabu@thick}% + \fi + \edef \tabu@thestyle ##1##2{\endgroup + \def\tabu@thestyle{% + \ifin@ \noexpand\tabu@leadersstyle {\tabu@thick} + {\the\tabu@on}{##1} + {\the\tabu@off}{##2}% + \else \noexpand\tabu@rulesstyle + {##1\vrule width \tabu@thick}% + {##1\leaders \hrule height \tabu@thick \hfil}% + \fi}% + }\expandafter \expandafter + \expandafter \tabu@thestyle \expandafter + \expandafter \expandafter + {\expandafter\tabu@c@lon\expandafter}\expandafter{\tabu@c@loff}% +}% \tabu@definestyle +{\catcode`\O=\active \lccode`\O=`\o \catcode`\,=\active + \lowercase{\gdef\tabu@oXIII {\catcode`\o=\active \let O=\tabu@oxiii}} + \gdef\tabu@commaXIII {\catcode`\,=\active \let ,=\space} +}% \catcode +\def\tabu@oxiii #1{% + \ifcase \ifx n#1\z@ \else + \ifx f#1\@ne\else + \tw@ \fi\fi + \expandafter\tabu@onxiii + \or \expandafter\tabu@ofxiii + \else o% + \fi#1}% +\def\tabu@onxiii #1#2{% + \ifcase \ifx !#2\tw@ \else + \ifcat.\noexpand#2\z@ \else + \ifx \tabu@spxiii#2\@ne\else + \tw@ \fi\fi\fi + \tabu@getparam{on}#2\expandafter\@gobble + \or \expandafter\tabu@onxiii % (space is active) + \else o\expandafter\@firstofone + \fi{#1#2}}% +\def\tabu@ofxiii #1#2{% + \ifx #2f\expandafter\tabu@offxiii + \else o\expandafter\@firstofone + \fi{#1#2}} +\def\tabu@offxiii #1#2{% + \ifcase \ifx !#2\tw@ \else + \ifcat.\noexpand#2\z@ \else + \ifx\tabu@spxiii#2\@ne \else + \tw@ \fi\fi\fi + \tabu@getparam{off}#2\expandafter\@gobble + \or \expandafter\tabu@offxiii % (space is active) + \else o\expandafter\@firstofone + \fi{#1#2}} +\def\tabu@getparam #1{\tabu@ \csname tabu@#1\endcsname=} +\def\tabu@getcolor #1{% \tabu@ <- \tabu@getcolor after \edef + \ifx \tabu@#1\else % no more spec + \let\tabu@theparam=#1\afterassignment \tabu@getc@l@r #1\fi +}% \tabu@getcolor +\def\tabu@getc@l@r #1\tabu@ {% + \def\tabu@temp{#1}\tabu@strtrim \tabu@temp + \ifx \tabu@temp\@empty + \else%\ifcsname \string\color@\tabu@temp \endcsname % if the color exists + \ifx \tabu@theparam \tabu@off \let\tabu@c@loff \tabu@c@l@r + \else \let\tabu@c@lon \tabu@c@l@r + \fi + %\else \tabu@warncolour{\tabu@temp}% + \fi%\fi + \tabu@ % next spec +}% \tabu@getc@l@r +\def\tabu@warncolour #1{\PackageWarning{tabu} + {Color #1 is not defined. Default color used}% +}% \tabu@warncolour +\def\tabu@leadersstyle #1#2#3#4#5{\def\tabu@leaders{{#1}{#2}{#3}{#4}{#5}}% + \ifx \tabu@leaders\tabu@leaders@G \else + \tabu@LEADERS{#1}{#2}{#3}{#4}{#5}\fi +}% \tabu@leadersstyle +\def\tabu@rulesstyle #1#2{\let\tabu@leaders \@undefined + \gdef\tabu@thevrule{#1}\gdef\tabu@thehrule{#2}% +}% \tabu@rulesstyle +%% The leaders boxes ------------------------------------------------ +\def\tabu@LEADERS #1#2#3#4#5{%% width, dash, dash color, gap, gap color + {\let\color \tabu@color % => during trials -> \color = \tabu@nocolor + {% % but the leaders boxes should have colors ! + \def\@therule{\vrule}\def\@thick{height}\def\@length{width}% + \def\@box{\hbox}\def\@unbox{\unhbox}\def\@elt{\wd}% + \def\@skip{\hskip}\def\@ss{\hss}\def\tabu@leads{\tabu@hleads}% + \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}% + \global\let\tabu@thehleaders \tabu@theleaders + }% + {% + \def\@therule{\hrule}\def\@thick{width}\def\@length{height}% + \def\@box{\vbox}\def\@unbox{\unvbox}\def\@elt{\ht}% + \def\@skip{\vskip}\def\@ss{\vss}\def\tabu@leads{\tabu@vleads}% + \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}% + \global\let\tabu@thevleaders \tabu@theleaders + }% + \gdef\tabu@leaders@G{{#1}{#2}{#3}{#4}{#5}}% + }% +}% \tabu@LEADERS +\def\tabu@therule #1#2{\@therule \@thick#1\@length\dimexpr#2/2 \@depth\z@} +\def\tabu@l@@d@rs #1#2#3#4#5{%% width, dash, dash color, gap, gap color + \global\setbox \tabu@leads=\@box{% + {#3\tabu@therule{#1}{#2}}% + \ifx\\#5\\\@skip#4\else{#5\tabu@therule{#1}{#4*2}}\fi + {#3\tabu@therule{#1}{#2}}}% + \global\setbox\tabu@leads=\@box to\@elt\tabu@leads{\@ss + {#3\tabu@therule{#1}{#2}}\@unbox\tabu@leads}% + \edef\tabu@theleaders ##1{\def\noexpand\tabu@theleaders {% + {##1\tabu@therule{#1}{#2}}% + \xleaders \copy\tabu@leads \@ss + \tabu@therule{0pt}{-#2}{##1\tabu@therule{#1}{#2}}}% + }\tabu@theleaders{#3}% +}% \tabu@l@@d@rs +%% \tabu \endtabu \tabu* \longtabu \endlongtabu \longtabu* ---------- +\newcommand*\tabu {\tabu@longfalse + \ifmmode \def\tabu@ {\array}\def\endtabu {\endarray}% + \else \def\tabu@ {\tabu@tabular}\def\endtabu {\endtabular}\fi + \expandafter\let\csname tabu*\endcsname \tabu + \expandafter\def\csname endtabu*\endcsname{\endtabu}% + \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget +}% {tabu} +\let\tabu@tabular \tabular % +\expandafter\def\csname tabu*\endcsname{\tabuscantokenstrue \tabu} +\newcommand*\longtabu {\tabu@longtrue + \ifmmode\PackageError{tabu}{longtabu not allowed in math mode}\fi + \def\tabu@{\longtable}\def\endlongtabu{\endlongtable}% + \LTchunksize=\@M + \expandafter\let\csname tabu*\endcsname \tabu + \expandafter\def\csname endlongtabu*\endcsname{\endlongtabu}% + \let\LT@startpbox \tabu@LT@startpbox % \everypar{ array struts } + \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget +}% {longtabu} +\expandafter\def\csname longtabu*\endcsname{\tabuscantokenstrue \longtabu} +\def\tabu@nolongtabu{\PackageError{tabu} + {longtabu requires the longtable package}\@ehd} +%% Read the target and then : \tabular or \@array ------------------ +\def\tabu@settarget {\futurelet\@let@token \tabu@sett@rget } +\def\tabu@sett@rget {\tabu@target \z@ + \ifcase \ifx \bgroup\@let@token \z@ \else + \ifx \@sptoken\@let@token \@ne \else + \if t\@let@token \tw@ \else + \if s\@let@token \thr@@\else + \z@\fi\fi\fi\fi + \expandafter\tabu@begin + \or \expandafter\tabu@gobblespace\expandafter\tabu@settarget + \or \expandafter\tabu@to + \or \expandafter\tabu@spread + \fi +}% \tabu@sett@rget +\def\tabu@to to{\def\tabu@halignto{to}\tabu@gettarget} +\def\tabu@spread spread{\tabu@spreadtrue\def\tabu@halignto{spread}\tabu@gettarget} +\def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target } +\def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoalt@rget } +\def\tabu@linegoalt@rget {% + \ifx \tabu@temp\LNGL@setlinegoal + \LNGL@setlinegoal \expandafter \@firstoftwo \fi % @gobbles \LNGL@setlinegoal + \tabu@begin +}% \tabu@linegoalt@rget +\def\tabu@begin #1#{% + \iftabu@measuring \expandafter\tabu@nestedmeasure \fi + \ifdim \tabu@target=\z@ \let\tabu@halignto \@empty + \else \edef\tabu@halignto{\tabu@halignto\the\tabu@target}% + \fi + \@testopt \tabu@tabu@ \tabu@aligndefault #1\@nil +}% \tabu@begin +\long\def\tabu@tabu@ [#1]#2\@nil #3{\tabu@setup + \def\tabu@align {#1}\def\tabu@savedpream{\NC@find #3}% + \tabu@ [\tabu@align ]#2{#3\tabu@rewritefirst }% +}% \tabu@tabu@ +\def\tabu@nestedmeasure {% + \ifodd 1\iftabu@spread \else \ifdim\tabu@target=\z@ \else 0 \fi\fi\relax + \tabu@spreadtrue + \else \begingroup \iffalse{\fi \ifnum0=`}\fi + \toks@{}\def\tabu@stack{b}% + \expandafter\tabu@collectbody\expandafter\tabu@quickrule + \expandafter\endgroup + \fi +}% \tabu@nestedmeasure +\def\tabu@quickrule {\indent\vrule height\z@ depth\z@ width\tabu@target} +%% \tabu@setup \tabu@init \tabu@indent +\def\tabu@setup{\tabu@alloc@ + \ifcase \tabu@nested + \ifmmode \else \iftabu@spread\else \ifdim\tabu@target=\z@ + \let\tabu@afterendpar \par + \fi\fi\fi + \def\tabu@aligndefault{c}\tabu@init \tabu@indent + \else % + \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth + \fi + \let\tabu@thetarget \tabudefaulttarget \let\tabu@restored \@undefined + \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do \tabu@rewritefirst}% + \everycr{}\let\@startpbox \tabu@startpbox % for nested tabu inside longtabu... + \let\@endpbox \tabu@endpbox % idem " " " " " " + \let\@tabarray \tabu@tabarray % idem " " " " " " + \tabu@setcleanup \tabu@setreset +}% \tabu@setup +\def\tabu@init{\tabu@starttimer \tabu@measuringfalse + \edef\tabu@hfuzz {\the\dimexpr\hfuzz+1sp}\global\tabu@footnotes{}% + \let\firsthline \tabu@firsthline \let\lasthline \tabu@lasthline + \let\firstline \tabu@firstline \let\lastline \tabu@lastline + \let\hline \tabu@hline \let\@xhline \tabu@xhline + \let\color \tabu@color \let\@arstrutbox \tabu@arstrutbox + \iftabu@colortbl\else\let\LT@@hline \tabu@LT@@hline \fi + \tabu@trivlist % + \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext + \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering + \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft + \let\tabudecimal \tabu@tabudecimal \let\Centering \tabu@Centering + \let\RaggedRight \tabu@RaggedRight \let\RaggedLeft \tabu@RaggedLeft + \let\justifying \tabu@justifying \let\rowfont \tabu@rowfont + \let\fbox \tabu@fbox \let\color@b@x \tabu@color@b@x + \let\tabu@@everycr \everycr \let\tabu@@everypar \everypar + \let\tabu@prepnext@tokORI \prepnext@tok\let\prepnext@tok \tabu@prepnext@tok + \let\tabu@multicolumnORI\multicolumn \let\multicolumn \tabu@multicolumn + \let\tabu@startpbox \@startpbox % for nested tabu inside longtabu pfff !!! + \let\tabu@endpbox \@endpbox % idem " " " " " " " + \let\tabu@tabarray \@tabarray % idem " " " " " " " + \tabu@adl@fix \let\endarray \tabu@endarray % colortbl & arydshln (delarray) + \iftabu@colortbl\CT@everycr\expandafter{\expandafter\iftabu@everyrow \the\CT@everycr \fi}\fi +}% \tabu@init +\def\tabu@indent{% correction for indentation + \ifdim \parindent>\z@\ifx \linewidth\tabudefaulttarget + \everypar\expandafter{% + \the\everypar\everypar\expandafter{\the\everypar}% + \setbox\z@=\lastbox + \ifdim\wd\z@>\z@ \edef\tabu@thetarget + {\the\dimexpr -\wd\z@+\tabudefaulttarget}\fi + \box\z@}% + \fi\fi +}% \tabu@indent +\def\tabu@setcleanup {% saves last global assignments + \ifodd 1\ifmmode \else \iftabu@long \else 0\fi\fi\relax + \def\tabu@aftergroupcleanup{% + \def\tabu@aftergroupcleanup{\aftergroup\tabu@cleanup}}% + \else + \def\tabu@aftergroupcleanup{% + \aftergroup\aftergroup\aftergroup\tabu@cleanup + \let\tabu@aftergroupcleanup \relax}% + \fi + \let\tabu@arc@Gsave \tabu@arc@G + \let\tabu@arc@G \tabu@arc@L % + \let\tabu@drsc@Gsave \tabu@drsc@G + \let\tabu@drsc@G \tabu@drsc@L % + \let\tabu@ls@Gsave \tabu@ls@G + \let\tabu@ls@G \tabu@ls@L % + \let\tabu@rc@Gsave \tabu@rc@G + \let\tabu@rc@G \tabu@rc@L % + \let\tabu@evr@Gsave \tabu@evr@G + \let\tabu@evr@G \tabu@evr@L % + \let\tabu@celllalign@save \tabu@celllalign + \let\tabu@cellralign@save \tabu@cellralign + \let\tabu@cellleft@save \tabu@cellleft + \let\tabu@cellright@save \tabu@cellright + \let\tabu@@celllalign@save \tabu@@celllalign + \let\tabu@@cellralign@save \tabu@@cellralign + \let\tabu@@cellleft@save \tabu@@cellleft + \let\tabu@@cellright@save \tabu@@cellright + \let\tabu@rowfontreset@save \tabu@rowfontreset + \let\tabu@@rowfontreset@save\tabu@@rowfontreset + \let\tabu@rowfontreset \@empty + \edef\tabu@alloc@save {\the\tabu@alloc}% restore at \tabu@reset + \edef\c@taburow@save {\the\c@taburow}% + \edef\tabu@naturalX@save {\the\tabu@naturalX}% + \let\tabu@naturalXmin@save \tabu@naturalXmin + \let\tabu@naturalXmax@save \tabu@naturalXmax + \let\tabu@mkarstrut@save \tabu@mkarstrut + \edef\tabu@clarstrut{% + \extrarowheight \the\dimexpr \ht\@arstrutbox-\ht\strutbox \relax + \extrarowdepth \the\dimexpr \dp\@arstrutbox-\dp\strutbox \relax + \let\noexpand\@arraystretch \@ne \noexpand\tabu@rearstrut}% +}% \tabu@setcleanup +\def\tabu@cleanup {\begingroup + \globaldefs\@ne \tabu@everyrowtrue + \let\tabu@arc@G \tabu@arc@Gsave + \let\CT@arc@ \tabu@arc@G + \let\tabu@drsc@G \tabu@drsc@Gsave + \let\CT@drsc@ \tabu@drsc@G + \let\tabu@ls@G \tabu@ls@Gsave + \let\tabu@ls@ \tabu@ls@G + \let\tabu@rc@G \tabu@rc@Gsave + \let\tabu@rc@ \tabu@rc@G + \let\CT@do@color \relax + \let\tabu@evr@G \tabu@evr@Gsave + \let\tabu@celllalign \tabu@celllalign@save + \let\tabu@cellralign \tabu@cellralign@save + \let\tabu@cellleft \tabu@cellleft@save + \let\tabu@cellright \tabu@cellright@save + \let\tabu@@celllalign \tabu@@celllalign@save + \let\tabu@@cellralign \tabu@@cellralign@save + \let\tabu@@cellleft \tabu@@cellleft@save + \let\tabu@@cellright \tabu@@cellright@save + \let\tabu@rowfontreset \tabu@rowfontreset@save + \let\tabu@@rowfontreset \tabu@@rowfontreset@save + \tabu@naturalX =\tabu@naturalX@save + \let\tabu@naturalXmax \tabu@naturalXmax@save + \let\tabu@naturalXmin \tabu@naturalXmin@save + \let\tabu@mkarstrut \tabu@mkarstrut@save + \c@taburow =\c@taburow@save + \ifcase \tabu@nested \tabu@alloc \m@ne\fi + \endgroup % + \ifcase \tabu@nested + \the\tabu@footnotes \global\tabu@footnotes{}% + \tabu@afterendpar \tabu@elapsedtime + \fi + \tabu@clarstrut + \everyrow\expandafter {\tabu@evr@G}% +}% \tabu@cleanup +\let\tabu@afterendpar \relax +\def\tabu@setreset {% + \edef\tabu@savedparams {% \relax for \tabu@message@save + \ifmmode \col@sep \the\arraycolsep + \else \col@sep \the\tabcolsep \fi \relax + \arrayrulewidth \the\arrayrulewidth \relax + \doublerulesep \the\doublerulesep \relax + \extratabsurround \the\extratabsurround \relax + \extrarowheight \the\extrarowheight \relax + \extrarowdepth \the\extrarowdepth \relax + \abovetabulinesep \the\abovetabulinesep \relax + \belowtabulinesep \the\belowtabulinesep \relax + \def\noexpand\arraystretch{\arraystretch}% + \ifdefined\minrowclearance \minrowclearance\the\minrowclearance\relax\fi}% + \begingroup + \@temptokena\expandafter{\tabu@savedparams}% => only for \savetabu / \usetabu + \ifx \tabu@arc@L\relax \else \tabu@setsave \tabu@arc@L \fi + \ifx \tabu@drsc@L\relax \else \tabu@setsave \tabu@drsc@L \fi + \tabu@setsave \tabu@ls@L \tabu@setsave \tabu@evr@L + \expandafter \endgroup \expandafter + \def\expandafter\tabu@saved@ \expandafter{\the\@temptokena + \let\tabu@arc@G \tabu@arc@L + \let\tabu@drsc@G \tabu@drsc@L + \let\tabu@ls@G \tabu@ls@L + \let\tabu@rc@G \tabu@rc@L + \let\tabu@evr@G \tabu@evr@L}% + \def\tabu@reset{\tabu@savedparams + \tabu@everyrowtrue \c@taburow \z@ + \let\CT@arc@ \tabu@arc@L + \let\CT@drsc@ \tabu@drsc@L + \let\tabu@ls@ \tabu@ls@L + \let\tabu@rc@ \tabu@rc@L + \global\tabu@alloc \tabu@alloc@save + \everyrow\expandafter{\tabu@evr@L}}% +}% \tabu@reset +\def\tabu@setsave #1{\expandafter\tabu@sets@ve #1\@nil{#1}} +\long\def\tabu@sets@ve #1\@nil #2{\@temptokena\expandafter{\the\@temptokena \def#2{#1}}} +%% The Rewriting Process ------------------------------------------- +\def\tabu@newcolumntype #1{% + \expandafter\tabu@new@columntype + \csname NC@find@\string#1\expandafter\endcsname + \csname NC@rewrite@\string#1\endcsname + {#1}% +}% \tabu@newcolumntype +\def\tabu@new@columntype #1#2#3{% + \def#1##1#3{\NC@{##1}}% + \let#2\relax \newcommand*#2% +}% \tabu@new@columntype +\def\tabu@privatecolumntype #1{% + \expandafter\tabu@private@columntype + \csname NC@find@\string#1\expandafter\endcsname + \csname NC@rewrite@\string#1\expandafter\endcsname + \csname tabu@NC@find@\string#1\expandafter\endcsname + \csname tabu@NC@rewrite@\string#1\endcsname + {#1}% +}% \tabu@privatecolumntype +\def\tabu@private@columntype#1#2#3#4{% + \g@addto@macro\tabu@privatecolumns{\let#1#3\let#2#4}% + \tabu@new@columntype#3#4% +}% \tabu@private@columntype +\let\tabu@privatecolumns \@empty +\newcommand*\tabucolumn [1]{\expandafter \def \expandafter + \tabu@highprioritycolumns\expandafter{\tabu@highprioritycolumns + \NC@do #1}}% +\let\tabu@highprioritycolumns \@empty +%% The | ``column'' : rewriting process -------------------------- +\tabu@privatecolumntype |{\tabu@rewritevline} +\newcommand*\tabu@rewritevline[1][]{\tabu@vlinearg{#1}% + \expandafter \NC@find \tabu@rewritten} +\def\tabu@lines #1{% + \ifx|#1\else \tabu@privatecolumntype #1{\tabu@rewritevline}\fi + \NC@list\expandafter{\the\NC@list \NC@do #1}% +}% \tabu@lines@ +\def\tabu@vlinearg #1{% + \ifx\\#1\\\def\tabu@thestyle {\tabu@ls@}% + \else\tabu@getline {#1}% + \fi + \def\tabu@rewritten ##1{\def\tabu@rewritten{!{##1\tabu@thevline}}% + }\expandafter\tabu@rewritten\expandafter{\tabu@thestyle}% + \expandafter \tabu@keepls \tabu@thestyle \@nil +}% \tabu@vlinearg +\def\tabu@keepls #1\@nil{% + \ifcat $\@cdr #1\@nil $% + \ifx \relax#1\else + \ifx \tabu@ls@#1\else + \let#1\relax + \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer + \tabu@savels\noexpand#1}\fi\fi\fi +}% \tabu@keepls +\def\tabu@thevline {\begingroup + \ifdefined\tabu@leaders + \setbox\@tempboxa=\vtop to\dimexpr + \ht\@arstrutbox+\dp\@arstrutbox{{\tabu@thevleaders}}% + \ht\@tempboxa=\ht\@arstrutbox \dp\@tempboxa=\dp\@arstrutbox + \box\@tempboxa + \else + \tabu@thevrule + \fi \endgroup +}% \tabu@thevline +\def\tabu@savels #1{% + \expandafter\let\csname\string#1\endcsname #1% + \expandafter\def\expandafter\tabu@reset\expandafter{\tabu@reset + \tabu@resetls#1}}% +\def\tabu@resetls #1{\expandafter\let\expandafter#1\csname\string#1\endcsname}% +%% \multicolumn inside tabu environment ----------------------------- +\tabu@newcolumntype \tabu@rewritemulticolumn{% + \aftergroup \tabu@endrewritemulticolumn % after \@mkpream group + \NC@list{\NC@do *}\tabu@textbar \tabu@lines + \tabu@savedecl + \tabu@privatecolumns + \NC@list\expandafter{\the\expandafter\NC@list \tabu@NC@list}% + \let\tabu@savels \relax + \NC@find +}% \tabu@rewritemulticolumn +\def\tabu@endrewritemulticolumn{\gdef\tabu@mkpreambuffer{}\endgroup} +\def\tabu@multicolumn{\tabu@ifenvir \tabu@multic@lumn \tabu@multicolumnORI} +\long\def\tabu@multic@lumn #1#2#3{\multispan{#1}\begingroup + \tabu@everyrowtrue + \NC@list{\NC@do \tabu@rewritemulticolumn}% + \expandafter\@gobbletwo % gobbles \multispan{#1} + \tabu@multicolumnORI{#1}{\tabu@rewritemulticolumn #2}% + {\iftabuscantokens \tabu@rescan \else \expandafter\@firstofone \fi + {#3}}% +}% \tabu@multic@lumn +%% The X column(s): rewriting process ----------------------------- +\tabu@privatecolumntype X[1][]{\begingroup \tabu@siunitx{\endgroup \tabu@rewriteX {#1}}} +\def\tabu@nosiunitx #1{#1{}{}\expandafter \NC@find \tabu@rewritten } +\def\tabu@siunitx #1{\@ifnextchar \bgroup + {\tabu@rewriteX@Ss{#1}} + {\tabu@nosiunitx{#1}}} +\def\tabu@rewriteX@Ss #1#2{\@temptokena{}% + \@defaultunits \let\tabu@temp =#2\relax\@nnil + \ifodd 1\ifx S\tabu@temp \else \ifx s\tabu@temp \else 0 \fi\fi + \def\NC@find{\def\NC@find >####1####2<####3\relax{#1 {####1}{####3}% + }\expandafter\NC@find \the\@temptokena \relax + }\expandafter\NC@rewrite@S \@gobble #2\relax + \else \tabu@siunitxerror + \fi + \expandafter \NC@find \tabu@rewritten +}% \tabu@rewriteX@Ss +\def\tabu@siunitxerror {\PackageError{tabu}{Not a S nor s column ! + \MessageBreak X column can only embed siunitx S or s columns}\@ehd +}% \tabu@siunitxerror +\def\tabu@rewriteX #1#2#3{\tabu@Xarg {#1}{#2}{#3}% + \iftabu@measuring + \else \tabu@measuringtrue % first X column found in the preamble + \let\@halignto \relax \let\tabu@halignto \relax + \iftabu@spread \tabu@spreadtarget \tabu@target \tabu@target \z@ + \else \tabu@spreadtarget \z@ \fi + \ifdim \tabu@target=\z@ + \setlength\tabu@target \tabu@thetarget + \tabu@message{\tabu@message@defaulttarget}% + \else \tabu@message{\tabu@message@target}\fi + \fi +}% \tabu@rewriteX +\def\tabu@rewriteXrestore #1#2#3{\let\@halignto \relax + \def\tabu@rewritten{l}} +\def\tabu@Xarg #1#2#3{% + \advance\tabu@Xcol \@ne \let\tabu@Xlcr \@empty + \let\tabu@Xdisp \@empty \let\tabu@Xmath \@empty + \ifx\\#1\\% + \def\tabu@rewritten{p}\tabucolX \p@ % + \else + \let\tabu@rewritten \@empty \let\tabu@temp \@empty \tabucolX \z@ + \tabu@Xparse {}#1\relax + \fi + \tabu@Xrewritten{#2}{#3}% +}% \tabu@Xarg +\def\tabu@Xparse #1{\futurelet\@let@token \tabu@Xtest} +\expandafter\def\expandafter\tabu@Xparsespace\space{\tabu@Xparse{}} +\def\tabu@Xtest{% + \ifcase \ifx \relax\@let@token \z@ \else + \if ,\@let@token \m@ne\else + \if p\@let@token 1\else + \if m\@let@token 2\else + \if b\@let@token 3\else + \if l\@let@token 4\else + \if c\@let@token 5\else + \if r\@let@token 6\else + \if j\@let@token 7\else + \if L\@let@token 8\else + \if C\@let@token 9\else + \if R\@let@token 10\else + \if J\@let@token 11\else + \ifx \@sptoken\@let@token 12\else + \if .\@let@token 13\else + \if -\@let@token 13\else + \ifcat $\@let@token 14\else + 15\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax + \or \tabu@Xtype {p}% + \or \tabu@Xtype {m}% + \or \tabu@Xtype {b}% + \or \tabu@Xalign \raggedright\relax + \or \tabu@Xalign \centering\relax + \or \tabu@Xalign \raggedleft\relax + \or \tabu@Xalign \tabu@justify\relax + \or \tabu@Xalign \RaggedRight\raggedright + \or \tabu@Xalign \Centering\centering + \or \tabu@Xalign \RaggedLeft\raggedleft + \or \tabu@Xalign \justifying\tabu@justify + \or \expandafter \tabu@Xparsespace + \or \expandafter \tabu@Xcoef + \or \expandafter \tabu@Xm@th + \or \tabu@Xcoef{}% + \else\expandafter \tabu@Xparse + \fi +}% \tabu@Xtest +\def\tabu@Xalign #1#2{% + \ifx \tabu@Xlcr\@empty \else \PackageWarning{tabu} + {Duplicate horizontal alignment specification}\fi + \ifdefined#1\def\tabu@Xlcr{#1}\let#1\relax + \else \def\tabu@Xlcr{#2}\let#2\relax\fi + \expandafter\tabu@Xparse +}% \tabu@Xalign +\def\tabu@Xtype #1{% + \ifx \tabu@rewritten\@empty \else \PackageWarning{tabu} + {Duplicate vertical alignment specification}\fi + \def\tabu@rewritten{#1}\expandafter\tabu@Xparse +}% \tabu@Xtype +\def\tabu@Xcoef#1{\edef\tabu@temp{\tabu@temp#1}% + \afterassignment\tabu@Xc@ef \tabu@cnt\number\if-#10\fi +}% \tabu@Xcoef +\def\tabu@Xc@ef{\advance\tabucolX \tabu@temp\the\tabu@cnt\p@ + \tabu@Xparse{}% +}% \tabu@Xc@ef +\def\tabu@Xm@th #1{\futurelet \@let@token \tabu@Xd@sp} +\def\tabu@Xd@sp{\let\tabu@Xmath=$% + \ifx $\@let@token \def\tabu@Xdisp{\displaystyle}% + \expandafter\tabu@Xparse + \else \expandafter\tabu@Xparse\expandafter{\expandafter}% + \fi +}% \tabu@Xd@sp +\def\tabu@Xrewritten {% + \ifx \tabu@rewritten\@empty \def\tabu@rewritten{p}\fi + \ifdim \tabucolX<\z@ \tabu@negcoeftrue + \else\ifdim \tabucolX=\z@ \tabucolX \p@ + \fi\fi + \edef\tabu@temp{{\the\tabu@Xcol}{\tabu@strippt\tabucolX}}% + \edef\tabu@Xcoefs{\tabu@Xcoefs \tabu@ \tabu@temp}% + \edef\tabu@rewritten ##1##2{\def\noexpand\tabu@rewritten{% + >{\tabu@Xlcr \ifx$\tabu@Xmath$\tabu@Xdisp\fi ##1}% + \tabu@rewritten {\tabu@hsize \tabu@temp}% + <{##2\ifx$\tabu@Xmath$\fi}}% + }\tabu@rewritten +}% \tabu@Xrewritten +\def\tabu@hsize #1#2{% + \ifdim #2\p@<\z@ + \ifdim \tabucolX=\maxdimen \tabu@wd{#1}\else + \ifdim \tabu@wd{#1}<-#2\tabucolX \tabu@wd{#1}\else -#2\tabucolX\fi + \fi + \else #2\tabucolX + \fi +}% \tabu@hsize +%% \usetabu and \preamble: rewriting process --------------------- +\tabu@privatecolumntype \usetabu [1]{% + \ifx\\#1\\\tabu@saveerr{}\else + \@ifundefined{tabu@saved@\string#1} + {\tabu@saveerr{#1}} + {\let\tabu@rewriteX \tabu@rewriteXrestore + \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\@ne}% + \fi +}% \NC@rewrite@\usetabu +\tabu@privatecolumntype \preamble [1]{% + \ifx\\#1\\\tabu@saveerr{}\else + \@ifundefined{tabu@saved@\string#1} + {\tabu@saveerr{#1}} + {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}% + \fi +}% \NC@rewrite@\preamble +%% Controlling the rewriting process ------------------------------- +\tabu@newcolumntype \tabu@rewritefirst{% + \iftabu@long \aftergroup \tabu@longpream % + \else \aftergroup \tabu@pream + \fi + \let\tabu@ \relax \let\tabu@hsize \relax + \let\tabu@Xcoefs \@empty \let\tabu@savels \relax + \tabu@Xcol \z@ \tabu@cnt \tw@ + \gdef\tabu@mkpreambuffer{\tabu@{}}\tabu@measuringfalse + \global\setbox\@arstrutbox \box\@arstrutbox + \NC@list{\NC@do *}\tabu@textbar \tabu@lines + \NC@list\expandafter{\the\NC@list \NC@do X}% + \iftabu@siunitx % + \NC@list\expandafter{\the\NC@list \NC@do S\NC@do s}\fi + \NC@list\expandafter{\the\expandafter\NC@list \tabu@highprioritycolumns}% + \expandafter\def\expandafter\tabu@NC@list\expandafter{% + \the\expandafter\NC@list \tabu@NC@list}% % * | X S + \NC@list\expandafter{\expandafter \NC@do \expandafter\usetabu + \expandafter \NC@do \expandafter\preamble + \the\NC@list \NC@do \tabu@rewritemiddle + \NC@do \tabu@rewritelast}% + \tabu@savedecl + \tabu@privatecolumns + \edef\tabu@prev{\the\@temptokena}\NC@find \tabu@rewritemiddle +}% NC@rewrite@\tabu@rewritefirst +\tabu@newcolumntype \tabu@rewritemiddle{% + \edef\tabu@temp{\the\@temptokena}\NC@find \tabu@rewritelast +}% \NC@rewrite@\tabu@rewritemiddle +\tabu@newcolumntype \tabu@rewritelast{% + \ifx \tabu@temp\tabu@prev \advance\tabu@cnt \m@ne + \NC@list\expandafter{\tabu@NC@list \NC@do \tabu@rewritemiddle + \NC@do \tabu@rewritelast}% + \else \let\tabu@prev\tabu@temp + \fi + \ifcase \tabu@cnt \expandafter\tabu@endrewrite + \else \expandafter\NC@find \expandafter\tabu@rewritemiddle + \fi +}% \NC@rewrite@\tabu@rewritelast +%% Choosing the strategy -------------------------------------------- +\def\tabu@endrewrite {% + \let\tabu@temp \NC@find + \ifx \@arrayright\relax \let\@arrayright \@empty \fi + \count@=% + \ifx \@finalstrut\tabu@finalstrut \z@ % outer in mode 0 print + \iftabu@measuring + \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer + \tabu@target \csname tabu@\the\tabu@nested.T\endcsname + \tabucolX \csname tabu@\the\tabu@nested.X\endcsname + \edef\@halignto {\ifx\@arrayright\@empty to\tabu@target\fi}}% + \fi + \else\iftabu@measuring 4 % X columns + \xdef\tabu@mkpreambuffer{\tabu@{\tabu@mkpreambuffer + \tabu@target \the\tabu@target + \tabu@spreadtarget \the\tabu@spreadtarget}% + \def\noexpand\tabu@Xcoefs{\tabu@Xcoefs}% + \edef\tabu@halignto{\ifx \@arrayright\@empty to\tabu@target\fi}}% + \let\tabu@Xcoefs \relax + \else\ifcase\tabu@nested \thr@@ % outer, no X + \global\let\tabu@afterendpar \relax + \else \@ne % inner, no X, outer in mode 1 or 2 + \fi + \ifdefined\tabu@usetabu + \else \ifdim\tabu@target=\z@ + \else \let\tabu@temp \tabu@extracolsep + \fi\fi + \fi + \fi + \xdef\tabu@mkpreambuffer{\count@ \the\count@ \tabu@mkpreambuffer}% + \tabu@temp +}% \tabu@endrewrite +\def\tabu@extracolsep{\@defaultunits \expandafter\let + \expandafter\tabu@temp \expandafter=\the\@temptokena \relax\@nnil + \ifx \tabu@temp\@sptoken + \expandafter\tabu@gobblespace \expandafter\tabu@extracolsep + \else + \edef\tabu@temp{\noexpand\NC@find + \if |\noexpand\tabu@temp @% + \else\if !\noexpand\tabu@temp @% + \else !% + \fi\fi + {\noexpand\extracolsep\noexpand\@flushglue}}% + \fi + \tabu@temp +}% \tabu@extrac@lsep +%% Implementing the strategy ---------------------------------------- +\long\def\tabu@pream #1\@preamble {% + \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup + \NC@list\expandafter {\tabu@NC@list}% in case of nesting... + \ifdefined\tabu@usetabu \tabu@usetabu \tabu@target \z@ \fi + \let\tabu@savedpreamble \@preamble + \global\let\tabu@elapsedtime \relax + \tabu@thebody ={#1\tabu@aftergroupcleanup}% + \tabu@thebody =\expandafter{\the\expandafter\tabu@thebody + \@preamble}% + \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens ) + \tabu@select +}% \tabu@pream +\long\def\tabu@longpream #1\LT@bchunk #2\LT@bchunk{% + \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup + \NC@list\expandafter {\tabu@NC@list}% in case of nesting... + \let\tabu@savedpreamble \@preamble + \global\let\tabu@elapsedtime \relax + \tabu@thebody ={#1\LT@bchunk #2\tabu@aftergroupcleanup \LT@bchunk}% + \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens ) + \tabu@select +}% \tabu@longpream +\def\tabu@select {% + \ifnum\tabu@nested>\z@ \tabuscantokensfalse \fi + \ifnum \count@=\@ne \iftabu@measuring \count@=\tw@ \fi\fi + \ifcase \count@ + \global\let\tabu@elapsedtime \relax + \tabu@seteverycr + \expandafter \tabuthepreamble % vertical adjustment (inherited from outer) + \or % exit in vertical measure + struts per cell because no X and outer in mode 3 + \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \tabu@seteverycr + \expandafter \tabuthepreamble + \or % exit without measure because no X and outer in mode 4 + \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty + \tabu@seteverycr + \expandafter \tabuthepreamble + \else % needs trials + \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty + \tabu@savecounters + \expandafter \tabu@setstrategy + \fi +}% \tabu@select +\def\tabu@@ {\gdef\tabu@mkpreambuffer} +%% Protections to set up before trials ------------------------------ +\def\tabu@setstrategy {\begingroup % + \tabu@trialh@@k \tabu@cnt \z@ % number of trials + \hbadness \@M \let\hbadness \@tempcnta + \hfuzz \maxdimen \let\hfuzz \@tempdima + \let\write \tabu@nowrite\let\GenericError \tabu@GenericError + \let\savetabu \@gobble \let\tabudefaulttarget \linewidth + \let\@footnotetext \@gobble \let\@xfootnote \tabu@xfootnote + \let\color \tabu@nocolor\let\rowcolor \tabu@norowcolor + \let\tabu@aftergroupcleanup \relax % only after the last trial + \tabu@mkpreambuffer + \ifnum \count@>\thr@@ \let\@halignto \@empty \tabucolX@init + \def\tabu@lasttry{\m@ne\p@}\fi + \begingroup \iffalse{\fi \ifnum0=`}\fi + \toks@{}\def\tabu@stack{b}\iftabuscantokens \endlinechar=10 \obeyspaces \fi % + \tabu@collectbody \tabu@strategy % +}% \tabu@setstrategy +\def\tabu@savecounters{% + \def\@elt ##1{\csname c@##1\endcsname\the\csname c@##1\endcsname}% + \edef\tabu@clckpt {\begingroup \globaldefs=\@ne \cl@@ckpt \endgroup}\let\@elt \relax +}% \tabu@savecounters +\def\tabucolX@init {% \tabucolX <= \tabu@target / (sum coefs > 0) + \dimen@ \z@ \tabu@Xsum \z@ \tabucolX \z@ \let\tabu@ \tabu@Xinit \tabu@Xcoefs + \ifdim \dimen@>\z@ + \@tempdima \dimexpr \tabu@target *\p@/\dimen@ + \tabu@hfuzz\relax + \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi + \fi +}% \tabucolX@init +\def\tabu@Xinit #1#2{\tabu@Xcol #1 \advance \tabu@Xsum + \ifdim #2\p@>\z@ #2\p@ \advance\dimen@ #2\p@ + \else -#2\p@ \tabu@negcoeftrue + \@tempdima \dimexpr \tabu@target*\p@/\dimexpr-#2\p@\relax \relax + \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi + \tabu@wddef{#1}{0pt}% + \fi +}% \tabu@Xinit +%% Collecting the environment body ---------------------------------- +\long\def\tabu@collectbody #1#2\end #3{% + \edef\tabu@stack{\tabu@pushbegins #2\begin\end\expandafter\@gobble\tabu@stack}% + \ifx \tabu@stack\@empty + \toks@\expandafter{\expandafter\tabu@thebody\expandafter{\the\toks@ #2}% + \def\tabu@end@envir{\end{#3}}% + \iftabuscantokens + \iftabu@long \def\tabu@endenvir {\end{#3}\tabu@gobbleX}% + \else \def\tabu@endenvir {\let\endarray \@empty + \end{#3}\tabu@gobbleX}% + \fi + \else \def\tabu@endenvir {\end{#3}}\fi}% + \let\tabu@collectbody \tabu@endofcollect + \else\def\tabu@temp{#3}% + \ifx \tabu@temp\@empty \toks@\expandafter{\the\toks@ #2\end }% + \else \ifx\tabu@temp\tabu@@spxiii \toks@\expandafter{\the\toks@ #2\end #3}% + \else \ifx\tabu@temp\tabu@X \toks@\expandafter{\the\toks@ #2\end #3}% + \else \toks@\expandafter{\the\toks@ #2\end{#3}}% + \fi\fi\fi + \fi + \tabu@collectbody{#1}% +}% \tabu@collectbody +\long\def\tabu@pushbegins#1\begin#2{\ifx\end#2\else b\expandafter\tabu@pushbegins\fi}% +\def\tabu@endofcollect #1{\ifnum0=`{}\fi + \expandafter\endgroup \the\toks@ #1% +}% \tabu@endofcollect +%% The trials: switching between strategies ------------------------- +\def\tabu@strategy {\relax % stops \count@ assignment ! + \ifcase\count@ % case 0 = print with vertical adjustment (outer is finished) + \expandafter \tabu@endoftrials + \or % case 1 = exit in vertical measure (outer in mode 3) + \expandafter\xdef\csname tabu@\the\tabu@nested.T\endcsname{\the\tabu@target}% + \expandafter\xdef\csname tabu@\the\tabu@nested.X\endcsname{\the\tabucolX}% + \expandafter \tabu@endoftrials + \or % case 2 = exit with a rule replacing the table (outer in mode 4) + \expandafter \tabu@quickend + \or % case 3 = outer is in mode 3 because of no X + \begingroup + \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \expandafter \tabu@measuring + \else % case 4 = horizontal measure + \begingroup + \global\let\tabu@elapsedtime \tabu@message@etime + \long\def\multicolumn##1##2##3{\multispan{##1}}% + \let\tabu@startpboxORI \@startpbox + \iftabu@spread + \def\tabu@naturalXmax {\z@}% + \let\tabu@naturalXmin \tabu@naturalXmax + \tabu@evr{\global\tabu@naturalX \z@}% + \let\@startpbox \tabu@startpboxmeasure + \else\iftabu@negcoef + \let\@startpbox \tabu@startpboxmeasure + \else \let\@startpbox \tabu@startpboxquick + \fi\fi + \expandafter \tabu@measuring + \fi +}% \tabu@strategy +\def\tabu@measuring{\expandafter \tabu@trial \expandafter + \count@ \the\count@ \tabu@endtrial +}% \tabu@measuring +\def\tabu@trial{\iftabu@long \tabu@longtrial \else \tabu@shorttrial \fi} +\def\tabu@shorttrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr + \ifx \tabu@savecounters\relax \else + \let\tabu@savecounters \relax \tabu@clckpt \fi + $\iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi + \expandafter{\expandafter \tabuthepreamble + \the\tabu@thebody + \csname tabu@adl@endtrial\endcsname + \endarray}$\egroup % got \tabu@box +}% \tabu@shorttrial +\def\tabu@longtrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr + \ifx \tabu@savecounters\relax \else + \let\tabu@savecounters \relax \tabu@clckpt \fi + \iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi + \expandafter{\expandafter \tabuthepreamble + \the\tabu@thebody + \tabuendlongtrial}\egroup % got \tabu@box +}% \tabu@longtrial +\def\tabuendlongtrial{% no @ allowed for \scantokens + \LT@echunk \global\setbox\@ne \hbox{\unhbox\@ne}\kern\wd\@ne + \LT@get@widths +}% \tabuendlongtrial +\def\tabu@adl@endtrial{% + \crcr \noalign{\global\adl@ncol \tabu@nbcols}}% anything global is crap, junky and fails ! +\def\tabu@seteverycr {\tabu@reset + \everycr \expandafter{\the\everycr \tabu@everycr}% + \let\everycr \tabu@noeverycr % +}% \tabu@seteverycr +\def\tabu@noeverycr{{\aftergroup\tabu@restoreeverycr \afterassignment}\toks@} +\def\tabu@restoreeverycr {\let\everycr \tabu@@everycr} +\def\tabu@everycr {\iftabu@everyrow \noalign{\tabu@everyrow}\fi} +\def\tabu@endoftrials {% + \iftabuscantokens \expandafter\@firstoftwo + \else \expandafter\@secondoftwo + \fi + {\expandafter \tabu@closetrialsgroup \expandafter + \tabu@rescan \expandafter{% + \expandafter\tabuthepreamble + \the\expandafter\tabu@thebody + \iftabu@long \else \endarray \fi}} + {\expandafter\tabu@closetrialsgroup \expandafter + \tabuthepreamble + \the\tabu@thebody}% + \tabu@endenvir % Finish ! +}% \tabu@endoftrials +\def\tabu@closetrialsgroup {% + \toks@\expandafter{\tabu@endenvir}% + \edef\tabu@bufferX{\endgroup + \tabucolX \the\tabucolX + \tabu@target \the\tabu@target + \tabu@cnt \the\tabu@cnt + \def\noexpand\tabu@endenvir{\the\toks@}% + %Quid de \@halignto = \tabu@halignto ?? + }% \tabu@bufferX + \tabu@bufferX + \ifcase\tabu@nested % print out (outer in mode 0) + \global\tabu@cnt \tabu@cnt + \tabu@evr{\tabu@verticaldynamicadjustment}% + \tabu@celllalign@def{\everypar{}}\let\tabu@cellralign \@empty + \let\@finalstrut \tabu@finalstrut + \else % vertical measure of nested tabu + \tabu@evr{\tabu@verticalinit}% + \tabu@celllalign@def{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \fi + \tabu@clckpt \let\@halignto \tabu@halignto + \let\@halignto \@empty + \tabu@seteverycr + \ifdim \tabustrutrule>\z@ \ifnum\tabu@nested=\z@ + \setbox\@arstrutbox \box\voidb@x % force \@arstrutbox to be rebuilt (visible struts) + \fi\fi +}% \tabu@closetrialsgroup +\def\tabu@quickend {\expandafter \endgroup \expandafter + \tabu@target \the\tabu@target \tabu@quickrule + \let\endarray \relax \tabu@endenvir +}% \tabu@quickend +\def\tabu@endtrial {\relax % stops \count@ assignment ! + \ifcase \count@ \tabu@err % case 0 = impossible here + \or \tabu@err % case 1 = impossible here + \or \tabu@err % case 2 = impossible here + \or % case 3 = outer goes into mode 0 + \def\tabu@bufferX{\endgroup}\count@ \z@ + \else % case 4 = outer goes into mode 3 + \iftabu@spread \tabu@spreadarith % inner into mode 1 (outer in mode 3) + \else \tabu@arith % or 2 (outer in mode 4) + \fi + \count@=% + \ifcase\tabu@nested \thr@@ % outer goes into mode 3 + \else\iftabu@measuring \tw@ % outer is in mode 4 + \else \@ne % outer is in mode 3 + \fi\fi + \edef\tabu@bufferX{\endgroup + \tabucolX \the\tabucolX + \tabu@target \the\tabu@target}% + \fi + \expandafter \tabu@bufferX \expandafter + \count@ \the\count@ \tabu@strategy +}% \tabu@endtrial +\def\tabu@err{\errmessage{(tabu) Internal impossible error! (\count@=\the\count@)}} +%% The algorithms: compute the widths / stop or go on --------------- +\def\tabu@arithnegcoef {% + \@tempdima \z@ \dimen@ \z@ \let\tabu@ \tabu@arith@negcoef \tabu@Xcoefs +}% \tabu@arithnegcoef +\def\tabu@arith@negcoef #1#2{% + \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ % saturated by definition + \advance\@tempdima #2\tabucolX + \else + \ifdim -#2\tabucolX <\tabu@wd{#1}% c_i X < natural width <= \tabu@target-> saturated + \advance\dimen@ -#2\p@ + \advance\@tempdima -#2\tabucolX + \else + \advance\@tempdima \tabu@wd{#1}% natural width <= c_i X => neutralised + \ifdim \tabu@wd{#1}<\tabu@target \else % neutralised + \advance\dimen@ -#2\p@ % saturated (natural width = tabu@target) + \fi + \fi + \fi +}% \tabu@arith@negcoef +\def\tabu@givespace #1#2{% here \tabu@DELTA < \z@ + \ifdim \@tempdima=\z@ + \tabu@wddef{#1}{\the\dimexpr -\tabu@DELTA*\p@/\tabu@Xsum}% + \else + \tabu@wddef{#1}{\the\dimexpr \tabu@hsize{#1}{#2} + *(\p@ -\tabu@DELTA*\p@/\@tempdima)/\p@\relax}% + \fi +}% \tabu@givespace +\def\tabu@arith {\advance\tabu@cnt \@ne + \ifnum \tabu@cnt=\@ne \tabu@message{\tabu@titles}\fi + \tabu@arithnegcoef + \@tempdimb \dimexpr \wd\tabu@box -\@tempdima \relax % + \tabu@DELTA = \dimexpr \wd\tabu@box - \tabu@target \relax + \tabu@message{\tabu@message@arith}% + \ifdim \tabu@DELTA <\tabu@hfuzz + \ifdim \tabu@DELTA<\z@ % wd (tabu)<\tabu@target ? + \let\tabu@ \tabu@givespace \tabu@Xcoefs + \advance\@tempdima \@tempdimb \advance\@tempdima -\tabu@DELTA % for message + \else % already converged: nothing to do but nearly impossible... + \fi + \tabucolX \maxdimen + \tabu@measuringfalse + \else % need for narrower X columns + \tabucolX =\dimexpr (\@tempdima -\tabu@DELTA) *\p@/\tabu@Xsum \relax + \tabu@measuringtrue + \@whilesw \iftabu@measuring\fi {% + \advance\tabu@cnt \@ne + \tabu@arithnegcoef + \tabu@DELTA =\dimexpr \@tempdima+\@tempdimb -\tabu@target \relax % always < 0 here + \tabu@message{\tabu@header + \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@ + \tabu@msgalign \@tempdima+\@tempdimb { }{ }{ }{ }{ }\@@ + \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@ + \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@ + \ifdim -\tabu@DELTA<\tabu@hfuzz \tabu@spaces target ok\else + \tabu@msgalign \dimexpr -\tabu@DELTA *\p@/\dimen@ {}{}{}{}{}\@@ + \fi}% + \ifdim -\tabu@DELTA<\tabu@hfuzz + \advance\@tempdima \@tempdimb % for message + \tabu@measuringfalse + \else + \advance\tabucolX \dimexpr -\tabu@DELTA *\p@/\dimen@ \relax + \fi + }% + \fi + \tabu@message{\tabu@message@reached}% + \edef\tabu@bufferX{\endgroup \tabu@cnt \the\tabu@cnt + \tabucolX \the\tabucolX + \tabu@target \the\tabu@target}% +}% \tabu@arith +\def\tabu@spreadarith {% + \dimen@ \z@ \@tempdima \tabu@naturalXmax \let\tabu@ \tabu@spread@arith \tabu@Xcoefs + \edef\tabu@naturalXmin {\the\dimexpr\tabu@naturalXmin*\dimen@/\p@}% + \@tempdimc =\dimexpr \wd\tabu@box -\tabu@naturalXmax+\tabu@naturalXmin \relax + \iftabu@measuring + \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax + \edef\tabu@bufferX{\endgroup \tabucolX \the\tabucolX \tabu@target\the\tabu@target}% + \else + \tabu@message{\tabu@message@spreadarith}% + \ifdim \dimexpr \@tempdimc+\tabu@spreadtarget >\tabu@target + \tabu@message{(tabu) spread + \ifdim \@tempdimc>\tabu@target useless here: default target used% + \else too large: reduced to fit default target\fi.}% + \else + \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax + \tabu@message{(tabu) spread: New target set to \the\tabu@target^^J}% + \fi + \begingroup \let\tabu@wddef \@gobbletwo + \@tempdimb \@tempdima + \tabucolX@init + \tabu@arithnegcoef + \wd\tabu@box =\dimexpr \wd\tabu@box +\@tempdima-\@tempdimb \relax + \expandafter\endgroup \expandafter\tabucolX \the\tabucolX + \tabu@arith + \fi +}% \tabu@spreadarith +\def\tabu@spread@arith #1#2{% + \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ + \else \advance\@tempdima \tabu@wd{#1}\relax + \fi +}% \tabu@spread@arith +%% Reporting in the .log file --------------------------------------- +\def\tabu@message@defaulttarget{% + \ifnum\tabu@nested=\z@^^J(tabu) Default target: + \ifx\tabudefaulttarget\linewidth \string\linewidth + \ifdim \tabu@thetarget=\linewidth \else + -\the\dimexpr\linewidth-\tabu@thetarget\fi = + \else\ifx\tabudefaulttarget\linegoal\string\linegoal= + \fi\fi + \else (tabu) Default target (nested): \fi + \the\tabu@target \on@line + \ifnum\tabu@nested=\z@ , page \the\c@page\fi} +\def\tabu@message@target {^^J(tabu) Target specified: + \the\tabu@target \on@line, page \the\c@page} +\def\tabu@message@arith {\tabu@header + \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@ + \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{ }\@@ + \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@ + \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@ + \ifdim \tabu@DELTA<\tabu@hfuzz giving space\else + \tabu@msgalign \dimexpr (\@tempdima-\tabu@DELTA) *\p@/\tabu@Xsum -\tabucolX {}{}{}{}{}\@@ + \fi +}% \tabu@message@arith +\def\tabu@message@spreadarith {\tabu@spreadheader + \tabu@msgalign \tabu@spreadtarget { }{ }{ }{ }{}\@@ + \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{}\@@ + \tabu@msgalign -\tabu@naturalXmax { }{}{}{}{}\@@ + \tabu@msgalign \tabu@naturalXmin { }{ }{ }{ }{}\@@ + \tabu@msgalign \ifdim \dimexpr\@tempdimc>\tabu@target \tabu@target + \else \@tempdimc+\tabu@spreadtarget \fi + {}{}{}{}{}\@@} +\def\tabu@message@negcoef #1#2{ + \tabu@spaces\tabu@spaces\space * #1. X[\rem@pt#2]: + \space width = \tabu@wd {#1} + \expandafter\string\csname tabu@\the\tabu@nested.W\number#1\endcsname + \ifdim -\tabu@pt#2\tabucolX<\tabu@target + < \number-\rem@pt#2 X + = \the\dimexpr -\tabu@pt#2\tabucolX \relax + \else + <= \the\tabu@target\space < \number-\rem@pt#2 X\fi} +\def\tabu@message@reached{\tabu@header + ******* Reached Target: + hfuzz = \tabu@hfuzz\on@line\space *******} +\def\tabu@message@etime{\edef\tabu@stoptime{\the\pdfelapsedtime}% + \tabu@message{(tabu)\tabu@spaces Time elapsed during measure: + \the\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax sec + \the\numexpr\numexpr(\tabu@stoptime-\tabu@starttime) + -\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax*65536\relax + *1000/65536\relax ms \tabu@spaces(\the\tabu@cnt\space + cycle\ifnum\tabu@cnt>\@ne s\fi)^^J^^J}} +\def\tabu@message@verticalsp {% + \ifdim \@tempdima>\tabu@ht + \ifdim \@tempdimb>\tabu@dp + \expandafter\expandafter\expandafter\string\tabu@ht = + \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@ + \expandafter\expandafter\expandafter\string\tabu@dp = + \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J% + \else + \expandafter\expandafter\expandafter\string\tabu@ht = + \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@^^J% + \fi + \else\ifdim \@tempdimb>\tabu@dp + \tabu@spaces\tabu@spaces\tabu@spaces + \expandafter\expandafter\expandafter\string\tabu@dp = + \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J\fi + \fi +}% \tabu@message@verticalsp +\edef\tabu@spaces{\@spaces} +\def\tabu@strippt{\expandafter\tabu@pt\the} +{\@makeother\P \@makeother\T\lowercase{\gdef\tabu@pt #1PT{#1}}} +\def\tabu@msgalign{\expandafter\tabu@msg@align\the\dimexpr} +\def\tabu@msgalign@PT{\expandafter\tabu@msg@align\romannumeral-`\0\tabu@strippt} +\def\do #1{% + \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{% + \ifnum##1<10 #1 #1\else + \ifnum##1<100 #1 \else + \ifnum##1<\@m #1\fi\fi\fi + ##1.##2##3##4##5##6##7##8#1}% + \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) }% + \def\tabu@titles{\ifnum \tabu@nested=\z@ + (tabu) Try#1 #1 tabu X #1 #1 #1tabu Width #1 #1 Target + #1 #1 #1 Coefs #1 #1 #1 Update^^J\fi}% + \def\tabu@spreadheader{% + (tabu) Try#1 #1 Spread #1 #1 tabu Width #1 #1 #1 Nat. X #1 #1 #1 #1Nat. Min. + #1 New Target^^J% + (tabu) sprd} + \def\tabu@message@save {\begingroup + \def\x ####1{\tabu@msg@align ####1{ }{ }{ }{ }{}\@@} + \def\z ####1{\expandafter\x\expandafter{\romannumeral-`\0\tabu@strippt + \dimexpr####1\p@{ }{ }}}% + \let\color \relax \def\tabu@rulesstyle ####1####2{\detokenize{####1}}% + \let\CT@arc@ \relax \let\@preamble \@gobble + \let\tabu@savedpream \@firstofone + \let\tabu@savedparams \@firstofone + \def\tabu@target ####1\relax {(tabu) target #1 #1 #1 #1 #1 = \x{####1}^^J}% + \def\tabucolX ####1\relax {(tabu) X columns width#1 = \x{####1}^^J}% + \def\tabu@nbcols ####1\relax {(tabu) Number of columns: \z{####1}^^J}% + \def\tabu@aligndefault ####1{(tabu) Default alignment: #1 #1 ####1^^J}% + \def\col@sep ####1\relax {(tabu) column sep #1 #1 #1 = \x{####1}^^J}% + \def\arrayrulewidth ####1\relax{(tabu) arrayrulewidth #1 = \x{####1}}% + \def\doublerulesep ####1\relax { doublerulesep = \x{####1}^^J}% + \def\extratabsurround####1\relax{(tabu) extratabsurround = \x{####1}^^J}% + \def\extrarowheight ####1\relax{(tabu) extrarowheight #1 = \x{####1}}% + \def\extrarowdepth ####1\relax {extrarowdepth = \x{####1}^^J}% + \def\abovetabulinesep####1\relax{(tabu) abovetabulinesep=\x{####1} }% + \def\belowtabulinesep####1\relax{ belowtabulinesep=\x{####1}^^J}% + \def\arraystretch ####1{(tabu) arraystretch #1 #1 = \z{####1}^^J}% + \def\minrowclearance####1\relax{(tabu) minrowclearance #1 = \x{####1}^^J}% + \def\tabu@arc@L ####1{(tabu) taburulecolor #1 #1 = ####1^^J}% + \def\tabu@drsc@L ####1{(tabu) tabudoublerulecolor= ####1^^J}% + \def\tabu@evr@L ####1{(tabu) everyrow #1 #1 #1 #1 = \detokenize{####1}^^J}% + \def\tabu@ls@L ####1{(tabu) line style = \detokenize{####1}^^J}% + \def\NC@find ####1\@nil{(tabu) tabu preamble#1 #1 = \detokenize{####1}^^J}% + \def\tabu@wddef####1####2{(tabu) Natural width ####1 = \x{####2}^^J}% + \let\edef \@gobbletwo \let\def \@empty \let\let \@gobbletwo + \tabu@message{% + (tabu) \string\savetabu{\tabu@temp}: \on@line^^J% + \tabu@usetabu \@nil^^J}% + \endgroup} +}\do{ } +%% Measuring the natural width (varwidth) - store the results ------- +\def\tabu@startpboxmeasure #1{\bgroup % entering \vtop + \edef\tabu@temp{\expandafter\@secondoftwo \ifx\tabu@hsize #1\else\relax\fi}% + \ifodd 1\ifx \tabu@temp\@empty 0 \else % starts with \tabu@hsize ? + \iftabu@spread \else % if spread -> measure + \ifdim \tabu@temp\p@>\z@ 0 \fi\fi\fi% if coef>0 -> do not measure + \let\@startpbox \tabu@startpboxORI % restore immediately (nesting) + \tabu@measuringtrue % for the quick option... + \tabu@Xcol =\expandafter\@firstoftwo\ifx\tabu@hsize #1\fi + \ifdim \tabu@temp\p@>\z@ \ifdim \tabu@temp\tabucolX<\tabu@target + \tabu@target=\tabu@temp\tabucolX \fi\fi + \setbox\tabu@box \hbox \bgroup + \begin{varwidth}\tabu@target + \let\FV@ListProcessLine \tabu@FV@ListProcessLine % \hbox to natural width... + \narrowragged \arraybackslash \parfillskip \@flushglue + \ifdefined\pdfadjustspacing \pdfadjustspacing\z@ \fi + \bgroup \aftergroup\tabu@endpboxmeasure + \ifdefined \cellspacetoplimit \tabu@cellspacepatch \fi + \else \expandafter\@gobble + \tabu@startpboxquick{#1}% \@gobble \bgroup + \fi +}% \tabu@startpboxmeasure +\def\tabu@cellspacepatch{\def\bcolumn##1\@nil{}\let\ecolumn\@empty + \bgroup\color@begingroup} +\def\tabu@endpboxmeasure {% + \@finalstrut \@arstrutbox + \end{varwidth}\egroup % + \ifdim \tabu@temp\p@ <\z@ % neg coef + \ifdim \tabu@wd\tabu@Xcol <\wd\tabu@box + \tabu@wddef\tabu@Xcol {\the\wd\tabu@box}% + \tabu@debug{\tabu@message@endpboxmeasure}% + \fi + \else % spread coef>0 + \global\advance \tabu@naturalX \wd\tabu@box + \@tempdima =\dimexpr \wd\tabu@box *\p@/\dimexpr \tabu@temp\p@\relax \relax + \ifdim \tabu@naturalXmax <\tabu@naturalX + \xdef\tabu@naturalXmax {\the\tabu@naturalX}\fi + \ifdim \tabu@naturalXmin <\@tempdima + \xdef\tabu@naturalXmin {\the\@tempdima}\fi + \fi + \box\tabu@box \egroup % end of \vtop (measure) restore \tabu@target +}% \tabu@endpboxmeasure +\def\tabu@wddef #1{\expandafter\xdef + \csname tabu@\the\tabu@nested.W\number#1\endcsname} +\def\tabu@wd #1{\csname tabu@\the\tabu@nested.W\number#1\endcsname} +\def\tabu@message@endpboxmeasure{\tabu@spaces\tabu@spaces<-> % <-> save natural wd + \the\tabu@Xcol. X[\tabu@temp]: + target = \the\tabucolX \space + \expandafter\expandafter\expandafter\string\tabu@wd\tabu@Xcol + =\tabu@wd\tabu@Xcol +}% \tabu@message@endpboxmeasure +\def\tabu@startpboxquick {\bgroup + \let\@startpbox \tabu@startpboxORI % restore immediately + \let\tabu \tabu@quick % \begin is expanded before... + \expandafter\@gobble \@startpbox % gobbles \bgroup +}% \tabu@startpboxquick +\def\tabu@quick {\begingroup \iffalse{\fi \ifnum0=`}\fi + \toks@{}\def\tabu@stack{b}\tabu@collectbody \tabu@endquick +}% \tabu@quick +\def\tabu@endquick {% + \ifodd 1\ifx\tabu@end@envir\tabu@endtabu \else + \ifx\tabu@end@envir\tabu@endtabus \else 0\fi\fi\relax + \endgroup + \else \let\endtabu \relax + \tabu@end@envir + \fi +}% \tabu@quick +\def\tabu@endtabu {\end{tabu}} +\def\tabu@endtabus {\end{tabu*}} +%% Measuring the heights and depths - store the results ------------- +\def\tabu@verticalmeasure{\everypar{}% + \ifnum \currentgrouptype>12 % 14=semi-simple, 15=math shift group + \setbox\tabu@box =\hbox\bgroup + \let\tabu@verticalspacing \tabu@verticalsp@lcr + \d@llarbegin % after \hbox ... + \else + \edef\tabu@temp{\ifnum\currentgrouptype=5\vtop + \else\ifnum\currentgrouptype=12\vcenter + \else\vbox\fi\fi}% + \setbox\tabu@box \hbox\bgroup$\tabu@temp \bgroup + \let\tabu@verticalspacing \tabu@verticalsp@pmb + \fi +}% \tabu@verticalmeasure +\def\tabu@verticalsp@lcr{% + \d@llarend \egroup % + \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep + \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax + \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi + \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi + \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi + \noindent\vrule height\@tempdima depth\@tempdimb +}% \tabu@verticalsp@lcr +\def\tabu@verticalsp@pmb{% inserts struts as needed + \par \expandafter\egroup + \expandafter$\expandafter + \egroup \expandafter + \@tempdimc \the\prevdepth + \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep + \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax + \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi + \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi + \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi + \let\@finalstrut \@gobble + \hrule height\@tempdima depth\@tempdimb width\hsize +%% \box\tabu@box +}% \tabu@verticalsp@pmb + +\def\tabu@verticalinit{% + \ifnum \c@taburow=\z@ \tabu@rearstrut \fi % after \tabu@reset ! + \advance\c@taburow \@ne + \tabu@htdef{\the\ht\@arstrutbox}\tabu@dpdef{\the\dp\@arstrutbox}% + \advance\c@taburow \m@ne +}% \tabu@verticalinit +\def\tabu@htdef {\expandafter\xdef \csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname} +\def\tabu@ht {\csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname} +\def\tabu@dpdef {\expandafter\xdef \csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname} +\def\tabu@dp {\csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname} +\def\tabu@verticaldynamicadjustment {% + \advance\c@taburow \@ne + \extrarowheight \dimexpr\tabu@ht - \ht\strutbox + \extrarowdepth \dimexpr\tabu@dp - \dp\strutbox + \let\arraystretch \@empty + \advance\c@taburow \m@ne +}% \tabu@verticaldynamicadjustment +\def\tabuphantomline{\crcr \noalign{% + {\globaldefs \@ne + \setbox\@arstrutbox \box\voidb@x + \let\tabu@@celllalign \tabu@celllalign + \let\tabu@@cellralign \tabu@cellralign + \let\tabu@@cellleft \tabu@cellleft + \let\tabu@@cellright \tabu@cellright + \let\tabu@@thevline \tabu@thevline + \let\tabu@celllalign \@empty + \let\tabu@cellralign \@empty + \let\tabu@cellright \@empty + \let\tabu@cellleft \@empty + \let\tabu@thevline \relax}% + \edef\tabu@temp{\tabu@multispan \tabu@nbcols{\noindent &}}% + \toks@\expandafter{\tabu@temp \noindent\tabu@everyrowfalse \cr + \noalign{\tabu@rearstrut + {\globaldefs\@ne + \let\tabu@celllalign \tabu@@celllalign + \let\tabu@cellralign \tabu@@cellralign + \let\tabu@cellleft \tabu@@cellleft + \let\tabu@cellright \tabu@@cellright + \let\tabu@thevline \tabu@@thevline}}}% + \expandafter}\the\toks@ +}% \tabuphantomline +%% \firsthline and \lasthline corrections --------------------------- +\def\tabu@firstline {\tabu@hlineAZ \tabu@firsthlinecorrection {}} +\def\tabu@firsthline{\tabu@hlineAZ \tabu@firsthlinecorrection \hline} +\def\tabu@lastline {\tabu@hlineAZ \tabu@lasthlinecorrection {}} +\def\tabu@lasthline {\tabu@hlineAZ \tabu@lasthlinecorrection \hline} +\def\tabu@hline {% replaces \hline if no colortbl (see \AtBeginDocument) + \noalign{\ifnum0=`}\fi + {\CT@arc@\hrule height\arrayrulewidth}% + \futurelet \tabu@temp \tabu@xhline +}% \tabu@hline +\def\tabu@xhline{% + \ifx \tabu@temp \hline + {\ifx \CT@drsc@\relax \vskip + \else\ifx \CT@drsc@\@empty \vskip + \else \CT@drsc@\hrule height + \fi\fi + \doublerulesep}% + \fi + \ifnum0=`{\fi}% +}% \tabu@xhline +\def\tabu@hlineAZ #1#2{\noalign{\ifnum0=`}\fi \dimen@ \z@ \count@ \z@ + \toks@{}\def\tabu@hlinecorrection{#1}\def\tabu@temp{#2}% + \tabu@hlineAZsurround +}% \tabu@hlineAZ +\newcommand*\tabu@hlineAZsurround[1][\extratabsurround]{% + \extratabsurround #1\let\tabucline \tabucline@scan + \let\hline \tabu@hlinescan \let\firsthline \hline + \let\cline \tabu@clinescan \let\lasthline \hline + \expandafter \futurelet \expandafter \tabu@temp + \expandafter \tabu@nexthlineAZ \tabu@temp +}% \tabu@hlineAZsurround +\def\tabu@hlinescan {\tabu@thick \arrayrulewidth \tabu@xhlineAZ \hline} +\def\tabu@clinescan #1{\tabu@thick \arrayrulewidth \tabu@xhlineAZ {\cline{#1}}} +\def\tabucline@scan{\@testopt \tabucline@sc@n {}} +\def\tabucline@sc@n #1[#2]{\tabu@xhlineAZ {\tabucline[{#1}]{#2}}} +\def\tabu@nexthlineAZ{% + \ifx \tabu@temp\hline \else + \ifx \tabu@temp\cline \else + \ifx \tabu@temp\tabucline \else + \tabu@hlinecorrection + \fi\fi\fi +}% \tabu@nexthlineAZ +\def\tabu@xhlineAZ #1{% + \toks@\expandafter{\the\toks@ #1}% + \@tempdimc \tabu@thick % The last line width + \ifcase\count@ \@tempdimb \tabu@thick % The first line width + \else \advance\dimen@ \dimexpr \tabu@thick+\doublerulesep \relax + \fi + \advance\count@ \@ne \futurelet \tabu@temp \tabu@nexthlineAZ +}% \tabu@xhlineAZ +\def\tabu@firsthlinecorrection{% \count@ = number of \hline -1 + \@tempdima \dimexpr \ht\@arstrutbox+\dimen@ + \edef\firsthline{% + \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule + height \the\dimexpr\@tempdima+\extratabsurround + depth \dp\@arstrutbox + width \tabustrutrule}\hss}\cr + \noalign{\vskip -\the\dimexpr \@tempdima+\@tempdimb + +\dp\@arstrutbox \relax}% + \the\toks@ + }\ifnum0=`{\fi + \expandafter}\firsthline % we are then ! +}% \tabu@firsthlinecorrection +\def\tabu@lasthlinecorrection{% + \@tempdima \dimexpr \dp\@arstrutbox+\dimen@+\@tempdimb+\@tempdimc + \edef\lasthline{% + \the\toks@ + \noalign{\vskip -\the\dimexpr\dimen@+\@tempdimb+\dp\@arstrutbox}% + \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule + depth \the\dimexpr \dp\@arstrutbox+\@tempdimb+\dimen@ + +\extratabsurround-\@tempdimc + height \z@ + width \tabustrutrule}\hss}\cr + }\ifnum0=`{\fi + \expandafter}\lasthline % we are then ! +}% \tabu@lasthlinecorrection +\def\tabu@LT@@hline{% + \ifx\LT@next\hline + \global\let\LT@next \@gobble + \ifx \CT@drsc@\relax + \gdef\CT@LT@sep{% + \noalign{\penalty-\@medpenalty\vskip\doublerulesep}}% + \else + \gdef\CT@LT@sep{% + \multispan\LT@cols{% + \CT@drsc@\leaders\hrule\@height\doublerulesep\hfill}\cr}% + \fi + \else + \global\let\LT@next\empty + \gdef\CT@LT@sep{% + \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}% + \fi + \ifnum0=`{\fi}% + \multispan\LT@cols + {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr + \CT@LT@sep + \multispan\LT@cols + {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr + \noalign{\penalty\@M}% + \LT@next +}% \tabu@LT@@hline +%% Horizontal lines : \tabucline ------------------------------------ +\let\tabu@start \@tempcnta +\let\tabu@stop \@tempcntb +\newcommand*\tabucline{\noalign{\ifnum0=`}\fi \tabu@cline} +\newcommand*\tabu@cline[2][]{\tabu@startstop{#2}% + \ifnum \tabu@stop<\z@ \toks@{}% + \else \tabu@clinearg{#1}\tabu@thestyle + \edef\tabucline{\toks@{% + \ifnum \tabu@start>\z@ \omit + \tabu@multispan\tabu@start {\span\omit}&\fi + \omit \tabu@multispan\tabu@stop {\span\omit}% + \tabu@thehline\cr + }}\tabucline + \tabu@tracinglines{(tabu:tabucline) Style: #1^^J\the\toks@^^J^^J}% + \fi + \futurelet \tabu@temp \tabu@xcline +}% \tabu@cline +\def\tabu@clinearg #1{% + \ifx\\#1\\\let\tabu@thestyle \tabu@ls@ + \else \@defaultunits \expandafter\let\expandafter\@tempa + \romannumeral-`\0#1\relax \@nnil + \ifx \hbox\@tempa \tabu@clinebox{#1}% + \else\ifx \box\@tempa \tabu@clinebox{#1}% + \else\ifx \vbox\@tempa \tabu@clinebox{#1}% + \else\ifx \vtop\@tempa \tabu@clinebox{#1}% + \else\ifx \copy\@tempa \tabu@clinebox{#1}% + \else\ifx \leaders\@tempa \tabu@clineleads{#1}% + \else\ifx \cleaders\@tempa \tabu@clineleads{#1}% + \else\ifx \xleaders\@tempa \tabu@clineleads{#1}% + \else\tabu@getline {#1}% + \fi\fi\fi\fi\fi\fi\fi\fi + \fi +}% \tabu@clinearg +\def\tabu@clinebox #1{\tabu@clineleads{\xleaders#1\hss}} +\def\tabu@clineleads #1{% + \let\tabu@thestyle \relax \let\tabu@leaders \@undefined + \gdef\tabu@thehrule{#1}} +\def\tabu@thehline{\begingroup + \ifdefined\tabu@leaders + \noexpand\tabu@thehleaders + \else \noexpand\tabu@thehrule + \fi \endgroup +}% \tabu@thehline +\def\tabu@xcline{% + \ifx \tabu@temp\tabucline + \toks@\expandafter{\the\toks@ \noalign + {\ifx\CT@drsc@\relax \vskip + \else \CT@drsc@\hrule height + \fi + \doublerulesep}}% + \fi + \tabu@docline +}% \tabu@xcline +\def\tabu@docline {\ifnum0=`{\fi \expandafter}\the\toks@} +\def\tabu@docline@evr {\xdef\tabu@doclineafter{\the\toks@}% + \ifnum0=`{\fi}\aftergroup\tabu@doclineafter} +\def\tabu@multispan #1#2{% + \ifnum\numexpr#1>\@ne #2\expandafter\tabu@multispan + \else \expandafter\@gobbletwo + \fi {#1-1}{#2}% +}% \tabu@multispan +\def\tabu@startstop #1{\tabu@start@stop #1\relax 1-\tabu@nbcols \@nnil} +\def\tabu@start@stop #1-#2\@nnil{% + \@defaultunits \tabu@start\number 0#1\relax \@nnil + \@defaultunits \tabu@stop \number 0#2\relax \@nnil + \tabu@stop \ifnum \tabu@start>\tabu@nbcols \m@ne + \else\ifnum \tabu@stop=\z@ \tabu@nbcols + \else\ifnum \tabu@stop>\tabu@nbcols \tabu@nbcols + \else \tabu@stop + \fi\fi\fi + \advance\tabu@start \m@ne + \ifnum \tabu@start>\z@ \advance\tabu@stop -\tabu@start \fi +}% \tabu@start@stop +%% Numbers: siunitx S columns (and \tabudecimal) ------------------- +\def\tabu@tabudecimal #1{% + \def\tabu@decimal{#1}\@temptokena{}% + \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces + \tabu@scandecimal +}% \tabu@tabudecimal +\def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@} +\def\tabu@skipdecimal#1{#1\tabu@scandecimal} +\def\tabu@getdecimal@ignorespaces{% + \ifcase 0\ifx\tabu@temp\ignorespaces\else + \ifx\tabu@temp\@sptoken1\else + 2\fi\fi\relax + \let\tabu@getdecimal@ \tabu@getdecimal + \expandafter\tabu@skipdecimal + \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal + \else \expandafter\tabu@skipdecimal + \fi +}% \tabu@getdecimal@ignorespaces +\def\tabu@get@decimal#1{\@temptokena\expandafter{\the\@temptokena #1}% + \tabu@scandecimal} +\def\do#1{% + \def\tabu@get@decimalspace#1{% + \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}% +}\do{ } +\let\tabu@@tabudecimal \tabu@tabudecimal +\def\tabu@getdecimal{% + \ifcase 0\ifx 0\tabu@temp\else + \ifx 1\tabu@temp\else + \ifx 2\tabu@temp\else + \ifx 3\tabu@temp\else + \ifx 4\tabu@temp\else + \ifx 5\tabu@temp\else + \ifx 6\tabu@temp\else + \ifx 7\tabu@temp\else + \ifx 8\tabu@temp\else + \ifx 9\tabu@temp\else + \ifx .\tabu@temp\else + \ifx ,\tabu@temp\else + \ifx -\tabu@temp\else + \ifx +\tabu@temp\else + \ifx e\tabu@temp\else + \ifx E\tabu@temp\else + \ifx\tabu@cellleft\tabu@temp1\else + \ifx\ignorespaces\tabu@temp1\else + \ifx\@sptoken\tabu@temp2\else + 3\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax + \expandafter\tabu@get@decimal + \or \expandafter\tabu@skipdecimal + \or \expandafter\tabu@get@decimalspace + \else\expandafter\tabu@printdecimal + \fi +}% \tabu@getdecimal +\def\tabu@printdecimal{% + \edef\tabu@temp{\the\@temptokena}% + \ifx\tabu@temp\@empty\else + \ifx\tabu@temp\space\else + \expandafter\tabu@decimal\expandafter{\the\@temptokena}% + \fi\fi +}% \tabu@printdecimal +%% Verbatim inside X columns ---------------------------------------- +\def\tabu@verbatim{% + \let\verb \tabu@verb + \let\FV@DefineCheckEnd \tabu@FV@DefineCheckEnd +}% \tabu@verbatim +\let\tabu@ltx@verb \verb +\def\tabu@verb{\@ifstar {\tabu@ltx@verb*} \tabu@ltx@verb} +\def\tabu@fancyvrb {% + \def\tabu@FV@DefineCheckEnd ##1{% + \def\tabu@FV@DefineCheckEnd{% + ##1% + \let\FV@CheckEnd \tabu@FV@CheckEnd + \let\FV@@CheckEnd \tabu@FV@@CheckEnd + \let\FV@@@CheckEnd \tabu@FV@@@CheckEnd + \edef\FV@EndScanning{% + \def\noexpand\next{\noexpand\end{\FV@EnvironName}}% + \global\let\noexpand\FV@EnvironName\relax + \noexpand\next}% + \xdef\FV@EnvironName{\detokenize\expandafter{\FV@EnvironName}}}% + }\expandafter\tabu@FV@DefineCheckEnd\expandafter{\FV@DefineCheckEnd} +}% \tabu@fancyvrb +\def\tabu@FV@CheckEnd #1{\expandafter\FV@@CheckEnd \detokenize{#1\end{}}\@nil} +\edef\tabu@FV@@@CheckEnd {\detokenize{\end{}}} +\begingroup +\catcode`\[1 \catcode`\]2 +\@makeother\{ \@makeother\} + \edef\x[\endgroup + \def\noexpand\tabu@FV@@CheckEnd ##1\detokenize[\end{]##2\detokenize[}]##3% + ]\x \@nil{\def\@tempa{#2}\def\@tempb{#3}} +\def\tabu@FV@ListProcessLine #1{% + \hbox {%to \hsize{% + \kern\leftmargin + \hbox {%to \linewidth{% + \FV@LeftListNumber + \FV@LeftListFrame + \FancyVerbFormatLine{#1}\hss +%% DG/SR modification begin - Jan. 28, 1998 (for numbers=right add-on) +%% \FV@RightListFrame}% + \FV@RightListFrame + \FV@RightListNumber}% +%% DG/SR modification end + \hss}} +%% \savetabu -------------------------------------------------------- +\newcommand*\savetabu[1]{\noalign{% + \tabu@sanitizearg{#1}\tabu@temp + \ifx \tabu@temp\@empty \tabu@savewarn{}{The tabu will not be saved}\else + \@ifundefined{tabu@saved@\tabu@temp}{}{\tabu@savewarn{#1}{Overwriting}}% + \ifdefined\tabu@restored \expandafter\let + \csname tabu@saved@\tabu@temp \endcsname \tabu@restored + \else {\tabu@save}% + \fi + \fi}% +}% \savetabu +\def\tabu@save {% + \toks0\expandafter{\tabu@saved@}% + \iftabu@negcoef + \let\tabu@wddef \relax \let\tabu@ \tabu@savewd \edef\tabu@savewd{\tabu@Xcoefs}% + \toks0\expandafter{\the\toks\expandafter0\tabu@savewd}\fi + \toks1\expandafter{\tabu@savedpream}% + \toks2\expandafter{\tabu@savedpreamble}% + \let\@preamble \relax + \let\tabu@savedpream \relax \let\tabu@savedparams \relax + \edef\tabu@preamble{% + \def\noexpand\tabu@aligndefault{\tabu@align}% + \def\tabu@savedparams {\noexpand\the\toks0}% + \def\tabu@savedpream {\noexpand\the\toks1}}% + \edef\tabu@usetabu{% + \def\@preamble {\noexpand\the\toks2}% + \tabu@target \the\tabu@target \relax + \tabucolX \the\tabucolX \relax + \tabu@nbcols \the\tabu@nbcols \relax + \def\noexpand\tabu@aligndefault{\tabu@align}% + \def\tabu@savedparams {\noexpand\the\toks0}% + \def\tabu@savedpream {\noexpand\the\toks1}}% + \let\tabu@aligndefault \relax \let\@sharp \relax + \edef\@tempa{\noexpand\tabu@s@ved + {\tabu@usetabu} + {\tabu@preamble} + {\the\toks1}}\@tempa + \tabu@message@save +}% \tabu@save +\long\def\tabu@s@ved #1#2#3{% + \def\tabu@usetabu{#1}% + \expandafter\gdef\csname tabu@saved@\tabu@temp\endcsname ##1{% + \ifodd ##1% \usetabu + \tabu@measuringfalse \tabu@spreadfalse % Just in case... + \gdef\tabu@usetabu {% + \ifdim \tabu@target>\z@ \tabu@warn@usetabu \fi + \global\let\tabu@usetabu \@undefined + \def\@halignto {to\tabu@target}% + #1% + \ifx \tabu@align\tabu@aligndefault@text + \ifnum \tabu@nested=\z@ + \let\tabu@align \tabu@aligndefault \fi\fi}% + \else % \preamble + \gdef\tabu@preamble {% + \global\let\tabu@preamble \@undefined + #2% + \ifx \tabu@align\tabu@aligndefault@text + \ifnum \tabu@nested=\z@ + \let\tabu@align \tabu@aligndefault \fi\fi}% + \fi + #3}% +}% \tabu@s@ved +\def\tabu@aligndefault@text {\tabu@aligndefault}% +\def\tabu@warn@usetabu {\PackageWarning{tabu} + {Specifying a target with \string\usetabu\space is useless + \MessageBreak The target cannot be changed!}} +\def\tabu@savewd #1#2{\ifdim #2\p@<\z@ \tabu@wddef{#1}{\tabu@wd{#1}}\fi} +\def\tabu@savewarn#1#2{\PackageInfo{tabu} + {User-name `#1' already used for \string\savetabu + \MessageBreak #2}}% +\def\tabu@saveerr#1{\PackageError{tabu} + {User-name `#1' is unknown for \string\usetabu + \MessageBreak I cannot restore an unknown preamble!}\@ehd} +%% \rowfont --------------------------------------------------------- +\newskip \tabu@cellskip +\def\tabu@rowfont{\ifdim \baselineskip=\z@\noalign\fi + {\ifnum0=`}\fi \tabu@row@font} +\newcommand*\tabu@row@font[2][]{% + \ifnum7=\currentgrouptype + \global\let\tabu@@cellleft \tabu@cellleft + \global\let\tabu@@cellright \tabu@cellright + \global\let\tabu@@celllalign \tabu@celllalign + \global\let\tabu@@cellralign \tabu@cellralign + \global\let\tabu@@rowfontreset\tabu@rowfontreset + \fi + \global\let\tabu@rowfontreset \tabu@rowfont@reset + \expandafter\gdef\expandafter\tabu@cellleft\expandafter{\tabu@cellleft #2}% + \ifcsname tabu@cell@#1\endcsname % row alignment + \csname tabu@cell@#1\endcsname \fi + \ifnum0=`{\fi}% end of group / noalign group +}% \rowfont +\def\tabu@ifcolorleavevmode #1{\let\color \tabu@leavevmodecolor #1\let\color\tabu@color}% +\def\tabu@rowfont@reset{% + \global\let\tabu@rowfontreset \tabu@@rowfontreset + \global\let\tabu@cellleft \tabu@@cellleft + \global\let\tabu@cellright \tabu@@cellright + \global\let\tabu@cellfont \@empty + \global\let\tabu@celllalign \tabu@@celllalign + \global\let\tabu@cellralign \tabu@@cellralign +}% \tabu@@rowfontreset +\let\tabu@rowfontreset \@empty % overwritten \AtBeginDocument if colortbl +%% \tabu@prepnext@tok ----------------------------------------------- +\newif \iftabu@cellright +\def\tabu@prepnext@tok{% + \ifnum \count@<\z@ % + \@tempcnta \@M % + \tabu@nbcols\z@ + \let\tabu@fornoopORI \@fornoop + \tabu@cellrightfalse + \else + \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left + \advance \tabu@nbcols \@ne + \iftabu@cellright % before-previous token is right and is finished + \tabu@cellrightfalse % + \tabu@righttok + \fi + \tabu@lefttok + \or % (case 1) previous token is right + \tabu@cellrighttrue \let\@fornoop \tabu@lastnoop + \else % special column: do not change the token + \iftabu@cellright % before-previous token is right + \tabu@cellrightfalse + \tabu@righttok + \fi + \fi % \ifcase + \fi + \tabu@prepnext@tokORI +}% \tabu@prepnext@tok +\long\def\tabu@lastnoop#1\@@#2#3{\tabu@lastn@@p #2\@nextchar \in@\in@@} +\def\tabu@lastn@@p #1\@nextchar #2#3\in@@{% + \ifx \in@#2\else + \let\@fornoop \tabu@fornoopORI + \xdef\tabu@mkpreambuffer{\tabu@nbcols\the\tabu@nbcols \tabu@mkpreambuffer}% + \toks0\expandafter{\expandafter\tabu@everyrowtrue \the\toks0}% + \expandafter\prepnext@tok + \fi +}% \tabu@lastnoop +\def\tabu@righttok{% + \advance \count@ \m@ne + \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}% + \advance \count@ \@ne +}% \tabu@righttok +\def\tabu@lefttok{\toks\count@\expandafter{\expandafter\tabu@celllalign + \the\toks\count@ \tabu@cellleft}% after because of $ +}% \tabu@lefttok +%% Neutralisation of glues ------------------------------------------ +\let\tabu@cellleft \@empty +\let\tabu@cellright \@empty +\tabu@celllalign@def{\tabu@cellleft}% +\let\tabu@cellralign \@empty +\def\tabu@cell@align #1#2#3{% + \let\tabu@maybesiunitx \toks@ \tabu@celllalign + \global \expandafter \tabu@celllalign@def \expandafter {\the\toks@ #1}% + \toks@\expandafter{\tabu@cellralign #2}% + \xdef\tabu@cellralign{\the\toks@}% + \toks@\expandafter{\tabu@cellleft #3}% + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@align +\def\tabu@cell@l{% force alignment to left + \tabu@cell@align + {\tabu@removehfil \raggedright \tabu@cellleft}% left + {\tabu@flush1\tabu@ignorehfil}% right + \raggedright +}% \tabu@cell@l +\def\tabu@cell@c{% force alignment to center + \tabu@cell@align + {\tabu@removehfil \centering \tabu@flush{.5}\tabu@cellleft} + {\tabu@flush{.5}\tabu@ignorehfil} + \centering +}% \tabu@cell@c +\def\tabu@cell@r{% force alignment to right + \tabu@cell@align + {\tabu@removehfil \raggedleft \tabu@flush1\tabu@cellleft} + \tabu@ignorehfil + \raggedleft +}% \tabu@cell@r +\def\tabu@cell@j{% force justification (for p, m, b columns) + \tabu@cell@align + {\tabu@justify\tabu@cellleft} + {} + \tabu@justify +}% \tabu@cell@j +\def\tabu@justify{% + \leftskip\z@skip \@rightskip\leftskip \rightskip\@rightskip + \parfillskip\@flushglue +}% \tabu@justify +%% ragged2e settings +\def\tabu@cell@L{% force alignment to left (ragged2e) + \tabu@cell@align + {\tabu@removehfil \RaggedRight \tabu@cellleft} + {\tabu@flush 1\tabu@ignorehfil} + \RaggedRight +}% \tabu@cell@L +\def\tabu@cell@C{% force alignment to center (ragged2e) + \tabu@cell@align + {\tabu@removehfil \Centering \tabu@flush{.5}\tabu@cellleft} + {\tabu@flush{.5}\tabu@ignorehfil} + \Centering +}% \tabu@cell@C +\def\tabu@cell@R{% force alignment to right (ragged2e) + \tabu@cell@align + {\tabu@removehfil \RaggedLeft \tabu@flush 1\tabu@cellleft} + \tabu@ignorehfil + \RaggedLeft +}% \tabu@cell@R +\def\tabu@cell@J{% force justification (ragged2e) + \tabu@cell@align + {\justifying \tabu@cellleft} + {} + \justifying +}% \tabu@cell@J +\def\tabu@flush#1{% + \iftabu@colortbl % colortbl uses \hfill rather than \hfil + \hskip \ifnum13<\currentgrouptype \stretch{#1}% + \else \ifdim#1pt<\p@ \tabu@cellskip + \else \stretch{#1} + \fi\fi \relax + \else % array.sty + \ifnum 13<\currentgrouptype + \hfil \hskip1sp \relax \fi + \fi +}% \tabu@flush +\let\tabu@hfil \hfil +\let\tabu@hfill \hfill +\let\tabu@hskip \hskip +\def\tabu@removehfil{% + \iftabu@colortbl + \unkern \tabu@cellskip =\lastskip + \ifnum\gluestretchorder\tabu@cellskip =\tw@ \hskip-\tabu@cellskip + \else \tabu@cellskip \z@skip + \fi + \else + \ifdim\lastskip=1sp\unskip\fi + \ifnum\gluestretchorder\lastskip =\@ne + \hfilneg % \hfilneg for array.sty but not for colortbl... + \fi + \fi +}% \tabu@removehfil +\def\tabu@ignorehfil{\aftergroup \tabu@nohfil} +\def\tabu@nohfil{% \hfil -> do nothing + restore original \hfil + \def\hfil{\let\hfil \tabu@hfil}% local to (alignment template) group +}% \tabu@nohfil +\def\tabu@colortblalignments {% if colortbl + \def\tabu@nohfil{% + \def\hfil {\let\hfil \tabu@hfil}% local to (alignment template) group + \def\hfill {\let\hfill \tabu@hfill}% (colortbl uses \hfill) pfff... + \def\hskip ####1\relax{\let\hskip \tabu@hskip}}% local +}% \tabu@colortblalignments +%% Taking care of footnotes and hyperfootnotes ---------------------- +\long\def\tabu@footnotetext #1{% + \edef\@tempa{\the\tabu@footnotes + \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}% + \global\tabu@footnotes\expandafter{\@tempa {#1}}}% +\long\def\tabu@xfootnotetext [#1]#2{% + \global\tabu@footnotes\expandafter{\the\tabu@footnotes + \footnotetext [{#1}]{#2}}} +\let\tabu@xfootnote \@xfootnote +\long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }} +\long\def\tabu@Hy@xfootnote [#1]{% + \begingroup + \value\@mpfn #1\relax + \protected@xdef \@thefnmark {\thempfn}% + \endgroup + \@footnotemark \tabu@Hy@ftntxt {#1}% +}% \tabu@Hy@xfootnote +\long\def\tabu@Hy@ftntxt #1#2{% + \edef\@tempa{% + \the\tabu@footnotes + \begingroup + \value\@mpfn #1\relax + \noexpand\protected@xdef\noexpand\@thefnmark {\noexpand\thempfn}% + \expandafter \noexpand \expandafter + \tabu@Hy@footnotetext \expandafter{\Hy@footnote@currentHref}% + }% + \global\tabu@footnotes\expandafter{\@tempa {#2}% + \endgroup}% +}% \tabu@Hy@ftntxt +\long\def\tabu@Hy@footnotetext #1#2{% + \H@@footnotetext{% + \ifHy@nesting + \hyper@@anchor {#1}{#2}% + \else + \Hy@raisedlink{% + \hyper@@anchor {#1}{\relax}% + }% + \def\@currentHref {#1}% + \let\@currentlabelname \@empty + #2% + \fi + }% +}% \tabu@Hy@footnotetext +%% No need for \arraybackslash ! ------------------------------------ +\def\tabu@latextwoe {% +\def\tabu@temp##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}} +\tabu@temp \tabu@centering \centering \arraybackslash +\tabu@temp \tabu@raggedleft \raggedleft \arraybackslash +\tabu@temp \tabu@raggedright \raggedright \arraybackslash +}% \tabu@latextwoe +\def\tabu@raggedtwoe {% +\def\tabu@temp ##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}} +\tabu@temp \tabu@Centering \Centering \arraybackslash +\tabu@temp \tabu@RaggedLeft \RaggedLeft \arraybackslash +\tabu@temp \tabu@RaggedRight \RaggedRight \arraybackslash +\tabu@temp \tabu@justifying \justifying \arraybackslash +}% \tabu@raggedtwoe +\def\tabu@normalcrbackslash{\let\\\@normalcr} +\def\tabu@trivlist{\expandafter\def\expandafter\@trivlist\expandafter{% + \expandafter\tabu@normalcrbackslash \@trivlist}} +%% Utilities: \fbox \fcolorbox and \tabudecimal ------------------- +\def\tabu@fbox {\leavevmode\afterassignment\tabu@beginfbox \setbox\@tempboxa\hbox} +\def\tabu@beginfbox {\bgroup \kern\fboxsep + \bgroup\aftergroup\tabu@endfbox} +\def\tabu@endfbox {\kern\fboxsep\egroup\egroup + \@frameb@x\relax} +\def\tabu@color@b@x #1#2{\leavevmode \bgroup + \def\tabu@docolor@b@x{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}% + \afterassignment\tabu@begincolor@b@x \setbox\z@ \hbox +}% \tabu@color@b@x +\def\tabu@begincolor@b@x {\kern\fboxsep \bgroup + \aftergroup\tabu@endcolor@b@x \set@color} +\def\tabu@endcolor@b@x {\kern\fboxsep \egroup + \dimen@\ht\z@ \advance\dimen@ \fboxsep \ht\z@ \dimen@ + \dimen@\dp\z@ \advance\dimen@ \fboxsep \dp\z@ \dimen@ + \tabu@docolor@b@x \egroup +}% \tabu@endcolor@b@x +%% Corrections (arydshln, delarray, colortbl) ----------------------- +\def\tabu@fix@arrayright {%% \@arrayright is missing from \endarray + \iftabu@colortbl + \ifdefined\adl@array % + \def\tabu@endarray{% + \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup % + \@arrayright % + \gdef\@preamble{}}% + \else % + \def\tabu@endarray{% + \crcr \egroup \egroup % + \@arrayright % + \gdef\@preamble{}\CT@end}% + \fi + \else + \ifdefined\adl@array % + \def\tabu@endarray{% + \adl@endarray \egroup \adl@arrayrestore \egroup % + \@arrayright % + \gdef\@preamble{}}% + \else % + \PackageWarning{tabu} + {\string\@arrayright\space is missing from the + \MessageBreak definition of \string\endarray. + \MessageBreak Compatibility with delarray.sty is broken.}% + \fi\fi +}% \tabu@fix@arrayright +\def\tabu@adl@xarraydashrule #1#2#3{% + \ifnum\@lastchclass=\adl@class@start\else + \ifnum\@lastchclass=\@ne\else + \ifnum\@lastchclass=5 \else % @-arg (class 5) and !-arg (class 1) + \adl@leftrulefalse \fi\fi % must be treated the same + \fi + \ifadl@zwvrule\else \ifadl@inactive\else + \@addtopreamble{\vrule\@width\arrayrulewidth + \@height\z@ \@depth\z@}\fi \fi + \ifadl@leftrule + \@addtopreamble{\adl@vlineL{\CT@arc@}{\adl@dashgapcolor}% + {\number#1}#3}% + \else \@addtopreamble{\adl@vlineR{\CT@arc@}{\adl@dashgapcolor}% + {\number#2}#3} + \fi +}% \tabu@adl@xarraydashrule +\def\tabu@adl@act@endpbox {% + \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox + \egroup \egroup + \adl@colhtdp \box\adl@box \hfil +}% \tabu@adl@act@endpbox +\def\tabu@adl@fix {% + \let\adl@xarraydashrule \tabu@adl@xarraydashrule % arydshln + \let\adl@act@endpbox \tabu@adl@act@endpbox % arydshln + \let\adl@act@@endpbox \tabu@adl@act@endpbox % arydshln + \let\@preamerror \@preamerr % arydshln +}% \tabu@adl@fix +%% Correction for longtable' \@startbox definition ------------------ +%% => \everypar is ``missing'' : TeX should be in vertical mode +\def\tabu@LT@startpbox #1{% + \bgroup + \let\@footnotetext\LT@p@ftntext + \setlength\hsize{#1}% + \@arrayparboxrestore + \everypar{% + \vrule \@height \ht\@arstrutbox \@width \z@ + \everypar{}}% +}% \tabu@LT@startpbox +%% \tracingtabu and the package options ------------------ +\DeclareOption{delarray}{\AtEndOfPackage{\RequirePackage{delarray}}} +\DeclareOption{linegoal}{% + \AtEndOfPackage{% + \RequirePackage{linegoal}[2010/12/07]% + \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX +}} +\DeclareOption{scantokens}{\tabuscantokenstrue} +\DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu=\tw@}} +\def\tracingtabu {\begingroup\@ifnextchar=% + {\afterassignment\tabu@tracing\count@} + {\afterassignment\tabu@tracing\count@1\relax}} +\def\tabu@tracing{\expandafter\endgroup + \expandafter\tabu@tr@cing \the\count@ \relax +}% \tabu@tracing +\def\tabu@tr@cing #1\relax {% + \ifnum#1>\thr@@ \let\tabu@tracinglines\message + \else \let\tabu@tracinglines\@gobble + \fi + \ifnum#1>\tw@ \let\tabu@DBG \tabu@@DBG + \def\tabu@mkarstrut {\tabu@DBG@arstrut}% + \tabustrutrule 1.5\p@ + \else \let\tabu@DBG \@gobble + \def\tabu@mkarstrut {\tabu@arstrut}% + \tabustrutrule \z@ + \fi + \ifnum#1>\@ne \let\tabu@debug \message + \else \let\tabu@debug \@gobble + \fi + \ifnum#1>\z@ + \let\tabu@message \message + \let\tabu@tracing@save \tabu@message@save + \let\tabu@starttimer \tabu@pdftimer + \else + \let\tabu@message \@gobble + \let\tabu@tracing@save \@gobble + \let\tabu@starttimer \relax + \fi +}% \tabu@tr@cing +%% Setup \AtBeginDocument +\AtBeginDocument{\tabu@AtBeginDocument} +\def\tabu@AtBeginDocument{\let\tabu@AtBeginDocument \@undefined + \ifdefined\arrayrulecolor \tabu@colortbltrue % + \tabu@colortblalignments % different glues are used + \else \tabu@colortblfalse \fi + \ifdefined\CT@arc@ \else \let\CT@arc@ \relax \fi + \ifdefined\CT@drsc@\else \let\CT@drsc@ \relax \fi + \let\tabu@arc@L \CT@arc@ \let\tabu@drsc@L \CT@drsc@ + \ifodd 1\ifcsname siunitx_table_collect_begin:Nn\endcsname % + \expandafter\ifx + \csname siunitx_table_collect_begin:Nn\endcsname\relax 0\fi\fi\relax + \tabu@siunitxtrue + \else \let\tabu@maybesiunitx \@firstofone % + \let\tabu@siunitx \tabu@nosiunitx + \tabu@siunitxfalse + \fi + \ifdefined\adl@array % + \else \let\tabu@adl@fix \relax + \let\tabu@adl@endtrial \@empty \fi + \ifdefined\longtable % + \else \let\longtabu \tabu@nolongtabu \fi + \ifdefined\cellspacetoplimit \tabu@warn@cellspace\fi + \csname\ifcsname ifHy@hyperfootnotes\endcsname % + ifHy@hyperfootnotes\else iffalse\fi\endcsname + \let\tabu@footnotetext \tabu@Hy@ftntext + \let\tabu@xfootnote \tabu@Hy@xfootnote \fi + \ifdefined\FV@DefineCheckEnd% + \tabu@fancyvrb \fi + \ifdefined\color % + \let\tabu@color \color + \def\tabu@leavevmodecolor ##1{% + \def\tabu@leavevmodecolor {\leavevmode ##1}% + }\expandafter\tabu@leavevmodecolor\expandafter{\color}% + \else + \let\tabu@color \tabu@nocolor + \let\tabu@leavevmodecolor \@firstofone \fi + \tabu@latextwoe + \ifdefined\@raggedtwoe@everyselectfont % + \tabu@raggedtwoe + \else + \let\tabu@cell@L \tabu@cell@l + \let\tabu@cell@R \tabu@cell@r + \let\tabu@cell@C \tabu@cell@c + \let\tabu@cell@J \tabu@cell@j \fi + \expandafter\in@ \expandafter\@arrayright \expandafter{\endarray}% + \ifin@ \let\tabu@endarray \endarray + \else \tabu@fix@arrayright \fi% + \everyrow{}% +}% \tabu@AtBeginDocument +\def\tabu@warn@cellspace{% + \PackageWarning{tabu}{% + Package cellspace has some limitations + \MessageBreak And redefines some macros of array.sty. + \MessageBreak Please use \string\tabulinesep\space to control + \MessageBreak vertical spacing of lines inside tabu environment}% +}% \tabu@warn@cellspace +%% tabu Package initialisation +\tabuscantokensfalse +\let\tabu@arc@G \relax +\let\tabu@drsc@G \relax +\let\tabu@evr@G \@empty +\let\tabu@rc@G \@empty +\def\tabu@ls@G {\tabu@linestyle@}% +\let\tabu@@rowfontreset \@empty % +\let\tabu@@celllalign \@empty +\let\tabu@@cellralign \@empty +\let\tabu@@cellleft \@empty +\let\tabu@@cellright \@empty +\def\tabu@naturalXmin {\z@} +\def\tabu@naturalXmax {\z@} +\let\tabu@rowfontreset \@empty +\def\tabulineon {4pt}\let\tabulineoff \tabulineon +\tabu@everyrowtrue +\ifdefined\pdfelapsedtime % + \def\tabu@pdftimer {\xdef\tabu@starttime{\the\pdfelapsedtime}}% +\else \let\tabu@pdftimer \relax \let\tabu@message@etime \relax +\fi +\tracingtabu=\z@ +\newtabulinestyle {=\maxdimen}% creates the 'factory' settings \tabu@linestyle@ +\tabulinestyle{} +\taburowcolors{} +\let\tabudefaulttarget \linewidth +\ProcessOptions* % \ProcessOptions* is quicker ! +\endinput +%% +%% End of file `tabu.sty'. -- cgit v0.12