Enumerations | Functions
msc.h File Reference

Go to the source code of this file.

Enumerations

enum  MscOutputFormat { MSC_BITMAP, MSC_EPS, MSC_SVG }
 

Functions

void writeMscGraphFromFile (const char *inFile, const char *outDir, const char *outFile, MscOutputFormat format)
 
QCString getMscImageMapFromFile (const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &context)
 
void writeMscImageMapFromFile (FTextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, MscOutputFormat format)
 

Enumeration Type Documentation

Enumerator
MSC_BITMAP 
MSC_EPS 
MSC_SVG 

Definition at line 24 of file msc.h.

Definition: msc.h:24
Definition: msc.h:24
Definition: msc.h:24

Function Documentation

QCString getMscImageMapFromFile ( const QCString inFile,
const QCString outDir,
const QCString relPath,
const QCString context 
)

Definition at line 156 of file msc.cpp.

158 {
159  QCString outFile = inFile + ".map";
160 
161 
162  //printf("*** running:getMscImageMapFromFile \n");
163  // chdir to the output dir, so dot can find the font file.
164  QCString oldDir = QDir::currentDirPath().utf8();
165  // go to the html output directory (i.e. path)
166  QDir::setCurrent(outDir);
167  //printf("Going to dir %s\n",QDir::currentDirPath().data());
168 
169  QCString mscExe = Config_getString("MSCGEN_PATH")+"mscgen"+portable_commandExtension();
170  QCString mscArgs = "-T ismap -i \"";
171  mscArgs+=inFile;
172  mscArgs+="\" -o \"";
173  mscArgs+=outFile + "\"";
174 
175  int exitCode;
177  if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0)
178  {
180  QDir::setCurrent(oldDir);
181  return "";
182  }
184 
186  FTextStream tmpout(&result);
187  convertMapFile(tmpout, outFile, relPath, context);
188  QDir().remove(outFile);
189 
190  QDir::setCurrent(oldDir);
191  return result.data();
192 }
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
void portable_sysTimerStop()
Definition: portable.cpp:415
char * data() const
Definition: qgstring.h:42
static QCString result
virtual bool remove(const QString &fileName, bool acceptAbsPath=TRUE)
Definition: qdir.cpp:915
const bool FALSE
Definition: qglobal.h:370
TFile * outFile
Definition: makeDST.cxx:36
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
static bool convertMapFile(FTextStream &t, const char *mapName, const QCString relPath, const QCString &context)
Definition: msc.cpp:31
void portable_sysTimerStart()
Definition: portable.cpp:410
static QString currentDirPath()
Definition: qdir_unix.cpp:141
#define Config_getString(val)
Definition: config.cpp:660
TFile * inFile
Definition: makeDST.cxx:36
const char * portable_commandExtension()
Definition: portable.cpp:382
QCString utf8() const
Definition: qstring.cpp:14507
static bool setCurrent(const QString &path)
Definition: qdir_unix.cpp:134
int portable_system(const char *command, const char *args, bool commandHasConsole)
Definition: portable.cpp:33
void writeMscGraphFromFile ( const char *  inFile,
const char *  outDir,
const char *  outFile,
MscOutputFormat  format 
)

Definition at line 92 of file msc.cpp.

94 {
95  QCString absOutFile = outDir;
96  absOutFile+=portable_pathSeparator();
97  absOutFile+=outFile;
98 
99  // chdir to the output dir, so dot can find the font file.
100  QCString oldDir = QDir::currentDirPath().utf8();
101  // go to the html output directory (i.e. path)
102  QDir::setCurrent(outDir);
103  //printf("Going to dir %s\n",QDir::currentDirPath().data());
104  QCString mscExe = Config_getString("MSCGEN_PATH")+"mscgen"+portable_commandExtension();
105  QCString mscArgs;
106  QCString extension;
107  switch (format)
108  {
109  case MSC_BITMAP:
110  mscArgs+="-T png";
111  extension=".png";
112  break;
113  case MSC_EPS:
114  mscArgs+="-T eps";
115  extension=".eps";
116  break;
117  case MSC_SVG:
118  mscArgs+="-T svg";
119  extension=".svg";
120  break;
121  default:
122  goto error; // I am not very fond of goto statements, but when in Rome...
123  }
124  mscArgs+=" -i \"";
125  mscArgs+=inFile;
126 
127  mscArgs+="\" -o \"";
128  mscArgs+=outFile;
129  mscArgs+=extension+"\"";
130  int exitCode;
131 // printf("*** running: %s %s outDir:%s %s\n",mscExe.data(),mscArgs.data(),outDir,outFile);
133  if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0)
134  {
136  goto error;
137  }
139  if ( (format==MSC_EPS) && (Config_getBool("USE_PDFLATEX")) )
140  {
141  QCString epstopdfArgs(maxCmdLine);
142  epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"",
143  outFile,outFile);
145  if (portable_system("epstopdf",epstopdfArgs)!=0)
146  {
147  err("Problems running epstopdf. Check your TeX installation!\n");
148  }
150  }
151 
152 error:
153  QDir::setCurrent(oldDir);
154 }
void portable_sysTimerStop()
Definition: portable.cpp:415
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
const bool FALSE
Definition: qglobal.h:370
error
Definition: include.cc:26
TFile * outFile
Definition: makeDST.cxx:36
static const int maxCmdLine
Definition: msc.cpp:29
void portable_sysTimerStart()
Definition: portable.cpp:410
static QString currentDirPath()
Definition: qdir_unix.cpp:141
Definition: msc.h:24
#define Config_getString(val)
Definition: config.cpp:660
Definition: msc.h:24
#define Config_getBool(val)
Definition: config.cpp:664
void err(const char *fmt,...)
Definition: message.cpp:226
TFile * inFile
Definition: makeDST.cxx:36
const char * portable_commandExtension()
Definition: portable.cpp:382
char portable_pathSeparator()
Definition: portable.cpp:355
QCString utf8() const
Definition: qstring.cpp:14507
static bool setCurrent(const QString &path)
Definition: qdir_unix.cpp:134
Definition: msc.h:24
int portable_system(const char *command, const char *args, bool commandHasConsole)
Definition: portable.cpp:33
void writeMscImageMapFromFile ( FTextStream t,
const QCString inFile,
const QCString outDir,
const QCString relPath,
const QCString baseName,
const QCString context,
MscOutputFormat  format 
)

Definition at line 194 of file msc.cpp.

201 {
202  QCString mapName = baseName+".map";
203  t << "<img src=\"" << relPath << baseName << ".";
204  switch (format)
205  {
206  case MSC_BITMAP:
207  t << "png";
208  break;
209  case MSC_EPS:
210  t << "eps";
211  break;
212  case MSC_SVG:
213  t << "svg";
214  break;
215  default:
216  t << "unknown";
217  }
218  t << "\" alt=\""
219  << baseName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>" << endl;
220  QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context);
221  t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">" << imap << "</map>" << endl;
222 }
QCString getMscImageMapFromFile(const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &context)
Definition: msc.cpp:156
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496
Definition: msc.h:24
Definition: msc.h:24
Definition: msc.h:24
QTextStream & endl(QTextStream &s)