From 44c1f04b2bc28fbeb14b6d4e17fda0cd029b6890 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 31 Jul 2020 12:49:36 +0200 Subject: Debug facility for the \cite command When issuing doxygen with `-d cite` the temporary (copied) files / directory are not removed, i.e.: - bib*.aux - bib*.bbl - bib*.blg - bib2xhtml.pl - citelist.doc - doxygen.bst - bibTmpDir (directory) --- src/cite.cpp | 11 +++++------ src/debug.cpp | 3 ++- src/debug.h | 3 ++- templates/html/bib2xhtml.pl | 7 ++++++- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/cite.cpp b/src/cite.cpp index 78df0c3..07a6dbf 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -22,6 +22,7 @@ #include "portable.h" #include "resourcemgr.h" #include "util.h" +#include "debug.h" #include #include @@ -30,10 +31,6 @@ #include #include -// Remove the temporary files -#define RM_TMP_FILES (true) -//#define RM_TMP_FILES (false) - const char *bibTmpFile = "bibTmpFile_"; const char *bibTmpDir = "bibTmpDir/"; @@ -115,6 +112,8 @@ void CitationManager::generatePage() // do not generate an empty citations page if (isEmpty()) return; // nothing to cite + 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); @@ -233,7 +232,7 @@ void CitationManager::generatePage() int exitCode; Portable::sysTimerStop(); if ((exitCode=Portable::system("perl","\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ - citeListFile+"\"")) != 0) + citeListFile+"\"" + (citeDebug ? " -d" : ""))) != 0) { err("Problems running bibtex. Verify that the command 'perl --version' works from the command line. Exit code: %d\n", exitCode); @@ -327,7 +326,7 @@ void CitationManager::generatePage() } // 9. Remove temporary files - if (RM_TMP_FILES) + if (!citeDebug) { thisDir.remove(citeListFile); thisDir.remove(doxygenBstFile); diff --git a/src/debug.cpp b/src/debug.cpp index 6815b3b..f56ef3a 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -42,7 +42,8 @@ static std::map< std::string, Debug::DebugMask > s_labels = { "filteroutput", Debug::FilterOutput }, { "lex", Debug::Lex }, { "plantuml", Debug::Plantuml }, - { "fortranfixed2free", Debug::FortranFixed2Free } + { "fortranfixed2free", Debug::FortranFixed2Free }, + { "cite", Debug::Cite } }; //------------------------------------------------------------------------ diff --git a/src/debug.h b/src/debug.h index edc95e2..e71595f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -36,7 +36,8 @@ class Debug FilterOutput = 0x00001000, Lex = 0x00002000, Plantuml = 0x00004000, - FortranFixed2Free = 0x00008000 + FortranFixed2Free = 0x00008000, + Cite = 0x00010000 }; static void print(DebugMask mask,int prio,const char *fmt,...); diff --git a/templates/html/bib2xhtml.pl b/templates/html/bib2xhtml.pl index da6dc62..2b462d3 100755 --- a/templates/html/bib2xhtml.pl +++ b/templates/html/bib2xhtml.pl @@ -118,11 +118,14 @@ sub html_ent { s/\\lfloor\b/⌊/g; s/\\rfloor\b/⌋/g; } +$bdebug = 0; foreach (@ARGV) { if (/\.bib$/) { $bibfile = $_; $bibfile =~ s/\.bib$//; push(@bibfiles,$bibfile); + } elsif ("$_" eq "-d") { + $bdebug = 1; } else { $htmlfile = $_; } @@ -315,5 +318,7 @@ close (OHTMLFILE); close(HTMLFILE); chmod($mode, "$htmlfile$$"); rename("$htmlfile$$", $htmlfile); -unlink(@tmpfiles); +if ($bdebug == 0) { + unlink(@tmpfiles); +} exit(0); -- cgit v0.12