Browse Source

DumpConfig() function

test
Michael Uleysky 9 years ago
parent
commit
6761e6e462
  1. 7
      src/init.cpp
  2. 1
      src/init.h
  3. 7
      src/main.cpp

7
src/init.cpp

@ -53,3 +53,10 @@ int BuildDepTree(DepTree* deptree,std::set<std::string>& used)
{ {
return deptree->CreateGlobalTree(used); return deptree->CreateGlobalTree(used);
} }
void DumpConfig()
{
for(auto& i: G_vars) COUT(INFO)<<i.first<<"="+i.second->Dump()<<";"<<std::endl;
for(auto& i: G_tosave) COUT(INFO)<<"save"<<i->Dump()<<";"<<std::endl;
for(auto& i: G_toprint) COUT(INFO)<<"print"<<i->Dump()<<";"<<std::endl;
}

1
src/init.h

@ -9,5 +9,6 @@ typedef void* yyscan_t;
int ParseConfigFile(char* config); int ParseConfigFile(char* config);
int RegisterArifmeticFunctions(); int RegisterArifmeticFunctions();
int BuildDepTree(DepTree* deptree, std::set<std::string>& used); int BuildDepTree(DepTree* deptree, std::set<std::string>& used);
void DumpConfig();
#endif #endif

7
src/main.cpp

@ -15,7 +15,7 @@ int main(int argc, char** argv)
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)
{ {
COUT(INFO)<<"No actions needed, exiting"<<std::endl; COUT(WARNING)<<"No actions needed, exiting"<<std::endl;
ClearGlobals(); ClearGlobals();
return 0; return 0;
} }
@ -35,12 +35,9 @@ int main(int argc, char** argv)
COUT(INFO)<<(tot-G_vars.size())<<" removed, "<<G_vars.size()<<" remains."<<std::endl; COUT(INFO)<<(tot-G_vars.size())<<" removed, "<<G_vars.size()<<" remains."<<std::endl;
} }
RegisterArifmeticFunctions(); RegisterArifmeticFunctions();
DumpConfig();
COUT(INFO)<<G_vars.size()<<std::endl;
for(auto& i: G_vars) COUT(INFO)<<i.first<<"="+i.second->Dump()<<";"<<std::endl;
ClearGlobals(); ClearGlobals();
delete DPTree; delete DPTree;

Loading…
Cancel
Save