#include "globals.h" // Variables definitions G_varsType G_vars; // Functions addresses G_funcsType G_funcs; // List of objects to save G_toType G_tosave; // List of objects to print G_toType G_toprint; void ClearGlobals() { for(auto& it:G_vars) delete it.second; for(auto& it:G_tosave) delete it; for(auto& it:G_toprint) delete it; G_vars.clear(); G_tosave.clear(); G_toprint.clear(); } void RegisterFunction(const std::string& name, Func func) { G_funcs.emplace(name,func); } bool Save(const ObjectList* input) { ObjectList::ListValues::size_type sz=input->Size(), i; if(sz<2 || sz%2==1 ) { COUT(ERROR)<<"Number of save arguments must not be "<At(i*2+1); if(!IS_OTYPE(arg1,ObjectString)) { COUT(ERROR)<<"Save format is save(object_1,file_1,...,object_n,file_n) where file_i is string"<At(i*2); arg2=dynamic_cast(input->At(i*2+1)); if(!arg1->Save(arg2->Value().c_str())) { COUT(ERROR)<<"Can't save object "<Dump()<<" to file "<Value()<Size(), i; if(sz==0) return true; // Print for(i=0;iAt(i)->Print()) { COUT(ERROR)<<"Unprintable object "<At(i)->Dump()<