|
|
@ -2,16 +2,39 @@ |
|
|
|
#include "init.h" |
|
|
|
#include "init.h" |
|
|
|
#include "globals.h" |
|
|
|
#include "globals.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void usage(const char* prg) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
std::cout<<"Usage: "<<prg<<" [-h] [-t num] [-d] [-g] [-i] [-q] file"<<std::endl<< |
|
|
|
|
|
|
|
"-h - this help,"<<std::endl<< |
|
|
|
|
|
|
|
"-t - set number of threads,"<<std::endl<< |
|
|
|
|
|
|
|
"-d - only parse config, print it and return (with -q, nothing printing),"<<std::endl<< |
|
|
|
|
|
|
|
"-g - enable debug messages,"<<std::endl<< |
|
|
|
|
|
|
|
"-i - print information about current actions,"<<std::endl<< |
|
|
|
|
|
|
|
"-q - be quitet, ignore print directives."<<std::endl<< |
|
|
|
|
|
|
|
"-g, -i and -q are mutually exclusive."<<std::endl; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) |
|
|
|
int main(int argc, char** argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(argc!=2) return 1; |
|
|
|
|
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
DepTree* DPTree; |
|
|
|
DepTree* DPTree; |
|
|
|
|
|
|
|
struct program_options options; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set default options
|
|
|
|
|
|
|
|
options.threads=1; |
|
|
|
|
|
|
|
options.help=options.dump=false; |
|
|
|
|
|
|
|
options.dl=NORMAL; |
|
|
|
|
|
|
|
options.config=0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Parse options
|
|
|
|
|
|
|
|
ret=ParseOptions(argc,argv,options); |
|
|
|
|
|
|
|
if(ret!=0 || options.config==0) {usage(argv[0]); return 1;} |
|
|
|
|
|
|
|
if(options.help) {usage(argv[0]); return 0;} |
|
|
|
|
|
|
|
|
|
|
|
SetDebugLevel(INFO); |
|
|
|
SetDebugLevel(options.dl); |
|
|
|
|
|
|
|
|
|
|
|
COUT(INFO)<<"Parse config file "<<argv[1]<<" "; |
|
|
|
COUT(INFO)<<"Parse config file "<<options.config<<" "; |
|
|
|
ret=ParseConfigFile(argv[1]); if(ret!=0) { ClearGlobals(); return 1;} |
|
|
|
ret=ParseConfigFile(options.config); if(ret!=0) { ClearGlobals(); return 1;} |
|
|
|
COUT(INFO)<<"Ok"<<std::endl; |
|
|
|
COUT(INFO)<<"Ok"<<std::endl; |
|
|
|
if(G_tosave.size()==0 && G_toprint.size()==0) |
|
|
|
if(G_tosave.size()==0 && G_toprint.size()==0) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -41,9 +64,13 @@ int main(int argc, char** argv) |
|
|
|
ret=CheckFunctions(); if(ret!=0) { ClearGlobals(); delete DPTree; return 1;} |
|
|
|
ret=CheckFunctions(); if(ret!=0) { ClearGlobals(); delete DPTree; return 1;} |
|
|
|
COUT(INFO)<<"Ok"<<std::endl; |
|
|
|
COUT(INFO)<<"Ok"<<std::endl; |
|
|
|
|
|
|
|
|
|
|
|
COUT(INFO)<<"Evaluate tree "; |
|
|
|
if(options.dump) DumpConfig(); |
|
|
|
ret=DPTree->EvaluateTree(); if(ret!=0) { ClearGlobals(); delete DPTree; return 1;} |
|
|
|
else |
|
|
|
COUT(INFO)<<"Ok"<<std::endl; |
|
|
|
{ |
|
|
|
|
|
|
|
COUT(INFO)<<"Evaluate tree "; |
|
|
|
|
|
|
|
ret=DPTree->EvaluateTree(); if(ret!=0) { ClearGlobals(); delete DPTree; return 1;} |
|
|
|
|
|
|
|
COUT(INFO)<<"Ok"<<std::endl; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ClearGlobals(); |
|
|
|
ClearGlobals(); |
|
|
|
delete DPTree; |
|
|
|
delete DPTree; |
|
|
|