00001
00002
00003
00004
00005 #if defined(WIN32) && !defined( __COMO__)
00006 #pragma warning(disable:4786 4503 4101)
00007 #endif
00008
00009 #include <iostream>
00010 using std::cout;
00011
00012 #include "atpg.hpp"
00013 #include "CmdLine.h"
00014 void processCmdLine(CmdLine& cL,int argc,char** argv){
00015 cL.addStandaloneSwitch("-i","initialize graph");
00016 cL.addStandaloneSwitch("-atpg","run atpg algorithm");
00017 cL.addStandaloneSwitch("-h","print this help message");
00018 cL.addParameterSwitch("-t","undefined","run test");
00019 cL.addParameterSwitch("-r","undefined","read dot file path");
00020 cL.addParameterSwitch("-w","undefined","write dot file path");
00021 cL.addParameterSwitch("-x","T?D?O?-","debug option, default to trace and debug to stdout");
00022 cL.process(argc,argv);
00023 }
00024 int main(int argc,char** argv){
00051 cout << "$Id$\n";
00052 SupportGraph sG;
00053 CmdLine cLine;
00054 processCmdLine(cLine,argc,argv);
00055 if("set"==cLine.switchValue("-h")){
00056 cLine.printSwitches();
00057 }else{
00058 const string& inputFile=cLine.switchValue("-r");
00059 if("undefined"!=inputFile){
00060 SupportGraph::DotFileType dotFileType=sG.getDotFileType(inputFile);
00061 if (SupportGraph::Digraph==dotFileType){
00062 cout << "Digraph file type\n";
00063 RunGraph<GraphvizDigraph> tGraph(inputFile);
00064 cout << tGraph.getVersion() << "\n";
00065 tGraph.setDebug(cLine.switchValue("-x"));
00066 if("set"==cLine.switchValue("-i")) tGraph.initializeGraph();
00067 if("undefined"!=cLine.switchValue("-t")) tGraph.test(cLine.switchValue("-t"));
00068 if("set"==cLine.switchValue("-atpg")) tGraph.runATPG();
00069 if("undefined"!=cLine.switchValue("-w")) tGraph.writeGraph(cLine.switchValue("-w"));
00070 }else if(SupportGraph::Graph==dotFileType){
00071 cout << "Graph file type not supported. Skipping\n";
00072 }else{
00073 cout << "Unknown file type. Skipping\n";
00074 }
00075 }
00076 }
00077 return 0;
00078 }