Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDependencies.cc File Reference

Example program to test dependencies of include files. More...

#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <dirent.h>
#include "JSystem/JSystemToolkit.hh"
#include "JLang/JLangToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test dependencies of include files.

Author
mdejong

Definition in file JDependencies.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 285 of file JDependencies.cc.

286 {
287  using namespace std;
288  using namespace JPP;
289 
290  string outputFile;
291  string jpp;
292  string dir;
293  int debug;
294 
295  try {
296 
297  JParser<> zap("Example program to test dependencies of include files");
298 
299  zap['o'] = make_field(outputFile) = "";
300  zap['J'] = make_field(jpp) = "";
301  zap['D'] = make_field(dir) = "";
302  zap['d'] = make_field(debug) = 3;
303 
304  zap(argc, argv);
305  }
306  catch(const exception &error) {
307  FATAL(error.what() << endl);
308  }
309 
310 
311  const JDirectory directory(jpp);
312 
313 
314  if (outputFile != "") {
315 
316  const size_t pos = outputFile.find(WILDCARD);
317 
318  if (pos != string::npos) {
319  outputFile.replace(pos, 1, (dir != "" ? dir.c_str() : "Jpp"));
320  }
321 
322  ofstream out(outputFile.c_str());
323 
324  out << "\\documentclass[border=5mm]{standalone}" << endl;
325  out << "" << endl;
326  out << "\\usepackage{tikz}" << endl;
327  out << "\\usetikzlibrary{graphs, graphdrawing}" << endl;
328  out << "\\usegdlibrary{layered}" << endl;
329  out << "\\begin{document}" << endl;
330  out << "" << endl;
331  out << "\\tikz \\graph [layered layout]" << endl;
332  out << "{" << endl;
333 
334  if (dir == "")
335  directory.print(out);
336  else
337  directory.print(out, dir);
338 
339  out << "};" << endl;
340  out << "" << endl;
341  out << "\\end{document}" << endl;
342 
343  out.close();
344  }
345 
346 
347  for (JDirectory::const_iterator i = directory.begin(); i != directory.end(); ++i) {
348 
349  DEBUG(i->first << ": " << flush);
350 
351  if (!directory.is_valid(i->first)) {
352 
353  const JDirectory::path_type path = directory.getPath(i->first);
354 
355  for (JDirectory::path_type::const_iterator dir = path.begin(); dir != path.end(); ++dir) {
356  DEBUG(' ' << *dir);
357  }
358  }
359 
360  DEBUG(endl);
361  }
362 
363  for (JDirectory::const_iterator i = directory.begin(); i != directory.end(); ++i) {
364  ASSERT(directory.is_valid(i->first), "check validity " << i->first);
365  }
366 
367  return 0;
368 }
Utility class to parse command line options.
Definition: JParser.hh:1500
string outputFile
do cat driver txt<< EOFevent ev_configure{RC_EVT%< ev_configure.txt > RC_DWRT path
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
then echo Creating output directory
Definition: JTuneHV.sh:77
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62