summaryrefslogtreecommitdiffstats
path: root/src/plantuml.cpp
diff options
context:
space:
mode:
authorCharles.Lee <cheoljoo.lee@lge.com>2018-12-28 07:12:52 (GMT)
committerCharles.Lee <cheoljoo.lee@lge.com>2018-12-28 07:12:52 (GMT)
commitc7a88a8fe29bd5bea22f5aa83175eebd20247125 (patch)
treea6a44dccd3122001e59fd53c87439877e5dbf260 /src/plantuml.cpp
parent756d8b203b67f3ab38f7d148794bb94175a064a7 (diff)
downloadDoxygen-c7a88a8fe29bd5bea22f5aa83175eebd20247125.zip
Doxygen-c7a88a8fe29bd5bea22f5aa83175eebd20247125.tar.gz
Doxygen-c7a88a8fe29bd5bea22f5aa83175eebd20247125.tar.bz2
# Introduction
- this is doxygen documents. - draw the plantuml # Explanation how to process for FAST plantuml ```puml @startuml folder config.xml { artifact PLANTUML_RUN_FAST folder config.xml [ artifact xml ==== and style ] } folder debug.cpp { artifact "Debug::Plantuml" folder debug.h { artifact "Plantuml=0x4000" } } config.xml -down-> debug.cpp debug.cpp -down-> docvisitor.cpp folder docvisitor.cpp { folder writePlantUMLSource { folder writePlantUMLSource.old [ write plantuml file (inline_umlgraph_#.pu) ---- writePlantUMLFile() generatePlantUMLOutput() ] folder writePlantUMLSource.new [ write plantuml file (inline_umlgraph_#) writePlantUMLFile() generatePlantUMLOutput() ---- add PUML_Type as arguments PlantumlManager::instance()->insert(generateType,puName,format,text); ] writePlantUMLSource -down-> writePlantUMLSource.old : Original writePlantUMLSource -down-> writePlantUMLSource.new : PLANTUML_RUN_FAST } artifact docbookvisitor.cpp artifact htmldocvisitor.cpp artifact latexdocvisitor.cpp artifact rtfdocvisitor.cpp artifact vhdldocgen.cpp } database PlantumlManager.DB [ static PlantumlManager *m_theInstance; QDict< QList<QCString> > m_pngPlantumlFiles; QDict< QList<QCString> > m_svgPlantumlFiles; QDict< QList<QCString> > m_epsPlantumlFiles; QDict< QCString > m_pngPlantumlContent; QDict< QCString > m_svgPlantumlContent; QDict< QCString > m_epsPlantumlContent; ] writePlantUMLSource.new -down-> PlantumlManager.DB : PLANTUML_RUN_FAST folder plantuml.cpp { folder generatePlantUMLOutput.old [ run java for each inline_umlgraph_#.pu ] folder generatePlantUMLOutput.new [ No run java for run once at the end of process Just add image into list ] writePlantUMLSource.old -down-> generatePlantUMLOutput.old : original writePlantUMLSource.new -down-> generatePlantUMLOutput.new : PLANTUML_RUN_FAST } folder doxygen.cpp { folder plantuml.h [ class PlantumlManager ] } folder plantuml.cpp { folder PlantumlManager_run [ PlantumlManager::instance()->run(); - run java once at the last time of doxygen process like drawing dot graph - read a inline_umlgraph_cache.pu - if exist , reuse it. - if not exist , add inline_umlgraph_type.pu - save all plantuml into inline_umlgraph_cache.pu for caching or reusing next time. - When we make inline_umlgraph_type.pu , we divide into 4 files for multi-processing. - But , prcessing image count is less than 8 , we will use only one file. ] } plantuml.h -down-> writePlantUMLSource : PLANTUML_RUN_FAST PlantumlManager.DB -down-> PlantumlManager_run : PLANTUML_RUN_FAST @enduml ``` ## cache - QCString m_cachePlantumlAllContent; // = fileToString = readInputFile // findScopePattern // QCString.find contains - instance() -> read cache file - writePlantULMSource() -> compare the text with cache contents - if matched , pass. - if not matched , add it. - add text to current plantuml - run() -> save current plantuml into cache file ## todo list - done - html example - cache - ing - multiple thread : divide into several files before running java. (already know the count) - epstopdf run : change the code like the java run
Diffstat (limited to 'src/plantuml.cpp')
-rw-r--r--src/plantuml.cpp140
1 files changed, 107 insertions, 33 deletions
diff --git a/src/plantuml.cpp b/src/plantuml.cpp
index c6ab7af..53f6125 100644
--- a/src/plantuml.cpp
+++ b/src/plantuml.cpp
@@ -14,6 +14,7 @@
*/
#include "plantuml.h"
+#include "util.h"
#include "portable.h"
#include "config.h"
#include "doxygen.h"
@@ -85,6 +86,7 @@ QCString writePlantUMLSource(const QCString &outDir,const QCString &fileName,con
QCString generateType(qcOutDir.right(qcOutDir.length() - (pos + 1)) );
Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType));
PlantumlManager::instance()->insert(generateType,puName,format,text);
+ Debug::print(Debug::Plantuml,0,"*** %s generateType: %s\n","writePlantUMLSource",qPrint(generateType));
}
return baseName;
@@ -162,8 +164,8 @@ void generatePlantUMLOutput(const char *baseName,const char *outDir,PlantUMLOutp
pumlArgs+="-charset UTF-8 ";
int exitCode;
msg("Running PlantUML on generated file %s.pu\n",baseName);
- portable_sysTimerStart();
if(!Config_getBool(PLANTUML_RUN_FAST)){ // ! Config_getBool(PLANTUML_RUN_FAST)
+ portable_sysTimerStart();
Debug::print(Debug::Plantuml,0,"*** running: %s %s outDir:%s %s\n",qPrint(pumlExe),qPrint(pumlArgs),outDir,baseName);
if ((exitCode=portable_system(pumlExe,pumlArgs,TRUE))!=0)
{
@@ -174,19 +176,21 @@ void generatePlantUMLOutput(const char *baseName,const char *outDir,PlantUMLOutp
{
QFile(QCString(baseName)+".pu").remove();
}
- }
- portable_sysTimerStop();
- if ( (format==PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
- {
- QCString epstopdfArgs(maxCmdLine);
- epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",baseName,baseName);
- portable_sysTimerStart();
- if ((exitCode=portable_system("epstopdf",epstopdfArgs))!=0)
+ portable_sysTimerStop();
+
+ if ( (format==PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
{
- err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
+ QCString epstopdfArgs(maxCmdLine);
+ epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",baseName,baseName);
+ portable_sysTimerStart();
+ if ((exitCode=portable_system("epstopdf",epstopdfArgs))!=0)
+ {
+ err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
+ }
+ portable_sysTimerStop();
}
- portable_sysTimerStop();
}
+
Doxygen::indexList->addImageFile(imgName);
}
@@ -199,6 +203,17 @@ PlantumlManager *PlantumlManager::instance()
if (!m_theInstance)
{
m_theInstance = new PlantumlManager;
+ QCString outputFilename = Config_getString(OUTPUT_DIRECTORY) + "/" + CACHE_FILENAME;
+ QFileInfo fi(outputFilename);
+ if (fi.exists()) {
+ m_theInstance->m_cachedPlantumlAllContent = fileToString(outputFilename);
+ } else {
+ m_theInstance->m_cachedPlantumlAllContent = "";
+ }
+ Debug::print(Debug::Plantuml,0,"*** instance() : m_cachedPlantumlAllContent = [%s]\n",qPrint(m_theInstance->m_cachedPlantumlAllContent));
+ m_theInstance->m_pngPlantumlContent.clear();
+ m_theInstance->m_svgPlantumlContent.clear();
+ m_theInstance->m_epsPlantumlContent.clear();
}
return m_theInstance;
}
@@ -241,7 +256,7 @@ PlantumlManager::~PlantumlManager()
}
}
-void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFiles,QDict< QCString > &PlantumlContent, const char *type)
+void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFiles,QDict< QCString > &PlantumlContent,PlantUMLOutputFormat format )
{
/* example : running: java -Djava.awt.headless=true -jar "/Users/cheoljoo/code/common_telltale/GP/Apps/Src/MgrTelltale/tools/plantuml.jar" -o "/Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html" -tpng "/Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html/A.pu" -charset UTF-8 outDir:/Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html /Users/cheoljoo/Code/LG/test_doxygen/DOXYGEN_OUTPUT/html/A
*/
@@ -252,6 +267,8 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
QCString pumlExe = "java";
QCString pumlArgs = "";
+ QCString pumlType = "";
+ QCString pumlOutDir = "";
QStrList &pumlIncludePathList = Config_getList(PLANTUML_INCLUDE_PATH);
char *s=pumlIncludePathList.first();
@@ -283,6 +300,18 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
pumlArgs += portable_commandExtension();
pumlArgs += "\" ";
}
+ switch (format)
+ {
+ case PUML_BITMAP:
+ pumlType="png";
+ break;
+ case PUML_EPS:
+ pumlType="eps";
+ break;
+ case PUML_SVG:
+ pumlType="svg";
+ break;
+ }
{
QDictIterator< QCString > it( PlantumlContent); // See QDictIterator
@@ -290,14 +319,17 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
for (it.toFirst();(nb=it.current());++it)
{
QCString pumlArguments(pumlArgs);
- msg("Running PlantUML on png PlantumlFiles in %s\n",qPrint(it.currentKey()));
+ msg("Running PlantUML on %s PlantumlFiles in %s\n",qPrint(pumlType),qPrint(it.currentKey()));
+ QList<QCString> *list = PlantumlFiles[it.currentKey()];
+ Debug::print(Debug::Plantuml,0,"*** %s PlantumlFiles key:%s size:%d\n","PlantumlManager::print Files",qPrint(it.currentKey()),(*list).count());
+ QListIterator<QCString> li(*list);
pumlArguments+="-o \"";
pumlArguments+=Config_getString(OUTPUT_DIRECTORY);
pumlArguments+="/";
pumlArguments+=it.currentKey();
pumlArguments+="\" ";
pumlArguments+="-charset UTF-8 -t";
- pumlArguments+=type;
+ pumlArguments+=pumlType;
pumlArguments+=" ";
QCString puFileName("");
@@ -305,8 +337,9 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
puFileName+="/";
puFileName+=it.currentKey();
puFileName+="/";
+ pumlOutDir=puFileName;
puFileName+="inline_umlgraph_";
- puFileName+=type;
+ puFileName+=pumlType;
puFileName+=it.currentKey();
puFileName+=".pu";
@@ -322,6 +355,8 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
file.writeBlock( *nb, nb->length() );
file.close();
Debug::print(Debug::Plantuml,0,"*** %s Running Plantuml arguments:%s\n","PlantumlManager::runPlantumlContent",qPrint(pumlArguments));
+
+ portable_sysTimerStart();
if ((exitCode=portable_system(pumlExe,pumlArguments,TRUE))!=0)
{
err("Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n",
@@ -329,42 +364,70 @@ void PlantumlManager::runPlantumlContent(QDict< QList <QCString> > &PlantumlFile
}
else if (Config_getBool(DOT_CLEANUP))
{
- file.remove();
+ file.remove();
+ }
+ portable_sysTimerStop();
+
+ if ( (format==PUML_EPS) && (Config_getBool(USE_PDFLATEX)) )
+ {
+ Debug::print(Debug::Plantuml,0,"*** %s Running epstopdf\n","PlantumlManager::runPlantumlContent");
+ QList<QCString> *list = PlantumlFiles[it.currentKey()];
+ QListIterator<QCString> li(*list);
+ QCString *nb;
+ for (li.toFirst();(nb=li.current());++li)
+ {
+ QCString epstopdfArgs(maxCmdLine);
+ epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",qPrint(pumlOutDir),qPrint(*nb),qPrint(pumlOutDir),qPrint(*nb));
+ portable_sysTimerStart();
+ if ((exitCode=portable_system("epstopdf",epstopdfArgs))!=0)
+ {
+ err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode);
+ }
+ portable_sysTimerStop();
+ }
}
}
}
+ if (Config_getBool(DOT_CLEANUP))
{
+ Debug::print(Debug::Plantuml,0,"*** %s Remove pu files\n","PlantumlManager::runPlantumlContent");
QDictIterator< QList<QCString> > it( PlantumlFiles); // See QDictIterator
QList<QCString> *list;
for (it.toFirst();(list=it.current());++it)
{
QListIterator<QCString> li(*list);
QCString *nb;
- if (Config_getBool(DOT_CLEANUP))
+ for (li.toFirst();(nb=li.current());++li)
{
- for (li.toFirst();(nb=li.current());++li)
- {
- QCString pumlName = "";
- pumlName+=Config_getString(OUTPUT_DIRECTORY);
- pumlName+="/";
- pumlName+=it.currentKey();
- pumlName+="/";
- pumlName+=*nb;
- pumlName+=".pu";
- QFile(pumlName).remove();
- }
+ QCString pumlName = "";
+ pumlName+=Config_getString(OUTPUT_DIRECTORY);
+ pumlName+="/";
+ pumlName+=it.currentKey();
+ pumlName+="/";
+ pumlName+=*nb;
+ pumlName+=".pu";
+ QFile(pumlName).remove();
}
}
}
+
}
void PlantumlManager::run()
{
Debug::print(Debug::Plantuml,0,"*** %s\n","PlantumlManager::run");
- runPlantumlContent(m_pngPlantumlFiles, m_pngPlantumlContent, "png");
- runPlantumlContent(m_svgPlantumlFiles, m_svgPlantumlContent, "svg");
- runPlantumlContent(m_epsPlantumlFiles, m_epsPlantumlContent, "eps");
+ runPlantumlContent(m_pngPlantumlFiles, m_pngPlantumlContent, PUML_BITMAP);
+ runPlantumlContent(m_svgPlantumlFiles, m_svgPlantumlContent, PUML_SVG);
+ runPlantumlContent(m_epsPlantumlFiles, m_epsPlantumlContent, PUML_EPS);
+ QCString outputFilename = Config_getString(OUTPUT_DIRECTORY) + "/" + CACHE_FILENAME;
+ QFile file(outputFilename);
+ if (!file.open(IO_WriteOnly))
+ {
+ err("Could not open file %s for writing\n",CACHE_FILENAME);
+ }
+ file.writeBlock( m_currentPlantumlAllContent, m_currentPlantumlAllContent.length() );
+ file.close();
}
void PlantumlManager::print(QDict< QList <QCString> > &PlantumlFiles)
@@ -374,7 +437,7 @@ void PlantumlManager::print(QDict< QList <QCString> > &PlantumlFiles)
QList<QCString> *list;
for (it.toFirst();(list=it.current());++it)
{
- Debug::print(Debug::Plantuml,0,"*** %s PlantumlFiles key:%s\n","PlantumlManager::print",qPrint(it.currentKey()));
+ Debug::print(Debug::Plantuml,0,"*** %s PlantumlFiles key:%s size:%d\n","PlantumlManager::print Files",qPrint(it.currentKey()),(*list).count());
QListIterator<QCString> li(*list);
QCString *nb;
for (li.toFirst();(nb=li.current());++li)
@@ -392,7 +455,7 @@ void PlantumlManager::print(QDict<QCString> &PlantumlContent)
QCString *nb;
for (it.toFirst();(nb=it.current());++it)
{
- Debug::print(Debug::Plantuml,0,"*** %s PlantumlContent key:%s\n","PlantumlManager::print",qPrint(it.currentKey()));
+ Debug::print(Debug::Plantuml,0,"*** %s PlantumlContent key:%s\n","PlantumlManager::print Content",qPrint(it.currentKey()));
Debug::print(Debug::Plantuml,0,"*** %s Content :%s\n","PlantumlManager::print",qPrint(*nb));
}
}
@@ -421,7 +484,18 @@ void PlantumlManager::addPlantumlContent(QDict< QCString > &PlantumlContent,cons
void PlantumlManager::insert(const QCString key , const QCString value, PlantUMLOutputFormat format,const QCString &puContent)
{
+ int find;
+
Debug::print(Debug::Plantuml,0,"*** %s key:%s ,value:%s\n","PlantumlManager::insert",qPrint(key),qPrint(value));
+
+ m_currentPlantumlAllContent+=puContent;
+
+ find = m_cachedPlantumlAllContent.find(puContent);
+ Debug::print(Debug::Plantuml,0,"*** %s find: %d\n","PlantumlManager::addPlantumlContent",find);
+ if(find >=0){ // matched in cache. so we skip to run java for this plantuml
+ return ;
+ }
+
switch (format)
{
case PUML_BITMAP: