From 3b6ea7abb3d529f7805ed54071d597f01b578740 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 15 Oct 2021 11:12:58 +0900 Subject: Imported Upstream version 1.8.17 --- src/dot.cpp | 295 ++++++++---------------------------------------------------- 1 file changed, 38 insertions(+), 257 deletions(-) (limited to 'src/dot.cpp') diff --git a/src/dot.cpp b/src/dot.cpp index 5cdf92c..f26bee4 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -16,12 +16,6 @@ #include #include -#include -#include -#include -#include -#include -#include #include "config.h" #include "dot.h" @@ -37,45 +31,19 @@ #define MAP_CMD "cmapx" -static int DOT_NUM_THREADS; // will be initialized in initDot - //-------------------------------------------------------------------- -void initDot() -{ - DotGraph::DOT_FONTNAME = Config_getString(DOT_FONTNAME); - if (DotGraph::DOT_FONTNAME.isEmpty()) - { - DotGraph::DOT_FONTNAME="Helvetica"; - } - - DotGraph::DOT_FONTSIZE = Config_getInt(DOT_FONTSIZE); - if (DotGraph::DOT_FONTSIZE<4) DotGraph::DOT_FONTSIZE=4; - - DOT_NUM_THREADS = Config_getInt(DOT_NUM_THREADS); - if (DOT_NUM_THREADS > 32) DOT_NUM_THREADS = 32; - if (DOT_NUM_THREADS <= 0) DOT_NUM_THREADS = QMAX(2,QThread::idealThreadCount()+1); - - // these are copied to be sure to be thread save - DotRunner::DOT_CLEANUP = Config_getBool(DOT_CLEANUP); - DotRunner::DOT_MULTI_TARGETS = Config_getBool(DOT_MULTI_TARGETS); - DotRunner::DOT_EXE.init(Config_getString(DOT_PATH) + "dot"); - - DotGraph::IMG_EXT = getDotImageExtension(); -} - - static QCString g_dotFontPath; static void setDotFontPath(const char *path) { ASSERT(g_dotFontPath.isEmpty()); - g_dotFontPath = portable_getenv("DOTFONTPATH"); + g_dotFontPath = Portable::getenv("DOTFONTPATH"); QCString newFontPath = Config_getString(DOT_FONTPATH); QCString spath = path; if (!newFontPath.isEmpty() && !spath.isEmpty()) { - newFontPath.prepend(spath+portable_pathListSeparator()); + newFontPath.prepend(spath+Portable::pathListSeparator()); } else if (newFontPath.isEmpty() && !spath.isEmpty()) { @@ -83,114 +51,25 @@ static void setDotFontPath(const char *path) } else { - portable_unsetenv("DOTFONTPATH"); + Portable::unsetenv("DOTFONTPATH"); return; } - portable_setenv("DOTFONTPATH",newFontPath); + Portable::setenv("DOTFONTPATH",newFontPath); } static void unsetDotFontPath() { if (g_dotFontPath.isEmpty()) { - portable_unsetenv("DOTFONTPATH"); + Portable::unsetenv("DOTFONTPATH"); } else { - portable_setenv("DOTFONTPATH",g_dotFontPath); + Portable::setenv("DOTFONTPATH",g_dotFontPath); } g_dotFontPath=""; } -// extract size from a dot generated SVG file -static bool readSVGSize(const QCString &fileName,int *width,int *height) -{ - bool found=FALSE; - QFile f(fileName); - if (!f.open(IO_ReadOnly)) - { - return FALSE; - } - const int maxLineLen=4096; - char buf[maxLineLen]; - while (!f.atEnd() && !found) - { - int numBytes = f.readLine(buf,maxLineLen-1); // read line - if (numBytes>0) - { - buf[numBytes]='\0'; - if (qstrncmp(buf,"