Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
dia.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2021 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#include "
dia.h
"
17
#include "
portable.h
"
18
#include "
config.h
"
19
#include "
message.h
"
20
#include "
util.h
"
21
#include "
dir.h
"
22
23
24
static
const
int
maxCmdLine
= 40960;
25
26
void
writeDiaGraphFromFile
(
const
QCString
&inFile,
const
QCString
&outDir,
27
const
QCString
&outFile,
DiaOutputFormat
format,
28
const
QCString
&srcFile,
int
srcLine)
29
{
30
QCString
absOutFile = outDir;
31
absOutFile+=
Portable::pathSeparator
();
32
absOutFile+=outFile;
33
34
// chdir to the output dir, so dot can find the font file.
35
std::string oldDir =
Dir::currentDirPath
();
36
// go to the html output directory (i.e. path)
37
Dir::setCurrent
(outDir.
str
());
38
//printf("Going to dir %s\n",Dir::currentDirPath().c_str());
39
QCString
diaExe =
Config_getString
(DIA_PATH)+
"dia"
+
Portable::commandExtension
();
40
QCString
diaArgs;
41
QCString
extension;
42
diaArgs+=
"-n "
;
43
if
(format==
DiaOutputFormat::BITMAP
)
44
{
45
diaArgs+=
"-t png-libart"
;
46
extension=
".png"
;
47
}
48
else
if
(format==
DiaOutputFormat::EPS
)
49
{
50
diaArgs+=
"-t eps"
;
51
extension=
".eps"
;
52
}
53
54
diaArgs+=
" -e \""
;
55
diaArgs+=outFile;
56
diaArgs+=extension+
"\""
;
57
58
diaArgs+=
" \""
;
59
diaArgs+=inFile;
60
diaArgs+=
"\""
;
61
62
//printf("*** running: %s %s outDir:%s %s\n",qPrint(diaExe),qPrint(diaArgs),outDir,outFile);
63
if
(
Portable::system
(diaExe,diaArgs,
FALSE
)!=0)
64
{
65
err_full
(srcFile,srcLine,
"Problems running {}. Check your installation or look typos in you dia file {}"
,
66
diaExe,inFile);
67
goto
error;
68
}
69
if
( (format==
DiaOutputFormat::EPS
) && (
Config_getBool
(USE_PDFLATEX)) )
70
{
71
QCString
epstopdfArgs(
maxCmdLine
,
QCString::ExplicitSize
);
72
epstopdfArgs.
sprintf
(
"\"%s.eps\" --outfile=\"%s.pdf\""
,
73
qPrint
(outFile),
qPrint
(outFile));
74
if
(
Portable::system
(
"epstopdf"
,epstopdfArgs)!=0)
75
{
76
err
(
"Problems running epstopdf. Check your TeX installation!\n"
);
77
}
78
else
79
{
80
Dir
().
remove
(outFile.
str
()+
".eps"
);
81
}
82
}
83
84
error:
85
Dir::setCurrent
(oldDir);
86
}
87
Dir
Class representing a directory in the file system.
Definition
dir.h:75
Dir::currentDirPath
static std::string currentDirPath()
Definition
dir.cpp:342
Dir::remove
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Definition
dir.cpp:314
Dir::setCurrent
static bool setCurrent(const std::string &path)
Definition
dir.cpp:350
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
QCString::str
const std::string & str() const
Definition
qcstring.h:552
QCString::sprintf
QCString & sprintf(const char *format,...)
Definition
qcstring.cpp:29
QCString::ExplicitSize
@ ExplicitSize
Definition
qcstring.h:146
config.h
Config_getBool
#define Config_getBool(name)
Definition
config.h:33
Config_getString
#define Config_getString(name)
Definition
config.h:32
writeDiaGraphFromFile
void writeDiaGraphFromFile(const QCString &inFile, const QCString &outDir, const QCString &outFile, DiaOutputFormat format, const QCString &srcFile, int srcLine)
Definition
dia.cpp:26
maxCmdLine
static const int maxCmdLine
Definition
dia.cpp:24
dia.h
DiaOutputFormat
DiaOutputFormat
Definition
dia.h:23
DiaOutputFormat::BITMAP
@ BITMAP
Definition
dia.h:23
DiaOutputFormat::EPS
@ EPS
Definition
dia.h:23
dir.h
message.h
err
#define err(fmt,...)
Definition
message.h:127
err_full
#define err_full(file, line, fmt,...)
Definition
message.h:132
Portable::pathSeparator
QCString pathSeparator()
Definition
portable.cpp:375
Portable::system
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
Definition
portable.cpp:106
Portable::commandExtension
const char * commandExtension()
Definition
portable.cpp:462
portable.h
Portable versions of functions that are platform dependent.
qPrint
const char * qPrint(const char *s)
Definition
qcstring.h:687
FALSE
#define FALSE
Definition
qcstring.h:34
util.h
A bunch of utility functions.
src
dia.cpp
Generated by
1.17.0