From 8d8c6fb137e2a369abe8704b2156d2482b739c71 Mon Sep 17 00:00:00 2001 From: Michael Rawson Date: Sat, 29 Jun 2024 10:25:18 +0200 Subject: [PATCH] inline pointless vstring typedef --- CASC/PortfolioMode.cpp | 42 +-- CASC/PortfolioMode.hpp | 6 +- CASC/Schedules.cpp | 4 +- CASC/Schedules.hpp | 4 +- DP/SimpleCongruenceClosure.cpp | 4 +- DP/SimpleCongruenceClosure.hpp | 4 +- FMB/FiniteModel.cpp | 10 +- FMB/FiniteModel.hpp | 4 +- FMB/FiniteModelBuilder.cpp | 6 +- FMB/FiniteModelBuilder.hpp | 4 +- FMB/FiniteModelMultiSorted.cpp | 22 +- FMB/FiniteModelMultiSorted.hpp | 22 +- FMB/ModelCheck.hpp | 4 +- FMB/Monotonicity.cpp | 4 +- FMB/SortInference.cpp | 2 +- Forwards.hpp | 5 +- Indexing/SubstitutionTree.hpp | 2 +- Inferences/Induction.hpp | 2 +- Inferences/Injectivity.cpp | 2 +- Inferences/Superposition.cpp | 16 +- Inferences/TheoryInstAndSimp.cpp | 6 +- Inferences/TheoryInstAndSimp.hpp | 2 +- Kernel/Clause.cpp | 52 ++-- Kernel/Clause.hpp | 10 +- Kernel/Formula.cpp | 20 +- Kernel/Formula.hpp | 20 +- Kernel/FormulaUnit.cpp | 4 +- Kernel/FormulaUnit.hpp | 2 +- Kernel/Inference.cpp | 2 +- Kernel/Inference.hpp | 4 +- Kernel/InferenceStore.cpp | 100 +++--- Kernel/InferenceStore.hpp | 6 +- Kernel/KBO.cpp | 26 +- Kernel/KBO.hpp | 4 +- Kernel/KBOComparator.cpp | 2 +- Kernel/KBOComparator.hpp | 2 +- Kernel/LPOComparator.cpp | 2 +- Kernel/LPOComparator.hpp | 2 +- Kernel/OperatorType.cpp | 8 +- Kernel/OperatorType.hpp | 4 +- Kernel/Ordering.cpp | 8 +- Kernel/Ordering.hpp | 2 +- Kernel/Renaming.cpp | 4 +- Kernel/Renaming.hpp | 2 +- Kernel/SKIKBO.hpp | 2 +- Kernel/Signature.cpp | 96 +++--- Kernel/Signature.hpp | 80 ++--- Kernel/Substitution.cpp | 2 +- Kernel/Substitution.hpp | 2 +- Kernel/Term.cpp | 82 ++--- Kernel/Term.hpp | 30 +- Kernel/Theory.cpp | 34 +- Kernel/Theory.hpp | 32 +- Kernel/Unit.cpp | 12 +- Kernel/Unit.hpp | 4 +- Lib/Backtrackable.hpp | 6 +- Lib/Environment.hpp | 2 +- Lib/Exception.cpp | 4 +- Lib/Exception.hpp | 12 +- Lib/Hash.hpp | 8 +- Lib/Int.cpp | 38 +-- Lib/Int.hpp | 28 +- Lib/IntNameTable.cpp | 2 +- Lib/IntNameTable.hpp | 8 +- Lib/List.hpp | 4 +- Lib/Metaiterators.hpp | 6 +- Lib/SharedSet.hpp | 2 +- Lib/StringUtils.cpp | 32 +- Lib/StringUtils.hpp | 24 +- Lib/Timer.cpp | 2 +- Lib/Timer.hpp | 2 +- Lib/Vector.hpp | 4 +- Parse/SMTLIB2.cpp | 132 ++++---- Parse/SMTLIB2.hpp | 70 ++--- Parse/TPTP.cpp | 196 ++++++------ Parse/TPTP.hpp | 104 +++---- SAT/SATClause.cpp | 4 +- SAT/SATClause.hpp | 2 +- SAT/SATLiteral.cpp | 2 +- SAT/SATLiteral.hpp | 2 +- SAT/Z3Interfacing.cpp | 16 +- SAT/Z3Interfacing.hpp | 4 +- Saturation/AWPassiveClauseContainer.cpp | 2 +- Saturation/AWPassiveClauseContainer.hpp | 2 +- Saturation/ClauseContainer.hpp | 4 +- .../PredicateSplitPassiveClauseContainer.cpp | 10 +- .../PredicateSplitPassiveClauseContainer.hpp | 10 +- Saturation/SaturationAlgorithm.cpp | 10 +- Saturation/Splitter.cpp | 8 +- Saturation/Splitter.hpp | 6 +- Saturation/SymElOutput.cpp | 2 +- Shell/AnswerExtractor.cpp | 8 +- Shell/AnswerExtractor.hpp | 2 +- Shell/CommandLine.cpp | 2 +- Shell/FOOLElimination.cpp | 2 +- Shell/FOOLElimination.hpp | 2 +- Shell/FunctionDefinitionHandler.cpp | 2 +- Shell/FunctionDefinitionHandler.hpp | 2 +- Shell/Interpolants.cpp | 2 +- Shell/LaTeX.cpp | 112 +++---- Shell/LaTeX.hpp | 34 +- Shell/LambdaElimination.cpp | 6 +- Shell/Lexer.cpp | 6 +- Shell/Lexer.hpp | 4 +- Shell/LispLexer.cpp | 4 +- Shell/LispParser.cpp | 30 +- Shell/LispParser.hpp | 30 +- Shell/NewCNF.hpp | 4 +- Shell/Options.cpp | 142 +++++---- Shell/Options.hpp | 294 +++++++++--------- Shell/PredicateDefinition.cpp | 2 +- Shell/Property.cpp | 12 +- Shell/Property.hpp | 8 +- Shell/Skolem.cpp | 6 +- Shell/Statistics.hpp | 2 +- Shell/TPTPPrinter.cpp | 52 ++-- Shell/TPTPPrinter.hpp | 16 +- Shell/TermAlgebra.cpp | 8 +- Shell/TermAlgebra.hpp | 4 +- Shell/TheoryFinder.cpp | 2 +- Shell/Token.cpp | 2 +- Shell/Token.hpp | 4 +- Shell/UIHelper.cpp | 22 +- Shell/UIHelper.hpp | 8 +- Shell/VarManager.cpp | 2 +- Shell/VarManager.hpp | 4 +- Test/GenerationTester.hpp | 12 +- Test/SyntaxSugar.hpp | 2 +- Test/UnitTesting.cpp | 30 +- Test/UnitTesting.hpp | 26 +- UnitTests/tCoproduct.cpp | 2 +- UnitTests/tOption.cpp | 8 +- UnitTests/tOptionConstraints.cpp | 6 +- UnitTests/tSafeRecursion.cpp | 6 +- UnitTests/tTermIndex.cpp | 20 +- vampire.cpp | 10 +- 136 files changed, 1283 insertions(+), 1290 deletions(-) diff --git a/CASC/PortfolioMode.cpp b/CASC/PortfolioMode.cpp index 11f0fe5019..05fb7eae4b 100644 --- a/CASC/PortfolioMode.cpp +++ b/CASC/PortfolioMode.cpp @@ -298,18 +298,18 @@ void PortfolioMode::rescaleScheduleLimits(const Schedule& sOld, Schedule& sNew, { Schedule::BottomFirstIterator it(sOld); while(it.hasNext()){ - vstring s = it.next(); + std::string s = it.next(); // rescale the instruction limit, if present size_t bidx = s.rfind(":i="); - if (bidx == vstring::npos) { + if (bidx == std::string::npos) { bidx = s.rfind("_i="); } - if (bidx != vstring::npos) { + if (bidx != std::string::npos) { bidx += 3; // advance past the "[:_]i=" bit size_t eidx = s.find_first_of(":_",bidx); // find the end of the number there - ASS_NEQ(eidx,vstring::npos); - vstring instrStr = s.substr(bidx,eidx-bidx); + ASS_NEQ(eidx,std::string::npos); + std::string instrStr = s.substr(bidx,eidx-bidx); unsigned instr; ALWAYS(Int::stringToUnsignedInt(instrStr,instr)); instr *= limit_multiplier; @@ -317,12 +317,12 @@ void PortfolioMode::rescaleScheduleLimits(const Schedule& sOld, Schedule& sNew, } // do the analogous with the time limit suffix - vstring ts = s.substr(s.find_last_of("_")+1,vstring::npos); + std::string ts = s.substr(s.find_last_of("_")+1,std::string::npos); unsigned time; ALWAYS(Lib::Int::stringToUnsignedInt(ts,time)); - vstring prefix = s.substr(0,s.find_last_of("_")); + std::string prefix = s.substr(0,s.find_last_of("_")); // Add a copy with increased time limit ... - vstring new_time_suffix = Lib::Int::toString((int)(time*limit_multiplier)); + std::string new_time_suffix = Lib::Int::toString((int)(time*limit_multiplier)); sNew.push(prefix + "_" + new_time_suffix); } @@ -334,17 +334,17 @@ void PortfolioMode::rescaleScheduleLimits(const Schedule& sOld, Schedule& sNew, * * @author Giles, Martin */ -void PortfolioMode::addScheduleExtra(const Schedule& sOld, Schedule& sNew, vstring extra) +void PortfolioMode::addScheduleExtra(const Schedule& sOld, Schedule& sNew, std::string extra) { Schedule::BottomFirstIterator it(sOld); while(it.hasNext()){ - vstring s = it.next(); + std::string s = it.next(); auto idx = s.find_last_of("_"); - vstring prefix = s.substr(0,idx); - vstring suffix = s.substr(idx,vstring::npos); - vstring new_s = prefix + ((prefix.back() != '_') ? ":" : "") + extra + suffix; + std::string prefix = s.substr(0,idx); + std::string suffix = s.substr(idx,std::string::npos); + std::string new_s = prefix + ((prefix.back() != '_') ? ":" : "") + extra + suffix; sNew.push(new_s); } @@ -454,7 +454,7 @@ bool PortfolioMode::runSchedule(Schedule schedule) { } ALWAYS(it.hasNext()); - vstring code = it.next(); + std::string code = it.next(); pid_t process = Multiprocessing::instance()->fork(); ASS_NEQ(process, -1); if(process == 0) @@ -546,10 +546,10 @@ bool PortfolioMode::runScheduleAndRecoverProof(Schedule schedule) /** * Return the intended slice time in deciseconds */ -unsigned PortfolioMode::getSliceTime(const vstring &sliceCode) +unsigned PortfolioMode::getSliceTime(const std::string &sliceCode) { unsigned pos = sliceCode.find_last_of('_'); - vstring sliceTimeStr = sliceCode.substr(pos+1); + std::string sliceTimeStr = sliceCode.substr(pos+1); unsigned sliceTime; ALWAYS(Int::stringToUnsignedInt(sliceTimeStr,sliceTime)); @@ -560,16 +560,16 @@ unsigned PortfolioMode::getSliceTime(const vstring &sliceCode) } size_t bidx = sliceCode.find(":i="); - if (bidx == vstring::npos) { + if (bidx == std::string::npos) { bidx = sliceCode.find("_i="); - if (bidx == vstring::npos) { + if (bidx == std::string::npos) { return 0; // run (essentially) forever } } // we have a valid begin index bidx += 3; // advance it past the "*i=" bit size_t eidx = sliceCode.find_first_of(":_",bidx); // find the end of the number there - ASS_NEQ(eidx,vstring::npos); - vstring sliceInstrStr = sliceCode.substr(bidx,eidx-bidx); + ASS_NEQ(eidx,std::string::npos); + std::string sliceInstrStr = sliceCode.substr(bidx,eidx-bidx); unsigned sliceInstr; ALWAYS(Int::stringToUnsignedInt(sliceInstrStr,sliceInstr)); @@ -583,7 +583,7 @@ unsigned PortfolioMode::getSliceTime(const vstring &sliceCode) /** * Run a slice given by its code using the specified time limit. */ -void PortfolioMode::runSlice(vstring sliceCode, int timeLimitInDeciseconds) +void PortfolioMode::runSlice(std::string sliceCode, int timeLimitInDeciseconds) { TIME_TRACE("run slice"); diff --git a/CASC/PortfolioMode.hpp b/CASC/PortfolioMode.hpp index cc93c376f8..5536166685 100644 --- a/CASC/PortfolioMode.hpp +++ b/CASC/PortfolioMode.hpp @@ -39,18 +39,18 @@ class PortfolioMode { static bool perform(Kernel::Problem* problem); static void rescaleScheduleLimits(const Schedule& sOld, Schedule& sNew, float limit_multiplier); - static void addScheduleExtra(const Schedule& sOld, Schedule& sNew, vstring extra); + static void addScheduleExtra(const Schedule& sOld, Schedule& sNew, std::string extra); private: // some of these names are kind of arbitrary and should be perhaps changed - unsigned getSliceTime(const vstring &sliceCode); + unsigned getSliceTime(const std::string &sliceCode); bool searchForProof(); bool prepareScheduleAndPerform(const Shell::Property& prop); void getSchedules(const Property& prop, Schedule& quick, Schedule& fallback); bool runSchedule(Schedule schedule); bool runScheduleAndRecoverProof(Schedule schedule); - [[noreturn]] void runSlice(vstring sliceCode, int remainingTime); + [[noreturn]] void runSlice(std::string sliceCode, int remainingTime); [[noreturn]] void runSlice(Options& strategyOpt); #if VDEBUG diff --git a/CASC/Schedules.cpp b/CASC/Schedules.cpp index 68d9396ab3..67e3db44bc 100644 --- a/CASC/Schedules.cpp +++ b/CASC/Schedules.cpp @@ -34,7 +34,7 @@ using namespace Lib; using namespace Shell; using namespace CASC; -void Schedules::getScheduleFromFile(const vstring& filename, Schedule& quick) +void Schedules::getScheduleFromFile(const std::string& filename, Schedule& quick) { if (filename == "") { USER_ERROR("Schedule file was not set."); @@ -44,7 +44,7 @@ void Schedules::getScheduleFromFile(const vstring& filename, Schedule& quick) USER_ERROR("Cannot open schedule file: " + filename); } ASS(schedule_file.is_open()); - vstring line; + std::string line; while (getline(schedule_file, line)) { // Allow structuring the schedule file with empty lines. // Allow documenting the schedule file with line comments. diff --git a/CASC/Schedules.hpp b/CASC/Schedules.hpp index bfa0bb1953..85f2f71439 100644 --- a/CASC/Schedules.hpp +++ b/CASC/Schedules.hpp @@ -20,12 +20,12 @@ namespace CASC { -typedef Lib::Stack Schedule; +typedef Lib::Stack Schedule; class Schedules { public: - static void getScheduleFromFile(const vstring& filename, Schedule& quick); + static void getScheduleFromFile(const std::string& filename, Schedule& quick); static void getHigherOrderSchedule2020(Schedule& quick, Schedule& fallback); diff --git a/DP/SimpleCongruenceClosure.cpp b/DP/SimpleCongruenceClosure.cpp index 20da28c214..6ef37706b1 100644 --- a/DP/SimpleCongruenceClosure.cpp +++ b/DP/SimpleCongruenceClosure.cpp @@ -35,7 +35,7 @@ using namespace std; const unsigned SimpleCongruenceClosure::NO_SIG_SYMBOL = 0xFFFFFFFF; -vstring SimpleCongruenceClosure::CEq::toString() const +std::string SimpleCongruenceClosure::CEq::toString() const { std::ostringstream res; res << c1<<"="<functionArity(f); if(arity>0) continue; if(!printIntroduced && env.signature->getFunction(f)->introduced()) continue; - vstring name = env.signature->functionName(f); + std::string name = env.signature->functionName(f); unsigned res = f_interpretation[f_offsets[f]]; if(res>0){ modelStm << "fof("<functionArity(f); if(arity==0) continue; if(!printIntroduced && env.signature->getFunction(f)->introduced()) continue; - vstring name = env.signature->functionName(f); + std::string name = env.signature->functionName(f); modelStm << "fof(function_"<predicateArity(f); if(arity>0) continue; if(!printIntroduced && env.signature->getPredicate(f)->introduced()) continue; - vstring name = env.signature->predicateName(f); + std::string name = env.signature->predicateName(f); unsigned res = p_interpretation[p_offsets[f]]; if(res==2){ modelStm << "fof("<predicateArity(f); if(arity==0) continue; if(!printIntroduced && env.signature->getPredicate(f)->introduced()) continue; - vstring name = env.signature->predicateName(f); + std::string name = env.signature->predicateName(f); modelStm << "fof(predicate_"<addFreshFunction(0,name.c_str()); t = Term::createConstant(f); _domainConstants.insert(c,t); diff --git a/FMB/FiniteModelBuilder.cpp b/FMB/FiniteModelBuilder.cpp index e8c07cf87f..5f1cf2b034 100644 --- a/FMB/FiniteModelBuilder.cpp +++ b/FMB/FiniteModelBuilder.cpp @@ -1557,8 +1557,8 @@ MainLoopResult FiniteModelBuilder::runImpl() #if VTRACE_FMB doPrinting = true; #endif - vstring min_res = "["; - vstring max_res = "["; + std::string min_res = "["; + std::string max_res = "["; for(unsigned s=0;s<_sortedSignature->distinctSorts;s++){ if(_distinctSortMaxs[s]==UINT_MAX){ max_res+="max"; @@ -2484,7 +2484,7 @@ bool FiniteModelBuilder::SmtBasedDSAE::init(unsigned _startModelSize, DArray zero); diff --git a/FMB/FiniteModelBuilder.hpp b/FMB/FiniteModelBuilder.hpp index 6fcd309db4..374ca26413 100644 --- a/FMB/FiniteModelBuilder.hpp +++ b/FMB/FiniteModelBuilder.hpp @@ -44,8 +44,8 @@ using namespace SAT; unsigned f; DArray grounding; - vstring toString(){ - vstring ret = Lib::Int::toString(f)+"["; + std::string toString(){ + std::string ret = Lib::Int::toString(f)+"["; for(unsigned i=0;i0) ret +=","; ret+=Lib::Int::toString(grounding[i]); diff --git a/FMB/FiniteModelMultiSorted.cpp b/FMB/FiniteModelMultiSorted.cpp index 8c0fb9bba8..61feff9e2f 100644 --- a/FMB/FiniteModelMultiSorted.cpp +++ b/FMB/FiniteModelMultiSorted.cpp @@ -179,13 +179,13 @@ bool FiniteModelMultiSorted::isPartial() return true; } -vstring FiniteModelMultiSorted::toString() +std::string FiniteModelMultiSorted::toString() { std::ostringstream modelStm; bool printIntroduced = false; - static DArray> cnames; + static DArray> cnames; cnames.ensure(env.signature->typeCons()); //Output sorts and their sizes @@ -197,8 +197,8 @@ vstring FiniteModelMultiSorted::toString() if(env.signature->isInterpretedNonDefault(s)) continue; - vstring sortName = env.signature->typeConName(s); - vstring sortNameLabel = (env.signature->isBoolCon(s)) ? "bool" : sortName; + std::string sortName = env.signature->typeConName(s); + std::string sortNameLabel = (env.signature->isBoolCon(s)) ? "bool" : sortName; // skip declaring $i, we know what it is if(!env.signature->isDefaultSortCon(s)) @@ -212,7 +212,7 @@ vstring FiniteModelMultiSorted::toString() for(unsigned i=1;i<=size;i++){ modelStm << "tff(" << append(prepend("declare_", sortNameLabel), Int::toString(i).c_str()) << ",type,"; int frep = sortRepr[s][i]; - vstring cname = prepend("fmb_", sortNameLabel+"_"+Lib::Int::toString(i)); + std::string cname = prepend("fmb_", sortNameLabel+"_"+Lib::Int::toString(i)); if(frep >= 0){ cname = env.signature->functionName(frep); } @@ -258,14 +258,14 @@ vstring FiniteModelMultiSorted::toString() unsigned arity = env.signature->functionArity(f); if(arity>0) continue; if(!printIntroduced && env.signature->getFunction(f)->introduced()) continue; - vstring name = env.signature->functionName(f); + std::string name = env.signature->functionName(f); unsigned res = f_interpretation[f_offsets[f]]; TermList srtT = env.signature->getFunction(f)->fnType()->result(); unsigned srt = srtT.term()->functor(); - vstring cname = cnames[srt][res]; + std::string cname = cnames[srt][res]; if(name == cname) continue; - vstring sortName = env.signature->typeConName(srt); + std::string sortName = env.signature->typeConName(srt); modelStm << "tff("<0){ modelStm << "tff("<functionArity(f); if(arity==0) continue; if(!printIntroduced && env.signature->getFunction(f)->introduced()) continue; - vstring name = env.signature->functionName(f); + std::string name = env.signature->functionName(f); OperatorType* sig = env.signature->getFunction(f)->fnType(); modelStm << "tff("<predicateArity(f); if(arity>0) continue; if(!printIntroduced && env.signature->getPredicate(f)->introduced()) continue; - vstring name = env.signature->predicateName(f); + std::string name = env.signature->predicateName(f); modelStm << "tff("<predicateArity(f); if(arity==0) continue; if(!printIntroduced && env.signature->getPredicate(f)->introduced()) continue; - vstring name = env.signature->predicateName(f); + std::string name = env.signature->predicateName(f); OperatorType* sig = env.signature->getPredicate(f)->predType(); modelStm << "tff("< pair = std::make_pair(c,srt); if(_domainConstants.find(pair,t)) return t; - vstring name = "domCon_"+env.signature->typeConName(srt)+"_"+Lib::Int::toString(c); + std::string name = "domCon_"+env.signature->typeConName(srt)+"_"+Lib::Int::toString(c); unsigned f = env.signature->addFreshFunction(0,name.c_str()); TermList srtT = TermList(AtomicSort::createConstant(srt)); env.signature->getFunction(f)->setType(OperatorType::getConstantsType(srtT)); @@ -106,25 +106,25 @@ class FiniteModelMultiSorted { { return _domainConstantsRev.find(t); } - vstring prepend(const char* prefix, vstring name) { + std::string prepend(const char* prefix, std::string name) { if (name.empty()) { - return vstring(prefix); + return std::string(prefix); } else if(name[0] == '$') { - return vstring("'") + prefix + name + "'"; + return std::string("'") + prefix + name + "'"; } else if (name[0] == '\'') { - vstring dequoted = name.substr(1, name.length() - 1); - return vstring("'") + prefix + dequoted; + std::string dequoted = name.substr(1, name.length() - 1); + return std::string("'") + prefix + dequoted; } else { return prefix + name; } } - vstring append(vstring name, const char* suffix) { + std::string append(std::string name, const char* suffix) { if (name.empty()) { - return vstring(suffix); + return std::string(suffix); } else if(name[0] == '$') { - return vstring("'") + name + suffix + "'"; + return std::string("'") + name + suffix + "'"; } else if (name[0] == '\'') { - vstring dequoted = name.substr(0, name.length() - 1); + std::string dequoted = name.substr(0, name.length() - 1); return dequoted + suffix + "'"; } else { return name + suffix; diff --git a/FMB/ModelCheck.hpp b/FMB/ModelCheck.hpp index 6d6036055a..85d91841ab 100644 --- a/FMB/ModelCheck.hpp +++ b/FMB/ModelCheck.hpp @@ -51,7 +51,7 @@ static void doCheck(UnitList* units) while(uit.hasNext()){ Unit* u = uit.next(); if(u->inputType()!= UnitInputType::MODEL_DEFINITION) continue; - vstring name; + std::string name; ALWAYS(Parse::TPTP::findAxiomName(u,name)); if(name == "finite_domain"){ //std::cout << "Finite domain axiom found:" << std::endl << u->toString() << std::endl; @@ -106,7 +106,7 @@ static void doCheck(UnitList* units) while(uit.hasNext()){ Unit* u = uit.next(); if(u->inputType()!= UnitInputType::MODEL_DEFINITION) continue; - vstring name; + std::string name; ALWAYS(Parse::TPTP::findAxiomName(u,name)); if(name == "finite_domain" || name == "distinct_domain") continue; diff --git a/FMB/Monotonicity.cpp b/FMB/Monotonicity.cpp index 60e8fd73db..a9d4f8b601 100644 --- a/FMB/Monotonicity.cpp +++ b/FMB/Monotonicity.cpp @@ -176,7 +176,7 @@ void Monotonicity::addSortPredicates(bool withMon, ClauseList*& clauses, DArray< DArray sortPredicates(env.signature->typeCons()); for(unsigned s=0;stypeCons();s++){ if(!isMonotonic[s]){ - vstring name = "sortPredicate_"+env.signature->typeConName(s); + std::string name = "sortPredicate_"+env.signature->typeConName(s); unsigned p = env.signature->addFreshPredicate(1,name.c_str()); env.signature->getPredicate(p)->setType(OperatorType::getPredicateType({TermList(AtomicSort::createConstant(s))})); sortPredicates[s] = p; @@ -331,7 +331,7 @@ void Monotonicity::addSortFunctions(bool withMon, ClauseList*& clauses) DArray sortFunctions(env.signature->typeCons()); for(unsigned s=0;stypeCons();s++){ if(!isMonotonic[s]){ - vstring name = "sortFunction_"+env.signature->typeConName(s); + std::string name = "sortFunction_"+env.signature->typeConName(s); unsigned f = env.signature->addFreshFunction(1,name.c_str()); TermList sT = TermList(AtomicSort::createConstant(s)); env.signature->getFunction(f)->setType(OperatorType::getFunctionType({sT},sT)); diff --git a/FMB/SortInference.cpp b/FMB/SortInference.cpp index d0c5ad663f..03321a8041 100644 --- a/FMB/SortInference.cpp +++ b/FMB/SortInference.cpp @@ -755,7 +755,7 @@ void SortInference::doInference() cout << _sig->distinctSorts << " distinct sorts" << endl; for(unsigned s=0;s<_sig->distinctSorts;s++){ unsigned children =0; - vstring res=""; + std::string res=""; for(unsigned i=0;i<_sig->sorts;i++){ if(_sig->parents[i]==s){ if(children>0) res+=","; diff --git a/Forwards.hpp b/Forwards.hpp index 9ebf1d4229..39b528451c 100644 --- a/Forwards.hpp +++ b/Forwards.hpp @@ -22,9 +22,6 @@ namespace Lib struct EmptyStruct {}; typedef void (*VoidFunc)(); -// historical alias to std::string: do not use in new code -using vstring = std::string; - template class VirtualIterator; template class ScopedPtr; @@ -39,7 +36,7 @@ template class List; template class SharedSet; typedef List IntList; -typedef Stack StringStack; +typedef Stack StringStack; typedef List VoidFuncList; class DefaultHash; diff --git a/Indexing/SubstitutionTree.hpp b/Indexing/SubstitutionTree.hpp index 6be647e59b..883e966a69 100644 --- a/Indexing/SubstitutionTree.hpp +++ b/Indexing/SubstitutionTree.hpp @@ -924,7 +924,7 @@ class SubstitutionTree final ASS(!q || !t.isSpecialVar()); } - vstring toString() + std::string toString() { return (q ? "q|" : "n|")+t.toString(); } /** diff --git a/Inferences/Induction.hpp b/Inferences/Induction.hpp index d698b84cb9..9f46ca094d 100644 --- a/Inferences/Induction.hpp +++ b/Inferences/Induction.hpp @@ -155,7 +155,7 @@ struct InductionContext { Formula* getFormulaWithSquashedSkolems(const std::vector& r, bool opposite, unsigned& var, VList** varList = nullptr, Substitution* subst = nullptr) const; - vstring toString() const { + std::string toString() const { std::stringstream str; for (const auto& indt : _indTerms) { str << *indt << std::endl; diff --git a/Inferences/Injectivity.cpp b/Inferences/Injectivity.cpp index c2ce3e4886..05a934c07d 100644 --- a/Inferences/Injectivity.cpp +++ b/Inferences/Injectivity.cpp @@ -116,7 +116,7 @@ TermList Injectivity::createNewLhs(TermList oldhead, TermStack& termArgs, unsign } Signature::Symbol* func = env.signature->getFunction(oldhead.term()->functor()); - vstring pref = "inv_" + func->name() + "_"; + std::string pref = "inv_" + func->name() + "_"; unsigned iFunc = env.signature->addFreshFunction(func->arity(), pref.c_str() ); OperatorType* funcType = func->fnType(); diff --git a/Inferences/Superposition.cpp b/Inferences/Superposition.cpp index 1503d8b747..f28eef4e0f 100644 --- a/Inferences/Superposition.cpp +++ b/Inferences/Superposition.cpp @@ -531,23 +531,23 @@ Clause* Superposition::performSuperposition( // First find which literal it is in the clause, as selection has occured already // this should remain the same...? - vstring rwPlace = Lib::Int::toString(rwClause->getLiteralPosition(rwLit)); - vstring eqPlace = Lib::Int::toString(eqClause->getLiteralPosition(eqLit)); + std::string rwPlace = Lib::Int::toString(rwClause->getLiteralPosition(rwLit)); + std::string eqPlace = Lib::Int::toString(eqClause->getLiteralPosition(eqLit)); - vstring rwPos="_"; + std::string rwPos="_"; ALWAYS(Kernel::positionIn(rwTerm,rwLit,rwPos)); - vstring eqPos = "("+eqPlace+").2"; + std::string eqPos = "("+eqPlace+").2"; rwPos = "("+rwPlace+")."+rwPos; - vstring eqClauseNum = Lib::Int::toString(eqClause->number()); - vstring rwClauseNum = Lib::Int::toString(rwClause->number()); + std::string eqClauseNum = Lib::Int::toString(eqClause->number()); + std::string rwClauseNum = Lib::Int::toString(rwClause->number()); - vstring extra = eqClauseNum + " into " + rwClauseNum+", unify on "+ + std::string extra = eqClauseNum + " into " + rwClauseNum+", unify on "+ eqPos+" in "+eqClauseNum+" and "+ rwPos+" in "+rwClauseNum; if (!env.proofExtra) { - env.proofExtra = new DHMap(); + env.proofExtra = new DHMap(); } env.proofExtra->insert(clause,extra); } diff --git a/Inferences/TheoryInstAndSimp.cpp b/Inferences/TheoryInstAndSimp.cpp index f1155f3f9d..d38adece61 100644 --- a/Inferences/TheoryInstAndSimp.cpp +++ b/Inferences/TheoryInstAndSimp.cpp @@ -87,7 +87,7 @@ Options::TheoryInstSimp manageDeprecations(Options::TheoryInstSimp mode) } } -TheoryInstAndSimp::TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, vstring const& exportSmtlib) +TheoryInstAndSimp::TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, std::string const& exportSmtlib) : _splitter(0) , _mode(manageDeprecations(mode)) , _thiTautologyDeletion(thiTautologyDeletion) @@ -932,10 +932,10 @@ SimplifyingGeneratingInference::ClauseGenerationResult TheoryInstAndSimp::genera DEBUG("input: ", *premise); DEBUG("selected literals: ", iterTraits(selectedLiterals.iterFifo()) - .map([](Literal* l) -> vstring { return l->toString(); }) + .map([](Literal* l) -> std::string { return l->toString(); }) .collect()) DEBUG("guards: ", iterTraits(guards.iterFifo()) - .map([](Literal* l) -> vstring { return l->toString(); }) + .map([](Literal* l) -> std::string { return l->toString(); }) .collect()) TIME_TRACE(THEORY_INST_SIMP); diff --git a/Inferences/TheoryInstAndSimp.hpp b/Inferences/TheoryInstAndSimp.hpp index 19a632220e..93b2dd0360 100644 --- a/Inferences/TheoryInstAndSimp.hpp +++ b/Inferences/TheoryInstAndSimp.hpp @@ -52,7 +52,7 @@ class TheoryInstAndSimp TheoryInstAndSimp() : TheoryInstAndSimp(*env.options) {} TheoryInstAndSimp(Options& opts); - TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, vstring const& exportSmtlib); + TheoryInstAndSimp(Options::TheoryInstSimp mode, bool thiTautologyDeletion, bool showZ3, bool generalisation, std::string const& exportSmtlib); void attach(SaturationAlgorithm* salg); diff --git a/Kernel/Clause.cpp b/Kernel/Clause.cpp index f21851df68..a58118eb8c 100644 --- a/Kernel/Clause.cpp +++ b/Kernel/Clause.cpp @@ -300,14 +300,14 @@ bool Clause::noSplits() const } /** - * Convert non-propositional part of the clause to vstring. + * Convert non-propositional part of the clause to std::string. */ -vstring Clause::literalsOnlyToString() const +std::string Clause::literalsOnlyToString() const { if (_length == 0) { return "$false"; } else { - vstring result; + std::string result; result += _literals[0]->toString(); for(unsigned i = 1; i < _length; i++) { result += " | "; @@ -318,43 +318,43 @@ vstring Clause::literalsOnlyToString() const } /** - * Convert the clause to the TPTP-compatible vstring representation. + * Convert the clause to the TPTP-compatible std::string representation. * * The split history is omitted. */ -vstring Clause::toTPTPString() const +std::string Clause::toTPTPString() const { - vstring result = literalsOnlyToString(); + std::string result = literalsOnlyToString(); return result; } /** - * Convert the clause to easily readable vstring representation. + * Convert the clause to easily readable std::string representation. */ -vstring Clause::toNiceString() const +std::string Clause::toNiceString() const { - vstring result = literalsOnlyToString(); + std::string result = literalsOnlyToString(); if (splits() && !splits()->isEmpty()) { - result += vstring(" {") + splits()->toString() + "}"; + result += std::string(" {") + splits()->toString() + "}"; } return result; } /** - * Convert the clause to the vstring representation + * Convert the clause to the std::string representation * Includes splitting, age, weight, selected and inference */ -vstring Clause::toString() const +std::string Clause::toString() const { // print id and literals of clause - vstring result = Int::toString(_number) + ". " + literalsOnlyToString(); + std::string result = Int::toString(_number) + ". " + literalsOnlyToString(); // print avatar components clause depends on if (splits() && !splits()->isEmpty()) { - result += vstring(" <- (") + Splitter::splitsToString(splits()) + ")"; + result += std::string(" <- (") + Splitter::splitsToString(splits()) + ")"; } // print inference and ids of parent clauses @@ -362,44 +362,44 @@ vstring Clause::toString() const if(env.options->proofExtra()!=Options::ProofExtra::OFF){ // print statistics: each entry should have the form key:value - result += vstring(" {"); + result += std::string(" {"); - result += vstring("a:") + Int::toString(age()); + result += std::string("a:") + Int::toString(age()); unsigned weight = (_weight ? _weight : computeWeight()); - result += vstring(",w:") + Int::toString(weight); + result += std::string(",w:") + Int::toString(weight); unsigned weightForClauseSelection = (_weightForClauseSelection ? _weightForClauseSelection : computeWeightForClauseSelection(*env.options)); if(weightForClauseSelection!=weight){ - result += vstring(",wCS:") + Int::toString(weightForClauseSelection); + result += std::string(",wCS:") + Int::toString(weightForClauseSelection); } if (numSelected()>0) { - result += vstring(",nSel:") + Int::toString(numSelected()); + result += std::string(",nSel:") + Int::toString(numSelected()); } if (env.colorUsed) { - result += vstring(",col:") + Int::toString(color()); + result += std::string(",col:") + Int::toString(color()); } if(derivedFromGoal()){ - result += vstring(",goal:1"); + result += std::string(",goal:1"); } if(env.maxSineLevel > 1) { // this is a cryptic way of saying "did we run Sine to compute sine levels?" - result += vstring(",sine:")+Int::toString((unsigned)_inference.getSineLevel()); + result += std::string(",sine:")+Int::toString((unsigned)_inference.getSineLevel()); } if(isPureTheoryDescendant()){ - result += vstring(",ptD:1"); + result += std::string(",ptD:1"); } if(env.options->induction() != Shell::Options::Induction::NONE){ - result += vstring(",inD:") + Int::toString(_inference.inductionDepth()); + result += std::string(",inD:") + Int::toString(_inference.inductionDepth()); } result += ",thAx:" + Int::toString((int)(_inference.th_ancestors)); result += ",allAx:" + Int::toString((int)(_inference.all_ancestors)); result += ",thDist:" + Int::toString( _inference.th_ancestors * env.options->theorySplitQueueExpectedRatioDenom() - _inference.all_ancestors); - result += vstring("}"); + result += std::string("}"); } return result; @@ -409,7 +409,7 @@ vstring Clause::toString() const * Convert the clause into sequence of strings, each containing * a proper clause */ -VirtualIterator Clause::toSimpleClauseStrings() +VirtualIterator Clause::toSimpleClauseStrings() { return pvi(getSingletonIterator(literalsOnlyToString())); } diff --git a/Kernel/Clause.hpp b/Kernel/Clause.hpp index 1242258615..a66f6c0c5f 100644 --- a/Kernel/Clause.hpp +++ b/Kernel/Clause.hpp @@ -121,10 +121,10 @@ class Clause void destroy(); void destroyExceptInferenceObject(); - vstring literalsOnlyToString() const; - vstring toString() const; - vstring toTPTPString() const; - vstring toNiceString() const; + std::string literalsOnlyToString() const; + std::string toString() const; + std::string toTPTPString() const; + std::string toNiceString() const; /** Return the clause store */ Store store() const { return _store; } @@ -259,7 +259,7 @@ class Clause void incNumActiveSplits() { _numActiveSplits++; } void decNumActiveSplits() { _numActiveSplits--; } - VirtualIterator toSimpleClauseStrings(); + VirtualIterator toSimpleClauseStrings(); void setAux() { diff --git a/Kernel/Formula.cpp b/Kernel/Formula.cpp index 87411eca5d..e3265f4872 100644 --- a/Kernel/Formula.cpp +++ b/Kernel/Formula.cpp @@ -22,7 +22,7 @@ namespace Kernel { using namespace std; -vstring Formula::DEFAULT_LABEL = "none"; +std::string Formula::DEFAULT_LABEL = "none"; /** * Destroy the content of the formula. The destruction depends on the type @@ -76,28 +76,28 @@ void Formula::destroy () } /** - * Convert the connective to a vstring. + * Convert the connective to a std::string. * @since 02/01/2004 Manchester */ -vstring Formula::toString (Connective c) +std::string Formula::toString (Connective c) { - static vstring names [] = + static std::string names [] = { "", "&", "|", "=>", "<=>", "<~>", "~", "!", "?", "$var", "$false", "$true","",""}; - ASS_EQ(sizeof(names)/sizeof(vstring), NOCONN+1); + ASS_EQ(sizeof(names)/sizeof(std::string), NOCONN+1); return names[(int)c]; } // Formula::toString (Connective c) /** - * Convert the formula to a vstring + * Convert the formula to a std::string * * @since 12/10/2002 Tbilisi, implemented as ostream output function * @since 09/12/2003 Manchester * @since 11/12/2004 Manchester, true and false added */ -vstring Formula::toString () const +std::string Formula::toString () const { - vstring res; + std::string res; // render a connective if specified, and then a Formula (or ")" of formula is nullptr) typedef struct { @@ -114,7 +114,7 @@ vstring Formula::toString () const // in any case start by rendering the connective passed from "above" { - vstring con = toString(todo.renderConnective); + std::string con = toString(todo.renderConnective); if (con != "") { res += " "+con+" "; } @@ -214,7 +214,7 @@ vstring Formula::toString () const } case BOOL_TERM: { - vstring term = f->getBooleanTerm().toString(); + std::string term = f->getBooleanTerm().toString(); res += env.options->showFOOL() ? "$formula{" + term + "}" : term; continue; diff --git a/Kernel/Formula.hpp b/Kernel/Formula.hpp index 118fd72feb..9a250c0901 100644 --- a/Kernel/Formula.hpp +++ b/Kernel/Formula.hpp @@ -75,8 +75,8 @@ class Formula VList* boundVariables () const; // output - vstring toString() const; - static vstring toString(Connective con); + std::string toString() const; + static std::string toString(Connective con); bool parenthesesRequired(Connective outer) const; // auxiliary functions void destroy(); @@ -87,8 +87,8 @@ class Formula bool getSkip(); bool hasLabel(){ return _label != DEFAULT_LABEL; } - vstring getLabel(){ return _label;} - void label(vstring l){ _label=l; } + std::string getLabel(){ return _label;} + void label(std::string l){ _label=l; } static Formula* fromClause(Clause* cl); @@ -114,8 +114,8 @@ class Formula /** connective */ Connective _connective; - static vstring DEFAULT_LABEL; - vstring _label; + static std::string DEFAULT_LABEL; + std::string _label; }; // class Formula @@ -127,15 +127,15 @@ class NamedFormula : public Formula { public: - explicit NamedFormula(vstring name) : Formula(NAME), _name(name) {} + explicit NamedFormula(std::string name) : Formula(NAME), _name(name) {} USE_ALLOCATOR(NamedFormula); - vstring name(){ return _name; } - const vstring name() const { return _name;} + std::string name(){ return _name; } + const std::string name() const { return _name;} protected: - vstring _name; + std::string _name; }; // class NamedFormula diff --git a/Kernel/FormulaUnit.cpp b/Kernel/FormulaUnit.cpp index 6d26cd0a03..6384eb253e 100644 --- a/Kernel/FormulaUnit.cpp +++ b/Kernel/FormulaUnit.cpp @@ -40,10 +40,10 @@ void FormulaUnit::destroy() /** - * Convert the unit to the vstring representation. + * Convert the unit to the std::string representation. * @since 20/05/2007 Manchester */ -vstring FormulaUnit::toString() const +std::string FormulaUnit::toString() const { return Int::toString(_number) + ". " + _formula->toString() + ' ' + inferenceAsString(); diff --git a/Kernel/FormulaUnit.hpp b/Kernel/FormulaUnit.hpp index 0d55762c1b..72a8e479da 100644 --- a/Kernel/FormulaUnit.hpp +++ b/Kernel/FormulaUnit.hpp @@ -42,7 +42,7 @@ class FormulaUnit {} void destroy(); - vstring toString() const; + std::string toString() const; unsigned varCnt(); diff --git a/Kernel/Inference.cpp b/Kernel/Inference.cpp index 9e5ee81900..7bc11c52b9 100644 --- a/Kernel/Inference.cpp +++ b/Kernel/Inference.cpp @@ -576,7 +576,7 @@ void Inference::computeTheoryRunningSums() * Return the rule name, such as "binary resolution". * @since 04/01/2008 Torrevieja */ -vstring Kernel::ruleName(InferenceRule rule) +std::string Kernel::ruleName(InferenceRule rule) { switch (rule) { case InferenceRule::INPUT: diff --git a/Kernel/Inference.hpp b/Kernel/Inference.hpp index bdab1c2af6..48c1ab7bf9 100644 --- a/Kernel/Inference.hpp +++ b/Kernel/Inference.hpp @@ -615,7 +615,7 @@ inline bool isSatRefutationRule(InferenceRule r) { (r == InferenceRule::GLOBAL_SUBSUMPTION); } -vstring ruleName(InferenceRule rule); +std::string ruleName(InferenceRule rule); /* * The following structs are here just that we can have specialized overloads for the Inference constructor (see below) @@ -858,7 +858,7 @@ class Inference void minimizePremises(); // TODO why would we ever need this? replace it be appropriate output operator for InferenceRule - vstring name() const { return ruleName(_rule); } + std::string name() const { return ruleName(_rule); } /** return the input type of the unit */ UnitInputType inputType() const { return (UnitInputType)_inputType; } diff --git a/Kernel/InferenceStore.cpp b/Kernel/InferenceStore.cpp index 176565d9dd..231379639a 100644 --- a/Kernel/InferenceStore.cpp +++ b/Kernel/InferenceStore.cpp @@ -68,7 +68,7 @@ InferenceStore::InferenceStore() { } -vstring InferenceStore::getUnitIdStr(Unit* cs) +std::string InferenceStore::getUnitIdStr(Unit* cs) { if (!cs->isClause()) { return Int::toString(cs->number()); @@ -99,7 +99,7 @@ void InferenceStore::recordIntroducedSymbol(Unit* u, SymbolType st, unsigned num /** * Record the introduction of a split name */ -void InferenceStore::recordIntroducedSplitName(Unit* u, vstring name) +void InferenceStore::recordIntroducedSplitName(Unit* u, std::string name) { ALWAYS(_introducedSplitNames.insert(u->number(),name)); } @@ -148,13 +148,13 @@ UnitIterator InferenceStore::getParents(Unit* us) * It is caller's responsibility to ensure that variables in @b vars are unique. */ template -vstring getQuantifiedStr(const VarContainer& vars, vstring inner, DHMap& t_map, bool innerParentheses=true){ +std::string getQuantifiedStr(const VarContainer& vars, std::string inner, DHMap& t_map, bool innerParentheses=true){ VirtualIterator vit=pvi( getContentIterator(vars) ); - vstring varStr; + std::string varStr; bool first=true; while(vit.hasNext()) { unsigned var =vit.next(); - vstring ty=""; + std::string ty=""; TermList t; if(t_map.find(var,t) && env.getMainProblem()->hasNonDefaultSorts()){ @@ -164,10 +164,10 @@ vstring getQuantifiedStr(const VarContainer& vars, vstring inner, DHMap -vstring getQuantifiedStr(const VarContainer& vars, vstring inner, bool innerParentheses=true) +std::string getQuantifiedStr(const VarContainer& vars, std::string inner, bool innerParentheses=true) { static DHMap d; return getQuantifiedStr(vars,inner,d,innerParentheses); } /** - * Return vstring containing quantified unit @b u. + * Return std::string containing quantified unit @b u. */ -vstring getQuantifiedStr(Unit* u, List* nonQuantified=0) +std::string getQuantifiedStr(Unit* u, List* nonQuantified=0) { Set vars; - vstring res; + std::string res; DHMap t_map; SortHelper::collectVariableSorts(u,t_map); if (u->isClause()) { @@ -351,7 +351,7 @@ struct InferenceStore::ProofPrinter if (cs->isClause()) { Clause* cl=cs->asClause(); - out << cl->toString() << vstring("\n"); + out << cl->toString() << std::string("\n"); } else { out << _is->getUnitIdStr(cs) << ". "; @@ -365,7 +365,7 @@ struct InferenceStore::ProofPrinter if (outputAxiomNames && rule==InferenceRule::INPUT) { ASS(!parents.hasNext()); //input clauses don't have parents - vstring name; + std::string name; if (Parse::TPTP::findAxiomName(cs, name)) { out << " " << name; } @@ -526,9 +526,9 @@ struct InferenceStore::TPTPProofPrinter } protected: - vstring splitPrefix; + std::string splitPrefix; - vstring getRole(InferenceRule rule, UnitInputType origin) + std::string getRole(InferenceRule rule, UnitInputType origin) { switch(rule) { case InferenceRule::INPUT: @@ -545,27 +545,27 @@ struct InferenceStore::TPTPProofPrinter } } - vstring tptpRuleName(InferenceRule rule) + std::string tptpRuleName(InferenceRule rule) { return StringUtils::replaceChar(ruleName(rule), ' ', '_'); } - vstring unitIdToTptp(vstring unitId) + std::string unitIdToTptp(std::string unitId) { return "f"+unitId; } - vstring tptpUnitId(Unit* us) + std::string tptpUnitId(Unit* us) { return unitIdToTptp(_is->getUnitIdStr(us)); } - vstring tptpDefId(Unit* us) + std::string tptpDefId(Unit* us) { return unitIdToTptp(Int::toString(us->number())+"_D"); } - vstring splitsToString(SplitSet* splits) + std::string splitsToString(SplitSet* splits) { ASS_G(splits->size(),0); @@ -573,7 +573,7 @@ struct InferenceStore::TPTPProofPrinter return Saturation::Splitter::getFormulaStringFromName(splits->sval(),true /*negated*/); } auto sit = splits->iter(); - vstring res("("); + std::string res("("); while(sit.hasNext()) { res+= Saturation::Splitter::getFormulaStringFromName(sit.next(),true /*negated*/); if (sit.hasNext()) { @@ -584,21 +584,21 @@ struct InferenceStore::TPTPProofPrinter return res; } - vstring quoteAxiomName(vstring n) + std::string quoteAxiomName(std::string n) { - static vstring allowedFirst("0123456789abcdefghijklmnopqrstuvwxyz"); + static std::string allowedFirst("0123456789abcdefghijklmnopqrstuvwxyz"); const char* allowed="_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; - if (n.size()==0 || allowedFirst.find(n[0])==vstring::npos || - n.find_first_not_of(allowed)!=vstring::npos) { + if (n.size()==0 || allowedFirst.find(n[0])==std::string::npos || + n.find_first_not_of(allowed)!=std::string::npos) { n='\''+n+'\''; } return n; } - vstring getFofString(vstring id, vstring formula, vstring inference, InferenceRule rule, UnitInputType origin=UnitInputType::AXIOM) + std::string getFofString(std::string id, std::string formula, std::string inference, InferenceRule rule, UnitInputType origin=UnitInputType::AXIOM) { - vstring kind = "fof"; + std::string kind = "fof"; if(env.getMainProblem()->hasNonDefaultSorts()){ kind="tff"; } if(env.getMainProblem()->isHigherOrder()){ kind="thf"; } @@ -607,9 +607,9 @@ struct InferenceStore::TPTPProofPrinter +" "+inference+")."; } - vstring getFormulaString(Unit* us) + std::string getFormulaString(Unit* us) { - vstring formulaStr; + std::string formulaStr; if (us->isClause()) { Clause* cl=us->asClause(); formulaStr=getQuantifiedStr(cl); @@ -632,12 +632,12 @@ struct InferenceStore::TPTPProofPrinter } return res; } - vstring getNewSymbols(vstring origin, vstring symStr) { + std::string getNewSymbols(std::string origin, std::string symStr) { return "new_symbols(" + origin + ",[" +symStr + "])"; } /** It is an iterator over SymbolId */ template - vstring getNewSymbols(vstring origin, It symIt) { + std::string getNewSymbols(std::string origin, It symIt) { std::ostringstream symsStr; while(symIt.hasNext()) { SymbolId sym = symIt.next(); @@ -654,7 +654,7 @@ struct InferenceStore::TPTPProofPrinter } return getNewSymbols(origin, symsStr.str()); } - vstring getNewSymbols(vstring origin, Unit* u) { + std::string getNewSymbols(std::string origin, Unit* u) { ASS(hasNewSymbols(u)); if(_is->_introducedSplitNames.find(u->number())){ @@ -683,31 +683,31 @@ struct InferenceStore::TPTPProofPrinter default: ; } - //get vstring representing the formula + //get std::string representing the formula - vstring formulaStr=getFormulaString(us); + std::string formulaStr=getFormulaString(us); - //get inference vstring + //get inference std::string - vstring inferenceStr; + std::string inferenceStr; if (rule==InferenceRule::INPUT) { - vstring fileName; + std::string fileName; if (env.options->inputFile()=="") { fileName="unknown"; } else { fileName="'"+env.options->inputFile()+"'"; } - vstring axiomName; + std::string axiomName; if (!outputAxiomNames || !Parse::TPTP::findAxiomName(us, axiomName)) { axiomName="unknown"; } inferenceStr="file("+fileName+","+quoteAxiomName(axiomName)+")"; } else if (!parents.hasNext()) { - vstring newSymbolInfo; + std::string newSymbolInfo; if (hasNewSymbols(us)) { - vstring newSymbOrigin; + std::string newSymbOrigin; if (rule == InferenceRule::FUNCTION_DEFINITION || rule == InferenceRule::FOOL_ITE_DEFINITION || rule == InferenceRule::FOOL_LET_DEFINITION || rule == InferenceRule::FOOL_FORMULA_DEFINITION || rule == InferenceRule::FOOL_MATCH_DEFINITION) { @@ -721,7 +721,7 @@ struct InferenceStore::TPTPProofPrinter } else { ASS(parents.hasNext()); - vstring statusStr; + std::string statusStr; if (rule==InferenceRule::SKOLEMIZE) { statusStr="status(esa),"+getNewSymbols("skolem",us); } @@ -752,7 +752,7 @@ struct InferenceStore::TPTPProofPrinter UnitIterator parents=_is->getParents(us, rule); ASS(rule==InferenceRule::GENERAL_SPLITTING); - vstring inferenceStr="inference("+tptpRuleName(rule)+",[],["; + std::string inferenceStr="inference("+tptpRuleName(rule)+",[],["; //here we rely on the fact that the base premise is always put as the first premise in //GeneralSplitting::apply @@ -782,7 +782,7 @@ struct InferenceStore::TPTPProofPrinter Literal* nameLit=_is->_splittingNameLiterals.get(us); //the name literal must always be stored - vstring defId=tptpDefId(us); + std::string defId=tptpDefId(us); out<::push(var,nameVars); } - vstring compStr; + std::string compStr; List* compOnlyVars=0; bool first=true; bool multiple=false; @@ -826,7 +826,7 @@ struct InferenceStore::TPTPProofPrinter compStr=getQuantifiedStr(compOnlyVars, compStr, multiple); List::destroy(compOnlyVars); - vstring defStr=compStr+" <=> "+Literal::complementaryLiteral(nameLit)->toString(); + std::string defStr=compStr+" <=> "+Literal::complementaryLiteral(nameLit)->toString(); defStr=getQuantifiedStr(nameVars, defStr); List::destroy(nameVars); @@ -849,9 +849,9 @@ struct InferenceStore::TPTPProofPrinter InferenceRule rule=InferenceRule::AVATAR_COMPONENT; - vstring defId=tptpDefId(us); - vstring splitPred = splitsToString(cl->splits()); - vstring defStr=getQuantifiedStr(cl)+" <=> ~"+splitPred; + std::string defId=tptpDefId(us); + std::string splitPred = splitsToString(cl->splits()); + std::string defStr=getQuantifiedStr(cl)+" <=> ~"+splitPred; out<hasNonDefaultSorts()){ kind="tff"; } if(env.getMainProblem()->isHigherOrder()){ kind="thf"; } @@ -982,7 +982,7 @@ void InferenceStore::outputUnsatCore(ostream& out, Unit* refutation) if(u->inference().rule() == InferenceRule::INPUT){ if(!u->isClause()){ if(u->getFormula()->hasLabel()){ - vstring label = u->getFormula()->getLabel(); + std::string label = u->getFormula()->getLabel(); out << label << endl; } else{ diff --git a/Kernel/InferenceStore.hpp b/Kernel/InferenceStore.hpp index bba9159544..be31ade266 100644 --- a/Kernel/InferenceStore.hpp +++ b/Kernel/InferenceStore.hpp @@ -70,7 +70,7 @@ class InferenceStore void recordSplittingNameLiteral(Unit* us, Literal* lit); void recordIntroducedSymbol(Unit* u, SymbolType st, unsigned number); - void recordIntroducedSplitName(Unit* u, vstring name); + void recordIntroducedSplitName(Unit* u, std::string name); void outputUnsatCore(std::ostream& out, Unit* refutation); void outputProof(std::ostream& out, Unit* refutation); @@ -79,7 +79,7 @@ class InferenceStore UnitIterator getParents(Unit* us, InferenceRule& rule); UnitIterator getParents(Unit* us); - vstring getUnitIdStr(Unit* cs); + std::string getUnitIdStr(Unit* cs); private: InferenceStore(); @@ -100,7 +100,7 @@ class InferenceStore typedef std::pair SymbolId; typedef Stack SymbolStack; DHMap _introducedSymbols; - DHMap _introducedSplitNames; + DHMap _introducedSplitNames; }; diff --git a/Kernel/KBO.cpp b/Kernel/KBO.cpp index 3ad94b8136..f3cdf0952a 100644 --- a/Kernel/KBO.cpp +++ b/Kernel/KBO.cpp @@ -438,10 +438,10 @@ struct PredSigTraits { static bool isColored(unsigned functor) { return env.signature->predicateColored(functor);} - static bool tryGetFunctor(const vstring& sym, unsigned arity, unsigned& out) + static bool tryGetFunctor(const std::string& sym, unsigned arity, unsigned& out) { return env.signature->tryGetPredicateNumber(sym,arity, out); } - static const vstring& weightFileName(const Options& opts) + static const std::string& weightFileName(const Options& opts) { return opts.predicateWeights(); } static bool isUnaryFunction (unsigned functor) @@ -466,10 +466,10 @@ struct FuncSigTraits { static bool isColored(unsigned functor) { return env.signature->functionColored(functor);} - static bool tryGetFunctor(const vstring& sym, unsigned arity, unsigned& out) + static bool tryGetFunctor(const std::string& sym, unsigned arity, unsigned& out) { return env.signature->tryGetFunctionNumber(sym,arity, out); } - static const vstring& weightFileName(const Options& opts) + static const std::string& weightFileName(const Options& opts) { return opts.functionWeights(); } static bool isUnaryFunction (unsigned functor) @@ -539,7 +539,7 @@ KboWeightMap KBO::weightsFromFile(const Options& opts) const ///////////////////////// parsing helper functions ///////////////////////// /** opens the file with name f or throws a UserError on failure */ - auto openFile = [](const vstring& f) -> ifstream { + auto openFile = [](const std::string& f) -> ifstream { ifstream file(f.c_str()); if (!file.is_open()) { throw UserErrorException("failed to open file ", f); @@ -547,12 +547,12 @@ KboWeightMap KBO::weightsFromFile(const Options& opts) const return file; }; - auto parseDefaultSymbolWeight = [&openFile](const vstring& fname) -> unsigned { + auto parseDefaultSymbolWeight = [&openFile](const std::string& fname) -> unsigned { if (!fname.empty()) { auto file = openFile(fname); - for (vstring ln; getline(file, ln);) { + for (std::string ln; getline(file, ln);) { unsigned dflt; - vstring special_name; + std::string special_name; bool err = !(std::stringstream(ln) >> special_name >> dflt); if (!err && special_name == SPECIAL_WEIGHT_IDENT_DEFAULT_WEIGHT) { return dflt; @@ -563,10 +563,10 @@ KboWeightMap KBO::weightsFromFile(const Options& opts) const }; /** tries to parse line of the form ` ` */ - auto tryParseSpecialLine = [](const vstring& ln, unsigned& introducedWeight, KboSpecialWeights& specialWeights) -> bool { + auto tryParseSpecialLine = [](const std::string& ln, unsigned& introducedWeight, KboSpecialWeights& specialWeights) -> bool { std::stringstream lnstr(ln); - vstring name; + std::string name; unsigned weight; bool ok = !!(lnstr >> name >> weight); if (ok) { @@ -581,10 +581,10 @@ KboWeightMap KBO::weightsFromFile(const Options& opts) const }; /** tries to parse line of the form ` ` */ - auto tryParseNormalLine = [&](const vstring& ln) -> bool { + auto tryParseNormalLine = [&](const std::string& ln) -> bool { std::stringstream lnstr(ln); - vstring name; + std::string name; unsigned arity; unsigned weight; bool ok = !!(lnstr >> name >> arity >> weight); @@ -619,7 +619,7 @@ KboWeightMap KBO::weightsFromFile(const Options& opts) const auto file = openFile(filename); - for (vstring ln; getline(file, ln);) { + for (std::string ln; getline(file, ln);) { if (!tryParseNormalLine(ln) && !tryParseSpecialLine(ln, introducedWeight, specialWeights)) { throw Lib::UserErrorException( "failed to read line from file ", filename, "\n", diff --git a/Kernel/KBO.hpp b/Kernel/KBO.hpp index d6dd15c1ab..4cfd03f3ac 100644 --- a/Kernel/KBO.hpp +++ b/Kernel/KBO.hpp @@ -56,7 +56,7 @@ struct KboSpecialWeights; template<> struct KboSpecialWeights { - inline bool tryAssign(const vstring& name, unsigned weight) + inline bool tryAssign(const std::string& name, unsigned weight) { return false; } inline static KboSpecialWeights dflt() @@ -74,7 +74,7 @@ struct KboSpecialWeights KboWeight _numInt; KboWeight _numRat; KboWeight _numReal; - inline bool tryAssign(const vstring& name, unsigned weight) + inline bool tryAssign(const std::string& name, unsigned weight) { if (name == SPECIAL_WEIGHT_IDENT_VAR ) { _variableWeight = weight; return true; } if (name == SPECIAL_WEIGHT_IDENT_NUM_INT ) { _numInt = weight; return true; } diff --git a/Kernel/KBOComparator.cpp b/Kernel/KBOComparator.cpp index 60a0a00da6..115aad74e5 100644 --- a/Kernel/KBOComparator.cpp +++ b/Kernel/KBOComparator.cpp @@ -270,7 +270,7 @@ void KBOComparator::countSymbols(const KBO& kbo, DHMap& vars, int& } } -vstring KBOComparator::toString() const +std::string KBOComparator::toString() const { std::stringstream str; diff --git a/Kernel/KBOComparator.hpp b/Kernel/KBOComparator.hpp index a75f8819ae..e0220bbe0d 100644 --- a/Kernel/KBOComparator.hpp +++ b/Kernel/KBOComparator.hpp @@ -38,7 +38,7 @@ class KBOComparator /** Executes the runtime specialized instructions with concrete substitution. */ bool check(const SubstApplicator* applicator) const; - vstring toString() const override; + std::string toString() const override; private: // TODO this could be done with KBO::State diff --git a/Kernel/LPOComparator.cpp b/Kernel/LPOComparator.cpp index a56dcd4cd4..6912f0e871 100644 --- a/Kernel/LPOComparator.cpp +++ b/Kernel/LPOComparator.cpp @@ -77,7 +77,7 @@ ostream& operator<<(ostream& out, const Instruction& n) return out; } -vstring LPOComparator::toString() const +std::string LPOComparator::toString() const { std::stringstream str; switch (_res) { diff --git a/Kernel/LPOComparator.hpp b/Kernel/LPOComparator.hpp index 30d4d81d5d..8deb0c30b1 100644 --- a/Kernel/LPOComparator.hpp +++ b/Kernel/LPOComparator.hpp @@ -33,7 +33,7 @@ class LPOComparator /** Executes the runtime specialized instructions with concrete substitution. */ bool check(const SubstApplicator* applicator) const; - vstring toString() const override; + std::string toString() const override; /** * Represents comparing check between two terms and branching diff --git a/Kernel/OperatorType.cpp b/Kernel/OperatorType.cpp index 77635f0b58..e45cbdbc31 100644 --- a/Kernel/OperatorType.cpp +++ b/Kernel/OperatorType.cpp @@ -133,11 +133,11 @@ OperatorType* OperatorType::getTypeFromKey(OperatorType::OperatorKey* key, unsig * @since 04/05/2013 bug fix (comma was used instead of *) * @author Andrei Voronkov */ -vstring OperatorType::argsToString() const +std::string OperatorType::argsToString() const { unsigned ar = arity(); ASS(ar); - vstring res = ar > 1 ? "(" : ""; + std::string res = ar > 1 ? "(" : ""; for (unsigned i = _typeArgsArity; i < ar; i++) { res += arg(i).toString(); if (i != ar-1) { @@ -151,9 +151,9 @@ vstring OperatorType::argsToString() const /** * Return the TPTP string representation of the OpertorType. */ -vstring OperatorType::toString() const +std::string OperatorType::toString() const { - vstring res; + std::string res; bool bracket = false; if(_typeArgsArity){ res = "!>["; diff --git a/Kernel/OperatorType.hpp b/Kernel/OperatorType.hpp index c42e47d929..64306d500f 100644 --- a/Kernel/OperatorType.hpp +++ b/Kernel/OperatorType.hpp @@ -189,13 +189,13 @@ class OperatorType return (*_key)[arity() - numTypeArguments()]; } - vstring toString() const; + std::string toString() const; bool isSingleSortType(TermList sort) const; bool isAllDefault() const { return isSingleSortType(AtomicSort::defaultSort()); } private: - vstring argsToString() const; + std::string argsToString() const; }; } diff --git a/Kernel/Ordering.cpp b/Kernel/Ordering.cpp index 35d5faf9eb..c3879c8e26 100644 --- a/Kernel/Ordering.cpp +++ b/Kernel/Ordering.cpp @@ -573,7 +573,7 @@ using UnaryFirstComparator = SpecAriFirstComparator<1,revert,InnerComparator>; template using ConstFirstComparator = SpecAriFirstComparator<0,revert,InnerComparator>; -static void loadPermutationFromString(DArray& p, const vstring& str) { +static void loadPermutationFromString(DArray& p, const std::string& str) { std::stringstream ss(str.c_str()); unsigned i = 0; unsigned val; @@ -721,7 +721,7 @@ DArray PrecedenceOrdering::typeConPrecFromOpts(Problem& prb, const Options& aux.initFromIterator(getRangeIterator(0u, nTypeCons), nTypeCons); if (!opt.typeConPrecedence().empty()) { - vstring precedence; + std::string precedence; ifstream precedence_file (opt.typeConPrecedence().c_str()); if (precedence_file.is_open() && getline(precedence_file, precedence)) { loadPermutationFromString(aux,precedence); @@ -747,7 +747,7 @@ DArray PrecedenceOrdering::funcPrecFromOpts(Problem& prb, const Options& op aux.initFromIterator(getRangeIterator(0u, nFunctions), nFunctions); if (!opt.functionPrecedence().empty()) { - vstring precedence; + std::string precedence; ifstream precedence_file (opt.functionPrecedence().c_str()); if (precedence_file.is_open() && getline(precedence_file, precedence)) { loadPermutationFromString(aux,precedence); @@ -771,7 +771,7 @@ DArray PrecedenceOrdering::predPrecFromOpts(Problem& prb, const Options& op aux.initFromIterator(getRangeIterator(0u, nPredicates), nPredicates); if (!opt.predicatePrecedence().empty()) { - vstring precedence; + std::string precedence; ifstream precedence_file (opt.predicatePrecedence().c_str()); if (precedence_file.is_open() && getline(precedence_file, precedence)) { loadPermutationFromString(aux,precedence); diff --git a/Kernel/Ordering.hpp b/Kernel/Ordering.hpp index 608ea77a8c..7eb7e17460 100644 --- a/Kernel/Ordering.hpp +++ b/Kernel/Ordering.hpp @@ -41,7 +41,7 @@ using namespace Shell; struct OrderingComparator { virtual ~OrderingComparator() = default; - virtual vstring toString() const = 0; + virtual std::string toString() const = 0; }; /** diff --git a/Kernel/Renaming.cpp b/Kernel/Renaming.cpp index c1885f0ac1..358f4bca8d 100644 --- a/Kernel/Renaming.cpp +++ b/Kernel/Renaming.cpp @@ -176,9 +176,9 @@ void Renaming::assertValid() const } } -vstring Renaming::toString() const +std::string Renaming::toString() const { - vstring res = "["; + std::string res = "["; VariableMap::Iterator mit(_data); while(mit.hasNext()) { unsigned from, to; diff --git a/Kernel/Renaming.hpp b/Kernel/Renaming.hpp index 95b7fb3d7c..95e606821e 100644 --- a/Kernel/Renaming.hpp +++ b/Kernel/Renaming.hpp @@ -87,7 +87,7 @@ class Renaming { #if VDEBUG void assertValid() const; - vstring toString() const; + std::string toString() const; #endif private: class Applicator diff --git a/Kernel/SKIKBO.hpp b/Kernel/SKIKBO.hpp index bb2f947b02..11e673f50a 100644 --- a/Kernel/SKIKBO.hpp +++ b/Kernel/SKIKBO.hpp @@ -118,7 +118,7 @@ class SKIKBO bool _basic_hol; #if VDEBUG - static vstring vCondResToString(VarCondRes v) + static std::string vCondResToString(VarCondRes v) { if(v == INCOMP){ return "incomparable"; } if(v == LEFT){ return "left"; } diff --git a/Kernel/Signature.cpp b/Kernel/Signature.cpp index 28f917900c..07ba8271d3 100644 --- a/Kernel/Signature.cpp +++ b/Kernel/Signature.cpp @@ -31,7 +31,7 @@ const unsigned Signature::STRING_DISTINCT_GROUP = 0; * @since 03/05/2013 train London-Manchester, argument numericConstant added * @author Andrei Voronkov */ -Signature::Symbol::Symbol(const vstring& nm, unsigned arity, bool interpreted, bool stringConstant,bool numericConstant, +Signature::Symbol::Symbol(const std::string& nm, unsigned arity, bool interpreted, bool stringConstant,bool numericConstant, bool overflownConstant) : _name(nm), _arity(arity), @@ -271,7 +271,7 @@ Signature::~Signature () * @since 03/05/2013 train Manchester-London * @author Andrei Voronkov */ -unsigned Signature::addIntegerConstant(const vstring& number,bool defaultSort) +unsigned Signature::addIntegerConstant(const std::string& number,bool defaultSort) { IntegerConstantType value(number); if (!defaultSort) { @@ -279,8 +279,8 @@ unsigned Signature::addIntegerConstant(const vstring& number,bool defaultSort) } // default sort should be used - vstring name = value.toString(); - vstring symbolKey = name + "_n"; + std::string name = value.toString(); + std::string symbolKey = name + "_n"; unsigned result; if (_funNames.find(symbolKey,result)) { return result; @@ -305,7 +305,7 @@ unsigned Signature::addIntegerConstant(const vstring& number,bool defaultSort) */ unsigned Signature::addIntegerConstant(const IntegerConstantType& value) { - vstring key = value.toString() + "_n"; + std::string key = value.toString() + "_n"; unsigned result; if (_funNames.find(key, result)) { return result; @@ -327,15 +327,15 @@ unsigned Signature::addIntegerConstant(const IntegerConstantType& value) * @since 03/05/2013 London * @author Andrei Voronkov */ -unsigned Signature::addRationalConstant(const vstring& numerator, const vstring& denominator,bool defaultSort) +unsigned Signature::addRationalConstant(const std::string& numerator, const std::string& denominator,bool defaultSort) { RationalConstantType value(numerator, denominator); if (!defaultSort) { return addRationalConstant(value); } - vstring name = value.toString(); - vstring key = name + "_q"; + std::string name = value.toString(); + std::string key = name + "_q"; unsigned result; if (_funNames.find(key,result)) { return result; @@ -355,7 +355,7 @@ unsigned Signature::addRationalConstant(const vstring& numerator, const vstring& unsigned Signature::addRationalConstant(const RationalConstantType& value) { - vstring key = value.toString() + "_q"; + std::string key = value.toString() + "_q"; unsigned result; if (_funNames.find(key, result)) { return result; @@ -373,13 +373,13 @@ unsigned Signature::addRationalConstant(const RationalConstantType& value) * @since 03/05/2013 London * @author Andrei Voronkov */ -unsigned Signature::addRealConstant(const vstring& number,bool defaultSort) +unsigned Signature::addRealConstant(const std::string& number,bool defaultSort) { RealConstantType value(number); if (!defaultSort) { return addRealConstant(value); } - vstring key = value.toString() + "_r"; + std::string key = value.toString() + "_r"; unsigned result; if (_funNames.find(key,result)) { return result; @@ -399,7 +399,7 @@ unsigned Signature::addRealConstant(const vstring& number,bool defaultSort) unsigned Signature::addRealConstant(const RealConstantType& value) { - vstring key = value.toString() + "_r"; + std::string key = value.toString() + "_r"; unsigned result; if (_funNames.find(key, result)) { return result; @@ -414,7 +414,7 @@ unsigned Signature::addRealConstant(const RealConstantType& value) /** * Add interpreted function */ -unsigned Signature::addInterpretedFunction(Interpretation interpretation, OperatorType* type, const vstring& name) +unsigned Signature::addInterpretedFunction(Interpretation interpretation, OperatorType* type, const std::string& name) { ASS(Theory::isFunction(interpretation)); @@ -429,7 +429,7 @@ unsigned Signature::addInterpretedFunction(Interpretation interpretation, Operat return res; } - vstring symbolKey = name+"_i"+Int::toString(interpretation)+(Theory::isPolymorphic(interpretation) ? type->toString() : ""); + std::string symbolKey = name+"_i"+Int::toString(interpretation)+(Theory::isPolymorphic(interpretation) ? type->toString() : ""); ASS_REP(!_funNames.find(symbolKey), name); unsigned fnNum = _funs.length(); @@ -447,7 +447,7 @@ unsigned Signature::addInterpretedFunction(Interpretation interpretation, Operat /** * Add interpreted predicate */ -unsigned Signature::addInterpretedPredicate(Interpretation interpretation, OperatorType* type, const vstring& name) +unsigned Signature::addInterpretedPredicate(Interpretation interpretation, OperatorType* type, const std::string& name) { ASS(!Theory::isFunction(interpretation)); @@ -463,7 +463,7 @@ unsigned Signature::addInterpretedPredicate(Interpretation interpretation, Opera return res; } - vstring symbolKey = name+"_i"+Int::toString(interpretation)+(Theory::isPolymorphic(interpretation) ? type->toString() : ""); + std::string symbolKey = name+"_i"+Int::toString(interpretation)+(Theory::isPolymorphic(interpretation) ? type->toString() : ""); // cout << "symbolKey " << symbolKey << endl; @@ -497,7 +497,7 @@ unsigned Signature::getInterpretingSymbol(Interpretation interp, OperatorType* t return res; } - vstring name = theory->getInterpretationName(interp); + std::string name = theory->getInterpretationName(interp); unsigned arity = Theory::getArity(interp); if (Theory::isFunction(interp)) { @@ -525,18 +525,18 @@ unsigned Signature::getInterpretingSymbol(Interpretation interp, OperatorType* t return _iSymbols.get(mi); } -const vstring& Signature::functionName(int number) +const std::string& Signature::functionName(int number) { // it is safe to reuse "$true" and "$false" for constants // because the user cannot define constants with these names herself // and the formula, obtained by toString() with "$true" or "$false" // in term position would be syntactically valid in FOOL if (!env.options->showFOOL() && isFoolConstantSymbol(false,number)) { - static vstring fols("$false"); + static std::string fols("$false"); return fols; } if (!env.options->showFOOL() && isFoolConstantSymbol(true,number)) { - static vstring troo("$true"); + static std::string troo("$true"); return troo; } return _funs[number]->name(); @@ -545,7 +545,7 @@ const vstring& Signature::functionName(int number) /** * Return true if specified function exists */ -bool Signature::functionExists(const vstring& name,unsigned arity) const +bool Signature::functionExists(const std::string& name,unsigned arity) const { return _funNames.find(key(name, arity)); } @@ -553,7 +553,7 @@ bool Signature::functionExists(const vstring& name,unsigned arity) const /** * Return true if specified predicate exists */ -bool Signature::predicateExists(const vstring& name,unsigned arity) const +bool Signature::predicateExists(const std::string& name,unsigned arity) const { return _predNames.find(key(name, arity)); } @@ -561,18 +561,18 @@ bool Signature::predicateExists(const vstring& name,unsigned arity) const /** * Return true if specified type constructor exists */ -bool Signature::typeConExists(const vstring& name,unsigned arity) const +bool Signature::typeConExists(const std::string& name,unsigned arity) const { return _typeConNames.find(key(name, arity)); } -unsigned Signature::getFunctionNumber(const vstring& name, unsigned arity) const +unsigned Signature::getFunctionNumber(const std::string& name, unsigned arity) const { ASS(_funNames.find(key(name, arity))); return _funNames.get(key(name, arity)); } -bool Signature::tryGetFunctionNumber(const vstring& name, unsigned arity, unsigned& out) const +bool Signature::tryGetFunctionNumber(const std::string& name, unsigned arity, unsigned& out) const { auto* value = _funNames.getPtr(key(name, arity)); if (value != NULL) { @@ -583,7 +583,7 @@ bool Signature::tryGetFunctionNumber(const vstring& name, unsigned arity, unsign } } -bool Signature::tryGetPredicateNumber(const vstring& name, unsigned arity, unsigned& out) const +bool Signature::tryGetPredicateNumber(const std::string& name, unsigned arity, unsigned& out) const { auto* value = _predNames.getPtr(key(name, arity)); if (value != NULL) { @@ -595,7 +595,7 @@ bool Signature::tryGetPredicateNumber(const vstring& name, unsigned arity, unsig } -unsigned Signature::getPredicateNumber(const vstring& name, unsigned arity) const +unsigned Signature::getPredicateNumber(const std::string& name, unsigned arity) const { ASS(_predNames.find(key(name, arity))); return _predNames.get(key(name, arity)); @@ -611,12 +611,12 @@ unsigned Signature::getPredicateNumber(const vstring& name, unsigned arity) cons * @param overflowConstant * @since 07/05/2007 Manchester */ -unsigned Signature::addFunction (const vstring& name, +unsigned Signature::addFunction (const std::string& name, unsigned arity, bool& added, bool overflowConstant) { - vstring symbolKey = key(name,arity); + std::string symbolKey = key(name,arity); unsigned result; if (_funNames.find(symbolKey,result)) { added = false; @@ -628,7 +628,7 @@ unsigned Signature::addFunction (const vstring& name, if (_arityCheck.find(name,prev)) { unsigned prevArity = prev/2; bool isFun = prev % 2; - USER_ERROR((vstring)"Symbol " + name + + USER_ERROR((std::string)"Symbol " + name + " is used both as a function of arity " + Int::toString(arity) + " and a " + (isFun ? "function" : "predicate") + " of arity " + Int::toString(prevArity)); @@ -648,16 +648,16 @@ unsigned Signature::addFunction (const vstring& name, * added to the distinct group STRING_DISTINCT_GROUP. * @author Andrei Voronkov */ -unsigned Signature::addStringConstant(const vstring& name) +unsigned Signature::addStringConstant(const std::string& name) { - vstring symbolKey = name + "_c"; + std::string symbolKey = name + "_c"; unsigned result; if (_funNames.find(symbolKey,result)) { return result; } _strings++; - vstring quotedName = "\"" + name + "\""; + std::string quotedName = "\"" + name + "\""; result = _funs.length(); Symbol* sym = new Symbol(quotedName,0,false,true); sym->addToDistinctGroup(STRING_DISTINCT_GROUP,result); @@ -791,11 +791,11 @@ unsigned Signature::formulaCount(Term* t){ * If a type constructor with this name and arity exists, return its number. * Otherwise, add a new one and return its number. */ -unsigned Signature::addTypeCon (const vstring& name, +unsigned Signature::addTypeCon (const std::string& name, unsigned arity, bool& added) { - vstring symbolKey = key(name,arity); + std::string symbolKey = key(name,arity); unsigned result; if (_typeConNames.find(symbolKey,result)) { added = false; @@ -823,11 +823,11 @@ unsigned Signature::addTypeCon (const vstring& name, * @since 06/12/2009 Haifa, arity check added * @author Andrei Voronkov */ -unsigned Signature::addPredicate (const vstring& name, +unsigned Signature::addPredicate (const std::string& name, unsigned arity, bool& added) { - vstring symbolKey = key(name,arity); + std::string symbolKey = key(name,arity); unsigned result; if (_predNames.find(symbolKey,result)) { added = false; @@ -839,7 +839,7 @@ unsigned Signature::addPredicate (const vstring& name, if (_arityCheck.find(name,prev)) { unsigned prevArity = prev/2; bool isFun = prev % 2; - USER_ERROR((vstring)"Symbol " + name + + USER_ERROR((std::string)"Symbol " + name + " is used both as a predicate of arity " + Int::toString(arity) + " and a " + (isFun ? "function" : "predicate") + " of arity " + Int::toString(prevArity)); @@ -877,8 +877,8 @@ unsigned Signature::addNameFunction(unsigned arity) */ unsigned Signature::addFreshFunction(unsigned arity, const char* prefix, const char* suffix) { - vstring pref(prefix); - vstring suf(suffix ? vstring("_")+suffix : ""); + std::string pref(prefix); + std::string suf(suffix ? std::string("_")+suffix : ""); bool added; unsigned result; //commented out because it could lead to introduction of function with the same name @@ -905,8 +905,8 @@ unsigned Signature::addFreshFunction(unsigned arity, const char* prefix, const c */ unsigned Signature::addFreshTypeCon(unsigned arity, const char* prefix, const char* suffix) { - vstring pref(prefix); - vstring suf(suffix ? vstring("_")+suffix : ""); + std::string pref(prefix); + std::string suf(suffix ? std::string("_")+suffix : ""); bool added; unsigned result; @@ -931,8 +931,8 @@ unsigned Signature::addFreshTypeCon(unsigned arity, const char* prefix, const ch */ unsigned Signature::addFreshPredicate(unsigned arity, const char* prefix, const char* suffix) { - vstring pref(prefix); - vstring suf(suffix ? vstring("_")+suffix : ""); + std::string pref(prefix); + std::string suf(suffix ? std::string("_")+suffix : ""); bool added = false; unsigned result; //commented out because it could lead to introduction of function with the same name @@ -1017,7 +1017,7 @@ unsigned Signature::addSkolemPredicate(unsigned arity, const char* suffix) * @since 27/02/2006 Redmond * @author Andrei Voronkov */ -vstring Signature::key(const vstring& name,int arity) +std::string Signature::key(const std::string& name,int arity) { return name + '_' + Int::toString(arity); } // Signature::key @@ -1068,14 +1068,14 @@ void Signature::addToDistinctGroup(unsigned constantSymbol, unsigned groupId) sym->addToDistinctGroup(groupId,constantSymbol); } -bool Signature::isProtectedName(vstring name) +bool Signature::isProtectedName(std::string name) { if (name=="$distinct") { //TODO: remove this hack once we properly support the $distinct predicate return true; } - vstring protectedPrefix = env.options->protectedPrefix(); + std::string protectedPrefix = env.options->protectedPrefix(); if (protectedPrefix.size()==0) { return false; } @@ -1111,7 +1111,7 @@ bool Signature::isProtectedName(vstring name) * @since 03/05/2013 train Manchester-London * @since 04/05/2015 Gothenburg -- do not quote FOOL true and false */ -bool Signature::symbolNeedsQuoting(vstring name, bool interpreted, unsigned arity) +bool Signature::symbolNeedsQuoting(std::string name, bool interpreted, unsigned arity) { ASS_G(name.length(),0); diff --git a/Kernel/Signature.hpp b/Kernel/Signature.hpp index 57d6b5f624..740dc615f9 100644 --- a/Kernel/Signature.hpp +++ b/Kernel/Signature.hpp @@ -42,7 +42,7 @@ namespace Kernel { using namespace Lib; -typedef Map SymbolMap; +typedef Map SymbolMap; /** * Class implementing signatures @@ -95,7 +95,7 @@ class Signature protected: /** print name */ - vstring _name; + std::string _name; // both _arity and _typeArgsArity could be recovered from _type. Storing directly here as well for convenience @@ -165,7 +165,7 @@ class Signature public: /** standard constructor */ - Symbol(const vstring& nm,unsigned arity, bool interpreted=false, bool stringConstant=false,bool numericConstant=false,bool overflownConstant=false); + Symbol(const std::string& nm,unsigned arity, bool interpreted=false, bool stringConstant=false,bool numericConstant=false,bool overflownConstant=false); void destroyFnSymbol(); void destroyPredSymbol(); void destroyTypeConSymbol(); @@ -223,7 +223,7 @@ class Signature return _typeArgsArity; } /** Return the name of the symbol */ - inline const vstring& name() const { return _name; } + inline const std::string& name() const { return _name; } /** Return true iff the object is of type InterpretedSymbol */ inline bool interpreted() const { return _interpreted; } /** Return true iff the symbol doesn't come from input problem but was introduced by Vampire */ @@ -332,7 +332,7 @@ class Signature public: - InterpretedSymbol(const vstring& nm, Interpretation interp) + InterpretedSymbol(const std::string& nm, Interpretation interp) : Symbol(nm, Theory::getArity(interp), true), _interp(interp) { } @@ -393,9 +393,9 @@ class Signature // Uninterpreted symbol declarations // - unsigned addPredicate(const vstring& name,unsigned arity,bool& added); - unsigned addTypeCon(const vstring& name,unsigned arity,bool& added); - unsigned addFunction(const vstring& name,unsigned arity,bool& added,bool overflowConstant = false); + unsigned addPredicate(const std::string& name,unsigned arity,bool& added); + unsigned addTypeCon(const std::string& name,unsigned arity,bool& added); + unsigned addFunction(const std::string& name,unsigned arity,bool& added,bool overflowConstant = false); /** * If a predicate with this name and arity exists, return its number. @@ -405,7 +405,7 @@ class Signature * @param arity arity of the symbol * @since 07/05/2007 Manchester */ - unsigned addPredicate(const vstring& name,unsigned arity) + unsigned addPredicate(const std::string& name,unsigned arity) { bool added; return addPredicate(name,arity,added); @@ -416,7 +416,7 @@ class Signature * * @since 28/12/2007 Manchester */ - unsigned addFunction(const vstring& name,unsigned arity) + unsigned addFunction(const std::string& name,unsigned arity) { bool added; return addFunction(name,arity,added); @@ -427,7 +427,7 @@ class Signature * * The added constant is of default ($i) sort. */ - unsigned addStringConstant(const vstring& name); + unsigned addStringConstant(const std::string& name); unsigned addFreshFunction(unsigned arity, const char* prefix, const char* suffix = 0); unsigned addSkolemFunction(unsigned arity,const char* suffix = 0, bool computable = false); unsigned addFreshTypeCon(unsigned arity, const char* prefix, const char* suffix = 0); @@ -453,23 +453,23 @@ class Signature unsigned getBoolDef(unsigned fn); // Interpreted symbol declarations - unsigned addIntegerConstant(const vstring& number,bool defaultSort); - unsigned addRationalConstant(const vstring& numerator, const vstring& denominator,bool defaultSort); - unsigned addRealConstant(const vstring& number,bool defaultSort); + unsigned addIntegerConstant(const std::string& number,bool defaultSort); + unsigned addRationalConstant(const std::string& numerator, const std::string& denominator,bool defaultSort); + unsigned addRealConstant(const std::string& number,bool defaultSort); unsigned addIntegerConstant(const IntegerConstantType& number); unsigned addRationalConstant(const RationalConstantType& number); unsigned addRealConstant(const RealConstantType& number); - unsigned addInterpretedFunction(Interpretation itp, OperatorType* type, const vstring& name); - unsigned addInterpretedFunction(Interpretation itp, const vstring& name) + unsigned addInterpretedFunction(Interpretation itp, OperatorType* type, const std::string& name); + unsigned addInterpretedFunction(Interpretation itp, const std::string& name) { ASS(!Theory::isPolymorphic(itp)); return addInterpretedFunction(itp,Theory::getNonpolymorphicOperatorType(itp),name); } - unsigned addInterpretedPredicate(Interpretation itp, OperatorType* type, const vstring& name); - unsigned addInterpretedPredicate(Interpretation itp, const vstring& name) + unsigned addInterpretedPredicate(Interpretation itp, OperatorType* type, const std::string& name); + unsigned addInterpretedPredicate(Interpretation itp, const std::string& name) { ASS(!Theory::isPolymorphic(itp)); return addInterpretedPredicate(itp,Theory::getNonpolymorphicOperatorType(itp),name); @@ -493,14 +493,14 @@ class Signature } /** return the name of a function with a given number */ - const vstring& functionName(int number); + const std::string& functionName(int number); /** return the name of a predicate with a given number */ - const vstring& predicateName(int number) + const std::string& predicateName(int number) { return _preds[number]->name(); } /** return the name of a type constructor with a given number */ - const vstring& typeConName(int number) + const std::string& typeConName(int number) { return _typeCons[number]->name(); } @@ -531,9 +531,9 @@ class Signature } /** return true iff predicate of given @b name and @b arity exists. */ - bool isPredicateName(vstring name, unsigned arity) + bool isPredicateName(std::string name, unsigned arity) { - vstring symbolKey = key(name,arity); + std::string symbolKey = key(name,arity); unsigned tmp; return _predNames.find(symbolKey,tmp); } @@ -584,9 +584,9 @@ class Signature Signature(); ~Signature(); - bool functionExists(const vstring& name,unsigned arity) const; - bool predicateExists(const vstring& name,unsigned arity) const; - bool typeConExists(const vstring& name,unsigned arity) const; + bool functionExists(const std::string& name,unsigned arity) const; + bool predicateExists(const std::string& name,unsigned arity) const; + bool typeConExists(const std::string& name,unsigned arity) const; /** true if there are user defined sorts */ bool hasSorts() const{ @@ -635,10 +635,10 @@ class Signature return _boolDefPreds.find(p, orig); } - bool tryGetFunctionNumber(const vstring& name, unsigned arity, unsigned& out) const; - bool tryGetPredicateNumber(const vstring& name, unsigned arity, unsigned& out) const; - unsigned getFunctionNumber(const vstring& name, unsigned arity) const; - unsigned getPredicateNumber(const vstring& name, unsigned arity) const; + bool tryGetFunctionNumber(const std::string& name, unsigned arity, unsigned& out) const; + bool tryGetPredicateNumber(const std::string& name, unsigned arity, unsigned& out) const; + unsigned getFunctionNumber(const std::string& name, unsigned arity) const; + unsigned getPredicateNumber(const std::string& name, unsigned arity) const; typedef SmartPtr> DistinctGroupMembers; @@ -652,7 +652,7 @@ class Signature bool hasTermAlgebras() { return !_termAlgebras.isEmpty(); } bool hasDefPreds() const { return !_fnDefPreds.isEmpty() || !_boolDefPreds.isEmpty(); } - static vstring key(const vstring& name,int arity); + static std::string key(const std::string& name,int arity); /** the number of string constants */ unsigned strings() const {return _strings;} @@ -774,11 +774,11 @@ class Signature return eqProxy; } - unsigned getBinaryProxy(vstring name){ + unsigned getBinaryProxy(std::string name){ ASS(name == "vIMP" || name == "vAND" || name == "vOR" || name == "vIFF" || name == "vXOR"); bool added = false; - auto convert = [] (vstring name) { + auto convert = [] (std::string name) { if(name == "vIMP"){ return IMP; } else if(name == "vAND"){ return AND; } else if(name == "vOR"){ return OR; } @@ -811,7 +811,7 @@ class Signature } //TODO merge with above? - unsigned getPiSigmaProxy(vstring name){ + unsigned getPiSigmaProxy(std::string name){ bool added = false; unsigned proxy = addFunction(name,1, added); if(added){ @@ -846,7 +846,7 @@ class Signature } }; - vstring name = convert(c); + std::string name = convert(c); if(c == S_COMB || c == B_COMB || c == C_COMB){ comb = addFunction(name,3, added); } else if ( c == K_COMB) { @@ -906,7 +906,7 @@ class Signature } Stack& getDividesNvalues(){ return _dividesNvalues; } - static bool symbolNeedsQuoting(vstring name, bool interpreted, unsigned arity); + static bool symbolNeedsQuoting(std::string name, bool interpreted, unsigned arity); private: Stack _dividesNvalues; @@ -916,7 +916,7 @@ class Signature unsigned _foolTrue; unsigned _foolFalse; - static bool isProtectedName(vstring name); + static bool isProtectedName(std::string name); static bool charNeedsQuoting(char c, bool first); /** Stack of function symbols */ Stack _funs; @@ -927,15 +927,15 @@ class Signature DHSet _choiceSymbols; /** - * Map from vstring "name_arity" to their numbers + * Map from std::string "name_arity" to their numbers * * String constants have key "value_c", integer constants "value_n", * rational "numerator_denominator_q" and real "value_r". */ SymbolMap _funNames; - /** Map from vstring "name_arity" to their numbers */ + /** Map from std::string "name_arity" to their numbers */ SymbolMap _predNames; - /** Map from vstring "name_arity" to their numbers */ + /** Map from std::string "name_arity" to their numbers */ SymbolMap _typeConNames; /** Map for the arity_check options: maps symbols to their arities */ SymbolMap _arityCheck; diff --git a/Kernel/Substitution.cpp b/Kernel/Substitution.cpp index 7721f55848..fbb1d01a7e 100644 --- a/Kernel/Substitution.cpp +++ b/Kernel/Substitution.cpp @@ -96,7 +96,7 @@ bool Substitution::findBinding(int var, TermList& res) const #if VDEBUG - vstring Substitution::toString() const + std::string Substitution::toString() const { std::stringstream out; out << *this; diff --git a/Kernel/Substitution.hpp b/Kernel/Substitution.hpp index 77488171d8..be2e45d958 100644 --- a/Kernel/Substitution.hpp +++ b/Kernel/Substitution.hpp @@ -57,7 +57,7 @@ class Substitution { return _map.mapValues(f); } #if VDEBUG - vstring toString() const; + std::string toString() const; #endif friend std::ostream& operator<<(std::ostream& out, Substitution const&); private: diff --git a/Kernel/Term.cpp b/Kernel/Term.cpp index 39da641633..89899a70f1 100644 --- a/Kernel/Term.cpp +++ b/Kernel/Term.cpp @@ -427,34 +427,34 @@ TermIterator Term::getVariableIterator(TermList tl) * Return the string representation of variable var. * @since 16/05/2007 */ -vstring Term::variableToString(unsigned var) +std::string Term::variableToString(unsigned var) { - return (vstring)"X" + Int::toString(var); + return (std::string)"X" + Int::toString(var); } // variableToString /** * Return the string representation of variable term var. * @since 16/05/2007 */ -vstring Term::variableToString(TermList var) +std::string Term::variableToString(TermList var) { ASS(var.isVar()); if (var.isOrdinaryVar()) { - return (vstring)"X" + Int::toString(var.var()); + return (std::string)"X" + Int::toString(var.var()); } else { - return (vstring)"S" + Int::toString(var.var()); + return (std::string)"S" + Int::toString(var.var()); } } // variableToString /** - * Return the vstring representation of the terms "head" + * Return the std::string representation of the terms "head" * i.e., the function / predicate symbol name or the special term head. * Special term prints also '(' and the following arguments which are not args() and a comma * Normal term prints "(" if there are any args to follow */ -vstring Term::headToString() const +std::string Term::headToString() const { if (isSpecial()) { const Term::SpecialTermData* sd = getSpecialData(); @@ -462,20 +462,20 @@ vstring Term::headToString() const switch(specialFunctor()) { case SpecialFunctor::FORMULA: { ASS_EQ(arity(), 0); - vstring formula = sd->getFormula()->toString(); + std::string formula = sd->getFormula()->toString(); return env.options->showFOOL() ? "$term{" + formula + "}" : formula; } case SpecialFunctor::LET: { ASS_EQ(arity(), 1); TermList binding = sd->getBinding(); bool isPredicate = binding.isTerm() && binding.term()->isBoolean(); - vstring functor = isPredicate ? env.signature->predicateName(sd->getFunctor()) + std::string functor = isPredicate ? env.signature->predicateName(sd->getFunctor()) : env.signature->functionName(sd->getFunctor()); OperatorType* type = isPredicate ? env.signature->getPredicate(sd->getFunctor())->predType() : env.signature->getFunction(sd->getFunctor())->fnType(); const VList* variables = sd->getVariables(); - vstring variablesList = ""; + std::string variablesList = ""; for (unsigned i = 0; i < VList::length(variables); i++) { unsigned var = VList::nth(variables, i); variablesList += Term::variableToString(var); @@ -495,7 +495,7 @@ vstring Term::headToString() const case SpecialFunctor::TUPLE: { ASS_EQ(arity(), 0); Term* term = sd->getTupleTerm(); - vstring termList = ""; + std::string termList = ""; Term::Iterator tit(term); unsigned i = term->arity(); while (tit.hasNext()) { @@ -514,8 +514,8 @@ vstring Term::headToString() const OperatorType* fnType = env.signature->getFunction(tupleFunctor)->fnType(); - vstring symbolsList = ""; - vstring typesList = ""; + std::string symbolsList = ""; + std::string typesList = ""; for (unsigned i = 0; i < VList::length(symbols); i++) { Signature::Symbol* symbol = (fnType->arg(i) == AtomicSort::boolSort()) ? env.signature->getPredicate(VList::nth(symbols, i)) @@ -535,7 +535,7 @@ vstring Term::headToString() const SList* sorts = sd->getLambdaVarSorts(); TermList lambdaExp = sd->getLambdaExp(); - vstring varList = "["; + std::string varList = "["; VList::Iterator vs(vars); SList::Iterator ss(sorts); @@ -564,7 +564,7 @@ vstring Term::headToString() const } bool print = (isLiteral() || isSort() || (env.signature->getFunction(_functor)->combinator() == Signature::NOT_COMB)) && arity(); - vstring name = ""; + std::string name = ""; if(isLiteral()) { name = static_cast(this)->predicateName(); } else if (isSort()) { @@ -583,14 +583,14 @@ vstring Term::headToString() const /** * In combination with Term::headToString prepares - * vstring representation of a term. + * std::string representation of a term. * (this) has to come from arguments of a term of non-zero arity, * possibly a special one. * Will close the term printed with ')' */ -vstring TermList::asArgsToString() const +std::string TermList::asArgsToString() const { - vstring res; + std::string res; Stack stack(64); @@ -633,10 +633,10 @@ vstring TermList::asArgsToString() const } /** - * Write as a vstring the head of the term list. + * Write as a std::string the head of the term list. * @since 27/02/2008 Manchester */ -vstring TermList::toString(bool topLevel) const +std::string TermList::toString(bool topLevel) const { if (isEmpty()) { return ""; @@ -649,10 +649,10 @@ vstring TermList::toString(bool topLevel) const /** - * Return the result of conversion of a term into a vstring. + * Return the result of conversion of a term into a std::string. * @since 16/05/2007 Manchester */ -vstring Term::toString(bool topLevel) const +std::string Term::toString(bool topLevel) const { bool printArgs = true; @@ -663,7 +663,7 @@ vstring Term::toString(bool topLevel) const if(!isSpecial() && !isLiteral()){ if(isSort() && static_cast(const_cast(this))->isArrowSort()){ ASS(arity() == 2); - vstring res; + std::string res; TermList arg1 = *(nthArgument(0)); TermList arg2 = *(nthArgument(1)); res += topLevel ? "" : "("; @@ -675,7 +675,7 @@ vstring Term::toString(bool topLevel) const printArgs = isSort() || env.signature->getFunction(_functor)->combinator() == Signature::NOT_COMB; } - vstring s = headToString(); + std::string s = headToString(); if (_arity && printArgs) { s += args()->asArgsToString(); // will also print the ')' @@ -684,14 +684,14 @@ vstring Term::toString(bool topLevel) const } // Term::toString /** - * Return the result of conversion of a literal into a vstring. + * Return the result of conversion of a literal into a std::string. * @since 16/05/2007 Manchester */ -vstring Literal::toString() const +std::string Literal::toString() const { if (isEquality()) { const TermList* lhs = args(); - vstring s = lhs->toString(); + std::string s = lhs->toString(); if (isPositive()) { s += " = "; } @@ -699,7 +699,7 @@ vstring Literal::toString() const s += " != "; } - vstring res = s + lhs->next()->toString(); + std::string res = s + lhs->next()->toString(); if (env.getMainProblem() == nullptr || env.getMainProblem()->isHigherOrder() || (SortHelper::getEqualityArgumentSort(this) == AtomicSort::boolSort())){ res = "("+res+")"; @@ -712,7 +712,7 @@ vstring Literal::toString() const } Stack stack(64); - vstring s = polarity() ? "" : "~"; + std::string s = polarity() ? "" : "~"; unsigned proj; if (Theory::tuples()->findProjection(functor(), true, proj)) { return s + "$proj(" + Int::toString(proj) + ", " + args()->asArgsToString(); @@ -731,10 +731,10 @@ vstring Literal::toString() const * Return the print name of the function symbol of this term. * @since 18/05/2007 Manchester */ -const vstring& Term::functionName() const +const std::string& Term::functionName() const { #if VDEBUG - static vstring nonexisting(""); + static std::string nonexisting(""); if (_functor>=static_cast(env.signature->functions())) { return nonexisting; } @@ -746,10 +746,10 @@ const vstring& Term::functionName() const /** * Return the print name of the type constructor symbol of this sort. */ -const vstring& AtomicSort::typeConName() const +const std::string& AtomicSort::typeConName() const { #if VDEBUG - static vstring nonexisting(""); + static std::string nonexisting(""); if (_functor>=static_cast(env.signature->typeCons())) { return nonexisting; } @@ -762,10 +762,10 @@ const vstring& AtomicSort::typeConName() const * Return the print name of the function symbol of this literal. * @since 18/05/2007 Manchester */ -const vstring& Literal::predicateName() const +const std::string& Literal::predicateName() const { #if VDEBUG - static vstring nonexisting(""); + static std::string nonexisting(""); if (_functor>=static_cast(env.signature->predicates())) { return nonexisting; } @@ -863,7 +863,7 @@ Term* Term::create(unsigned function, unsigned arity, const TermList* args) /** Create a new constant and insert in into the sharing * structure. */ -Term* Term::createConstant(const vstring& name) +Term* Term::createConstant(const std::string& name) { unsigned symbolNumber = env.signature->addFunction(name,0); return createConstant(symbolNumber); @@ -1172,7 +1172,7 @@ TermList AtomicSort::arrowSort(TermStack& domSorts, TermList range) return res; } -AtomicSort* AtomicSort::createConstant(const vstring& name) +AtomicSort* AtomicSort::createConstant(const std::string& name) { bool added; unsigned newSort = env.signature->addTypeCon(name,0,added); @@ -1576,9 +1576,9 @@ AtomicSort::AtomicSort() } #if VDEBUG -vstring Term::headerToString() const +std::string Term::headerToString() const { - vstring s("functor: "); + std::string s("functor: "); s += Int::toString(_functor) + ", arity: " + Int::toString(_arity) + ", weight: " + Int::toString(_weight) + ", vars: " + Int::toString(_vars) @@ -1649,7 +1649,7 @@ bool Kernel::operator<(const TermList& lhs, const TermList& rhs) bool Literal::rightArgOrder(TermList const& lhs, TermList const& rhs) { return !Indexing::TermSharing::argNormGt(lhs,rhs); } -bool Kernel::positionIn(TermList& subterm,TermList* term,vstring& position) +bool Kernel::positionIn(TermList& subterm,TermList* term,std::string& position) { //cout << "positionIn " << subterm.toString() << " in " << term->toString() << endl; @@ -1664,7 +1664,7 @@ bool Kernel::positionIn(TermList& subterm,TermList* term,vstring& position) return positionIn(subterm,term->term(),position); } -bool Kernel::positionIn(TermList& subterm,Term* term,vstring& position) +bool Kernel::positionIn(TermList& subterm,Term* term,std::string& position) { //cout << "positionIn " << subterm.toString() << " in " << term->toString() << endl; diff --git a/Kernel/Term.hpp b/Kernel/Term.hpp index 84e20aab6b..1f163e9ca4 100644 --- a/Kernel/Term.hpp +++ b/Kernel/Term.hpp @@ -167,7 +167,7 @@ class TermList { unsigned defaultHash() const { return DefaultHash::hash(content()); } unsigned defaultHash2() const { return content(); } - vstring toString(bool topLevel = true) const; + std::string toString(bool topLevel = true) const; friend std::ostream& operator<<(std::ostream& out, Kernel::TermList const& tl); /** make the term into an ordinary variable with a given number */ @@ -247,7 +247,7 @@ class TermList { friend bool operator<(const TermList& lhs, const TermList& rhs); private: - vstring asArgsToString() const; + std::string asArgsToString() const; // the actual content of a TermList // this packs several things in: @@ -474,7 +474,7 @@ class alignas(8) Term static Term* createNonShared(Term* t); static Term* cloneNonShared(Term* t); - static Term* createConstant(const vstring& name); + static Term* createConstant(const std::string& name); /** Create a new constant and insert in into the sharing structure */ static Term* createConstant(unsigned symbolNumber) { return create(symbolNumber,0,0); } static Term* createITE(Formula * condition, TermList thenBranch, TermList elseBranch, TermList branchSort); @@ -503,10 +503,10 @@ class alignas(8) Term SpecialFunctor specialFunctor() const { return toSpecialFunctor(functor()); } - vstring toString(bool topLevel = true) const; + std::string toString(bool topLevel = true) const; friend std::ostream& operator<<(std::ostream& out, Kernel::Term const& tl); - static vstring variableToString(unsigned var); - static vstring variableToString(TermList var); + static std::string variableToString(unsigned var); + static std::string variableToString(TermList var); /** return the arguments * @@ -773,7 +773,7 @@ class alignas(8) Term return _isTwoVarEquality; } - const vstring& functionName() const; + const std::string& functionName() const; /** True if the term is, in fact, a literal */ bool isLiteral() const { return _args[0]._literal(); } @@ -791,7 +791,7 @@ class alignas(8) Term } #if VDEBUG - vstring headerToString() const; + std::string headerToString() const; void assertValid() const; #endif @@ -874,7 +874,7 @@ class alignas(8) Term virtual bool computableOrVar() const; protected: - vstring headToString() const; + std::string headToString() const; unsigned computeDistinctVars() const; @@ -990,7 +990,7 @@ class AtomicSort static AtomicSort* create2(unsigned tc, TermList arg1, TermList arg2); static AtomicSort* create(AtomicSort const* t,TermList* args); static AtomicSort* createConstant(unsigned typeCon) { return create(typeCon,0,0); } - static AtomicSort* createConstant(const vstring& name); + static AtomicSort* createConstant(const std::string& name); /** True if the sort is a higher-order arrow sort */ bool isArrowSort() const; @@ -1001,7 +1001,7 @@ class AtomicSort /** true if sort is the sort of an tuple */ bool isTupleSort() const; - const vstring& typeConName() const; + const std::string& typeConName() const; static TermList arrowSort(TermStack& domSorts, TermList range); static TermList arrowSort(TermList s1, TermList s2); @@ -1201,9 +1201,9 @@ class Literal bool isAnswerLiteral() const; friend std::ostream& operator<<(std::ostream& out, Kernel::Literal const& tl); - vstring toString() const; + std::string toString() const; - const vstring& predicateName() const; + const std::string& predicateName() const; virtual bool computable() const; virtual bool computableOrVar() const; @@ -1215,8 +1215,8 @@ class Literal // TODO used in some proofExtra output // find a better place for this? -bool positionIn(TermList& subterm,TermList* term, vstring& position); -bool positionIn(TermList& subterm,Term* term, vstring& position); +bool positionIn(TermList& subterm,TermList* term, std::string& position); +bool positionIn(TermList& subterm,Term* term, std::string& position); } // namespace Kernel diff --git a/Kernel/Theory.cpp b/Kernel/Theory.cpp index ba6a20f0b5..1647f4aed1 100644 --- a/Kernel/Theory.cpp +++ b/Kernel/Theory.cpp @@ -40,7 +40,7 @@ using namespace Lib; // IntegerConstantType // -IntegerConstantType::IntegerConstantType(const vstring& str) +IntegerConstantType::IntegerConstantType(const std::string& str) { if (!Int::stringToInt(str, _val)) { throw MachineArithmeticException(); @@ -296,7 +296,7 @@ Comparison IntegerConstantType::comparePrecedence(IntegerConstantType n1, Intege } } -vstring IntegerConstantType::toString() const +std::string IntegerConstantType::toString() const { return Int::toString(_val); } @@ -310,7 +310,7 @@ RationalConstantType::RationalConstantType(InnerType num, InnerType den) init(num, den); } -RationalConstantType::RationalConstantType(const vstring& num, const vstring& den) +RationalConstantType::RationalConstantType(const std::string& num, const std::string& den) { init(InnerType(num), InnerType(den)); } @@ -377,10 +377,10 @@ bool RationalConstantType::operator>(const RationalConstantType& o) const } -vstring RationalConstantType::toString() const +std::string RationalConstantType::toString() const { - vstring numStr = _num.toString(); - vstring denStr = _den.toString(); + std::string numStr = _num.toString(); + std::string denStr = _den.toString(); // return "("+numStr+"/"+denStr+")"; return numStr+"/"+denStr; @@ -486,10 +486,10 @@ Comparison RealConstantType::comparePrecedence(RealConstantType n1, RealConstant return RationalConstantType::comparePrecedence(n1, n2); } -bool RealConstantType::parseDouble(const vstring& num, RationalConstantType& res) +bool RealConstantType::parseDouble(const std::string& num, RationalConstantType& res) { try { - vstring newNum; + std::string newNum; IntegerConstantType denominator = 1; bool haveDecimal = false; bool neg = false; @@ -531,7 +531,7 @@ bool RealConstantType::parseDouble(const vstring& num, RationalConstantType& res } -RealConstantType::RealConstantType(const vstring& number) +RealConstantType::RealConstantType(const std::string& number) { RationalConstantType value; if (parseDouble(number, value)) { @@ -564,7 +564,7 @@ RealConstantType::RealConstantType(const vstring& number) init(numerator, denominator); } -vstring RealConstantType::toNiceString() const +std::string RealConstantType::toNiceString() const { if (denominator().toInner()==1) { return numerator().toString()+".0"; @@ -1312,7 +1312,7 @@ OperatorType* Theory::getConversionOperationType(Interpretation i) return OperatorType::getFunctionType({from}, to); } -vstring Theory::getInterpretationName(Interpretation interp) { +std::string Theory::getInterpretationName(Interpretation interp) { switch (interp) { case INT_SUCCESSOR: //this one is not according the TPTP arithmetic (it doesn't have successor) @@ -1811,7 +1811,7 @@ Term* Theory::representConstant(const RealConstantType& num) return Term::create(func, 0, 0); } -Term* Theory::representIntegerConstant(vstring str) +Term* Theory::representIntegerConstant(std::string str) { try { return Theory::instance()->representConstant(IntegerConstantType(str)); @@ -1830,7 +1830,7 @@ Term* Theory::representIntegerConstant(vstring str) } } -Term* Theory::representRealConstant(vstring str) +Term* Theory::representRealConstant(std::string str) { try { return Theory::instance()->representConstant(RealConstantType(str)); @@ -1843,7 +1843,7 @@ Term* Theory::representRealConstant(vstring str) * Register that a predicate pred with a given polarity has the given * template. See tryGetInterpretedLaTeXName for explanation of templates */ -void Theory::registerLaTeXPredName(unsigned pred, bool polarity, vstring temp) +void Theory::registerLaTeXPredName(unsigned pred, bool polarity, std::string temp) { if(polarity){ _predLaTeXnamesPos.insert(pred,temp); @@ -1855,7 +1855,7 @@ void Theory::registerLaTeXPredName(unsigned pred, bool polarity, vstring temp) * Register that a function has the given template * See tryGetInterpretedLaTeXName for explanation of templates */ -void Theory::registerLaTeXFuncName(unsigned func, vstring temp) +void Theory::registerLaTeXFuncName(unsigned func, std::string temp) { _funcLaTeXnames.insert(func,temp); } @@ -1967,7 +1967,7 @@ std::ostream& operator<<(std::ostream& out, Kernel::Theory::Interpretation const * replaced by the actual parameters elsewhere. For example, the template for * not greater or equal to is "a0 \not \geq a1" */ -vstring Theory::tryGetInterpretedLaTeXName(unsigned func, bool pred,bool polarity) +std::string Theory::tryGetInterpretedLaTeXName(unsigned func, bool pred,bool polarity) { //cout << "Get LaTeX for " << func << endl; @@ -2002,7 +2002,7 @@ vstring Theory::tryGetInterpretedLaTeXName(unsigned func, bool pred,bool polarit // There are some default templates // For predicates these include the notion of polarity - vstring pol = polarity ? "" : " \\not "; + std::string pol = polarity ? "" : " \\not "; //TODO do we want special symbols for quotient, remainder, floor, ceiling, truncate, round? diff --git a/Kernel/Theory.hpp b/Kernel/Theory.hpp index f645168ec1..1967e4126d 100644 --- a/Kernel/Theory.hpp +++ b/Kernel/Theory.hpp @@ -66,7 +66,7 @@ class IntegerConstantType IntegerConstantType(const IntegerConstantType&) = default; IntegerConstantType& operator=(const IntegerConstantType&) = default; constexpr IntegerConstantType(InnerType v) : _val(v) {} - explicit IntegerConstantType(const vstring& str); + explicit IntegerConstantType(const std::string& str); IntegerConstantType operator+(const IntegerConstantType& num) const; IntegerConstantType operator-(const IntegerConstantType& num) const; @@ -113,7 +113,7 @@ class IntegerConstantType static Comparison comparePrecedence(IntegerConstantType n1, IntegerConstantType n2); size_t hash() const; - vstring toString() const; + std::string toString() const; private: InnerType _val; IntegerConstantType operator/(const IntegerConstantType& num) const; @@ -143,7 +143,7 @@ struct RationalConstantType { RationalConstantType& operator=(const RationalConstantType&) = default; RationalConstantType(InnerType num, InnerType den); - RationalConstantType(const vstring& num, const vstring& den); + RationalConstantType(const std::string& num, const std::string& den); constexpr RationalConstantType(InnerType num) : _num(num), _den(1) {} //assuming den=1 RationalConstantType operator+(const RationalConstantType& num) const; @@ -179,7 +179,7 @@ struct RationalConstantType { RationalConstantType abs() const; - vstring toString() const; + std::string toString() const; const InnerType& numerator() const { return _num; } const InnerType& denominator() const { return _den; } @@ -213,7 +213,7 @@ class RealConstantType : public RationalConstantType RealConstantType(const RealConstantType&) = default; RealConstantType& operator=(const RealConstantType&) = default; - explicit RealConstantType(const vstring& number); + explicit RealConstantType(const std::string& number); explicit constexpr RealConstantType(const RationalConstantType& rat) : RationalConstantType(rat) {} RealConstantType(int num, int den) : RationalConstantType(num, den) {} explicit constexpr RealConstantType(typename IntegerConstantType::InnerType number) : RealConstantType(RationalConstantType(number)) {} @@ -235,7 +235,7 @@ class RealConstantType : public RationalConstantType RealConstantType abs() const; - vstring toNiceString() const; + std::string toNiceString() const; size_t hash() const; static Comparison comparePrecedence(RealConstantType n1, RealConstantType n2); @@ -250,7 +250,7 @@ class RealConstantType : public RationalConstantType */ RationalConstantType representation() const; private: - static bool parseDouble(const vstring& num, RationalConstantType& res); + static bool parseDouble(const std::string& num, RationalConstantType& res); }; @@ -434,7 +434,7 @@ class Theory return i == INT_PLUS || i == RAT_PLUS || i == REAL_PLUS; } - static vstring getInterpretationName(Interpretation i); + static std::string getInterpretationName(Interpretation i); static unsigned getArity(Interpretation i); static bool isFunction(Interpretation i); static bool isInequality(Interpretation i); @@ -495,15 +495,15 @@ class Theory Interpretation interpretPredicate(unsigned pred); Interpretation interpretPredicate(Literal* t); - void registerLaTeXPredName(unsigned func, bool polarity, vstring temp); - void registerLaTeXFuncName(unsigned func, vstring temp); - vstring tryGetInterpretedLaTeXName(unsigned func, bool pred,bool polarity=true); + void registerLaTeXPredName(unsigned func, bool polarity, std::string temp); + void registerLaTeXFuncName(unsigned func, std::string temp); + std::string tryGetInterpretedLaTeXName(unsigned func, bool pred,bool polarity=true); private: // For recording the templates for predicate and function symbols - DHMap _predLaTeXnamesPos; - DHMap _predLaTeXnamesNeg; - DHMap _funcLaTeXnames; + DHMap _predLaTeXnamesPos; + DHMap _predLaTeXnamesNeg; + DHMap _funcLaTeXnames; public: @@ -554,8 +554,8 @@ class Theory Term* representConstant(const RationalConstantType& num); Term* representConstant(const RealConstantType& num); - Term* representIntegerConstant(vstring str); - Term* representRealConstant(vstring str); + Term* representIntegerConstant(std::string str); + Term* representRealConstant(std::string str); private: Theory(); static OperatorType* getConversionOperationType(Interpretation i); diff --git a/Kernel/Unit.cpp b/Kernel/Unit.cpp index 25878413ed..c0d7944fe9 100644 --- a/Kernel/Unit.cpp +++ b/Kernel/Unit.cpp @@ -109,7 +109,7 @@ void Unit::destroy() } } -vstring Unit::toString() const +std::string Unit::toString() const { if(isClause()) { return static_cast(this)->toString(); @@ -146,11 +146,11 @@ Formula* Unit::getFormula() } /** - * Print the inference as a vstring (used in printing units in + * Print the inference as a std::string (used in printing units in * refutations). * @since 04/01/2008 Torrevieja */ -vstring Unit::inferenceAsString() const +std::string Unit::inferenceAsString() const { #if 1 InferenceStore& infS = *InferenceStore::instance(); @@ -160,7 +160,7 @@ vstring Unit::inferenceAsString() const Unit* us = const_cast(this); parents = infS.getParents(us, rule); - vstring result = (vstring)"[" + ruleName(rule); + std::string result = (std::string)"[" + ruleName(rule); bool first = true; while (parents.hasNext()) { Unit* parent = parents.next(); @@ -169,14 +169,14 @@ vstring Unit::inferenceAsString() const result += infS.getUnitIdStr(parent); } // print Extra - vstring extra; + std::string extra; if (env.proofExtra && env.proofExtra->find(this,extra) && extra != "") { result += ", " + extra; } return result + ']'; #else - vstring result = (vstring)"[" + _inference->name(); + std::string result = (std::string)"[" + _inference->name(); bool first = true; Inference::Iterator it = _inference->iterator(); while (_inference->hasNext(it)) { diff --git a/Kernel/Unit.hpp b/Kernel/Unit.hpp index 8c76139a4d..287978ef57 100644 --- a/Kernel/Unit.hpp +++ b/Kernel/Unit.hpp @@ -46,10 +46,10 @@ class Unit }; void destroy(); - vstring toString() const; + std::string toString() const; unsigned varCnt(); - vstring inferenceAsString() const; + std::string inferenceAsString() const; /** True if a clause unit */ bool isClause() const diff --git a/Lib/Backtrackable.hpp b/Lib/Backtrackable.hpp index 7e1393a383..2ebdb0af47 100644 --- a/Lib/Backtrackable.hpp +++ b/Lib/Backtrackable.hpp @@ -47,7 +47,7 @@ class BacktrackObject virtual void backtrack() = 0; #if VDEBUG - virtual vstring toString() const { return "(backtrack object)"; } + virtual std::string toString() const { return "(backtrack object)"; } #endif template static BacktrackObject* fromClosure(F f); @@ -187,9 +187,9 @@ class BacktrackData } #if VDEBUG - vstring toString() + std::string toString() { - vstring res; + std::string res; unsigned cnt=0; BacktrackObject* bobj=_boList; while(bobj) { diff --git a/Lib/Environment.hpp b/Lib/Environment.hpp index c0a1e3fd94..6a7a888a5a 100644 --- a/Lib/Environment.hpp +++ b/Lib/Environment.hpp @@ -53,7 +53,7 @@ class Environment DHMap* predicateSineLevels; - DHMap* proofExtra; // maps Unit* pointers to the associated proof extra string, if available + DHMap* proofExtra; // maps Unit* pointers to the associated proof extra string, if available bool timeLimitReached() const; diff --git a/Lib/Exception.cpp b/Lib/Exception.cpp index ac3fe1fa7e..e3a74a0af8 100644 --- a/Lib/Exception.cpp +++ b/Lib/Exception.cpp @@ -25,7 +25,7 @@ namespace Lib using namespace std; Exception::Exception (const char* msg, int line) - : _message((vstring(msg)+": "+Int::toString(line)).c_str()) {} + : _message((std::string(msg)+": "+Int::toString(line)).c_str()) {} /** * Write a description of the exception to a stream. @@ -56,7 +56,7 @@ void InvalidOperationException::cry (ostream& str) const } // InvalidOperationException::cry -SystemFailException::SystemFailException(const vstring msg, int err) +SystemFailException::SystemFailException(const std::string msg, int err) : Exception(msg+" error "+Int::toString(err)+": "+strerror(err)), err(err) { //#if VDEBUG diff --git a/Lib/Exception.hpp b/Lib/Exception.hpp index bec45aa252..e823a42dcf 100644 --- a/Lib/Exception.hpp +++ b/Lib/Exception.hpp @@ -54,7 +54,7 @@ struct OutputAll<> { class Exception : public ThrowableBase { template - vstring toString(Msg... msg){ + std::string toString(Msg... msg){ std::stringstream out; OutputAll::apply(out, msg...); return out.str(); @@ -63,7 +63,7 @@ class Exception : public ThrowableBase /** Create an exception with a given error message */ explicit Exception (const char* msg) : _message(msg) {} Exception (const char* msg, int line); - explicit Exception (const vstring msg) : _message(msg) {} + explicit Exception (const std::string msg) : _message(msg) {} template explicit Exception(Msg... msg) @@ -73,13 +73,13 @@ class Exception : public ThrowableBase virtual void cry (std::ostream&) const; virtual ~Exception() {} - const vstring& msg() { return _message; } + const std::string& msg() { return _message; } protected: /** Default constructor, required for some subclasses, made protected * so that it cannot be called directly */ Exception () {} /** The error message */ - vstring _message; + std::string _message; friend std::ostream& operator<<(std::ostream& out, Exception const& self) { self.cry(out); return out; } @@ -154,7 +154,7 @@ class InvalidOperationException InvalidOperationException (const char* msg) : Exception(msg) {} - InvalidOperationException (const vstring msg) + InvalidOperationException (const std::string msg) : Exception(msg) {} void cry (std::ostream&) const; @@ -167,7 +167,7 @@ class SystemFailException : public Exception { public: - SystemFailException (const vstring msg, int err); + SystemFailException (const std::string msg, int err); void cry (std::ostream&) const; int err; diff --git a/Lib/Hash.hpp b/Lib/Hash.hpp index 1ec13e0451..777d9e834b 100644 --- a/Lib/Hash.hpp +++ b/Lib/Hash.hpp @@ -183,8 +183,8 @@ class DefaultHash ); } - // vstrings hash the underlying C-style string - static unsigned hash(const vstring& str) + // strings hash the underlying C-style string + static unsigned hash(const std::string& str) { return DefaultHash::hashNulTerminated(str.c_str()); } // dispatch to VectorHash @@ -299,8 +299,8 @@ class DefaultHash2 { return static_cast(val); } - // vstrings use their length - static unsigned hash(const vstring &str) { + // strings use their length + static unsigned hash(const std::string &str) { return str.length(); } diff --git a/Lib/Int.cpp b/Lib/Int.cpp index 31a04daf81..978adc8738 100644 --- a/Lib/Int.cpp +++ b/Lib/Int.cpp @@ -30,14 +30,14 @@ using namespace Lib; * @since 27/05/2003 Manchester * @since 27/08/2003 Vienna, changed to return a string * @since 06/12/2003 Manchester, changed to use sprintf - * @since 07/08/2014 Manchester, changed to return a vstring + * @since 07/08/2014 Manchester, changed to return a std::string */ -vstring Int::toString (int i) +std::string Int::toString (int i) { constexpr auto BUFSIZE = 20; char tmp [BUFSIZE]; snprintf(tmp,BUFSIZE,"%d",i); - vstring result(tmp); + std::string result(tmp); return result; } // Int::toString (int i) @@ -49,12 +49,12 @@ vstring Int::toString (int i) * @param d the double * @since 09/12/2003 Manchester */ -vstring Int::toString(double d) +std::string Int::toString(double d) { constexpr auto BUFSIZE = 256; char tmp [BUFSIZE]; snprintf(tmp,BUFSIZE,"%g",d); - vstring result(tmp); + std::string result(tmp); return result; } // Int::toString @@ -66,12 +66,12 @@ vstring Int::toString(double d) * @param l the long * @since 10/02/2004 Manchester */ -vstring Int::toString(long l) +std::string Int::toString(long l) { constexpr auto BUFSIZE = 256; char tmp [BUFSIZE]; snprintf(tmp,BUFSIZE,"%ld",l); - vstring result(tmp); + std::string result(tmp); return result; } // Int::toString @@ -81,12 +81,12 @@ vstring Int::toString(long l) * Return the string representation of an unsigned integer. * @since 10/02/2004 Manchester */ -vstring Int::toString(unsigned i) +std::string Int::toString(unsigned i) { constexpr auto BUFSIZE = 256; char tmp [BUFSIZE]; snprintf(tmp,BUFSIZE,"%u",i); - vstring result(tmp); + std::string result(tmp); return result; } // Int::toString @@ -94,22 +94,22 @@ vstring Int::toString(unsigned i) /** * Return the string representation of an unsigned integer. */ -vstring Int::toString(unsigned long i) +std::string Int::toString(unsigned long i) { constexpr auto BUFSIZE = 256; char tmp [BUFSIZE]; snprintf(tmp,BUFSIZE,"%lu",i); - vstring result(tmp); + std::string result(tmp); return result; } // Int::toString -vstring Int::toHexString(size_t i) +std::string Int::toHexString(size_t i) { constexpr auto BUFSIZE = 256; char tmp [BUFSIZE]; snprintf(tmp,BUFSIZE,"0x%zx",i); - vstring result(tmp); + std::string result(tmp); return result; } // Int::toString @@ -142,19 +142,19 @@ bool Int::stringToLong (const char* str,long& result) /** - * Convert a vstring to an integer value. + * Convert a std::string to an integer value. * @since 30/08/2004 Torrevieja */ -bool Int::stringToInt (const vstring& str,int& result) +bool Int::stringToInt (const std::string& str,int& result) { return stringToInt(str.c_str(),result); } // Int::stringToInt /** - * Convert a vstring to an unsigned integer value. + * Convert a std::string to an unsigned integer value. * @since 20/09/2009 Redmond */ -bool Int::stringToUnsignedInt (const vstring& str,unsigned& result) +bool Int::stringToUnsignedInt (const std::string& str,unsigned& result) { return stringToUnsignedInt(str.c_str(),result); } // Int::stringToUnsignedInt @@ -264,11 +264,11 @@ bool Int::stringToUnsigned64 (const char* str,long long unsigned& result) } // Int::stringToUnsigned64 /** - * Convert a vstring to a 64-bit unsigned. No overflow check is made. + * Convert a std::string to a 64-bit unsigned. No overflow check is made. * * @since 30/11/2006 Haifa */ -bool Int::stringToUnsigned64 (const vstring& str,long long unsigned& result) +bool Int::stringToUnsigned64 (const std::string& str,long long unsigned& result) { return stringToUnsigned64(str.c_str(),result); } // Int::stringToUnsigned64 diff --git a/Lib/Int.hpp b/Lib/Int.hpp index 0a2a1d41e5..a1cfec818e 100644 --- a/Lib/Int.hpp +++ b/Lib/Int.hpp @@ -41,19 +41,19 @@ namespace Lib { class Int { public: - static vstring toString(int i); - static vstring toString(unsigned i); - static vstring toString(unsigned long i); - static vstring toString(long l); - /** Return the vstring representation of a float */ - static vstring toString(float f) { return toString((double)f); } - static vstring toString(double d); + static std::string toString(int i); + static std::string toString(unsigned i); + static std::string toString(unsigned long i); + static std::string toString(long l); + /** Return the std::string representation of a float */ + static std::string toString(float f) { return toString((double)f); } + static std::string toString(double d); - static vstring toHexString(size_t i); + static std::string toHexString(size_t i); static bool isInteger(const char* str); /** True if @b str is a string representing an (arbitrary precision) integer */ - static inline bool isInteger(const vstring& str) { return isInteger(str.c_str()); } + static inline bool isInteger(const std::string& str) { return isInteger(str.c_str()); } /** Compare two integers. */ inline static Comparison compare (int i1, int i2) @@ -78,17 +78,17 @@ class Int { return f1 < f2 ? LESS : f1 == f2 ? EQUAL : GREATER; } static bool stringToLong(const char*,long& result); static bool stringToUnsignedLong(const char*,unsigned long& result); - static bool stringToLong(const vstring& str,long& result) { + static bool stringToLong(const std::string& str,long& result) { return stringToLong(str.c_str(),result); } - static bool stringToInt(const vstring& str,int& result); + static bool stringToInt(const std::string& str,int& result); static bool stringToInt(const char* str,int& result); static bool stringToUnsignedInt(const char* str,unsigned& result); - static bool stringToUnsignedInt(const vstring& str,unsigned& result); + static bool stringToUnsignedInt(const std::string& str,unsigned& result); static bool stringToDouble(const char*,double& result); - static bool stringToDouble(const vstring& str,double& result) { return stringToDouble(str.c_str(), result); } + static bool stringToDouble(const std::string& str,double& result) { return stringToDouble(str.c_str(), result); } static bool stringToFloat(const char*,float& result); - static bool stringToUnsigned64(const vstring& str,long long unsigned& result); + static bool stringToUnsigned64(const std::string& str,long long unsigned& result); static bool stringToUnsigned64(const char* str,long long unsigned& result); static int sign(int i); static int sign(long i); diff --git a/Lib/IntNameTable.cpp b/Lib/IntNameTable.cpp index 37f0bf7f57..2a0558d993 100644 --- a/Lib/IntNameTable.cpp +++ b/Lib/IntNameTable.cpp @@ -34,7 +34,7 @@ IntNameTable::IntNameTable () /** * Insert an element in the table and return its number. */ -int IntNameTable::insert (const vstring& str) +int IntNameTable::insert (const std::string& str) { #if VDEBUG int result = 0; diff --git a/Lib/IntNameTable.hpp b/Lib/IntNameTable.hpp index e5f81a7c41..50f6a84475 100644 --- a/Lib/IntNameTable.hpp +++ b/Lib/IntNameTable.hpp @@ -30,14 +30,14 @@ class IntNameTable { public: IntNameTable(); - int insert(const vstring& str); + int insert(const std::string& str); // /** return name number n */ -// inline vstring operator[] (int n) const { return _names[n]; } +// inline std::string operator[] (int n) const { return _names[n]; } // int numberOfSymbols(); private: - Map _map; -// Array _names; + Map _map; +// Array _names; int _nextNumber; }; // class NameTable diff --git a/Lib/List.hpp b/Lib/List.hpp index 4df9012289..b0229289fd 100644 --- a/Lib/List.hpp +++ b/Lib/List.hpp @@ -456,8 +456,8 @@ class List #if VDEBUG // Only works if called on a List of elements with toString functions - vstring toString(){ - vstring h = _head->toString(); + std::string toString(){ + std::string h = _head->toString(); if(_tail){ return h+","+_tail->toString(); } diff --git a/Lib/Metaiterators.hpp b/Lib/Metaiterators.hpp index 203e5039a5..1fb328deee 100644 --- a/Lib/Metaiterators.hpp +++ b/Lib/Metaiterators.hpp @@ -1224,13 +1224,13 @@ T minFn(T a1, T a2) { return std::min(a1,a2); } template struct StmJoinAuxStruct { - StmJoinAuxStruct(vstring glue, It it) : _glue(glue), _it(it) {} - vstring _glue; + StmJoinAuxStruct(std::string glue, It it) : _glue(glue), _it(it) {} + std::string _glue; It _it; }; template -StmJoinAuxStruct join(vstring glue, It it) +StmJoinAuxStruct join(std::string glue, It it) { return StmJoinAuxStruct(glue, it); } diff --git a/Lib/SharedSet.hpp b/Lib/SharedSet.hpp index f778d4b1d1..9cf8960b24 100644 --- a/Lib/SharedSet.hpp +++ b/Lib/SharedSet.hpp @@ -300,7 +300,7 @@ class SharedSet { } - vstring toString() const + std::string toString() const { std::ostringstream res; res<<(*this); diff --git a/Lib/StringUtils.cpp b/Lib/StringUtils.cpp index b3c202ce62..ac45441170 100644 --- a/Lib/StringUtils.cpp +++ b/Lib/StringUtils.cpp @@ -23,7 +23,7 @@ namespace Lib using namespace std; -vstring StringUtils::replaceChar(vstring str, char src, char target) +std::string StringUtils::replaceChar(std::string str, char src, char target) { size_t len=str.size(); static DArray buf; @@ -42,15 +42,15 @@ vstring StringUtils::replaceChar(vstring str, char src, char target) tptr++; sptr++; } - return vstring(buf.array(), len); + return std::string(buf.array(), len); } /** - * Sanitize vstring so that it can be used as a valid suffix in the + * Sanitize std::string so that it can be used as a valid suffix in the * Signature::addFreshFunction() and Signature::addFreshPredicate() * functions. */ -vstring StringUtils::sanitizeSuffix(vstring str) +std::string StringUtils::sanitizeSuffix(std::string str) { size_t len=str.size(); static DArray buf; @@ -80,10 +80,10 @@ vstring StringUtils::sanitizeSuffix(vstring str) tptr++; sptr++; } - return vstring(buf.array(), len); + return std::string(buf.array(), len); } -bool StringUtils::isPositiveInteger(vstring str) +bool StringUtils::isPositiveInteger(std::string str) { size_t sz = str.size(); @@ -98,7 +98,7 @@ bool StringUtils::isPositiveInteger(vstring str) return true; } -bool StringUtils::isPositiveDecimal(vstring str) +bool StringUtils::isPositiveDecimal(std::string str) { size_t sz = str.size(); @@ -121,7 +121,7 @@ bool StringUtils::isPositiveDecimal(vstring str) return true; } -void StringUtils::splitStr(const char* str, char delimiter, Stack& strings) +void StringUtils::splitStr(const char* str, char delimiter, Stack& strings) { static Stack currPart; currPart.reset(); @@ -142,7 +142,7 @@ void StringUtils::splitStr(const char* str, char delimiter, Stack& stri strings.push(currPart.begin()); } -void StringUtils::dropEmpty(Stack& strings) +void StringUtils::dropEmpty(Stack& strings) { unsigned i = 0; for (unsigned j = 0; j < strings.size(); j++) { @@ -153,9 +153,9 @@ void StringUtils::dropEmpty(Stack& strings) strings.truncate(i); } -bool StringUtils::readEquality(const char* str, char eqChar, vstring& lhs, vstring& rhs) +bool StringUtils::readEquality(const char* str, char eqChar, std::string& lhs, std::string& rhs) { - static Stack parts; + static Stack parts; parts.reset(); splitStr(str, eqChar, parts); if(parts.size()!=2) { @@ -169,16 +169,16 @@ bool StringUtils::readEquality(const char* str, char eqChar, vstring& lhs, vstri /** * If str doesn't contain equalities, false is returned and the content of pairs is undefined. */ -bool StringUtils::readEqualities(const char* str, char delimiter, char eqChar, DHMap& pairs) +bool StringUtils::readEqualities(const char* str, char delimiter, char eqChar, DHMap& pairs) { - static Stack parts; + static Stack parts; parts.reset(); splitStr(str, delimiter, parts); - Stack::TopFirstIterator pit(parts); + Stack::TopFirstIterator pit(parts); while(pit.hasNext()) { - vstring part = pit.next(); - vstring lhs, rhs; + std::string part = pit.next(); + std::string lhs, rhs; if(!readEquality(part.c_str(), eqChar, lhs, rhs)) { return false; } diff --git a/Lib/StringUtils.hpp b/Lib/StringUtils.hpp index 03ae279ec8..e1d96e1ee3 100644 --- a/Lib/StringUtils.hpp +++ b/Lib/StringUtils.hpp @@ -25,30 +25,30 @@ template struct StringParser; class StringUtils { public: - static vstring replaceChar(vstring str, char src, char target); - static vstring sanitizeSuffix(vstring str); - static bool isPositiveInteger(vstring str); - static bool isPositiveDecimal(vstring str); - - static void splitStr(const char* str, char delimiter, Stack& strings); - static void dropEmpty(Stack& strings); - static bool readEquality(const char* str, char eqChar, vstring& lhs, vstring& rhs); - static bool readEqualities(const char* str, char delimiter, char eqChar, DHMap& pairs); + static std::string replaceChar(std::string str, char src, char target); + static std::string sanitizeSuffix(std::string str); + static bool isPositiveInteger(std::string str); + static bool isPositiveDecimal(std::string str); + + static void splitStr(const char* str, char delimiter, Stack& strings); + static void dropEmpty(Stack& strings); + static bool readEquality(const char* str, char eqChar, std::string& lhs, std::string& rhs); + static bool readEqualities(const char* str, char delimiter, char eqChar, DHMap& pairs); template - static A parse(vstring const& str) + static A parse(std::string const& str) { return StringParser{}(str); } }; template<> struct StringParser { - int operator()(vstring const& str) + int operator()(std::string const& str) { return atoi(str.c_str()); } }; template<> struct StringParser { - float operator()(vstring const& str) + float operator()(std::string const& str) { return atof(str.c_str()); } }; diff --git a/Lib/Timer.cpp b/Lib/Timer.cpp index 6548c85d19..56a9484ea7 100644 --- a/Lib/Timer.cpp +++ b/Lib/Timer.cpp @@ -336,7 +336,7 @@ void Timer::syncClock() } } -vstring Timer::msToSecondsString(int ms) +std::string Timer::msToSecondsString(int ms) { return Int::toString(static_cast(ms)/1000)+" s"; } diff --git a/Lib/Timer.hpp b/Lib/Timer.hpp index 2ea5a70006..484380198f 100644 --- a/Lib/Timer.hpp +++ b/Lib/Timer.hpp @@ -90,7 +90,7 @@ class Timer static void ensureTimerInitialized(); static void deinitializeTimer(); - static vstring msToSecondsString(int ms); + static std::string msToSecondsString(int ms); static void printMSString(std::ostream& str, int ms); static void setLimitEnforcement(bool enabled) diff --git a/Lib/Vector.hpp b/Lib/Vector.hpp index b2f3b841f4..8a6c4f625d 100644 --- a/Lib/Vector.hpp +++ b/Lib/Vector.hpp @@ -104,9 +104,9 @@ class Vector * Convert the vector to its string representation. To use this function, * elements must have a toString() function too. */ - vstring toString() + std::string toString() { - vstring res; + std::string res; for(size_t i=0;i<_length;i++) { if (i>0) { res+=","; diff --git a/Parse/SMTLIB2.cpp b/Parse/SMTLIB2.cpp index cff5baf32a..47dbc5ec50 100644 --- a/Parse/SMTLIB2.cpp +++ b/Parse/SMTLIB2.cpp @@ -53,7 +53,7 @@ #define LOG4(a1,a2,a3,a4) #endif -#define USER_ERROR_EXPR(msg) USER_ERROR(vstring(msg)+" in top-level expression '"+_topLevelExpr->toString()+"'") +#define USER_ERROR_EXPR(msg) USER_ERROR(std::string(msg)+" in top-level expression '"+_topLevelExpr->toString()+"'") namespace Parse { @@ -132,8 +132,8 @@ void SMTLIB2::readBenchmark(LExprList* bench) } if (ibRdr.tryAcceptAtom("declare-sort")) { - vstring name = ibRdr.readAtom(); - vstring arity; + std::string name = ibRdr.readAtom(); + std::string arity; if (!ibRdr.tryReadAtom(arity)) { USER_ERROR_EXPR("Unspecified arity while declaring sort: "+name); } @@ -146,7 +146,7 @@ void SMTLIB2::readBenchmark(LExprList* bench) } if (ibRdr.tryAcceptAtom("define-sort")) { - vstring name = ibRdr.readAtom(); + std::string name = ibRdr.readAtom(); LExprList* args = ibRdr.readList(); if (!ibRdr.hasNext()) { @@ -162,7 +162,7 @@ void SMTLIB2::readBenchmark(LExprList* bench) } if (ibRdr.tryAcceptAtom("declare-fun")) { - vstring name = ibRdr.readAtom(); + std::string name = ibRdr.readAtom(); LExprList* iSorts = ibRdr.readList(); LispListReader iSortRdr(iSorts); auto lookup = new TermLookup(); @@ -221,7 +221,7 @@ void SMTLIB2::readBenchmark(LExprList* bench) } if (ibRdr.tryAcceptAtom("declare-const")) { - vstring name = ibRdr.readAtom(); + std::string name = ibRdr.readAtom(); if (!ibRdr.hasNext()) { USER_ERROR_EXPR("declare-const expects a const definition body"); } @@ -249,7 +249,7 @@ void SMTLIB2::readBenchmark(LExprList* bench) bool recursive = false; if (ibRdr.tryAcceptAtom("define-fun") || (recursive = ibRdr.tryAcceptAtom("define-fun-rec"))) { - vstring name = ibRdr.readAtom(); + std::string name = ibRdr.readAtom(); LExprList* iArgs = ibRdr.readList(); LispListReader iArgRdr(iArgs); auto lookup = new TermLookup(); @@ -338,7 +338,7 @@ void SMTLIB2::readBenchmark(LExprList* bench) // not an official SMTLIB command if (ibRdr.tryAcceptAtom("color-symbol")) { - vstring symbol = ibRdr.readAtom(); + std::string symbol = ibRdr.readAtom(); if (ibRdr.tryAcceptAtom(":left")) { colorSymbol(symbol, Color::COLOR_LEFT); @@ -376,7 +376,7 @@ void SMTLIB2::readBenchmark(LExprList* bench) while (lIt.hasNext()) { LExpr* exp = lIt.next(); ASS(exp->isAtom()); - vstring& name = exp->str; + std::string& name = exp->str; markSymbolUncomputable(name); } ibRdr.acceptEOL(); @@ -482,7 +482,7 @@ const char * SMTLIB2::s_smtlibLogicNameStrings[] = { "UFNIA" }; -SMTLIBLogic SMTLIB2::getLogicFromString(const vstring& str) +SMTLIBLogic SMTLIB2::getLogicFromString(const std::string& str) { static NameArray smtlibLogicNames(s_smtlibLogicNameStrings, sizeof(s_smtlibLogicNameStrings)/sizeof(char*)); ASS_EQ(smtlibLogicNames.length, SMT_UNDEFINED); @@ -494,7 +494,7 @@ SMTLIBLogic SMTLIB2::getLogicFromString(const vstring& str) return static_cast(res); } -void SMTLIB2::readLogic(const vstring& logicStr) +void SMTLIB2::readLogic(const std::string& logicStr) { _logic = getLogicFromString(logicStr); _logicSet = true; @@ -569,9 +569,9 @@ void SMTLIB2::readLogic(const vstring& logicStr) // ---------------------------------------------------------------------- -void SMTLIB2::readDeclareSort(const vstring& name, const vstring& arity) +void SMTLIB2::readDeclareSort(const std::string& name, const std::string& arity) { - vstring pName = name + TYPECON_POSTFIX; + std::string pName = name + TYPECON_POSTFIX; if (isAlreadyKnownSymbol(pName)) { USER_ERROR_EXPR("Redeclaring built-in, declared or defined sort symbol: "+name); } @@ -592,9 +592,9 @@ void SMTLIB2::readDeclareSort(const vstring& name, const vstring& arity) env.signature->getTypeCon(srt)->setType(OperatorType::getTypeConType(val)); } -void SMTLIB2::readDefineSort(const vstring& name, LExprList* args, LExpr* body) +void SMTLIB2::readDefineSort(const std::string& name, LExprList* args, LExpr* body) { - vstring pName = name + TYPECON_POSTFIX; + std::string pName = name + TYPECON_POSTFIX; if (isAlreadyKnownSymbol(pName)) { USER_ERROR_EXPR("Redeclaring built-in, declared or defined sort symbol: "+name); } @@ -641,7 +641,7 @@ const char * SMTLIB2::s_formulaSymbolNameStrings[] = { "xor" }; -SMTLIB2::FormulaSymbol SMTLIB2::getBuiltInFormulaSymbol(const vstring& str) +SMTLIB2::FormulaSymbol SMTLIB2::getBuiltInFormulaSymbol(const std::string& str) { static NameArray formulaSymbolNames(s_formulaSymbolNameStrings, sizeof(s_formulaSymbolNameStrings)/sizeof(char*)); ASS_EQ(formulaSymbolNames.length, FS_USER_PRED_SYMBOL); @@ -677,7 +677,7 @@ const char * SMTLIB2::s_termSymbolNameStrings[] = { "to_real" }; -SMTLIB2::TermSymbol SMTLIB2::getBuiltInTermSymbol(const vstring& str) +SMTLIB2::TermSymbol SMTLIB2::getBuiltInTermSymbol(const std::string& str) { static NameArray termSymbolNames(s_termSymbolNameStrings, sizeof(s_termSymbolNameStrings)/sizeof(char*)); ASS_EQ(termSymbolNames.length, TS_USER_FUNCTION); @@ -689,7 +689,7 @@ SMTLIB2::TermSymbol SMTLIB2::getBuiltInTermSymbol(const vstring& str) return static_cast(resInt); } -bool SMTLIB2::isAlreadyKnownSymbol(const vstring& name) +bool SMTLIB2::isAlreadyKnownSymbol(const std::string& name) { if (getBuiltInFormulaSymbol(name) != FS_USER_PRED_SYMBOL) { return true; @@ -706,7 +706,7 @@ bool SMTLIB2::isAlreadyKnownSymbol(const vstring& name) return false; } -void SMTLIB2::readDeclareFun(const vstring& name, LExprList* iSorts, LExpr* oSort, unsigned taArity) +void SMTLIB2::readDeclareFun(const std::string& name, LExprList* iSorts, LExpr* oSort, unsigned taArity) { if (isAlreadyKnownSymbol(name)) { USER_ERROR_EXPR("Redeclaring function symbol: "+name); @@ -726,7 +726,7 @@ void SMTLIB2::readDeclareFun(const vstring& name, LExprList* iSorts, LExpr* oSor declareFunctionOrPredicate(name,rangeSort,argSorts,taArity); } -SMTLIB2::DeclaredSymbol SMTLIB2::declareFunctionOrPredicate(const vstring& name, TermList rangeSort, const TermStack& argSorts, unsigned taArity) +SMTLIB2::DeclaredSymbol SMTLIB2::declareFunctionOrPredicate(const std::string& name, TermList rangeSort, const TermStack& argSorts, unsigned taArity) { bool added = false; unsigned symNum; @@ -771,7 +771,7 @@ SMTLIB2::DeclaredSymbol SMTLIB2::declareFunctionOrPredicate(const vstring& name, // ---------------------------------------------------------------------- -void SMTLIB2::readDefineFun(const vstring& name, LExprList* iArgs, LExpr* oSort, LExpr* body, const TermStack& typeArgs, bool recursive) +void SMTLIB2::readDefineFun(const std::string& name, LExprList* iArgs, LExpr* oSort, LExpr* body, const TermStack& typeArgs, bool recursive) { if (isAlreadyKnownSymbol(name)) { USER_ERROR_EXPR("Redeclaring function symbol: "+name); @@ -795,7 +795,7 @@ void SMTLIB2::readDefineFun(const vstring& name, LExprList* iArgs, LExpr* oSort, LExprList* pair = iaRdr.readList(); LispListReader pRdr(pair); - vstring vName = pRdr.readAtom(); + std::string vName = pRdr.readAtom(); TermList vSort = parseSort(pRdr.readNext()); pRdr.acceptEOL(); @@ -884,7 +884,7 @@ void SMTLIB2::readDefineFunsRec(LExprList* declsExpr, LExprList* defsExpr) Declaration decl; LispListReader declRdr(declExpr->list); - vstring name = declRdr.readAtom(); + std::string name = declRdr.readAtom(); if (isAlreadyKnownSymbol(name)) { USER_ERROR_EXPR("Redeclaring function symbol: "+name); } @@ -900,7 +900,7 @@ void SMTLIB2::readDefineFunsRec(LExprList* declsExpr, LExprList* defsExpr) LExprList* pair = iaRdr.readList(); LispListReader pRdr(pair); - vstring vName = pRdr.readAtom(); + std::string vName = pRdr.readAtom(); TermList vSort = parseSort(pRdr.readNext()); pRdr.acceptEOL(); @@ -1003,7 +1003,7 @@ void SMTLIB2::readTypeParameters(LispListReader& rdr, TermLookup* lookup, TermSt void SMTLIB2::readDeclareDatatype(LExpr *sort, LExprList *datatype) { // first declare the sort - vstring dtypeName = sort->str+TYPECON_POSTFIX; + std::string dtypeName = sort->str+TYPECON_POSTFIX; if (isAlreadyKnownSymbol(dtypeName)) { USER_ERROR_EXPR("Redeclaring built-in, declared or defined sort symbol as datatype: " + dtypeName); } @@ -1024,7 +1024,7 @@ void SMTLIB2::readDeclareDatatype(LExpr *sort, LExprList *datatype) ALWAYS(_declaredSymbols.insert(dtypeName, make_pair(srt,SymbolType::TYPECON))); Stack constructors; TermStack argSorts; - Stack destructorNames; + Stack destructorNames; ASS(added); env.signature->getTypeCon(srt)->setType(OperatorType::getTypeConType(numTypeVars)); @@ -1038,7 +1038,7 @@ void SMTLIB2::readDeclareDatatype(LExpr *sort, LExprList *datatype) argSorts.reset(); destructorNames.reset(); // read each constructor declaration - vstring constrName; + std::string constrName; LExpr *constr = dtypeRdr.next(); ASS(constr->isList()); LispListReader constrRdr(constr); @@ -1080,12 +1080,12 @@ void SMTLIB2::readDeclareDatatypes(LExprList* sorts, LExprList* datatypes, bool // first declare all the sorts, and then only the constructors, in // order to allow mutually recursive datatypes definitions LispListReader dtypesNamesRdr(sorts); - Stack dtypeNames; + Stack dtypeNames; while (dtypesNamesRdr.hasNext()) { LispListReader dtypeNRdr(dtypesNamesRdr.readList()); - vstring dtypeName = dtypeNRdr.readAtom()+TYPECON_POSTFIX; - const vstring& dtypeSize = dtypeNRdr.readAtom(); + std::string dtypeName = dtypeNRdr.readAtom()+TYPECON_POSTFIX; + const std::string& dtypeSize = dtypeNRdr.readAtom(); unsigned arity; if(!Int::stringToUnsignedInt(dtypeSize,arity)){ USER_ERROR_EXPR("datatype arity not given"); } if(arity>0){ USER_ERROR_EXPR("unsupported parametric datatype declaration"); } @@ -1107,14 +1107,14 @@ void SMTLIB2::readDeclareDatatypes(LExprList* sorts, LExprList* datatypes, bool Stack constructors; TermStack argSorts; - Stack destructorNames; + Stack destructorNames; LispListReader dtypesDefsRdr(datatypes); - Stack::BottomFirstIterator dtypeNameIter(dtypeNames); + Stack::BottomFirstIterator dtypeNameIter(dtypeNames); while(dtypesDefsRdr.hasNext()) { ASS(dtypeNameIter.hasNext()); constructors.reset(); - const vstring& taName = dtypeNameIter.next(); + const std::string& taName = dtypeNameIter.next(); bool added = false; unsigned sort = env.signature->addTypeCon(taName,0,added); ASS(!added); @@ -1125,7 +1125,7 @@ void SMTLIB2::readDeclareDatatypes(LExprList* sorts, LExprList* datatypes, bool argSorts.reset(); destructorNames.reset(); // read each constructor declaration - vstring constrName; + std::string constrName; LExpr *constr = dtypeRdr.next(); if (constr->isAtom()) { // atom, construtor of arity 0 @@ -1159,8 +1159,8 @@ void SMTLIB2::readDeclareDatatypes(LExprList* sorts, LExprList* datatypes, bool } } -TermAlgebraConstructor* SMTLIB2::buildTermAlgebraConstructor(vstring constrName, TermList taSort, - Stack destructorNames, TermStack argSorts) { +TermAlgebraConstructor* SMTLIB2::buildTermAlgebraConstructor(std::string constrName, TermList taSort, + Stack destructorNames, TermStack argSorts) { if (isAlreadyKnownSymbol(constrName)) { USER_ERROR_EXPR("Redeclaring function symbol: " + constrName); } @@ -1183,7 +1183,7 @@ TermAlgebraConstructor* SMTLIB2::buildTermAlgebraConstructor(vstring constrName, Lib::Array destructorFunctors(arity); for (unsigned i = 0; i < arity; i++) { - vstring destructorName = destructorNames[i]; + std::string destructorName = destructorNames[i]; TermList destructorSort = argSorts[i]; if (isAlreadyKnownSymbol(destructorName)) { @@ -1271,7 +1271,7 @@ TermList SMTLIB2::ParseResult::asTerm(TermList& resTrm) } } -vstring SMTLIB2::ParseResult::toString() +std::string SMTLIB2::ParseResult::toString() { if (isSeparator()) { return "separator"; @@ -1325,7 +1325,7 @@ Interpretation SMTLIB2::getFormulaSymbolInterpretation(FormulaSymbol fs, TermLis default: ASSERTION_VIOLATION; } - USER_ERROR_EXPR("invalid sort "+ firstArgSort.toString() +" for interpretation "+vstring(s_formulaSymbolNameStrings[fs])); + USER_ERROR_EXPR("invalid sort "+ firstArgSort.toString() +" for interpretation "+std::string(s_formulaSymbolNameStrings[fs])); } Interpretation SMTLIB2::getUnaryMinusInterpretation(TermList argSort) @@ -1377,10 +1377,10 @@ Interpretation SMTLIB2::getTermSymbolInterpretation(TermSymbol ts, TermList firs default: ASSERTION_VIOLATION_REP(ts); } - USER_ERROR_EXPR("invalid sort "+firstArgSort.toString()+" for interpretation "+vstring(s_termSymbolNameStrings[ts])); + USER_ERROR_EXPR("invalid sort "+firstArgSort.toString()+" for interpretation "+std::string(s_termSymbolNameStrings[ts])); } -void SMTLIB2::complainAboutArgShortageOrWrongSorts(const vstring& symbolClass, LExpr* exp) +void SMTLIB2::complainAboutArgShortageOrWrongSorts(const std::string& symbolClass, LExpr* exp) { USER_ERROR_EXPR("Not enough arguments or wrong sorts for "+symbolClass+" application '"+exp->toString()+"'"); } @@ -1453,7 +1453,7 @@ void SMTLIB2::parseLetPrepareLookup(LExpr* exp) LExprList* pair = bindRdr.readList(); LispListReader pRdr(pair); - const vstring& cName = pRdr.readAtom(); + const std::string& cName = pRdr.readAtom(); ParseResult* pr = (--boundExprs); TermList t; TermList sort = pr->asTerm(t); @@ -1529,7 +1529,7 @@ void SMTLIB2::parseLetEnd(LExpr* exp) // so we know it is let ASS(exp->isList()); LispListReader lRdr(exp->list); - DEBUG_CODE(const vstring& theLetAtom =) + DEBUG_CODE(const std::string& theLetAtom =) lRdr.readAtom(); ASS_EQ(getBuiltInTermSymbol(theLetAtom),TS_LET); @@ -1548,7 +1548,7 @@ void SMTLIB2::parseLetEnd(LExpr* exp) LExprList* pair = bindRdr.readList(); LispListReader pRdr(pair); - const vstring& cName = pRdr.readAtom(); + const std::string& cName = pRdr.readAtom(); TermList boundExpr; _results.pop().asTerm(boundExpr); @@ -1581,7 +1581,7 @@ void SMTLIB2::parseLetEnd(LExpr* exp) static const char *UNDERSCORE = "_"; -bool SMTLIB2::isTermAlgebraConstructor(const vstring &name) +bool SMTLIB2::isTermAlgebraConstructor(const std::string &name) { if (_declaredSymbols.find(name)) { DeclaredSymbol &s = _declaredSymbols.get(name); @@ -1599,7 +1599,7 @@ void SMTLIB2::parseMatchBegin(LExpr *exp) LispListReader lRdr(exp->list); // the match atom - DEBUG_CODE(const vstring &theMatchAtom =) lRdr.readAtom(); + DEBUG_CODE(const std::string &theMatchAtom =) lRdr.readAtom(); ASS_EQ(theMatchAtom, MATCH); // next is the matched term @@ -1739,7 +1739,7 @@ void SMTLIB2::parseMatchEnd(LExpr *exp) ASS(exp->isList()); LispListReader lRdr(exp->list); - DEBUG_CODE(const vstring &theMatchAtom =) lRdr.readAtom(); + DEBUG_CODE(const std::string &theMatchAtom =) lRdr.readAtom(); ASS_EQ(getBuiltInTermSymbol(theMatchAtom), TS_MATCH); lRdr.readNext(); // the matched term @@ -1844,7 +1844,7 @@ void SMTLIB2::parseQuantBegin(LExpr* exp) LispListReader lRdr(exp->list); // the quant atom - DEBUG_CODE(const vstring& theQuantAtom =) + DEBUG_CODE(const std::string& theQuantAtom =) lRdr.readAtom(); ASS(theQuantAtom == FORALL || theQuantAtom == EXISTS); _todo.push(make_pair(PO_QUANT,exp)); @@ -1856,7 +1856,7 @@ void SMTLIB2::parseQuantBegin(LExpr* exp) LExprList* pair = varRdr.readList(); LispListReader pRdr(pair); - vstring vName = pRdr.readAtom(); + std::string vName = pRdr.readAtom(); if(!pRdr.hasNext()) { USER_ERROR_EXPR("No associated sort for "+vName+" in quantification "+exp->toString()); } @@ -1886,7 +1886,7 @@ void SMTLIB2::parseQuantEnd(LExpr* exp) LExprList* pair = varRdr.readList(); LispListReader pRdr(pair); - vstring vName = pRdr.readAtom(); + std::string vName = pRdr.readAtom(); ASS(pRdr.hasNext()); ParseResult pr = _results.pop(); TermList vSort; @@ -1971,7 +1971,7 @@ void SMTLIB2::parseAnnotatedTerm(LExpr* exp) } -bool SMTLIB2::parseAsScopeLookup(const vstring& id) +bool SMTLIB2::parseAsScopeLookup(const std::string& id) { Scopes::Iterator sIt(_scopes); while (sIt.hasNext()) { @@ -1987,9 +1987,9 @@ bool SMTLIB2::parseAsScopeLookup(const vstring& id) return false; } -bool SMTLIB2::parseAsSortDefinition(const vstring& id,LExpr* exp) +bool SMTLIB2::parseAsSortDefinition(const std::string& id,LExpr* exp) { - vstring pId = id + TYPECON_POSTFIX; + std::string pId = id + TYPECON_POSTFIX; auto def = _sortDefinitions.findPtr(pId); if (!def) { return false; @@ -2004,7 +2004,7 @@ bool SMTLIB2::parseAsSortDefinition(const vstring& id,LExpr* exp) } TermList arg; ALWAYS(_results.pop().asTerm(arg) == AtomicSort::superSort()); - const vstring& argName = argRdr.readAtom(); + const std::string& argName = argRdr.readAtom(); // TODO: could check if the same string names more than one argument positions // the following just takes the first and ignores the others lookup->insert(argName,make_pair(arg,AtomicSort::superSort())); @@ -2018,7 +2018,7 @@ bool SMTLIB2::parseAsSortDefinition(const vstring& id,LExpr* exp) return true; } -bool SMTLIB2::parseAsSpecConstant(const vstring& id) +bool SMTLIB2::parseAsSpecConstant(const std::string& id) { if (StringUtils::isPositiveInteger(id)) { if (_numeralsAreReal) { @@ -2045,7 +2045,7 @@ bool SMTLIB2::parseAsSpecConstant(const vstring& id) return false; } -bool SMTLIB2::parseAsUserDefinedSymbol(const vstring& id,LExpr* exp,bool isSort) +bool SMTLIB2::parseAsUserDefinedSymbol(const std::string& id,LExpr* exp,bool isSort) { DeclaredSymbol sym; if (!_declaredSymbols.find(id+(isSort?TYPECON_POSTFIX:""),sym)) { @@ -2131,7 +2131,7 @@ bool SMTLIB2::parseAsUserDefinedSymbol(const vstring& id,LExpr* exp,bool isSort) static const char* BUILT_IN_SYMBOL = "built-in symbol"; -bool SMTLIB2::parseAsBuiltinFormulaSymbol(const vstring& id, LExpr* exp) +bool SMTLIB2::parseAsBuiltinFormulaSymbol(const std::string& id, LExpr* exp) { FormulaSymbol fs = getBuiltInFormulaSymbol(id); switch (fs) { @@ -2414,7 +2414,7 @@ bool SMTLIB2::parseAsBuiltinFormulaSymbol(const vstring& id, LExpr* exp) } } -bool SMTLIB2::parseAsBuiltinTermSymbol(const vstring& id, LExpr* exp) +bool SMTLIB2::parseAsBuiltinTermSymbol(const std::string& id, LExpr* exp) { // try built-in term symbols TermSymbol ts = getBuiltInTermSymbol(id); @@ -2667,7 +2667,7 @@ void SMTLIB2::parseRankedFunctionApplication(LExpr* exp) if(headRdr.tryAcceptAtom("divisible")){ - const vstring& numeral = headRdr.readAtom(); + const std::string& numeral = headRdr.readAtom(); if (!StringUtils::isPositiveInteger(numeral)) { USER_ERROR_EXPR("Expected numeral as an argument of a ranked function in "+head->toString()); @@ -2691,7 +2691,7 @@ void SMTLIB2::parseRankedFunctionApplication(LExpr* exp) } else if(headRdr.tryAcceptAtom("is")){ // discriminator predicate for term algebras - const vstring& consName = headRdr.readAtom(); + const std::string& consName = headRdr.readAtom(); if (_declaredSymbols.find(consName)) { DeclaredSymbol& s = _declaredSymbols.get(consName); @@ -2760,7 +2760,7 @@ SMTLIB2::ParseResult SMTLIB2::parseTermOrFormula(LExpr* body, bool isSort) // special treatment of some tokens LExpr* fst = lRdr.readNext(); if (fst->isAtom()) { - vstring& id = fst->str; + std::string& id = fst->str; if (id == FORALL || id == EXISTS) { parseQuantBegin(exp); @@ -2821,7 +2821,7 @@ SMTLIB2::ParseResult SMTLIB2::parseTermOrFormula(LExpr* body, bool isSort) // INTENTIONAL FALL-THROUGH FOR ATOMS } case PO_PARSE_APPLICATION: { // the arguments have already been parsed - vstring id; + std::string id; if (exp->isAtom()) { // the fall-through case id = exp->str; } else { @@ -2877,7 +2877,7 @@ SMTLIB2::ParseResult SMTLIB2::parseTermOrFormula(LExpr* body, bool isSort) } } case PO_PARSE_SORT_APPLICATION: { // the arguments have already been parsed - vstring id; + std::string id; if (exp->isAtom()) { // the fall-through case id = exp->str; } else { @@ -2924,7 +2924,7 @@ SMTLIB2::ParseResult SMTLIB2::parseTermOrFormula(LExpr* body, bool isSort) case PO_LABEL: { ASS_GE(_results.size(),1); ParseResult res = _results.pop(); - vstring label = exp->toString(); + std::string label = exp->toString(); res.setLabel(label); _results.push(res); continue; @@ -3057,7 +3057,7 @@ Signature::Symbol* SMTLIB2::getSymbol(DeclaredSymbol& s) { return sym; } -void SMTLIB2::colorSymbol(const vstring& name, Color color) +void SMTLIB2::colorSymbol(const std::string& name, Color color) { if (!_declaredSymbols.find(name)) { USER_ERROR_EXPR("'"+name+"' is not a user symbol"); @@ -3070,7 +3070,7 @@ void SMTLIB2::colorSymbol(const vstring& name, Color color) sym->addColor(color); } -void SMTLIB2::markSymbolUncomputable(const vstring& name) +void SMTLIB2::markSymbolUncomputable(const std::string& name) { if (!_declaredSymbols.find(name)) { USER_ERROR("'"+name+"' is not a user symbol"); diff --git a/Parse/SMTLIB2.hpp b/Parse/SMTLIB2.hpp index aee3c1edf6..3a32d0bcd6 100644 --- a/Parse/SMTLIB2.hpp +++ b/Parse/SMTLIB2.hpp @@ -70,7 +70,7 @@ class SMTLIB2 { return _logic; } - const vstring& getStatus() const { + const std::string& getStatus() const { return _statusStr; } @@ -81,7 +81,7 @@ class SMTLIB2 { /** * Maps a string to a SmtlibLogic value. */ - static SMTLIBLogic getLogicFromString(const vstring& str); + static SMTLIBLogic getLogicFromString(const std::string& str); /** * Have we seen "set-logic" entry yet? @@ -104,17 +104,17 @@ class SMTLIB2 { /** * Handle "set-logic" entry. */ - void readLogic(const vstring& logicStr); + void readLogic(const std::string& logicStr); /** Content of the ":status: info entry. */ - vstring _statusStr; + std::string _statusStr; /** Content of the ":source: info entry. */ - vstring _sourceInfo; + std::string _sourceInfo; /** * Handle "declare-sort" entry. */ - void readDeclareSort(const vstring& name, const vstring& arity); + void readDeclareSort(const std::string& name, const std::string& arity); /** * Sort definition is a macro (with arguments) for a complex sort expression. @@ -137,12 +137,12 @@ class SMTLIB2 { /** * Maps smtlib name of a defined sort to its SortDefinition struct. */ - DHMap _sortDefinitions; + DHMap _sortDefinitions; /** * Handle "define-sort" entry. */ - void readDefineSort(const vstring& name, LExprList* args, LExpr* body); + void readDefineSort(const std::string& name, LExprList* args, LExpr* body); /** * Helper funtion to check that a parsed sort is indeed a sort. @@ -178,9 +178,9 @@ class SMTLIB2 { static const char * s_formulaSymbolNameStrings[]; /** - * Lookup to see if vstring is a built-in FormulaSymbol. + * Lookup to see if std::string is a built-in FormulaSymbol. */ - static FormulaSymbol getBuiltInFormulaSymbol(const vstring& str); + static FormulaSymbol getBuiltInFormulaSymbol(const std::string& str); /** * Some built-in symbols represent functions with not-Bool result of sort @@ -212,15 +212,15 @@ class SMTLIB2 { static const char * s_termSymbolNameStrings[]; /** - * Lookup to see if vstring is a built-in TermSymbol. + * Lookup to see if std::string is a built-in TermSymbol. */ - static TermSymbol getBuiltInTermSymbol(const vstring& str); + static TermSymbol getBuiltInTermSymbol(const std::string& str); /** - * Is the given vstring a built-in FormulaSymbol, built-in TermSymbol + * Is the given std::string a built-in FormulaSymbol, built-in TermSymbol * or a declared function/predicate/type constructor? */ - bool isAlreadyKnownSymbol(const vstring& name); + bool isAlreadyKnownSymbol(const std::string& name); enum class SymbolType { FUNCTION, @@ -230,7 +230,7 @@ class SMTLIB2 { /** */ typedef std::pair DeclaredSymbol; /** symbols are implicitly declared also when they are defined (see below) */ - DHMap _declaredSymbols; + DHMap _declaredSymbols; /** * Given a symbol name, range sort (which can be Bool) and argSorts, @@ -238,14 +238,14 @@ class SMTLIB2 { * store the ensuing DeclaredSymbol in _declaredSymbols * and return it. */ - DeclaredSymbol declareFunctionOrPredicate(const vstring& name, TermList rangeSort, const TermStack& argSorts, unsigned taArity); + DeclaredSymbol declareFunctionOrPredicate(const std::string& name, TermList rangeSort, const TermStack& argSorts, unsigned taArity); /** * Handle "declare-fun" entry. * * Declaring a function just extends the signature. */ - void readDeclareFun(const vstring& name, LExprList* iSorts, LExpr* oSort, unsigned taArity); + void readDeclareFun(const std::string& name, LExprList* iSorts, LExpr* oSort, unsigned taArity); /** * Handle "define-fun[-rec]" entry. @@ -253,7 +253,7 @@ class SMTLIB2 { * Defining a function extends the signature and adds the new function's definition into _formulas. * Additionally, the "define-fun-rec" variant allows the defined function to be present inside the definition, allowing recursion. */ - void readDefineFun(const vstring& name, LExprList* iArgs, LExpr* oSort, LExpr* body, const TermStack& typeArgs, bool recursive); + void readDefineFun(const std::string& name, LExprList* iArgs, LExpr* oSort, LExpr* body, const TermStack& typeArgs, bool recursive); /** * Handle "define-funs-rec" entry. * @@ -265,8 +265,8 @@ class SMTLIB2 { void readDeclareDatatypes(LExprList* sorts, LExprList* datatypes, bool codatatype = false); - TermAlgebraConstructor* buildTermAlgebraConstructor(vstring constrName, TermList taSort, - Stack destructorNames, TermStack argSorts); + TermAlgebraConstructor* buildTermAlgebraConstructor(std::string constrName, TermList taSort, + Stack destructorNames, TermStack argSorts); /** * Parse result of parsing an smtlib term (which can be of sort Bool and therefore represented in vampire by a formula) @@ -290,7 +290,7 @@ class SMTLIB2 { bool formula; /** The label assigned to this formula using the ":named" annotation of SMT-LIB2; * empty string means no label. */ - vstring label; + std::string label; union { Formula* frm; TermList trm; @@ -312,7 +312,7 @@ class SMTLIB2 { * Records a label for the formula represented by this `ParserResult`, * resulting from a ":named" SMT-LIB2 annotation. */ - void setLabel(vstring l){ label = l; } + void setLabel(std::string l){ label = l; } /** * Helper that attaches a label to a `Formula` * if a label is recorded for this `ParserResult`. @@ -320,7 +320,7 @@ class SMTLIB2 { */ Formula* attachLabelToFormula(Formula* frm); - vstring toString(); + std::string toString(); }; /** Return Theory::Interpretation for overloaded arithmetic comparison operators based on their argSort (either Int or Real) */ @@ -339,7 +339,7 @@ class SMTLIB2 { /** < termlist, vampire sort id > */ typedef std::pair SortedTerm; /** mast an identifier to SortedTerm */ - typedef DHMap TermLookup; + typedef DHMap TermLookup; typedef Stack Scopes; /** Stack of parsing contexts: * for variables from quantifiers and @@ -385,7 +385,7 @@ class SMTLIB2 { // a few helper functions enabling the body of parseTermOrFormula be of reasonable size - [[noreturn]] void complainAboutArgShortageOrWrongSorts(const vstring& symbolClass, LExpr* exp); + [[noreturn]] void complainAboutArgShortageOrWrongSorts(const std::string& symbolClass, LExpr* exp); /** * Read `[vars]` from a `(par ([vars]) body)` block into `lookup`. @@ -397,7 +397,7 @@ class SMTLIB2 { void parseLetPrepareLookup(LExpr* exp); void parseLetEnd(LExpr* exp); - bool isTermAlgebraConstructor(const vstring& name); + bool isTermAlgebraConstructor(const std::string& name); void parseMatchBegin(LExpr* exp); void parseMatchCaseStart(LExpr* exp); void parseMatchCaseEnd(LExpr* exp); @@ -411,18 +411,18 @@ class SMTLIB2 { void parseAnnotatedTerm(LExpr* exp); /** Scope's are filled by forall, exists, and let */ - bool parseAsScopeLookup(const vstring& id); - bool parseAsSortDefinition(const vstring& id, LExpr* exp); + bool parseAsScopeLookup(const std::string& id); + bool parseAsSortDefinition(const std::string& id, LExpr* exp); /** Currently either numeral or decimal */ - bool parseAsSpecConstant(const vstring& id); + bool parseAsSpecConstant(const std::string& id); /** Declared or defined functions (and predicates) - which includes 0-arity ones */ - bool parseAsUserDefinedSymbol(const vstring& id, LExpr* exp, bool isSort); + bool parseAsUserDefinedSymbol(const std::string& id, LExpr* exp, bool isSort); /** Whatever is built-in and looks like a formula from vampire perspective (see FormulaSymbol) * - includes the second half of parsing quantifiers */ - bool parseAsBuiltinFormulaSymbol(const vstring& id, LExpr* exp); + bool parseAsBuiltinFormulaSymbol(const std::string& id, LExpr* exp); /** Whatever is built-in and looks like a term from vampire perspective (see TermSymbol) * - excludes parts for dealing with let */ - bool parseAsBuiltinTermSymbol(const vstring& id, LExpr* exp); + bool parseAsBuiltinTermSymbol(const std::string& id, LExpr* exp); /** Parsing things like "((_ divisible 5) x)" */ void parseRankedFunctionApplication(LExpr* exp); @@ -492,14 +492,14 @@ class SMTLIB2 { * * Behaves like conjecture declaration in TPTP */ - void colorSymbol(const vstring& name, Color color); + void colorSymbol(const std::string& name, Color color); /** * Unofficial option * * Disallows a symbol in synthesized program */ - void markSymbolUncomputable(const vstring& name); + void markSymbolUncomputable(const std::string& name); /** * Units collected during parsing. @@ -510,7 +510,7 @@ class SMTLIB2 { * To support a mechanism for dealing with large arithmetic constants. * Adapted from the tptp parser. */ - Set _overflow; + Set _overflow; /** * Top-level expression that is parsed presently. diff --git a/Parse/TPTP.cpp b/Parse/TPTP.cpp index b5f93b307b..86b7070f6d 100644 --- a/Parse/TPTP.cpp +++ b/Parse/TPTP.cpp @@ -48,7 +48,7 @@ using namespace Parse; #define DEBUG_SHOW_TOKENS 0 #define DEBUG_SHOW_UNITS 0 #define DEBUG_SOURCE 0 -DHMap TPTP::_axiomNames; +DHMap TPTP::_axiomNames; //Numbers chosen to avoid clashing with connectives. //Unlikely to ever have 100 connectives, so this should be ok. @@ -273,7 +273,7 @@ void TPTP::parseImpl() break; default: #if VDEBUG - throw ParseErrorException(((vstring)"Don't know how to process state ")+toString(s),_lineNumber); + throw ParseErrorException(((std::string)"Don't know how to process state ")+toString(s),_lineNumber); #else throw ParseErrorException("Don't know how to process state ",_lineNumber); #endif @@ -290,9 +290,9 @@ void TPTP::parseImpl() * Return either the content or the string for this token * @since 11/04/2011 Manchester */ -vstring TPTP::Token::toString() const +std::string TPTP::Token::toString() const { - vstring str = TPTP::toString(tag); + std::string str = TPTP::toString(tag); return str == "" ? content : str; } // Token::toString @@ -301,7 +301,7 @@ vstring TPTP::Token::toString() const * is not fixed (e.g. for T_NAME) * @since 11/04/2011 Manchester */ -vstring TPTP::toString(Tag tag) +std::string TPTP::toString(Tag tag) { switch (tag) { case T_EOF: @@ -730,13 +730,13 @@ void TPTP::skipWhiteSpacesAndComments() // Only check for Status if in preamble before any units read (also only in the top level file, not in includes) if(_units.list() == 0 && _inputs.isEmpty()){ _chars[n]='\0'; - vstring cline(_chars.content()); - if(cline.find("Status")!=vstring::npos){ - if(cline.find("Theorem")!=vstring::npos){ UIHelper::setExpectingUnsat(); } - else if(cline.find("Unsatisfiable")!=vstring::npos){ UIHelper::setExpectingUnsat(); } - else if(cline.find("ContradictoryAxioms")!=vstring::npos){ UIHelper::setExpectingUnsat(); } - else if(cline.find("Satisfiable")!=vstring::npos){ UIHelper::setExpectingSat(); } - else if(cline.find("CounterSatisfiable")!=vstring::npos){ UIHelper::setExpectingSat(); } + std::string cline(_chars.content()); + if(cline.find("Status")!=std::string::npos){ + if(cline.find("Theorem")!=std::string::npos){ UIHelper::setExpectingUnsat(); } + else if(cline.find("Unsatisfiable")!=std::string::npos){ UIHelper::setExpectingUnsat(); } + else if(cline.find("ContradictoryAxioms")!=std::string::npos){ UIHelper::setExpectingUnsat(); } + else if(cline.find("Satisfiable")!=std::string::npos){ UIHelper::setExpectingSat(); } + else if(cline.find("CounterSatisfiable")!=std::string::npos){ UIHelper::setExpectingSat(); } } } #endif @@ -1069,12 +1069,12 @@ void TPTP::readAtom(Token& tok) } } // readAtom -TPTP::ParseErrorException::ParseErrorException(vstring message,int pos, unsigned ln) : _ln(ln) +TPTP::ParseErrorException::ParseErrorException(std::string message,int pos, unsigned ln) : _ln(ln) { _message = message + " at position " + Int::toString(pos); } // TPTP::ParseErrorException::ParseErrorException -TPTP::ParseErrorException::ParseErrorException(vstring message,Token& tok, unsigned ln) : _ln(ln) +TPTP::ParseErrorException::ParseErrorException(std::string message,Token& tok, unsigned ln) : _ln(ln) { _message = message + " at position " + Int::toString(tok.start) + " (text: " + tok.toString() + ')'; } // TPTP::ParseErrorException::ParseErrorException @@ -1236,7 +1236,7 @@ void TPTP::unitList() if (tok.tag != T_NAME) { PARSE_ERROR("cnf(), fof(), vampire() or include() expected",tok); } - vstring name(tok.content); + std::string name(tok.content); _states.push(UNIT_LIST); if (name == "cnf") { _states.push(CNF); @@ -1304,7 +1304,7 @@ void TPTP::fof(bool fo) consumeToken(T_COMMA); tok = getTok(0); int start = tok.start; - vstring tp = name(); + std::string tp = name(); _isQuestion = false; if(_modelDefinition){ @@ -1343,7 +1343,7 @@ void TPTP::fof(bool fo) USER_ERROR("Unsupported unit type '", tp, "' found"); } else { - PARSE_ERROR((vstring)"unit type, such as axiom or definition expected but " + tp + " found", + PARSE_ERROR((std::string)"unit type, such as axiom or definition expected but " + tp + " found", start); } consumeToken(T_COMMA); @@ -1381,7 +1381,7 @@ void TPTP::tff() consumeToken(T_COMMA); tok = getTok(0); int start = tok.start; - vstring tp = name(); + std::string tp = name(); if (tp == "type") { // Read a TPTP type declaration. consumeToken(T_COMMA); @@ -1396,7 +1396,7 @@ void TPTP::tff() lpars++; resetToks(); } - vstring nm = name(); + std::string nm = name(); consumeToken(T_COLON); if(_isThf){ tok = getTok(0); @@ -1470,7 +1470,7 @@ void TPTP::tff() _lastInputType = UnitInputType::CLAIM; } else { - PARSE_ERROR((vstring)"unit type, such as axiom or definition expected but " + tp + " found", + PARSE_ERROR((std::string)"unit type, such as axiom or definition expected but " + tp + " found", start); } consumeToken(T_COMMA); @@ -1614,7 +1614,7 @@ void TPTP::holTerm() Token tok = getTok(0); resetToks(); - vstring name = tok.content; + std::string name = tok.content; unsigned arity = _typeArities.find(name) ? _typeArities.get(name) : 0; switch (tok.tag) { @@ -1676,7 +1676,7 @@ void TPTP::holTerm() } -vstring TPTP::convert(Tag t) +std::string TPTP::convert(Tag t) { switch(t){ case T_AND: @@ -1772,7 +1772,7 @@ void TPTP::endHolFormula() } case LITERAL: default: - throw ::Exception((vstring)"tell me how to handle connective " + Int::toString(con)); + throw ::Exception((std::string)"tell me how to handle connective " + Int::toString(con)); } Token& tok = getTok(0); @@ -2065,9 +2065,9 @@ void TPTP::include() consumeToken(T_LPAR); Token& tok = getTok(0); if (tok.tag != T_NAME) { - PARSE_ERROR((vstring)"file name expected",tok); + PARSE_ERROR((std::string)"file name expected",tok); } - vstring relativeName=tok.content; + std::string relativeName=tok.content; resetToks(); bool ignore = _forbiddenIncludes.contains(relativeName); if (!ignore) { @@ -2080,16 +2080,16 @@ void TPTP::include() tok = getTok(0); if (tok.tag == T_COMMA) { if (!ignore) { - _allowedNames = new Set; + _allowedNames = new Set; } resetToks(); consumeToken(T_LBRA); for(;;) { tok = getTok(0); if (tok.tag != T_NAME) { - PARSE_ERROR((vstring)"formula name expected",tok); + PARSE_ERROR((std::string)"formula name expected",tok); } - vstring axName=tok.content; + std::string axName=tok.content; resetToks(); if (!ignore) { _allowedNames->insert(axName); @@ -2111,15 +2111,15 @@ void TPTP::include() // here should be a computation of the new include directory according to // the TPTP standard, so far we just set it to "" _includeDirectory = ""; - vstring fileName(env.options->includeFileName(relativeName)); + std::string fileName(env.options->includeFileName(relativeName)); _in = new ifstream(fileName.c_str()); if (!*_in) { - USER_ERROR((vstring)"cannot open file " + fileName); + USER_ERROR((std::string)"cannot open file " + fileName); } } // include /** add a file name to the list of forbidden includes */ -void TPTP::addForbiddenInclude(vstring file) +void TPTP::addForbiddenInclude(std::string file) { _forbiddenIncludes.insert(file); } @@ -2128,13 +2128,13 @@ void TPTP::addForbiddenInclude(vstring file) * Read the next token that must be a name. * @since 10/04/2011 Manchester */ -vstring TPTP::name() +std::string TPTP::name() { Token& tok = getTok(0); if (tok.tag != T_NAME) { PARSE_ERROR("name expected",tok); } - vstring nm = tok.content; + std::string nm = tok.content; resetToks(); return nm; } // name @@ -2147,7 +2147,7 @@ void TPTP::consumeToken(Tag t) { Token& tok = getTok(0); if (tok.tag != t) { - vstring expected = toString(t); + std::string expected = toString(t); PARSE_ERROR(expected + " expected",tok); } resetToks(); @@ -2333,7 +2333,7 @@ void TPTP::letType() void TPTP::endLetTypes() { - vstring name = _strings.pop(); + std::string name = _strings.pop(); Type* t = _types.pop(); OperatorType* type = constructOperatorType(t); @@ -2463,7 +2463,7 @@ void TPTP::midDefinition() void TPTP::symbolDefinition() { - vstring nm = _strings.pop(); + std::string nm = _strings.pop(); unsigned arity = 0; VList* vs = VList::empty(); @@ -2538,11 +2538,11 @@ void TPTP::symbolDefinition() */ void TPTP::tupleDefinition() { - Set uniqueConstants; + Set uniqueConstants; Stack symbols; TermStack sorts; - vstring constant = _strings.pop(); + std::string constant = _strings.pop(); do { if (uniqueConstants.contains(constant)) { USER_ERROR("The symbol " + constant + " is defined twice in a tuple $let-expression."); @@ -2606,8 +2606,8 @@ void TPTP::endDefinition() { : env.signature->getFunction(symbol)->fnType()->result(); if (refSort != definitionSort) { - vstring definitionSortName = definitionSort.toString(); - vstring refSymbolName = isPredicate + std::string definitionSortName = definitionSort.toString(); + std::string refSymbolName = isPredicate ? env.signature->predicateName(symbol) : env.signature->functionName(symbol); OperatorType* type = isPredicate @@ -2908,7 +2908,7 @@ void TPTP::term() */ void TPTP::endTerm() { - vstring name = _strings.pop(); + std::string name = _strings.pop(); if (name == toString(T_ITE)) { _states.push(END_ITE); @@ -2977,7 +2977,7 @@ void TPTP::formulaInfix() return; } - vstring name = _strings.pop(); + std::string name = _strings.pop(); if (name == toString(T_ITE)) { _states.push(END_TERM_AS_FORMULA); @@ -3112,7 +3112,7 @@ Literal* TPTP::createEquality(bool polarity,TermList& lhs,TermList& rhs) * the arguments are assumed to be on the _termLists stack. * @since 27/03/1015 Manchester */ -Formula* TPTP::createPredicateApplication(vstring name, unsigned arity) +Formula* TPTP::createPredicateApplication(std::string name, unsigned arity) { ASS_GE(_termLists.size(), arity); @@ -3193,7 +3193,7 @@ Formula* TPTP::createPredicateApplication(vstring name, unsigned arity) * the arguments are assumed to be on the _termLists stack. * @since 13/04/2015 Gothenburg, major changes to support FOOL */ -TermList TPTP::createFunctionApplication(vstring name, unsigned arity) +TermList TPTP::createFunctionApplication(std::string name, unsigned arity) { //TODO update to deal with wierd /\ @ ... syntax ASS_GE(_termLists.size(), arity); @@ -3241,7 +3241,7 @@ TermList TPTP::createFunctionApplication(vstring name, unsigned arity) * the arguments are assumed to be on the _termLists stack. * @since 13/04/2015 Gothenburg, major changes to support FOOL */ -TermList TPTP::createTypeConApplication(vstring name, unsigned arity) +TermList TPTP::createTypeConApplication(std::string name, unsigned arity) { ASS_GE(_termLists.size(), arity); @@ -3302,7 +3302,7 @@ void TPTP::endFormula() return; case LITERAL: default: - throw ::Exception((vstring)"tell me how to handle connective " + Int::toString(con)); + throw ::Exception((std::string)"tell me how to handle connective " + Int::toString(con)); } Token& tok = getTok(0); @@ -3548,7 +3548,7 @@ void TPTP::endFof() bool isFof = _bools.pop(); Formula* f = _formulas.pop(); - vstring nm = _strings.pop(); // unit name + std::string nm = _strings.pop(); // unit name if (_allowedNames && !_allowedNames->contains(nm)) { return; } @@ -3587,7 +3587,7 @@ void TPTP::endFof() positive = !positive; } if (g->connective() != LITERAL) { - USER_ERROR((vstring)"input formula not in CNF: " + f->toString()); + USER_ERROR((std::string)"input formula not in CNF: " + f->toString()); } Literal* l = static_cast(g)->literal(); lits.push(positive ? l : Literal::complementaryLiteral(l)); @@ -3599,7 +3599,7 @@ void TPTP::endFof() case FALSE: break; default: - USER_ERROR((vstring)"input formula not in CNF: " + f->toString()); + USER_ERROR((std::string)"input formula not in CNF: " + f->toString()); } } unit = Clause::fromStack(lits,FromInput(_lastInputType)); @@ -3678,7 +3678,7 @@ void TPTP::endFof() * with a fresh predicate symbol (of name nm) and return that one. * The new symbo is marked not to be eliminated during preprocessing. */ -Unit* TPTP::processClaimFormula(Unit* unit, Formula * f, const vstring& nm) +Unit* TPTP::processClaimFormula(Unit* unit, Formula * f, const std::string& nm) { bool added; unsigned pred = env.signature->addPredicate(nm,0,added); @@ -3726,7 +3726,7 @@ void TPTP::endTff() ASS(_types.isEmpty()); OperatorType* ot = constructOperatorType(t); - vstring name = _strings.pop(); + std::string name = _strings.pop(); unsigned arity = ot->arity(); bool isPredicate = ot->isPredicateType() && !_isThf; @@ -3888,11 +3888,11 @@ TPTP::SourceRecord* TPTP::getSource() //file if(source_kind.content == "file"){ - vstring fileName = getTok(0).content; + std::string fileName = getTok(0).content; resetToks(); consumeToken(T_COMMA); resetToks(); - vstring nameInFile = getTok(0).content; + std::string nameInFile = getTok(0).content; resetToks(); // cout << "Creating file source record for " << fileName << " and " << nameInFile << endl; @@ -3903,7 +3903,7 @@ TPTP::SourceRecord* TPTP::getSource() // inference else if(source_kind.content == "inference" || source_kind.content == "introduced"){ bool introduced = (source_kind.content == "introduced"); - vstring name = getTok(0).content; + std::string name = getTok(0).content; resetToks(); // cout << "Creating inference source record for " << name << endl; @@ -3938,7 +3938,7 @@ TPTP::SourceRecord* TPTP::getSource() PARSE_ERROR("Source unit name expected",tok); } - vstring premise = tok.content; + std::string premise = tok.content; tok = getTok(0); if (tok.tag != T_COMMA && tok.tag != T_RBRA) { @@ -4236,7 +4236,7 @@ TermList TPTP::readSort() case T_NAME: { unsigned arity = 0; - vstring fname = tok.content; + std::string fname = tok.content; if(_isThf){ arity = _typeConstructorArities.find(fname) ? _typeConstructorArities.get(fname) : 0; readTypeArgs(arity); @@ -4270,7 +4270,7 @@ TermList TPTP::readSort() } case T_VAR: { - vstring vname = tok.content; + std::string vname = tok.content; unsigned var = (unsigned)_vars.insert(vname); return TermList(var, false); } @@ -4355,7 +4355,7 @@ bool TPTP::higherPrecedence(int c1,int c2) ASSERTION_VIOLATION; } // higherPriority -bool TPTP::findInterpretedPredicate(vstring name, unsigned arity) { +bool TPTP::findInterpretedPredicate(std::string name, unsigned arity) { if (name == "$evaleq" || name == "$equal" || name == "$distinct") { return true; } @@ -4408,7 +4408,7 @@ Formula* TPTP::makeJunction (Connective c,Formula* lhs,Formula* rhs) * @param arg some argument of the function, require to resolve its type for overloaded * built-in functions */ -unsigned TPTP::addFunction(vstring name,int arity,bool& added,TermList& arg) +unsigned TPTP::addFunction(std::string name,int arity,bool& added,TermList& arg) { if (name == "$sum") { return addOverloadedFunction(name,arity,2,added,arg, @@ -4573,7 +4573,7 @@ unsigned TPTP::addFunction(vstring name,int arity,bool& added,TermList& arg) * @return the predicate number in the signature, or -1 if it is a different name for an equality * predicate */ -int TPTP::addPredicate(vstring name,int arity,bool& added,TermList& arg) +int TPTP::addPredicate(std::string name,int arity,bool& added,TermList& arg) { if (name == "$evaleq" || name == "$equal") { return -1; @@ -4631,7 +4631,7 @@ int TPTP::addPredicate(vstring name,int arity,bool& added,TermList& arg) } // addPredicate -unsigned TPTP::addOverloadedFunction(vstring name,int arity,int symbolArity,bool& added,TermList& arg, +unsigned TPTP::addOverloadedFunction(std::string name,int arity,int symbolArity,bool& added,TermList& arg, Theory::Interpretation integer,Theory::Interpretation rational, Theory::Interpretation real) { @@ -4642,7 +4642,7 @@ unsigned TPTP::addOverloadedFunction(vstring name,int arity,int symbolArity,bool TermList* n = arg.next(); for(int i=1;iaddInterpretedFunction(real,name); } - USER_ERROR((vstring)"The symbol " + name + " is used with a non-numeric type"); + USER_ERROR((std::string)"The symbol " + name + " is used with a non-numeric type"); } // addOverloadedFunction -unsigned TPTP::addOverloadedPredicate(vstring name,int arity,int symbolArity,bool& added,TermList& arg, +unsigned TPTP::addOverloadedPredicate(std::string name,int arity,int symbolArity,bool& added,TermList& arg, Theory::Interpretation integer,Theory::Interpretation rational, Theory::Interpretation real) { @@ -4672,7 +4672,7 @@ unsigned TPTP::addOverloadedPredicate(vstring name,int arity,int symbolArity,boo TermList* n = arg.next(); for(int i=1;iaddInterpretedPredicate(real,name); } - USER_ERROR((vstring)"The symbol " + name + " is used with a non-numeric type"); + USER_ERROR((std::string)"The symbol " + name + " is used with a non-numeric type"); } // addOverloadedPredicate /** @@ -4723,7 +4723,7 @@ TermList TPTP::sortOf(TermList t) } // sortOf /** - * Add an integer constant by reading it from the vstring name. + * Add an integer constant by reading it from the std::string name. * If it overflows, create an uninterpreted constant of the * integer type and the name 'name'. Check that the name of the constant * does not collide with user-introduced names of uninterpreted constants. @@ -4732,7 +4732,7 @@ TermList TPTP::sortOf(TermList t) * as terms of the default sort when fof() or cnf() is used * @author Andrei Voronkov */ -unsigned TPTP::addIntegerConstant(const vstring& name, Set& overflow, bool defaultSort) +unsigned TPTP::addIntegerConstant(const std::string& name, Set& overflow, bool defaultSort) { try { return env.signature->addIntegerConstant(name,defaultSort); @@ -4746,14 +4746,14 @@ unsigned TPTP::addIntegerConstant(const vstring& name, Set& overflow, b symbol->setType(OperatorType::getConstantsType(defaultSort ? AtomicSort::defaultSort() : AtomicSort::intSort())); } else if (!overflow.contains(name)) { - USER_ERROR((vstring)"Cannot use name '" + name + "' as an atom name since it collides with an integer number"); + USER_ERROR((std::string)"Cannot use name '" + name + "' as an atom name since it collides with an integer number"); } return fun; } } // TPTP::addIntegerConstant /** - * Add an rational constant by reading it from the vstring name. + * Add an rational constant by reading it from the std::string name. * If it overflows, create an uninterpreted constant of the * rational type and the name 'name'. Check that the name of the constant * does not collide with user-introduced names of uninterpreted constants. @@ -4762,10 +4762,10 @@ unsigned TPTP::addIntegerConstant(const vstring& name, Set& overflow, b * between treating rationals using fof() and tff() * @author Andrei Voronkov */ -unsigned TPTP::addRationalConstant(const vstring& name, Set& overflow, bool defaultSort) +unsigned TPTP::addRationalConstant(const std::string& name, Set& overflow, bool defaultSort) { size_t i = name.find_first_of("/"); - ASS(i != vstring::npos); + ASS(i != std::string::npos); try { return env.signature->addRationalConstant(name.substr(0,i), name.substr(i+1), @@ -4780,14 +4780,14 @@ unsigned TPTP::addRationalConstant(const vstring& name, Set& overflow, symbol->setType(OperatorType::getConstantsType(defaultSort ? AtomicSort::defaultSort() : AtomicSort::rationalSort())); } else if (!overflow.contains(name)) { - USER_ERROR((vstring)"Cannot use name '" + name + "' as an atom name since it collides with an rational number"); + USER_ERROR((std::string)"Cannot use name '" + name + "' as an atom name since it collides with an rational number"); } return fun; } } // TPTP::addRationalConstant /** - * Add an real constant by reading it from the vstring name. + * Add an real constant by reading it from the std::string name. * If it overflows, create an uninterpreted constant of the * real type and the name 'name'. Check that the name of the constant * does not collide with user-introduced names of uninterpreted constants. @@ -4796,7 +4796,7 @@ unsigned TPTP::addRationalConstant(const vstring& name, Set& overflow, * between treating rationals using fof() and tff() * @author Andrei Voronkov */ -unsigned TPTP::addRealConstant(const vstring& name, Set& overflow, bool defaultSort) +unsigned TPTP::addRealConstant(const std::string& name, Set& overflow, bool defaultSort) { try { return env.signature->addRealConstant(name,defaultSort); @@ -4810,7 +4810,7 @@ unsigned TPTP::addRealConstant(const vstring& name, Set& overflow, bool symbol->setType(OperatorType::getConstantsType(defaultSort ? AtomicSort::defaultSort() : AtomicSort::realSort())); } else if (!overflow.contains(name)) { - USER_ERROR((vstring)"Cannot use name '" + name + "' as an atom name since it collides with an real number"); + USER_ERROR((std::string)"Cannot use name '" + name + "' as an atom name since it collides with an real number"); } return fun; } @@ -4818,15 +4818,15 @@ unsigned TPTP::addRealConstant(const vstring& name, Set& overflow, bool /** - * Add an uninterpreted constant by reading it from the vstring name. + * Add an uninterpreted constant by reading it from the std::string name. * Check that the name of the constant does not collide with uninterpreted constants * created by the parser from overflown input numbers. * @since 22/07/2011 Manchester */ -unsigned TPTP::addUninterpretedConstant(const vstring& name, Set& overflow, bool& added) +unsigned TPTP::addUninterpretedConstant(const std::string& name, Set& overflow, bool& added) { if (overflow.contains(name)) { - USER_ERROR((vstring)"Cannot use name '" + name + "' as an atom name since it collides with an integer number"); + USER_ERROR((std::string)"Cannot use name '" + name + "' as an atom name since it collides with an integer number"); } //TODO make sure Vampire internal names are unique to Vampire //and cannot occur in the input AYB @@ -4843,7 +4843,7 @@ unsigned TPTP::addUninterpretedConstant(const vstring& name, Set& overf * Associate name @b name with unit @b unit * Each formula can have its name assigned at most once */ -void TPTP::assignAxiomName(const Unit* unit, vstring& name) +void TPTP::assignAxiomName(const Unit* unit, std::string& name) { ALWAYS(_axiomNames.insert(unit->number(), name)); } // TPTP::assignAxiomName @@ -4852,7 +4852,7 @@ void TPTP::assignAxiomName(const Unit* unit, vstring& name) * If @b unit has a name associated, assign it into @b result, * and return true; otherwise return false */ -bool TPTP::findAxiomName(const Unit* unit, vstring& result) +bool TPTP::findAxiomName(const Unit* unit, std::string& result) { return _axiomNames.find(unit->number(), result); } // TPTP::findAxiomName @@ -4864,11 +4864,11 @@ bool TPTP::findAxiomName(const Unit* unit, vstring& result) void TPTP::vampire() { consumeToken(T_LPAR); - vstring nm = name(); + std::string nm = name(); if (nm == "option") { // vampire(option,age_weight_ratio,3) consumeToken(T_COMMA); - vstring opt = name(); + std::string opt = name(); consumeToken(T_COMMA); Token tok = getTok(0); switch (tok.tag) { @@ -4885,7 +4885,7 @@ void TPTP::vampire() // Allows us to insert LaTeX templates for predicate and function symbols else if(nm == "latex"){ consumeToken(T_COMMA); - vstring kind = name(); + std::string kind = name(); bool pred; if (kind == "predicate") { pred = true; @@ -4897,7 +4897,7 @@ void TPTP::vampire() PARSE_ERROR("either 'predicate' or 'function' expected",getTok(0)); } consumeToken(T_COMMA); - vstring symb = name(); + std::string symb = name(); consumeToken(T_COMMA); Token tok = getTok(0); if (tok.tag != T_INT) { @@ -4913,11 +4913,11 @@ void TPTP::vampire() if(tok.tag != T_STRING){ PARSE_ERROR("a template string expected",tok); } - vstring temp = tok.content; + std::string temp = tok.content; resetToks(); if(pred){ consumeToken(T_COMMA); - vstring pol= name(); + std::string pol= name(); bool polarity; if(pol=="true"){polarity=true;}else if(pol=="false"){polarity=false;} else{ PARSE_ERROR("polarity expected (true/false)",getTok(0)); } @@ -4931,7 +4931,7 @@ void TPTP::vampire() } else if (nm == "symbol") { consumeToken(T_COMMA); - vstring kind = name(); + std::string kind = name(); bool pred; if (kind == "predicate") { pred = true; @@ -4943,7 +4943,7 @@ void TPTP::vampire() PARSE_ERROR("either 'predicate' or 'function' expected",getTok(0)); } consumeToken(T_COMMA); - vstring symb = name(); + std::string symb = name(); consumeToken(T_COMMA); Token tok = getTok(0); if (tok.tag != T_INT) { @@ -4957,7 +4957,7 @@ void TPTP::vampire() consumeToken(T_COMMA); Color color = COLOR_INVALID; bool skip = false, uncomputable = false; - vstring lr = name(); + std::string lr = name(); if (lr == "left") { color=COLOR_LEFT; } @@ -5001,7 +5001,7 @@ void TPTP::vampire() } else if (nm == "model_check"){ consumeToken(T_COMMA); - vstring command = name(); + std::string command = name(); if(command == "formulas_start"){ _modelDefinition = false; } @@ -5017,7 +5017,7 @@ void TPTP::vampire() else USER_ERROR("Unknown model_check command"); } else { - USER_ERROR((vstring)"Unknown vampire directive: "+nm); + USER_ERROR((std::string)"Unknown vampire directive: "+nm); } consumeToken(T_RPAR); consumeToken(T_DOT); @@ -5146,7 +5146,7 @@ void TPTP::printStacks() { while (cit.hasNext()) cout << " " << cit.next(); cout << endl; - Stack::Iterator sit(_strings); + Stack::Iterator sit(_strings); cout << "Strings:"; if (!sit.hasNext()) cout << " "; while (sit.hasNext()) cout << " " << sit.next(); @@ -5241,12 +5241,12 @@ void TPTP::printStacks() { unsigned i = lfs.length(); while (sit.hasNext()) { LetSymbol f = sit.next(); - vstring name = f.first.first; + std::string name = f.first.first; unsigned arity = f.first.second; unsigned symbol = f.second.first; bool isPredicate = f.second.second; - vstring symbolName = isPredicate ? env.signature->predicateName(symbol) + std::string symbolName = isPredicate ? env.signature->predicateName(symbol) : env.signature->functionName (symbol); cout << name << "/" << arity << " -> " << symbolName; @@ -5270,12 +5270,12 @@ void TPTP::printStacks() { unsigned i = lfs.length(); while (csit.hasNext()) { LetSymbol f = csit.next(); - vstring name = f.first.first; + std::string name = f.first.first; unsigned arity = f.first.second; unsigned symbol = f.second.first; bool isPredicate = f.second.second; - vstring symbolName = isPredicate ? env.signature->predicateName(symbol) + std::string symbolName = isPredicate ? env.signature->predicateName(symbol) : env.signature->functionName (symbol); cout << name << "/" << arity << " -> " << symbolName; @@ -5302,7 +5302,7 @@ void TPTP::printStacks() { LetSymbolReference ref = lbit.next(); unsigned symbol = SYMBOL(ref); bool isPredicate = IS_PREDICATE(ref); - vstring symbolName = isPredicate ? env.signature->predicateName(symbol) + std::string symbolName = isPredicate ? env.signature->predicateName(symbol) : env.signature->functionName (symbol); cout << symbolName; if (--i > 0) { diff --git a/Parse/TPTP.hpp b/Parse/TPTP.hpp index c1dead9c37..df25eab231 100644 --- a/Parse/TPTP.hpp +++ b/Parse/TPTP.hpp @@ -294,8 +294,8 @@ class TPTP /** position of the beginning of this token */ int start; /** content */ - vstring content; - vstring toString() const; + std::string content; + std::string toString() const; }; /** @@ -305,13 +305,13 @@ class TPTP : public ParsingRelatedException { public: - ParseErrorException(vstring message,unsigned ln) : _message(message), _ln(ln) {} - ParseErrorException(vstring message,Token& tok,unsigned ln); - ParseErrorException(vstring message,int position,unsigned ln); + ParseErrorException(std::string message,unsigned ln) : _message(message), _ln(ln) {} + ParseErrorException(std::string message,Token& tok,unsigned ln); + ParseErrorException(std::string message,int position,unsigned ln); void cry(std::ostream&) const; ~ParseErrorException() {} protected: - vstring _message; + std::string _message; unsigned _ln = 0; }; // TPTP::ParseErrorException @@ -345,10 +345,10 @@ class TPTP * based on this value. */ bool containsConjecture() const { return _containsConjecture; } - void addForbiddenInclude(vstring file); - static bool findAxiomName(const Unit* unit, vstring& result); + void addForbiddenInclude(std::string file); + static bool findAxiomName(const Unit* unit, std::string& result); //this function is used also by the API - static void assignAxiomName(const Unit* unit, vstring& name); + static void assignAxiomName(const Unit* unit, std::string& name); unsigned lineNumber(){ return _lineNumber; } private: void parseImpl(); @@ -457,11 +457,11 @@ class TPTP /** $array theoy */ TS_ARRAY, }; - static bool findTheorySort(const vstring name, TheorySort &ts) { - static const vstring theorySortNames[] = { + static bool findTheorySort(const std::string name, TheorySort &ts) { + static const std::string theorySortNames[] = { "$array" }; - static const unsigned theorySorts = sizeof(theorySortNames)/sizeof(vstring); + static const unsigned theorySorts = sizeof(theorySortNames)/sizeof(std::string); for (unsigned sort = 0; sort < theorySorts; sort++) { if (theorySortNames[sort] == name) { ts = static_cast(sort); @@ -470,7 +470,7 @@ class TPTP } return false; } - static bool isTheorySort(const vstring name) { + static bool isTheorySort(const std::string name) { static TheorySort dummy; return findTheorySort(name, dummy); } @@ -487,11 +487,11 @@ class TPTP /** $array theory */ TF_SELECT, TF_STORE }; - static bool findTheoryFunction(const vstring name, TheoryFunction &tf) { - static const vstring theoryFunctionNames[] = { + static bool findTheoryFunction(const std::string name, TheoryFunction &tf) { + static const std::string theoryFunctionNames[] = { "$select", "$store" }; - static const unsigned theoryFunctions = sizeof(theoryFunctionNames)/sizeof(vstring); + static const unsigned theoryFunctions = sizeof(theoryFunctionNames)/sizeof(std::string); for (unsigned fun = 0; fun < theoryFunctions; fun++) { if (theoryFunctionNames[fun] == name) { tf = static_cast(fun); @@ -500,7 +500,7 @@ class TPTP } return false; } - static bool isTheoryFunction(const vstring name) { + static bool isTheoryFunction(const std::string name) { static TheoryFunction dummy; return findTheoryFunction(name, dummy); } @@ -523,22 +523,22 @@ class TPTP * This is to support the feature formula_selection of the include * directive of the TPTP format. */ - Set* _allowedNames; + Set* _allowedNames; /** stacks of allowed names when include is used */ - Stack*> _allowedNamesStack; + Stack*> _allowedNamesStack; /** set of files whose inclusion should be ignored */ - Set _forbiddenIncludes; + Set _forbiddenIncludes; /** the input stream */ std::istream* _in; /** in the case include() is used, previous streams will be saved here */ Stack _inputs; /** the current include directory */ - vstring _includeDirectory; + std::string _includeDirectory; /** in the case include() is used, previous sequence of directories will be * saved here, this is required since TPTP requires the directory to be * relative to the "current directory, that is, the directory used by the last include() */ - Stack _includeDirectories; + Stack _includeDirectories; /** input characters */ Array _chars; /** position in the input stream of the 0th character in _chars[] */ @@ -567,7 +567,7 @@ class TPTP /** */ bool _containsPolymorphism; /** various strings saved during parsing */ - Stack _strings; + Stack _strings; /** various connectives saved during parsing */ // they must be int, since non-existing value -1 can be used Stack _connectives; /** various boolean values saved during parsing */ @@ -599,14 +599,14 @@ class TPTP /** bindings of variables to sorts */ Map _variableSorts; /** overflown arithmetical constants for which uninterpreted constants are introduced */ - Set _overflow; + Set _overflow; /** current color, if the input contains colors */ Color _currentColor; /** a robsubstitution object to be used temporarily that is kept around to safe memory allocation time */ RobSubstitution _substScratchpad; /** a function name and arity */ - typedef std::pair LetSymbolName; + typedef std::pair LetSymbolName; /** a symbol number with a predicate/function flag */ typedef std::pair LetSymbolReference; @@ -723,7 +723,7 @@ class TPTP Tag readNumber(Token&); int decimal(int pos); int positiveDecimal(int pos); - static vstring toString(Tag); + static std::string toString(Tag); // parser functions static Formula* makeJunction(Connective c,Formula* lhs,Formula* rhs); @@ -732,7 +732,7 @@ class TPTP void tff(); void vampire(); void consumeToken(Tag); - vstring name(); + std::string name(); void formula(); void funApp(); void simpleFormula(); @@ -746,9 +746,9 @@ class TPTP void endTerm(); void endArgs(); Literal* createEquality(bool polarity,TermList& lhs,TermList& rhs); - Formula* createPredicateApplication(vstring name,unsigned arity); - TermList createFunctionApplication(vstring name,unsigned arity); - TermList createTypeConApplication(vstring name,unsigned arity); + Formula* createPredicateApplication(std::string name,unsigned arity); + TermList createFunctionApplication(std::string name,unsigned arity); + TermList createTypeConApplication(std::string name,unsigned arity); void endEquality(); void midEquality(); void formulaInfix(); @@ -792,31 +792,31 @@ class TPTP void unbindVariables(); void skipToRPAR(); void skipToRBRA(); - unsigned addFunction(vstring name,int arity,bool& added,TermList& someArgument); - int addPredicate(vstring name,int arity,bool& added,TermList& someArgument); - unsigned addOverloadedFunction(vstring name,int arity,int symbolArity,bool& added,TermList& arg, + unsigned addFunction(std::string name,int arity,bool& added,TermList& someArgument); + int addPredicate(std::string name,int arity,bool& added,TermList& someArgument); + unsigned addOverloadedFunction(std::string name,int arity,int symbolArity,bool& added,TermList& arg, Theory::Interpretation integer,Theory::Interpretation rational, Theory::Interpretation real); - unsigned addOverloadedPredicate(vstring name,int arity,int symbolArity,bool& added,TermList& arg, + unsigned addOverloadedPredicate(std::string name,int arity,int symbolArity,bool& added,TermList& arg, Theory::Interpretation integer,Theory::Interpretation rational, Theory::Interpretation real); TermList sortOf(TermList term); static bool higherPrecedence(int c1,int c2); - vstring convert(Tag t); + std::string convert(Tag t); - bool findInterpretedPredicate(vstring name, unsigned arity); + bool findInterpretedPredicate(std::string name, unsigned arity); OperatorType* constructOperatorType(Type* t, VList* vars = 0); public: // make the tptp routines for dealing with overflown constants available to other parsers - static unsigned addIntegerConstant(const vstring&, Set& overflow, bool defaultSort); - static unsigned addRationalConstant(const vstring&, Set& overflow, bool defaultSort); - static unsigned addRealConstant(const vstring&, Set& overflow, bool defaultSort); - static unsigned addUninterpretedConstant(const vstring& name, Set& overflow, bool& added); + static unsigned addIntegerConstant(const std::string&, Set& overflow, bool defaultSort); + static unsigned addRationalConstant(const std::string&, Set& overflow, bool defaultSort); + static unsigned addRealConstant(const std::string&, Set& overflow, bool defaultSort); + static unsigned addUninterpretedConstant(const std::string& name, Set& overflow, bool& added); // also here, simply made public static to share the code with another use site - static Unit* processClaimFormula(Unit* unit, Formula* f, const vstring& nm); + static Unit* processClaimFormula(Unit* unit, Formula* f, const std::string& nm); /** * Used to store the contents of the 'source' of an input formula @@ -827,16 +827,16 @@ class TPTP virtual bool isFile() = 0; }; struct FileSourceRecord : SourceRecord { - const vstring fileName; - const vstring nameInFile; + const std::string fileName; + const std::string nameInFile; bool isFile(){ return true; } - FileSourceRecord(vstring fN, vstring nF) : fileName(fN), nameInFile(nF) {} + FileSourceRecord(std::string fN, std::string nF) : fileName(fN), nameInFile(nF) {} }; struct InferenceSourceRecord : SourceRecord{ - const vstring name; - Stack premises; + const std::string name; + Stack premises; bool isFile(){ return false; } - InferenceSourceRecord(vstring n) : name(n) {} + InferenceSourceRecord(std::string n) : name(n) {} }; void setUnitSourceMap(DHMap* m){ @@ -851,18 +851,18 @@ class TPTP /** This field stores names of input units if the * output_axiom_names option is enabled */ - static DHMap _axiomNames; + static DHMap _axiomNames; /** Stores the type arities of function symbols */ - DHMap _typeArities; - DHMap _typeConstructorArities; + DHMap _typeArities; + DHMap _typeConstructorArities; bool _filterReserved; bool _seenConjecture; #if VDEBUG - void printStates(vstring extra); - void printInts(vstring extra); + void printStates(std::string extra); + void printInts(std::string extra); const char* toString(State s); #endif #ifdef DEBUG_SHOW_STATE diff --git a/SAT/SATClause.cpp b/SAT/SATClause.cpp index cee95926e7..6371ce7c7a 100644 --- a/SAT/SATClause.cpp +++ b/SAT/SATClause.cpp @@ -208,9 +208,9 @@ SATClause* SATClause::fromStack(SATLiteralStack& stack) /** * Convert the clause to the string representation. */ -vstring SATClause::toString() const +std::string SATClause::toString() const { - vstring result; + std::string result; if (_length == 0) { result = "#"; } else { diff --git a/SAT/SATClause.hpp b/SAT/SATClause.hpp index 7ffe51f61d..16a6a1c218 100644 --- a/SAT/SATClause.hpp +++ b/SAT/SATClause.hpp @@ -91,7 +91,7 @@ class SATClause void destroy(); - vstring toString() const; + std::string toString() const; static SATClause* removeDuplicateLiterals(SATClause *cl); diff --git a/SAT/SATLiteral.cpp b/SAT/SATLiteral.cpp index 17e9407e1f..ad8a9350f9 100644 --- a/SAT/SATLiteral.cpp +++ b/SAT/SATLiteral.cpp @@ -30,7 +30,7 @@ using namespace std; using namespace Lib; using namespace Shell; -vstring SATLiteral::toString() const +std::string SATLiteral::toString() const { if(isPositive()) { return Int::toString(var()); diff --git a/SAT/SATLiteral.hpp b/SAT/SATLiteral.hpp index c131331710..0db9fcbd57 100644 --- a/SAT/SATLiteral.hpp +++ b/SAT/SATLiteral.hpp @@ -67,7 +67,7 @@ class SATLiteral inline bool operator!=(const SATLiteral& l) const { return _content!=l._content; } - vstring toString() const; + std::string toString() const; /** * Return a dummy literal that is not equal to any diff --git a/SAT/Z3Interfacing.cpp b/SAT/Z3Interfacing.cpp index f7670af73a..21cc5e6bad 100644 --- a/SAT/Z3Interfacing.cpp +++ b/SAT/Z3Interfacing.cpp @@ -75,7 +75,7 @@ using namespace Lib; //using namespace z3; -Z3Interfacing::Z3Interfacing(const Shell::Options& opts, SAT2FO& s2f, bool unsatCoresForAssumptions, vstring const& exportSmtlib): +Z3Interfacing::Z3Interfacing(const Shell::Options& opts, SAT2FO& s2f, bool unsatCoresForAssumptions, std::string const& exportSmtlib): Z3Interfacing(s2f, opts.showZ3(), /* unsatCoresForAssumptions = */ unsatCoresForAssumptions, exportSmtlib) { } @@ -105,7 +105,7 @@ void handleZ3Error(Z3_context ctxt, Z3_error_code code) throw z3::exception(errToString(code)); } -Z3Interfacing::Z3Interfacing(SAT2FO& s2f, bool showZ3, bool unsatCoresForAssumptions, vstring const& exportSmtlib): +Z3Interfacing::Z3Interfacing(SAT2FO& s2f, bool showZ3, bool unsatCoresForAssumptions, std::string const& exportSmtlib): _hasSeenArrays(false), _varCnt(0), _sat2fo(s2f), @@ -519,7 +519,7 @@ z3::sort Z3Interfacing::getz3sort(SortId s) } template -vstring to_vstring(A const& a) +std::string to_std::string(A const& a) { std::stringstream out; out << a; @@ -544,7 +544,7 @@ void Z3Interfacing::createTermAlgebra(TermList sort) } } - auto new_string_symbol = [this](unsigned f, const vstring& typePostfix, bool pred = false) + auto new_string_symbol = [this](unsigned f, const std::string& typePostfix, bool pred = false) { return Z3_mk_string_symbol(_context, ((pred ? env.signature->getPredicate(f) : env.signature->getFunction(f))->name()+'_'+typePostfix).c_str()); }; @@ -565,7 +565,7 @@ void Z3Interfacing::createTermAlgebra(TermList sort) auto taSortT = taSort.term(); auto ta = env.signature->getTermAlgebraOfSort(taSort); Substitution typeSubst; - vstring typePostfix = "$"; + std::string typePostfix = "$"; ta->getTypeSub(taSortT, typeSubst); for(unsigned i = 0; i < taSortT->arity(); i++) { // MS: Is it OK not to use any separator here? @@ -809,7 +809,7 @@ z3::func_decl Z3Interfacing::z3Function(FuncOrPredId functor) auto type = functor.isPredicate ? symb->predType() : symb->fnType(); // polymorphic symbol application: treat f(, ...) as f(...) for Z3 - vstring namebuf = symb->name(); + std::string namebuf = symb->name(); Substitution typeSubst; if(functor.forSorts) { SortHelper::getTypeSub(functor.forSorts, typeSubst); @@ -1149,7 +1149,7 @@ z3::expr Z3Interfacing::getNameExpr(unsigned var) { return _varNames.getOrInit(var, [&](){ // this method is called very often in runs with a lot of avatar reasoning. Cache the constants to avoid that z3 has to search for the string name in its function index - vstring name = "v"+Lib::Int::toString(var); + std::string name = "v"+Lib::Int::toString(var); outputln("(declare-fun ", name, " () Bool)"); return _context.bool_const(name.c_str()); }); @@ -1169,7 +1169,7 @@ z3::expr Z3Interfacing::getConst(Signature::Symbol* symb, z3::sort sort) { return _constantNames.getOrInit(symb, [&]() { // careful: keep native constants' names distinct from the above ones (hence the "c"-prefix below) - vstring name("c" + symb->name()); + std::string name("c" + symb->name()); outputln("(declare-fun ", name, " () ", sort, ")"); return _context.constant(name.c_str(), sort); }); diff --git a/SAT/Z3Interfacing.hpp b/SAT/Z3Interfacing.hpp index 2943154234..2e023a244e 100644 --- a/SAT/Z3Interfacing.hpp +++ b/SAT/Z3Interfacing.hpp @@ -56,8 +56,8 @@ namespace SAT{ class Z3Interfacing : public PrimitiveProofRecordingSATSolver { public: - Z3Interfacing(const Shell::Options& opts, SAT2FO& s2f, bool unsatCoresForAssumptions, vstring const& exportSmtlib); - Z3Interfacing(SAT2FO& s2f, bool showZ3, bool unsatCoresForAssumptions, vstring const& exportSmtlib); + Z3Interfacing(const Shell::Options& opts, SAT2FO& s2f, bool unsatCoresForAssumptions, std::string const& exportSmtlib); + Z3Interfacing(SAT2FO& s2f, bool showZ3, bool unsatCoresForAssumptions, std::string const& exportSmtlib); ~Z3Interfacing(); static char const* z3_full_version(); diff --git a/Saturation/AWPassiveClauseContainer.cpp b/Saturation/AWPassiveClauseContainer.cpp index ebe107bf4c..5279eb9c8c 100644 --- a/Saturation/AWPassiveClauseContainer.cpp +++ b/Saturation/AWPassiveClauseContainer.cpp @@ -43,7 +43,7 @@ using namespace std; using namespace Lib; using namespace Kernel; -AWPassiveClauseContainer::AWPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, vstring name) : +AWPassiveClauseContainer::AWPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, std::string name) : PassiveClauseContainer(isOutermost, opt, name), _ageQueue(opt), _weightQueue(opt), diff --git a/Saturation/AWPassiveClauseContainer.hpp b/Saturation/AWPassiveClauseContainer.hpp index d6b6a6738d..e95f9d8931 100644 --- a/Saturation/AWPassiveClauseContainer.hpp +++ b/Saturation/AWPassiveClauseContainer.hpp @@ -65,7 +65,7 @@ class AWPassiveClauseContainer : public PassiveClauseContainer { public: - AWPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, vstring name); + AWPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, std::string name); ~AWPassiveClauseContainer(); void add(Clause* cl) override; diff --git a/Saturation/ClauseContainer.hpp b/Saturation/ClauseContainer.hpp index 50749da1c1..42043ed669 100644 --- a/Saturation/ClauseContainer.hpp +++ b/Saturation/ClauseContainer.hpp @@ -110,7 +110,7 @@ class PassiveClauseContainer : public RandomAccessClauseContainer { public: - PassiveClauseContainer(bool isOutermost, const Shell::Options& opt, vstring name = "") : _isOutermost(isOutermost), _opt(opt), _name(name) {} + PassiveClauseContainer(bool isOutermost, const Shell::Options& opt, std::string name = "") : _isOutermost(isOutermost), _opt(opt), _name(name) {} virtual ~PassiveClauseContainer(){}; LimitsChangeEvent changedEvent; @@ -161,7 +161,7 @@ class PassiveClauseContainer const Shell::Options& _opt; public: - vstring _name; + std::string _name; }; class ActiveClauseContainer diff --git a/Saturation/PredicateSplitPassiveClauseContainer.cpp b/Saturation/PredicateSplitPassiveClauseContainer.cpp index 9b3a080a8a..63d08626ac 100644 --- a/Saturation/PredicateSplitPassiveClauseContainer.cpp +++ b/Saturation/PredicateSplitPassiveClauseContainer.cpp @@ -32,7 +32,7 @@ int computeLCM(int a, int b) { return (a*b)/Int::gcd(a, b); } -PredicateSplitPassiveClauseContainer::PredicateSplitPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, vstring name, +PredicateSplitPassiveClauseContainer::PredicateSplitPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, std::string name, std::vector> queues, std::vector cutoffs, std::vector ratios, bool layeredArrangement) : PassiveClauseContainer(isOutermost, opt, name), _queues(std::move(queues)), _cutoffs(cutoffs), _layeredArrangement(layeredArrangement) @@ -462,7 +462,7 @@ bool PredicateSplitPassiveClauseContainer::childrenPotentiallyFulfilLimits(Claus return false; } -TheoryMultiSplitPassiveClauseContainer::TheoryMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues) : +TheoryMultiSplitPassiveClauseContainer::TheoryMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues) : PredicateSplitPassiveClauseContainer(isOutermost, opt, name, std::move(queues), opt.theorySplitQueueCutoffs(), opt.theorySplitQueueRatios(), opt.theorySplitQueueLayeredArrangement()) {} float TheoryMultiSplitPassiveClauseContainer::evaluateFeature(Clause* cl) const @@ -480,7 +480,7 @@ float TheoryMultiSplitPassiveClauseContainer::evaluateFeatureEstimate(unsigned, return inf.th_ancestors * expectedRatioDenominator - inf.all_ancestors; } -AvatarMultiSplitPassiveClauseContainer::AvatarMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues) : +AvatarMultiSplitPassiveClauseContainer::AvatarMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues) : PredicateSplitPassiveClauseContainer(isOutermost, opt, name, std::move(queues), opt.avatarSplitQueueCutoffs(), opt.avatarSplitQueueRatios(), opt.avatarSplitQueueLayeredArrangement()) {} float AvatarMultiSplitPassiveClauseContainer::evaluateFeature(Clause* cl) const @@ -496,7 +496,7 @@ float AvatarMultiSplitPassiveClauseContainer::evaluateFeatureEstimate(unsigned, return (inf.splits() == nullptr) ? 0 : inf.splits()->size(); } -SineLevelMultiSplitPassiveClauseContainer::SineLevelMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues) : +SineLevelMultiSplitPassiveClauseContainer::SineLevelMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues) : PredicateSplitPassiveClauseContainer(isOutermost, opt, name, std::move(queues), opt.sineLevelSplitQueueCutoffs(), opt.sineLevelSplitQueueRatios(), opt.sineLevelSplitQueueLayeredArrangement()) {} float SineLevelMultiSplitPassiveClauseContainer::evaluateFeature(Clause* cl) const @@ -511,7 +511,7 @@ float SineLevelMultiSplitPassiveClauseContainer::evaluateFeatureEstimate(unsigne return inf.getSineLevel(); } -PositiveLiteralMultiSplitPassiveClauseContainer::PositiveLiteralMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues) : +PositiveLiteralMultiSplitPassiveClauseContainer::PositiveLiteralMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues) : PredicateSplitPassiveClauseContainer(isOutermost, opt, name, std::move(queues), opt.positiveLiteralSplitQueueCutoffs(), opt.positiveLiteralSplitQueueRatios(), opt.positiveLiteralSplitQueueLayeredArrangement()) {} float PositiveLiteralMultiSplitPassiveClauseContainer::evaluateFeature(Clause* cl) const diff --git a/Saturation/PredicateSplitPassiveClauseContainer.hpp b/Saturation/PredicateSplitPassiveClauseContainer.hpp index 4ee5dc114f..100e18dcbd 100644 --- a/Saturation/PredicateSplitPassiveClauseContainer.hpp +++ b/Saturation/PredicateSplitPassiveClauseContainer.hpp @@ -22,7 +22,7 @@ class PredicateSplitPassiveClauseContainer : public PassiveClauseContainer { public: - PredicateSplitPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, vstring name, std::vector> queues, std::vector cutoffs, std::vector ratios, bool layeredArrangement); + PredicateSplitPassiveClauseContainer(bool isOutermost, const Shell::Options& opt, std::string name, std::vector> queues, std::vector cutoffs, std::vector ratios, bool layeredArrangement); virtual ~PredicateSplitPassiveClauseContainer(); void add(Clause* cl) override; @@ -89,7 +89,7 @@ class PredicateSplitPassiveClauseContainer class TheoryMultiSplitPassiveClauseContainer : public PredicateSplitPassiveClauseContainer { public: - TheoryMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues); + TheoryMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues); private: float evaluateFeature(Clause* cl) const override; @@ -99,7 +99,7 @@ class TheoryMultiSplitPassiveClauseContainer : public PredicateSplitPassiveClaus class AvatarMultiSplitPassiveClauseContainer : public PredicateSplitPassiveClauseContainer { public: - AvatarMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues); + AvatarMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues); private: float evaluateFeature(Clause* cl) const override; @@ -109,7 +109,7 @@ class AvatarMultiSplitPassiveClauseContainer : public PredicateSplitPassiveClaus class SineLevelMultiSplitPassiveClauseContainer : public PredicateSplitPassiveClauseContainer { public: - SineLevelMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues); + SineLevelMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues); private: float evaluateFeature(Clause* cl) const override; @@ -119,7 +119,7 @@ class SineLevelMultiSplitPassiveClauseContainer : public PredicateSplitPassiveCl class PositiveLiteralMultiSplitPassiveClauseContainer : public PredicateSplitPassiveClauseContainer { public: - PositiveLiteralMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, Lib::vstring name, std::vector> queues); + PositiveLiteralMultiSplitPassiveClauseContainer(bool isOutermost, const Shell::Options &opt, std::string name, std::vector> queues); private: float evaluateFeature(Clause* cl) const override; diff --git a/Saturation/SaturationAlgorithm.cpp b/Saturation/SaturationAlgorithm.cpp index a7c2d5b2a6..7b8d3d512a 100644 --- a/Saturation/SaturationAlgorithm.cpp +++ b/Saturation/SaturationAlgorithm.cpp @@ -130,12 +130,12 @@ using namespace Saturation; SaturationAlgorithm* SaturationAlgorithm::s_instance = 0; -std::unique_ptr makeLevel0(bool isOutermost, const Options& opt, vstring name) +std::unique_ptr makeLevel0(bool isOutermost, const Options& opt, std::string name) { return std::make_unique(isOutermost, opt, name + "AWQ"); } -std::unique_ptr makeLevel1(bool isOutermost, const Options& opt, vstring name) +std::unique_ptr makeLevel1(bool isOutermost, const Options& opt, std::string name) { if (opt.useTheorySplitQueues()) { @@ -154,7 +154,7 @@ std::unique_ptr makeLevel1(bool isOutermost, const Optio } } -std::unique_ptr makeLevel2(bool isOutermost, const Options& opt, vstring name) +std::unique_ptr makeLevel2(bool isOutermost, const Options& opt, std::string name) { if (opt.useAvatarSplitQueues()) { @@ -173,7 +173,7 @@ std::unique_ptr makeLevel2(bool isOutermost, const Optio } } -std::unique_ptr makeLevel3(bool isOutermost, const Options& opt, vstring name) +std::unique_ptr makeLevel3(bool isOutermost, const Options& opt, std::string name) { if (opt.useSineLevelSplitQueues()) { @@ -192,7 +192,7 @@ std::unique_ptr makeLevel3(bool isOutermost, const Optio } } -std::unique_ptr makeLevel4(bool isOutermost, const Options& opt, vstring name) +std::unique_ptr makeLevel4(bool isOutermost, const Options& opt, std::string name) { if (opt.usePositiveLiteralSplitQueues()) { diff --git a/Saturation/Splitter.cpp b/Saturation/Splitter.cpp index 916248b467..39b979a9c2 100644 --- a/Saturation/Splitter.cpp +++ b/Saturation/Splitter.cpp @@ -616,7 +616,7 @@ void SplittingBranchSelector::recomputeModel(SplitLevelStack& addedComps, SplitL // Splitter ////////////// -vstring Splitter::splPrefix = ""; +std::string Splitter::splPrefix = ""; Splitter::Splitter() : _deleteDeactivated(Options::SplittingDeleteDeactivated::ON), _branchSelector(*this), @@ -727,7 +727,7 @@ SATLiteral Splitter::getLiteralFromName(SplitLevel compName) bool polarity = (compName&1)==0; return SATLiteral(var, polarity); } -vstring Splitter::getFormulaStringFromName(SplitLevel compName, bool negated) +std::string Splitter::getFormulaStringFromName(SplitLevel compName, bool negated) { SATLiteral lit = getLiteralFromName(compName); if (negated) { @@ -990,7 +990,7 @@ bool Splitter::handleNonSplittable(Clause* cl) * Since the component names in a clauses Splitset should be interpreted as propositional variables, * Splitter know how to do their proper printing. */ -vstring Splitter::splitsToString(SplitSet* splits) +std::string Splitter::splitsToString(SplitSet* splits) { std::ostringstream res; @@ -1232,7 +1232,7 @@ Clause* Splitter::buildAndInsertComponentClause(SplitLevel name, unsigned size, possibly_flipped_lits = &oplit; } - vstring formula_name = getFormulaStringFromName(posName); + std::string formula_name = getFormulaStringFromName(posName); Clause* temp = Clause::fromIterator(arrayIter(possibly_flipped_lits, size), NonspecificInference0(inpType,InferenceRule::AVATAR_DEFINITION)); Formula* def_f = new BinaryFormula(IFF, diff --git a/Saturation/Splitter.hpp b/Saturation/Splitter.hpp index 893d8ee4ce..e09027391b 100644 --- a/Saturation/Splitter.hpp +++ b/Saturation/Splitter.hpp @@ -191,9 +191,9 @@ class Splitter { SplitLevel getNameFromLiteral(SATLiteral lit) const; Unit* getDefinitionFromName(SplitLevel compName) const; - static vstring splitsToString(SplitSet* splits); + static std::string splitsToString(SplitSet* splits); static SATLiteral getLiteralFromName(SplitLevel compName); - static vstring getFormulaStringFromName(SplitLevel compName, bool negated = false); + static std::string getFormulaStringFromName(SplitLevel compName, bool negated = false); bool isUsedName(SplitLevel name) const { ASS_L(name,_db.size()); @@ -314,7 +314,7 @@ class Splitter { Set> _already_added; public: - static vstring splPrefix; + static std::string splPrefix; // for observing the current model SplitLevel splitLevelBound() { return _db.size(); } diff --git a/Saturation/SymElOutput.cpp b/Saturation/SymElOutput.cpp index 4d919ef705..edcf30a346 100644 --- a/Saturation/SymElOutput.cpp +++ b/Saturation/SymElOutput.cpp @@ -136,7 +136,7 @@ void SymElOutput::outputSymbolElimination(Color eliminated, Clause* c) } std::cout<<" symbol elimination"<isPredicateName(cname, 0)) { _symElNextClauseNumber++; cname = "inv"+Int::toString(_symElNextClauseNumber); diff --git a/Shell/AnswerExtractor.cpp b/Shell/AnswerExtractor.cpp index 8b0a610dc9..025888536b 100644 --- a/Shell/AnswerExtractor.cpp +++ b/Shell/AnswerExtractor.cpp @@ -682,7 +682,7 @@ Term* SynthesisManager::translateToSynthesisConditionTerm(Literal* l) ASS(!l->isSpecial()); unsigned arity = l->arity(); - vstring fnName = "cond_"; + std::string fnName = "cond_"; if (l->isNegative()) { fnName.append("not_"); } @@ -743,7 +743,7 @@ TermList SynthesisManager::ConjectureSkolemReplacement::transformTermList(TermLi if (sort == AtomicSort::intSort()) { return zero; } else { - vstring name = "cz_" + sort.toString(); + std::string name = "cz_" + sort.toString(); unsigned czfn; if (!env.signature->tryGetFunctionNumber(name, 0, czfn)) { czfn = env.signature->addFreshFunction(0, name.c_str()); @@ -765,7 +765,7 @@ TermList SynthesisManager::ConjectureSkolemReplacement::transformTermList(TermLi if (vsort == AtomicSort::intSort()) { s.bind(v, zero); } else { - vstring name = "cz_" + vsort.toString(); + std::string name = "cz_" + vsort.toString(); unsigned czfn; if (!env.signature->tryGetFunctionNumber(name, 0, czfn)) { czfn = env.signature->addFreshFunction(0, name.c_str()); @@ -795,7 +795,7 @@ TermList SynthesisManager::ConjectureSkolemReplacement::transformSubterm(TermLis if (t->functor() == getITEFunctionSymbol(sort)) { // Build condition Term* tcond = t->nthArgument(0)->term(); - vstring condName = tcond->functionName(); + std::string condName = tcond->functionName(); unsigned pred = _condFnToPred.get(tcond->functor()); Stack args; for (unsigned i = 0; i < tcond->arity(); ++i) args.push(transform(*(tcond->nthArgument(i)))); diff --git a/Shell/AnswerExtractor.hpp b/Shell/AnswerExtractor.hpp index a94dc425ef..ef79b98102 100644 --- a/Shell/AnswerExtractor.hpp +++ b/Shell/AnswerExtractor.hpp @@ -132,7 +132,7 @@ class SynthesisManager : public AnswerLiteralManager static Term* createRegularITE(Term* condition, TermList thenBranch, TermList elseBranch, TermList branchSort); static unsigned getITEFunctionSymbol(TermList sort) { - vstring name = "$ite_" + sort.toString(); + std::string name = "$ite_" + sort.toString(); bool added = false; unsigned fn = env.signature->addFunction(name, 3, added); if (added) { diff --git a/Shell/CommandLine.cpp b/Shell/CommandLine.cpp index e145ff0776..5454abcb1b 100644 --- a/Shell/CommandLine.cpp +++ b/Shell/CommandLine.cpp @@ -72,7 +72,7 @@ void CommandLine::interpret (Options& options) } if (arg[0] == '-') { if (_next == _last) { - USER_ERROR((vstring)"no value specified for option " + arg); + USER_ERROR((std::string)"no value specified for option " + arg); } else{ if (arg[1] == '-') { diff --git a/Shell/FOOLElimination.cpp b/Shell/FOOLElimination.cpp index 36792523a4..d135e04e14 100644 --- a/Shell/FOOLElimination.cpp +++ b/Shell/FOOLElimination.cpp @@ -1011,7 +1011,7 @@ unsigned FOOLElimination::introduceFreshSymbol(Context context, const char* pref return symbol; } -void FOOLElimination::reportProcessed(vstring inputRepr, vstring outputRepr) { +void FOOLElimination::reportProcessed(std::string inputRepr, std::string outputRepr) { if (inputRepr != outputRepr) { /** * If show_fool is set to off, the string representations of the input diff --git a/Shell/FOOLElimination.hpp b/Shell/FOOLElimination.hpp index a4852f6b16..062d543b2c 100644 --- a/Shell/FOOLElimination.hpp +++ b/Shell/FOOLElimination.hpp @@ -108,7 +108,7 @@ class FOOLElimination { // Report that a given formula or a term has been rewritten during defooling // The term or formula is passed as its string representation - static void reportProcessed(vstring inputRepr, vstring outputRepr); + static void reportProcessed(std::string inputRepr, std::string outputRepr); }; #endif // __FOOLElimination__ diff --git a/Shell/FunctionDefinitionHandler.cpp b/Shell/FunctionDefinitionHandler.cpp index 7451bcd7c8..8479a07916 100644 --- a/Shell/FunctionDefinitionHandler.cpp +++ b/Shell/FunctionDefinitionHandler.cpp @@ -353,7 +353,7 @@ void InductionTemplate::addBranch(std::vector&& recursiveCalls, Term* hea _branches.push_back(std::move(branch)); } -vstring InductionTemplate::toString() const +std::string InductionTemplate::toString() const { std::stringstream str; str << "Branches: "; diff --git a/Shell/FunctionDefinitionHandler.hpp b/Shell/FunctionDefinitionHandler.hpp index 9a4208fee1..5165447ba1 100644 --- a/Shell/FunctionDefinitionHandler.hpp +++ b/Shell/FunctionDefinitionHandler.hpp @@ -60,7 +60,7 @@ struct InductionTemplate { const std::vector& branches() const { return _branches; } - vstring toString() const; + std::string toString() const; unsigned _functor; unsigned _arity; diff --git a/Shell/Interpolants.cpp b/Shell/Interpolants.cpp index fd6c4b4347..0c737f0b68 100644 --- a/Shell/Interpolants.cpp +++ b/Shell/Interpolants.cpp @@ -370,7 +370,7 @@ namespace Shell FormulaList* outerConjunction = FormulaList::empty(); // statistics only - vstring nestednesses; + std::string nestednesses; for (auto& rootBuilderPair : contributions) { InterpolantBuilder& builder = rootBuilderPair.second; diff --git a/Shell/LaTeX.cpp b/Shell/LaTeX.cpp index a2fc2c769c..5cf2c6a2b5 100644 --- a/Shell/LaTeX.cpp +++ b/Shell/LaTeX.cpp @@ -49,9 +49,9 @@ using namespace std; using namespace Lib; using namespace Kernel; -vstring LaTeX::header() +std::string LaTeX::header() { - vstring res = "\\documentclass[border=10pt,preview,multi,varwidth=\\maxdimen]{standalone}\n" + std::string res = "\\documentclass[border=10pt,preview,multi,varwidth=\\maxdimen]{standalone}\n" "\\usepackage{latexsym}\n" "\\newenvironment{VampireStep}{}{}\n" "\\standaloneenv{VampireStep}\n" @@ -84,7 +84,7 @@ vstring LaTeX::header() return res; } -vstring LaTeX::footer() +std::string LaTeX::footer() { return "\\end{document}\n"; } @@ -94,9 +94,9 @@ vstring LaTeX::footer() * Convert the refutation to LaTeX * @since 04/01/2004 Manchester */ -vstring LaTeX::refutationToString(Unit* ref) +std::string LaTeX::refutationToString(Unit* ref) { - vstring res = header(); + std::string res = header(); Stack outKernel; Set handledKernel; @@ -160,7 +160,7 @@ vstring LaTeX::refutationToString(Unit* ref) } -vstring LaTeX::toString(Unit* u) +std::string LaTeX::toString(Unit* u) { if(u->isClause()) { return toString(static_cast(u)); @@ -169,11 +169,11 @@ vstring LaTeX::toString(Unit* u) } } -vstring replaceNeg(vstring s) +std::string replaceNeg(std::string s) { size_t start_pos = s.find("~",0); if(start_pos != std::string::npos){ - s.replace(start_pos,1,vstring(" \\neg ")); + s.replace(start_pos,1,std::string(" \\neg ")); } return s; } @@ -187,14 +187,14 @@ vstring replaceNeg(vstring s) * @since 11/12/2004 Manchester, true and false added * @since 29/04/2005 Manchester, inequality instead of negation of equality */ -vstring LaTeX::toString (Formula* f) const +std::string LaTeX::toString (Formula* f) const { - static vstring names [] = + static std::string names [] = { "", " \\Vand ", " \\Vor ", " \\Vimp ", " \\Viff ", " \\Vxor ", "\\neg ", "\\forall ", "\\exists ", "\bot", "\top", "", ""}; Connective c = f->connective(); - vstring con = names[(int)c]; + std::string con = names[(int)c]; switch (c) { case LITERAL: return toString(f->literal()); @@ -204,7 +204,7 @@ vstring LaTeX::toString (Formula* f) const { FormulaList::Iterator arg(f->args()); ASS(arg.hasNext()); - vstring result = toString(arg.next(),c); + std::string result = toString(arg.next(),c); while (arg.hasNext()) { result += con + toString(arg.next(),c); } @@ -227,10 +227,10 @@ vstring LaTeX::toString (Formula* f) const case FORALL: case EXISTS: { - vstring result("("); + std::string result("("); VList::Iterator vs(f->vars()); while (vs.hasNext()) { - result += con + varToString(vs.next()) + vstring(" "); + result += con + varToString(vs.next()) + std::string(" "); } return result + ")" + toString(f->qarg(),c); } @@ -259,10 +259,10 @@ vstring LaTeX::toString (Formula* f) const * @param outer connective of the outer formula * @since 09/12/2003 Manchester */ -vstring LaTeX::toString (Formula* f, Connective outer) const +std::string LaTeX::toString (Formula* f, Connective outer) const { return f->parenthesesRequired(outer) ? - vstring("(") + toString(f) + ")" : + std::string("(") + toString(f) + ")" : toString(f); } // LaTeX::toString (const Formula&, Connective outer) @@ -272,16 +272,16 @@ vstring LaTeX::toString (Formula* f, Connective outer) const * @since 23/10/2003 Manchester, implemented as stream output function * @since 09/12/2003 Manchester */ -vstring LaTeX::toString (Clause* c) +std::string LaTeX::toString (Clause* c) { - vstring result; + std::string result; if (c->isEmpty()) { if(c->splits() && !c->splits()->isEmpty()){ auto sit = c->splits()->iter(); result = "\\mathit{false}"; while(sit.hasNext()){ - result += vstring(" \\Vor ") + replaceNeg(Saturation::Splitter::getFormulaStringFromName(sit.next(),true /*negated*/)); + result += std::string(" \\Vor ") + replaceNeg(Saturation::Splitter::getFormulaStringFromName(sit.next(),true /*negated*/)); } } else{ @@ -293,12 +293,12 @@ vstring LaTeX::toString (Clause* c) unsigned clen=c->length(); for(unsigned i=1;isplits() && !c->splits()->isEmpty()){ auto sit = c->splits()->iter(); while(sit.hasNext()){ - result += vstring(" \\Vor ") + replaceNeg(Saturation::Splitter::getFormulaStringFromName(sit.next(),true /*negated*/)); + result += std::string(" \\Vor ") + replaceNeg(Saturation::Splitter::getFormulaStringFromName(sit.next(),true /*negated*/)); } } } @@ -311,7 +311,7 @@ vstring LaTeX::toString (Clause* c) * Convert literal to LaTeX. * @since 09/12/2003 Manchester */ -vstring LaTeX::toString (Literal* l) const +std::string LaTeX::toString (Literal* l) const { if (l->isEquality()) { if (l->isNegative()) { @@ -323,7 +323,7 @@ vstring LaTeX::toString (Literal* l) const } // if (_map) { -// vstring result; +// std::string result; // if (_map->toString(a,*this,result)) { // return result; // } @@ -331,18 +331,18 @@ vstring LaTeX::toString (Literal* l) const //Check if this symbol has an interpreted LaTeX name // this should be true for all known interpreted symbols and any recorded symbols - vstring template_str = theory->tryGetInterpretedLaTeXName(l->functor(),true,l->isNegative()); + std::string template_str = theory->tryGetInterpretedLaTeXName(l->functor(),true,l->isNegative()); if(template_str.empty()){ - vstring res; + std::string res; if (l->isNegative()) { res="\\neg ";} return res+symbolToString(l->functor(), true) + toString(l->args()); } else{ // replace arguments in the template, arg0 replaces a0 etc. for(unsigned i=0;iarity();i++){ - vstring from = "a"+Lib::Int::toString(i); - vstring to = toString(l->nthArgument(i),true); + std::string from = "a"+Lib::Int::toString(i); + std::string to = toString(l->nthArgument(i),true); size_t start_pos = 0; while((start_pos = template_str.find(from, start_pos)) != std::string::npos) { template_str.replace(start_pos, from.length(), to); @@ -362,18 +362,18 @@ vstring LaTeX::toString (Literal* l) const * @since 23/10/2002 Manchester, changed to handle special KIF names * @since 09/09/2003 Manchester, changed to use string instead of char* * @since 25/07/2005 Tallinn, changed to parse the name symbol by symbol - * @since 07/08/2014 Manchester, changed to use vstring + * @since 07/08/2014 Manchester, changed to use std::string */ -vstring LaTeX::symbolToString (unsigned num, bool pred) const +std::string LaTeX::symbolToString (unsigned num, bool pred) const { - vstring symbolName; // the name of this symbol, if any + std::string symbolName; // the name of this symbol, if any if(pred) { symbolName = env.signature->predicateName(num); } else { // if (f.isSkolemFunction()) { -// return (vstring)"\\sigma_{" + Int::toString(f.number()) + "}"; +// return (std::string)"\\sigma_{" + Int::toString(f.number()) + "}"; // } symbolName = env.signature->functionName(num); } @@ -437,7 +437,7 @@ vstring LaTeX::symbolToString (unsigned num, bool pred) const } if (digits == end) { *name = 0; - return vstring("\\mathit{") + newName + '}'; + return std::string("\\mathit{") + newName + '}'; } // copy digits as an index *name++ = '_'; @@ -447,7 +447,7 @@ vstring LaTeX::symbolToString (unsigned num, bool pred) const } *name++ = '}'; *name = 0; - return vstring("\\mathit{") + newName + '}'; + return std::string("\\mathit{") + newName + '}'; } @@ -460,13 +460,13 @@ vstring LaTeX::symbolToString (unsigned num, bool pred) const * * @since 09/12/2003 Manchester */ -vstring LaTeX::toString (TermList* terms,bool single) const +std::string LaTeX::toString (TermList* terms,bool single) const { if (terms->isEmpty()) { return ""; } - vstring result = single ? "" : " ("; + std::string result = single ? "" : " ("; bool first=true; TermList* t=terms; while(t->isNonEmpty()) { @@ -479,7 +479,7 @@ vstring LaTeX::toString (TermList* terms,bool single) const } // if (_map) { -// vstring result; +// std::string result; // if (_map->toString(t,*this,result)) { // return result; // } @@ -494,7 +494,7 @@ vstring LaTeX::toString (TermList* terms,bool single) const //Check if this symbol has an interpreted LaTeX name // this should be true for all known interpreted symbols and any recorded symbols - vstring template_str = theory->tryGetInterpretedLaTeXName(trm->functor(),false); + std::string template_str = theory->tryGetInterpretedLaTeXName(trm->functor(),false); if(template_str.empty()){ result += symbolToString(trm->functor(), false) + toString(trm->args()); @@ -502,8 +502,8 @@ vstring LaTeX::toString (TermList* terms,bool single) const else{ // replace arguments in the template, arg0 replaces a0 etc. for(unsigned i=0;iarity();i++){ - vstring from = "a"+Lib::Int::toString(i); - vstring to = toString(trm->nthArgument(i),true); + std::string from = "a"+Lib::Int::toString(i); + std::string to = toString(trm->nthArgument(i),true); size_t start_pos = 0; while((start_pos = template_str.find(from, start_pos)) != std::string::npos) { template_str.replace(start_pos, from.length(), to); @@ -525,12 +525,12 @@ vstring LaTeX::toString (TermList* terms,bool single) const // * Convert unit to LaTeX. // * @since 09/12/2003 Manchester // */ -// vstring LaTeX::toString (const Unit& u) const +// std::string LaTeX::toString (const Unit& u) const // { // TRACER("LaTeX::toString (const Unit& u)"); -// vstring prefix = Int::toString(u.number()) + ". "; -// vstring postfix = vstring("(") + Unit::toString(u.inputType()) + ")"; +// std::string prefix = Int::toString(u.number()) + ". "; +// std::string postfix = std::string("(") + Unit::toString(u.inputType()) + ")"; // switch (u.unitType()) { // case CLAUSE: @@ -544,14 +544,14 @@ vstring LaTeX::toString (TermList* terms,bool single) const // } // } // LaTeX::toString (const Unit& u) -vstring LaTeX::getClauseLatexId(Unit* cs) +std::string LaTeX::getClauseLatexId(Unit* cs) { return Int::toString(cs->number()); } -vstring LaTeX::toStringAsInference(Unit* cs, InferenceStore::FullInference* inf) +std::string LaTeX::toStringAsInference(Unit* cs, InferenceStore::FullInference* inf) { - vstring res("\\begin{VampireStep}\n[$"); + std::string res("\\begin{VampireStep}\n[$"); bool hasParents=inf->premCnt; for(unsigned i=0;ipremCnt;i++) { @@ -594,11 +594,11 @@ vstring LaTeX::toStringAsInference(Unit* cs, InferenceStore::FullInference* inf) * @since 23/10/2002 Manchester, as stream output function * @since 09/12/2003 Manchester */ -vstring LaTeX::toStringAsInference(Unit* unit) +std::string LaTeX::toStringAsInference(Unit* unit) { Inference& inf = unit->inference(); - vstring res("\\begin{VampireStep}\n[$"); + std::string res("\\begin{VampireStep}\n[$"); bool hasParents=false; Inference::Iterator it = inf.iterator(); @@ -639,15 +639,15 @@ vstring LaTeX::toStringAsInference(Unit* unit) } /* -vstring LaTeX::splittingToString(InferenceStore::SplittingRecord* sr) +std::string LaTeX::splittingToString(InferenceStore::SplittingRecord* sr) { - vstring res("[$"); + std::string res("[$"); res += getClauseLatexId(sr->premise); Stack >::Iterator ncit(sr->namedComps); while(ncit.hasNext()) { - res += vstring(",")+Int::toString(ncit.next().second->number())+"_D"; + res += std::string(",")+Int::toString(ncit.next().second->number())+"_D"; } res += "\\rightarrow "; res += getClauseLatexId(sr->result) @@ -690,10 +690,10 @@ vstring LaTeX::splittingToString(InferenceStore::SplittingRecord* sr) * @since 09/12/2003 Manchester * @since 17/9/2005 flight Chicago-Frankfurt, row variables case added */ -vstring LaTeX::varToString (unsigned num) const +std::string LaTeX::varToString (unsigned num) const { // if (v.toInt() < 0) { // row variable -// return vstring("@_{") + Int::toString(-v.toInt()) + "}"; +// return std::string("@_{") + Int::toString(-v.toInt()) + "}"; // } //#if KIF_EXPERIMENTS // switch (v.toInt()) { @@ -714,7 +714,7 @@ vstring LaTeX::varToString (unsigned num) const // } //#endif - return vstring("x_{") + Int::toString(num) + "}"; + return std::string("x_{") + Int::toString(num) + "}"; } // LaTeX::toString (Var v) @@ -727,11 +727,11 @@ vstring LaTeX::varToString (unsigned num) const // { // TRACER("LaTeX::output (const Refutation& ref)"); -// vstring fileName = _options.latexOutput(); +// std::string fileName = _options.latexOutput(); // if (fileName == "off") { // return; // } -// vstring refutation = toString(ref); +// std::string refutation = toString(ref); // if (fileName == "on") { // cout << refutation; // return; @@ -750,7 +750,7 @@ vstring LaTeX::varToString (unsigned num) const // * and arguments args. // * @since 28/09/2005 Redmond // */ -// vstring LaTeX::toString (const vstring& funOrPred,const TermList& args) const +// std::string LaTeX::toString (const std::string& funOrPred,const TermList& args) const // { // return funOrPred + toString(args); // } diff --git a/Shell/LaTeX.hpp b/Shell/LaTeX.hpp index 4e3ad53521..d103d4b11f 100644 --- a/Shell/LaTeX.hpp +++ b/Shell/LaTeX.hpp @@ -39,28 +39,28 @@ class LaTeX public: LaTeX() {} - vstring header(); - vstring footer(); - vstring refutationToString(Unit* ref); + std::string header(); + std::string footer(); + std::string refutationToString(Unit* ref); - vstring toString(const Term&) const; - vstring toString(const vstring& funOrPred,const TermList& args) const; - vstring toString(Unit*); + std::string toString(const Term&) const; + std::string toString(const std::string& funOrPred,const TermList& args) const; + std::string toString(Unit*); private: - vstring varToString(unsigned num) const; - vstring toString(TermList*,bool single=false) const; - vstring toString(Literal*) const; - vstring toString(Clause*); - vstring toString(Formula*) const; - vstring toString(Formula*, Connective c) const; + std::string varToString(unsigned num) const; + std::string toString(TermList*,bool single=false) const; + std::string toString(Literal*) const; + std::string toString(Clause*); + std::string toString(Formula*) const; + std::string toString(Formula*, Connective c) const; - vstring getClauseLatexId(Unit* cs); + std::string getClauseLatexId(Unit* cs); - //vstring splittingToString(InferenceStore::SplittingRecord*); - vstring toStringAsInference(Unit*); - vstring toStringAsInference(Unit* cs, InferenceStore::FullInference* inf); + //std::string splittingToString(InferenceStore::SplittingRecord*); + std::string toStringAsInference(Unit*); + std::string toStringAsInference(Unit* cs, InferenceStore::FullInference* inf); - vstring symbolToString (unsigned num, bool pred) const; + std::string symbolToString (unsigned num, bool pred) const; }; // class LaTeX diff --git a/Shell/LambdaElimination.cpp b/Shell/LambdaElimination.cpp index c63357fead..8e2b98f69a 100644 --- a/Shell/LambdaElimination.cpp +++ b/Shell/LambdaElimination.cpp @@ -146,7 +146,7 @@ TermList LambdaElimination::elimLambda(Formula* formula) Formula* lhs = formula->left(); Formula* rhs = formula->right(); - vstring name = (conn == IFF ? "vIFF" : (conn == IMP ? "vIMP" : "vXOR")); + std::string name = (conn == IFF ? "vIFF" : (conn == IMP ? "vIMP" : "vXOR")); constant = TermList(Term::createConstant(env.signature->getBinaryProxy(name))); TermList form1 = elimLambda(lhs); @@ -165,7 +165,7 @@ TermList LambdaElimination::elimLambda(Formula* formula) case OR:{ FormulaList::Iterator argsIt(formula->args()); - vstring name = (conn == AND ? "vAND" : "vOR"); + std::string name = (conn == AND ? "vAND" : "vOR"); constant = TermList(Term::createConstant(env.signature->getBinaryProxy(name))); /*TermListComparator tlc; @@ -209,7 +209,7 @@ TermList LambdaElimination::elimLambda(Formula* formula) VList* var = VList::singleton(0); TermList form = elimLambda(formula->qarg()); - vstring name = (conn == FORALL ? "vPI" : "vSIGMA"); + std::string name = (conn == FORALL ? "vPI" : "vSIGMA"); unsigned proxy = env.signature->getPiSigmaProxy(name); TermList s; diff --git a/Shell/Lexer.cpp b/Shell/Lexer.cpp index 4c5f7b8cbe..1a698ccfcd 100644 --- a/Shell/Lexer.cpp +++ b/Shell/Lexer.cpp @@ -97,7 +97,7 @@ void Lexer::readNumber (Token& token) } } saveTokenText(token); - throw LexerException((vstring)"incorrect number format in " + token.text, + throw LexerException((std::string)"incorrect number format in " + token.text, *this); } token.tag = TT_INTEGER; @@ -154,7 +154,7 @@ void Lexer::readUnsignedInteger () * Create a new lexer exception. * @since 15/07/2004 Turku */ -LexerException::LexerException (vstring message,const Lexer& lexer) +LexerException::LexerException (std::string message,const Lexer& lexer) : _message (message) { if (lexer.isAtEndOfFile()) { @@ -189,7 +189,7 @@ void Lexer::readSequence (const char* cs) while (*cs) { readNextChar(); if (lastCharacter() != *cs) { - throw LexerException((vstring)cs + + throw LexerException((std::string)cs + " expected",*this); } cs++; diff --git a/Shell/Lexer.hpp b/Shell/Lexer.hpp index 3c7ddb5ae3..ddfdea0acb 100644 --- a/Shell/Lexer.hpp +++ b/Shell/Lexer.hpp @@ -39,11 +39,11 @@ class LexerException : public ParsingRelatedException { public: - LexerException(vstring message,const Lexer&); + LexerException(std::string message,const Lexer&); void cry(std::ostream&) const; ~LexerException() {} protected: - vstring _message; + std::string _message; }; // LexerException diff --git a/Shell/LispLexer.cpp b/Shell/LispLexer.cpp index 4df6e29e05..e86b7db4a1 100644 --- a/Shell/LispLexer.cpp +++ b/Shell/LispLexer.cpp @@ -194,13 +194,13 @@ void LispLexer::readQuotedString(Token& token, char opening, char closing, char } else { if (escape && _lastCharacter!=closing && _lastCharacter!=escapeChar) { - throw LexerException((vstring)"invalid escape sequence in quoted string ", *this); + throw LexerException((std::string)"invalid escape sequence in quoted string ", *this); } escape=false; saveLastChar(); } } - throw LexerException((vstring)"file ended while reading quoted string ", *this); + throw LexerException((std::string)"file ended while reading quoted string ", *this); } // LispLexer::readQuotedString diff --git a/Shell/LispParser.cpp b/Shell/LispParser.cpp index 45b14064b2..923a8ab16b 100644 --- a/Shell/LispParser.cpp +++ b/Shell/LispParser.cpp @@ -158,14 +158,14 @@ void LispParser::parse(List** expr0) * Return a LISP string corresponding to this expression * @since 26/08/2009 Redmond */ -vstring LispParser::Expression::toString(bool outerParentheses) const +std::string LispParser::Expression::toString(bool outerParentheses) const { switch (tag) { case ATOM: return str; case LIST: { - vstring result; + std::string result; if(outerParentheses) { result = "("; } @@ -188,7 +188,7 @@ vstring LispParser::Expression::toString(bool outerParentheses) const * If expression corresponds to a unary function named @c funcionName, * return true and assign its argument to @c arg. Otherwise return false. */ -bool LispParser::Expression::get1Arg(vstring functionName, Expression*& arg) +bool LispParser::Expression::get1Arg(std::string functionName, Expression*& arg) { if(!isList()) { return false; @@ -196,7 +196,7 @@ bool LispParser::Expression::get1Arg(vstring functionName, Expression*& arg) List::Iterator args(list); if(!args.hasNext()) { return false; } - vstring name = args.next()->str; + std::string name = args.next()->str; if(name!=functionName) { return false; } if(!args.hasNext()) { return false; } @@ -213,7 +213,7 @@ bool LispParser::Expression::get1Arg(vstring functionName, Expression*& arg) * return true and assign its arguments to @c arg1 and @c arg2. Otherwise * return false. */ -bool LispParser::Expression::get2Args(vstring functionName, Expression*& arg1, Expression*& arg2) +bool LispParser::Expression::get2Args(std::string functionName, Expression*& arg1, Expression*& arg2) { if(!isList()) { return false; @@ -221,7 +221,7 @@ bool LispParser::Expression::get2Args(vstring functionName, Expression*& arg1, E List::Iterator args(list); if(!args.hasNext()) { return false; } - vstring name = args.next()->str; + std::string name = args.next()->str; if(name!=functionName) { return false; } if(!args.hasNext()) { return false; } @@ -281,7 +281,7 @@ bool LispParser::Expression::getSingleton(Expression*& el) * Create a new parser exception. * @since 17/07/2004 Turku */ -LispParser::Exception::Exception(vstring message,const Token& token) +LispParser::Exception::Exception(std::string message,const Token& token) : _message (message) { _message += " in line "; @@ -303,7 +303,7 @@ void LispParser::Exception::cry(ostream& out) const // LispListReader // -void LispListReader::lispError(LExpr* expr, vstring reason) +void LispListReader::lispError(LExpr* expr, std::string reason) { if(expr) { USER_ERROR(reason+": "+expr->toString()); @@ -316,7 +316,7 @@ void LispListReader::lispError(LExpr* expr, vstring reason) /** * Report error with the current lisp element */ -void LispListReader::lispCurrError(vstring reason) +void LispListReader::lispCurrError(std::string reason) { if(hasNext()) { lispError(peekAtNext(), reason); @@ -340,7 +340,7 @@ LExpr* LispListReader::readNext() return it.next(); } -bool LispListReader::tryReadAtom(vstring& atom) +bool LispListReader::tryReadAtom(std::string& atom) { if(!hasNext()) { return false; } @@ -353,16 +353,16 @@ bool LispListReader::tryReadAtom(vstring& atom) return false; } -vstring LispListReader::readAtom() +std::string LispListReader::readAtom() { - vstring atm; + std::string atm; if(!tryReadAtom(atm)) { lispCurrError("atom expected"); } return atm; } -bool LispListReader::tryAcceptAtom(vstring atom) +bool LispListReader::tryAcceptAtom(std::string atom) { if(!hasNext()) { return false; } @@ -374,7 +374,7 @@ bool LispListReader::tryAcceptAtom(vstring atom) return false; } -void LispListReader::acceptAtom(vstring atom) +void LispListReader::acceptAtom(std::string atom) { if(!tryAcceptAtom(atom)) { lispCurrError("atom \""+atom+"\" expected"); @@ -435,7 +435,7 @@ void LispListReader::acceptEOL() } } -bool LispListReader::lookAheadAtom(vstring atom) +bool LispListReader::lookAheadAtom(std::string atom) { if(!hasNext()) { return false; } LExpr* next = peekAtNext(); diff --git a/Shell/LispParser.hpp b/Shell/LispParser.hpp index e0f8a41eb1..005d424c53 100644 --- a/Shell/LispParser.hpp +++ b/Shell/LispParser.hpp @@ -53,7 +53,7 @@ class LispParser /** type of the expression */ Tag tag; /** the value (for atoms and numbers) */ - vstring str; + std::string str; /** list of expressions */ List* list; /** build a list expressions with the list initially empty */ @@ -63,18 +63,18 @@ class LispParser list(0) {} /** build a string-values expression */ - Expression(Tag t,vstring s) + Expression(Tag t,std::string s) : tag(t), str(s), list(0) {} - vstring toString(bool outerParentheses=true) const; + std::string toString(bool outerParentheses=true) const; bool isList() const { return tag==LIST; } bool isAtom() const { return tag==ATOM; } - bool get2Args(vstring functionName, Expression*& arg1, Expression*& arg2); - bool get1Arg(vstring functionName, Expression*& arg); + bool get2Args(std::string functionName, Expression*& arg1, Expression*& arg2); + bool get1Arg(std::string functionName, Expression*& arg); bool getPair(Expression*& el1, Expression*& el2); bool getSingleton(Expression*& el); }; @@ -93,11 +93,11 @@ class LispParser : public Lib::ParsingRelatedException { public: - Exception (vstring message,const Token&); + Exception (std::string message,const Token&); void cry (std::ostream&) const; ~Exception () {} protected: - vstring _message; + std::string _message; }; // Exception private: @@ -122,16 +122,16 @@ class LispListReader { } explicit LispListReader(LExprList* list) : it(list) {} - [[noreturn]] void lispError(LExpr* expr, vstring reason="error"); - [[noreturn]] void lispCurrError(vstring reason="error"); + [[noreturn]] void lispError(LExpr* expr, std::string reason="error"); + [[noreturn]] void lispCurrError(std::string reason="error"); bool hasNext() { return it.hasNext(); } LExpr* peekAtNext(); LExpr* readNext(); LExpr* next() { return readNext(); } - bool tryReadAtom(vstring& atom); - vstring readAtom(); + bool tryReadAtom(std::string& atom); + std::string readAtom(); bool tryReadListExpr(LExpr*& e); LExpr* readListExpr(); @@ -139,8 +139,8 @@ class LispListReader { bool tryReadList(LExprList*& list); LExprList* readList(); - bool tryAcceptAtom(vstring atom); - void acceptAtom(vstring atom); + bool tryAcceptAtom(std::string atom); + void acceptAtom(std::string atom); void acceptAtom() { readAtom(); } bool tryAcceptList(); @@ -148,7 +148,7 @@ class LispListReader { void acceptEOL(); - bool lookAheadAtom(vstring atom); + bool lookAheadAtom(std::string atom); bool tryAcceptCurlyBrackets(); private: @@ -172,7 +172,7 @@ class LispListWriter } #endif - LispListWriter& operator<<(vstring s) + LispListWriter& operator<<(std::string s) { _elements.push(new LExpr(LispParser::ATOM, s)); return *this; diff --git a/Shell/NewCNF.hpp b/Shell/NewCNF.hpp index 9e98ccb544..3768efb087 100644 --- a/Shell/NewCNF.hpp +++ b/Shell/NewCNF.hpp @@ -178,8 +178,8 @@ class NewCNF // Position of a gen literal in _genClauses std::list>::iterator iter; - vstring toString() { - vstring res = "GC("+Int::toString(size())+")"; + std::string toString() { + std::string res = "GC("+Int::toString(size())+")"; if (!valid) { res += " [INVALID]"; } diff --git a/Shell/Options.cpp b/Shell/Options.cpp index 25db946990..09a50567bb 100644 --- a/Shell/Options.cpp +++ b/Shell/Options.cpp @@ -1199,7 +1199,7 @@ void Options::init() _inequalityNormalization.addProblemConstraint(hasTheories()); _inequalityNormalization.tag(OptionTag::THEORIES); - auto choiceArithmeticSimplificationMode = [&](vstring l, vstring s, ArithmeticSimplificationMode d) + auto choiceArithmeticSimplificationMode = [&](std::string l, std::string s, ArithmeticSimplificationMode d) { return ChoiceOptionValue(l,s,d, {"force", "cautious", "off", }); }; _cancellation = choiceArithmeticSimplificationMode( "cancellation", "canc", @@ -2390,7 +2390,7 @@ void Options::set(const char* name,const char* value, bool longOpt) (!longOpt && !_lookup.findShort(name)->set(value))) { switch (ignoreMissing()) { case IgnoreMissing::OFF: - USER_ERROR((vstring) value +" is an invalid value for "+(vstring)name+"\nSee help or use explain i.e. vampire -explain mode"); + USER_ERROR((std::string) value +" is an invalid value for "+(std::string)name+"\nSee help or use explain i.e. vampire -explain mode"); break; case IgnoreMissing::WARN: if (outputAllowed()) { @@ -2405,7 +2405,7 @@ void Options::set(const char* name,const char* value, bool longOpt) } catch (const ValueNotFoundException&) { if (_ignoreMissing.actualValue != IgnoreMissing::ON) { - vstring msg = (vstring)name + (longOpt ? " is not a valid option" : " is not a valid short option (did you mean --?)"); + std::string msg = (std::string)name + (longOpt ? " is not a valid option" : " is not a valid short option (did you mean --?)"); if (_ignoreMissing.actualValue == IgnoreMissing::WARN) { if (outputAllowed()) { addCommentSignForSZS(std::cout); @@ -2413,10 +2413,10 @@ void Options::set(const char* name,const char* value, bool longOpt) } return; } // else: - Stack sim = getSimilarOptionNames(name,false); - Stack::Iterator sit(sim); + Stack sim = getSimilarOptionNames(name,false); + Stack::Iterator sit(sim); if(sit.hasNext()){ - vstring first = sit.next(); + std::string first = sit.next(); msg += "\n\tMaybe you meant "; if(sit.hasNext()) msg += "one of:\n\t\t"; msg += first; @@ -2432,7 +2432,7 @@ void Options::set(const char* name,const char* value, bool longOpt) * Set option by its name and value. * @since 06/04/2005 Torrevieja */ -void Options::set(const vstring& name,const vstring& value) +void Options::set(const std::string& name,const std::string& value) { set(name.c_str(),value.c_str(),true); } // Options::set/2 @@ -2459,7 +2459,7 @@ bool Options::HasTheories::check(Property*p) { * @param relativeName the relative name, must begin and end with "'" * because of the TPTP syntax * @since 16/10/2003 Manchester, relativeName changed to string from char* - * @since 07/08/2014 Manchester, relativeName changed to vstring + * @since 07/08/2014 Manchester, relativeName changed to std::string */ // TODO this behaviour isn't quite right, at least: // 1. we use the *root* file to resolve relative paths, which won't work if we have an axiom file that includes another @@ -2468,7 +2468,7 @@ bool Options::HasTheories::check(Property*p) { // cf https://tptp.org/TPTP/TR/TPTPTR.shtml#IncludeSection // probable solution: move all this logic into TPTP parser and do it properly there -vstring Options::includeFileName (const vstring& relativeName) +std::string Options::includeFileName (const std::string& relativeName) { if (relativeName[0] == '/') { // absolute name return relativeName; @@ -2481,7 +2481,7 @@ vstring Options::includeFileName (const vstring& relativeName) // truncatedRelativeName is relative. // Use the conventions of Vampire: // (a) first search the value of "include" - vstring dir = include(); + std::string dir = include(); if (dir == "") { // include undefined // (b) search in the directory of the 'current file' @@ -2529,7 +2529,7 @@ void Options::output (ostream& str) const if(!explainOption().empty()){ AbstractOptionValue* option; - vstring name = explainOption(); + std::string name = explainOption(); try{ option = _lookup.findLong(name); } @@ -2543,12 +2543,12 @@ void Options::output (ostream& str) const } if(!option){ str << name << " not a known option" << endl; - Stack sim_s = getSimilarOptionNames(name,true); - Stack sim_l = getSimilarOptionNames(name,false); - VirtualIterator sit = pvi(concatIters( - Stack::Iterator(sim_s),Stack::Iterator(sim_l))); + Stack sim_s = getSimilarOptionNames(name,true); + Stack sim_l = getSimilarOptionNames(name,false); + VirtualIterator sit = pvi(concatIters( + Stack::Iterator(sim_s),Stack::Iterator(sim_l))); if(sit.hasNext()){ - vstring first = sit.next(); + std::string first = sit.next(); str << "\tMaybe you meant "; if(sit.hasNext()) str << "one of:\n\t\t"; str << first; @@ -2592,11 +2592,9 @@ void Options::output (ostream& str) const VirtualIterator options = _lookup.values(); - //Stack groups; int num_tags = static_cast(OptionTag::LAST_TAG); Stack> groups; for(int i=0; i<=num_tags;i++){ - // groups.push(new vstringstream); Stack stack; groups.push(stack); } @@ -2616,10 +2614,10 @@ void Options::output (ostream& str) const //output them in reverse order for(int i=num_tags;i>=0;i--){ if(groups[i].isEmpty()) continue; - vstring label = " "+_tagNames[i]+" "; + std::string label = " "+_tagNames[i]+" "; ASS(label.length() < 40); - vstring br = "******************************"; - vstring br_gap = br.substr(0,(br.length()-(label.length()/2))); + std::string br = "******************************"; + std::string br_gap = br.substr(0,(br.length()-(label.length()/2))); str << endl << br << br; if (label.length() % 2 == 0) { str << endl; @@ -2735,7 +2733,7 @@ bool Options::RatioOptionValue::readRatio(const char* val, char separator) return true; } -bool Options::NonGoalWeightOptionValue::setValue(const vstring& value) +bool Options::NonGoalWeightOptionValue::setValue(const std::string& value) { float newValue; if(!Int::stringToFloat(value.c_str(),newValue)) return false; @@ -2752,7 +2750,7 @@ bool Options::NonGoalWeightOptionValue::setValue(const vstring& value) return true; } -bool Options::SelectionOptionValue::setValue(const vstring& value) +bool Options::SelectionOptionValue::setValue(const std::string& value) { int sel; if(!Int::stringToInt(value,sel)) return false; @@ -2814,7 +2812,7 @@ bool Options::SelectionOptionValue::setValue(const vstring& value) } } -bool Options::InputFileOptionValue::setValue(const vstring& value) +bool Options::InputFileOptionValue::setValue(const std::string& value) { actualValue=value; if(value.empty()) return true; @@ -2845,11 +2843,11 @@ bool Options::InputFileOptionValue::setValue(const vstring& value) } -bool Options::TimeLimitOptionValue::setValue(const vstring& value) +bool Options::TimeLimitOptionValue::setValue(const std::string& value) { int length = value.size(); if (length == 0 || length >= COPY_SIZE) { - USER_ERROR((vstring)"wrong value for time limit: " + value); + USER_ERROR((std::string)"wrong value for time limit: " + value); } char copy[COPY_SIZE]; @@ -2888,7 +2886,7 @@ bool Options::TimeLimitOptionValue::setValue(const vstring& value) float number; if (! Int::stringToFloat(copy,number)) { - USER_ERROR((vstring)"wrong value for time limit: " + value); + USER_ERROR((std::string)"wrong value for time limit: " + value); } #ifdef _MSC_VER @@ -2908,7 +2906,7 @@ bool Options::TimeLimitOptionValue::setValue(const vstring& value) * An optname starting with $ is not meant to be a real option, but a fake one. * Fakes get stored in the map fakes and can be referenced later, during the sampling process. */ -void Options::strategySamplingAssign(vstring optname, vstring value, DHMap& fakes) +void Options::strategySamplingAssign(std::string optname, std::string value, DHMap& fakes) { // dollar sign signifies fake options if (optname[0] == '$') { @@ -2934,10 +2932,10 @@ void Options::strategySamplingAssign(vstring optname, vstring value, DHMap& fakes) +std::string Options::strategySamplingLookup(std::string optname, DHMap& fakes) { if (optname[0] == '$') { - vstring* foundVal = fakes.findPtr(optname); + std::string* foundVal = fakes.findPtr(optname); if (!foundVal) { USER_ERROR("Sampling file processing error -- unassigned fake option: " + optname); } @@ -2953,7 +2951,7 @@ vstring Options::strategySamplingLookup(vstring optname, DHMap& return ""; } -void Options::sampleStrategy(const vstring& strategySamplerFilename) +void Options::sampleStrategy(const std::string& strategySamplerFilename) { std::ifstream input(strategySamplerFilename.c_str()); @@ -2964,10 +2962,10 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) // our local randomizing engine (randomly seeded) std::mt19937 rng((std::random_device())()); // map of local variables (fake options) - DHMap fakes; + DHMap fakes; - vstring line; // parsed lines - Stack pieces; // temp stack used for splitting + std::string line; // parsed lines + Stack pieces; // temp stack used for splitting while (std::getline(input, line)) { if (line.length() == 0 || line[0] == '#') { // empty lines and comments (starting with # as the first! character) @@ -2979,8 +2977,8 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) USER_ERROR("Sampling file parse error -- each rule must contain exactly one >. Here: "+line); } - vstring cond = pieces[0]; - vstring body = pieces[1]; + std::string cond = pieces[0]; + std::string body = pieces[1]; pieces.reset(); // evaluate condition, if false, will skip the rest @@ -2989,22 +2987,22 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) StringUtils::splitStr(cond.c_str(),' ',pieces); StringUtils::dropEmpty(pieces); - Stack pair; - Stack::BottomFirstIterator it(pieces); + Stack pair; + Stack::BottomFirstIterator it(pieces); while(it.hasNext()) { - vstring equation = it.next(); + std::string equation = it.next(); StringUtils::splitStr(equation.c_str(),'=',pair); StringUtils::dropEmpty(pair); if (pair.size() != 2) { USER_ERROR("Sampling file parse error -- invalid equation: "+equation); } bool negated = false; - vstring optName = pair[0]; + std::string optName = pair[0]; if (optName.back() == '!') { negated = true; optName.pop_back(); } - vstring storedVal = strategySamplingLookup(optName,fakes); + std::string storedVal = strategySamplingLookup(optName,fakes); if ((storedVal != pair[1]) != negated) { fireRule = false; break; @@ -3028,23 +3026,23 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) USER_ERROR("Sampling file parse error -- rule body must consist of three space-separated parts. Here: "+body); } - vstring optname = pieces[0]; - vstring sampler = pieces[1]; - vstring args = pieces[2]; + std::string optname = pieces[0]; + std::string sampler = pieces[1]; + std::string args = pieces[2]; pieces.reset(); if (sampler == "~cat") { // categorical sampling, e.g., "~cat group:36,predicate:4,expand:4,off:1,function:1" provides a list of value with frequencies StringUtils::splitStr(args.c_str(),',',pieces); unsigned total = 0; - Stack> mulvals; //values with multiplicities, e.g. "off:5", or "on:1" + Stack> mulvals; //values with multiplicities, e.g. "off:5", or "on:1" // parse the mulvals { - Stack pair; - Stack::BottomFirstIterator it(pieces); + Stack pair; + Stack::BottomFirstIterator it(pieces); while(it.hasNext()) { - vstring mulval = it.next(); + std::string mulval = it.next(); StringUtils::splitStr(mulval.c_str(),':',pair); // StringUtils::dropEmpty(pair); if (pair.size() != 2) { @@ -3063,9 +3061,9 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) } // actual sampling - vstring value; + std::string value; unsigned sample = std::uniform_int_distribution(1,total)(rng); - Stack>::BottomFirstIterator it(mulvals); + Stack>::BottomFirstIterator it(mulvals); while (it.hasNext()) { auto mulval = it.next(); if (sample <= mulval.first) { @@ -3158,7 +3156,7 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) } /* - Stack::BottomFirstIterator it(pieces); + Stack::BottomFirstIterator it(pieces); while(it.hasNext()) { cout << "tok:" << it.next() << endl; } @@ -3169,28 +3167,28 @@ void Options::sampleStrategy(const vstring& strategySamplerFilename) } /** - * Assign option values as encoded in the option vstring if assign=true, otherwise check that + * Assign option values as encoded in the option std::string if assign=true, otherwise check that * the option values are not currently set to those values. * according to the argument in the format * opt1=val1:opt2=val2:...:optn=valN, * for example bs=off:cond=on:drc=off:nwc=1.5:nicw=on:sos=on:sio=off:spl=sat:ssnc=none */ -void Options::readOptionsString(vstring optionsString,bool assign) +void Options::readOptionsString(std::string optionsString,bool assign) { // repeatedly look for param=value while (optionsString != "") { size_t index1 = optionsString.find('='); - if (index1 == vstring::npos) { + if (index1 == std::string::npos) { error: USER_ERROR("bad option specification '" + optionsString+"'"); } size_t index = optionsString.find(':'); - if (index!=vstring::npos && index1 > index) { + if (index!=std::string::npos && index1 > index) { goto error; } - vstring param = optionsString.substr(0,index1); - vstring value; - if (index==vstring::npos) { + std::string param = optionsString.substr(0,index1); + std::string value; + if (index==std::string::npos) { value = optionsString.substr(index1+1); } else { @@ -3216,7 +3214,7 @@ void Options::readOptionsString(vstring optionsString,bool assign) } } else{ - vstring current = opt->getStringOfActual(); + std::string current = opt->getStringOfActual(); if(value==current){ USER_ERROR("option "+param+" uses forbidden value "+value); } @@ -3238,7 +3236,7 @@ void Options::readOptionsString(vstring optionsString,bool assign) } } - if (index==vstring::npos) { + if (index==std::string::npos) { return; } optionsString = optionsString.substr(index+1); @@ -3252,11 +3250,11 @@ void Options::readOptionsString(vstring optionsString,bool assign) * in deciseconds * @throws UserErrorException if the test id is incorrect */ -void Options::readFromEncodedOptions (vstring testId) +void Options::readFromEncodedOptions (std::string testId) { _testId.actualValue = testId; - vstring ma(testId,0,3); // the first 3 characters + std::string ma(testId,0,3); // the first 3 characters if (ma == "dis") { _saturationAlgorithm.actualValue = SaturationAlgorithm::DISCOUNT; } @@ -3275,10 +3273,10 @@ void Options::readFromEncodedOptions (vstring testId) // after last '_' we have time limit size_t index = testId.find_last_of('_'); - if (index == vstring::npos) { // not found + if (index == std::string::npos) { // not found goto error; } - vstring timeString = testId.substr(index+1); + std::string timeString = testId.substr(index+1); _timeLimitInDeciseconds.set(timeString); // setting assumes seconds as default, but encoded strings use deciseconds _timeLimitInDeciseconds.actualValue = _timeLimitInDeciseconds.actualValue/10; @@ -3295,7 +3293,7 @@ void Options::readFromEncodedOptions (vstring testId) } index = testId.find('_'); - vstring sel = testId.substr(0,index); + std::string sel = testId.substr(0,index); _selection.set(sel); testId = testId.substr(index+1); @@ -3304,7 +3302,7 @@ void Options::readFromEncodedOptions (vstring testId) } index = testId.find('_'); - vstring awr = testId.substr(0,index); + std::string awr = testId.substr(0,index); _ageWeightRatio.set(awr.c_str()); if (index==string::npos) { //there are no extra options @@ -3322,13 +3320,13 @@ void Options::setForcedOptionValues() } /** - * Return testId vstring that represents current values of the options + * Return testId std::string that represents current values of the options */ -vstring Options::generateEncodedOptions() const +std::string Options::generateEncodedOptions() const { std::ostringstream res; //saturation algorithm - vstring sat; + std::string sat; switch(_saturationAlgorithm.actualValue){ case SaturationAlgorithm::LRS : sat="lrs"; break; case SaturationAlgorithm::DISCOUNT : sat="dis"; break; @@ -3390,7 +3388,7 @@ vstring Options::generateEncodedOptions() const AbstractOptionValue* option = options.next(); // TODO do we want to also filter by !isDefault? if(!forbidden.contains(option) && option->is_set && !option->isDefault()){ - vstring name = option->shortName; + std::string name = option->shortName; if(name.empty()) name = option->longName; if(!first){ res<<":";}else{first=false;} res << name << "=" << option->getStringOfActual(); @@ -3591,11 +3589,11 @@ bool Options::checkProblemOptionConstraints(Property* prop, bool before_preproce } template -std::vector parseCommaSeparatedList(vstring const& str) +std::vector parseCommaSeparatedList(std::string const& str) { std::stringstream stream(str); std::vector parsed; - vstring cur; + std::string cur; while (std::getline(stream, cur, ',')) { parsed.push_back(StringUtils::parse(cur)); } diff --git a/Shell/Options.hpp b/Shell/Options.hpp index 491d66da8a..aa1c486570 100644 --- a/Shell/Options.hpp +++ b/Shell/Options.hpp @@ -49,7 +49,6 @@ #include "Lib/DArray.hpp" #include "Lib/Stack.hpp" #include "Lib/Int.hpp" -#include "Lib/Allocator.hpp" #include "Lib/Comparison.hpp" #include "Lib/Timer.hpp" @@ -72,7 +71,7 @@ class Property; * * @author Giles */ -static size_t distance(const vstring &s1, const vstring &s2) +static size_t distance(const std::string &s1, const std::string &s2) { const size_t m(s1.size()); const size_t n(s2.size()); @@ -85,13 +84,13 @@ static size_t distance(const vstring &s1, const vstring &s2) for( size_t k=0; k<=n; k++ ) costs[k] = k; size_t i = 0; - for ( vstring::const_iterator it1 = s1.begin(); it1 != s1.end(); ++it1, ++i ) + for ( std::string::const_iterator it1 = s1.begin(); it1 != s1.end(); ++it1, ++i ) { costs[0] = i+1; size_t corner = i; size_t j = 0; - for ( vstring::const_iterator it2 = s2.begin(); it2 != s2.end(); ++it2, ++j ) + for ( std::string::const_iterator it2 = s2.begin(); it2 != s2.end(); ++it2, ++j ) { size_t upper = costs[j+1]; if( *it1 == *it2 ){costs[j+1] = corner;} @@ -127,9 +126,9 @@ class Options void output (std::ostream&) const; // Dealing with encoded options. Used by --decode option - void readFromEncodedOptions (vstring testId); - void readOptionsString (vstring testId,bool assign=true); - vstring generateEncodedOptions() const; + void readFromEncodedOptions (std::string testId); + void readOptionsString (std::string testId,bool assign=true); + std::string generateEncodedOptions() const; // deal with completeness bool complete(const Problem&) const; @@ -162,7 +161,7 @@ class Options * and if $nm is set to NZ, samples from a shifted geometric distribution with p=0.07 and a shift=2. (So 2 gets selected with a probability p, * 3 with a probability p(1-p), ... and 2+i with a probability p(1-p)^i). */ - void sampleStrategy(const vstring& samplerFileName); + void sampleStrategy(const std::string& samplerFileName); /** * Return the problem name @@ -172,14 +171,14 @@ class Options * the problem name is equal to "unknown". The problem name can * be set to a specific value using setProblemName(). */ - const vstring& problemName () const { return _problemName.actualValue; } - void setProblemName(vstring str) { _problemName.actualValue = str; } + const std::string& problemName () const { return _problemName.actualValue; } + void setProblemName(std::string str) { _problemName.actualValue = str; } - void setInputFile(const vstring& newVal){ _inputFile.set(newVal); } - vstring includeFileName (const vstring& relativeName); + void setInputFile(const std::string& newVal){ _inputFile.set(newVal); } + std::string includeFileName (const std::string& relativeName); // standard ways of creating options - void set(const vstring& name, const vstring& value); // implicitly the long version used here + void set(const std::string& name, const std::string& value); // implicitly the long version used here void set(const char* name, const char* value, bool longOpt); public: @@ -783,8 +782,8 @@ class Options // The details are explained in comments below private: // helper function of sampleStrategy - void strategySamplingAssign(vstring optname, vstring value, DHMap& fakes); - vstring strategySamplingLookup(vstring optname, DHMap& fakes); + void strategySamplingAssign(std::string optname, std::string value, DHMap& fakes); + std::string strategySamplingLookup(std::string optname, DHMap& fakes); /** * These store the names of the choices for an option. @@ -803,27 +802,27 @@ class Options } public: OptionChoiceValues() : _names() { }; - OptionChoiceValues(Stack names) : _names(std::move(names)) + OptionChoiceValues(Stack names) : _names(std::move(names)) { check_names_are_short(); } - OptionChoiceValues(std::initializer_list list) : _names(list) + OptionChoiceValues(std::initializer_list list) : _names(list) { check_names_are_short(); } - int find(vstring value) const { + int find(std::string value) const { for(unsigned i=0;i<_names.length();i++){ if(value.compare(_names[i])==0) return i; } return -1; } const int length() const { return _names.length(); } - const vstring operator[](int i) const{ return _names[i];} + const std::string operator[](int i) const{ return _names[i];} private: - Stack _names; + Stack _names; }; // Declare constraints here so they can be referred to, but define them below @@ -847,7 +846,7 @@ class Options */ struct AbstractOptionValue { AbstractOptionValue(){} - AbstractOptionValue(vstring l,vstring s) : + AbstractOptionValue(std::string l,std::string s) : longName(l), shortName(s), experimental(false), is_set(false),_should_copy(true), _tag(OptionTag::LAST_TAG), supress_problemconstraints(false) {} // Never copy an OptionValue... the Constraint system would break @@ -862,9 +861,9 @@ class Options // This is the main method, it sets the value of the option using an input string // Returns false if we cannot set (will cause a UserError in Options::set) - virtual bool setValue(const vstring& value) = 0; + virtual bool setValue(const std::string& value) = 0; - bool set(const vstring& value, bool dont_touch_if_defaulting = false) { + bool set(const std::string& value, bool dont_touch_if_defaulting = false) { bool okay = setValue(value); if (okay && (!dont_touch_if_defaulting || !isDefault())) { is_set=true; @@ -876,9 +875,9 @@ class Options void setExperimental(){experimental=true;} // Meta-data - vstring longName; - vstring shortName; - vstring description; + std::string longName; + std::string shortName; + std::string description; bool experimental; bool is_set; @@ -897,12 +896,11 @@ class Options } // This allows us to get the actual value in string form - virtual vstring getStringOfActual() const = 0; + virtual std::string getStringOfActual() const = 0; // Check if default value virtual bool isDefault() const = 0; // For use in showOptions and explainOption - //virtual void output(vstringstream& out) const { virtual void output(std::ostream& out,bool linewrap) const { out << "--" << longName; if(!shortName.empty()){ out << " (-"<> vstringDArrayUP; + typedef std::unique_ptr> stringDArrayUP; - typedef std::pair RandEntry; + typedef std::pair RandEntry; private: // Tag state OptionTag _tag; Lib::Stack _modes; - vstringDArrayUP toArray(std::initializer_list& list){ - DArray* array = new DArray(list.size()); + stringDArrayUP toArray(std::initializer_list& list){ + DArray* array = new DArray(list.size()); unsigned index=0; - for(typename std::initializer_list::iterator it = list.begin(); + for(typename std::initializer_list::iterator it = list.begin(); it!=list.end();++it){ (*array)[index++] =*it; } - return vstringDArrayUP(array); + return stringDArrayUP(array); } protected: // Note has LIFO semantics so use BottomFirstIterator @@ -979,7 +977,7 @@ class Options // with something when the Options object is created. They should then all be reconstructed // This is annoying but preferable to the alternative in my opinion OptionValue(){} - OptionValue(vstring l, vstring s,T def) : AbstractOptionValue(l,s), + OptionValue(std::string l, std::string s,T def) : AbstractOptionValue(l,s), defaultValue(def), actualValue(def){} // We store the defaultValue separately so that we can check if the actualValue is non-default @@ -989,8 +987,8 @@ class Options virtual bool isDefault() const { return defaultValue==actualValue;} // Getting the string versions of values, useful for output - virtual vstring getStringOfValue(T value) const{ ASSERTION_VIOLATION;} - virtual vstring getStringOfActual() const { return getStringOfValue(actualValue); } + virtual std::string getStringOfValue(T value) const{ ASSERTION_VIOLATION;} + virtual std::string getStringOfActual() const { return getStringOfValue(actualValue); } // Adding and checking constraints // By default constraints are soft and reaction to them is controlled by the bad_option option @@ -1073,11 +1071,11 @@ class Options template struct ChoiceOptionValue : public OptionValue { ChoiceOptionValue(){} - ChoiceOptionValue(vstring l, vstring s,T def,OptionChoiceValues c) : + ChoiceOptionValue(std::string l, std::string s,T def,OptionChoiceValues c) : OptionValue(l,s,def), choices(c) {} - ChoiceOptionValue(vstring l, vstring s,T d) : ChoiceOptionValue(l,s,d, T::optionChoiceValues()) {} + ChoiceOptionValue(std::string l, std::string s,T d) : ChoiceOptionValue(l,s,d, T::optionChoiceValues()) {} - bool setValue(const vstring& value){ + bool setValue(const std::string& value){ // makes reasonable assumption about ordering of every enum int index = choices.find(value.c_str()); if(index<0) return false; @@ -1099,7 +1097,7 @@ class Options } else{ out << ","; - vstring next = choices[i]; + std::string next = choices[i]; if(linewrap && next.size()+count>60){ // next.size() will be <70, how big is a tab? out << std::endl << "\t"; for(unsigned j=0;j(value); return choices[i]; } @@ -1128,8 +1126,8 @@ class Options */ struct BoolOptionValue : public OptionValue { BoolOptionValue(){} - BoolOptionValue(vstring l,vstring s, bool d) : OptionValue(l,s,d){} - bool setValue(const vstring& value){ + BoolOptionValue(std::string l,std::string s, bool d) : OptionValue(l,s,d){} + bool setValue(const std::string& value){ if (! value.compare("on") || ! value.compare("true")) { actualValue=true; @@ -1142,36 +1140,36 @@ class Options return true; } - vstring getStringOfValue(bool value) const { return (value ? "on" : "off"); } + std::string getStringOfValue(bool value) const { return (value ? "on" : "off"); } }; struct IntOptionValue : public OptionValue { IntOptionValue(){} - IntOptionValue(vstring l,vstring s, int d) : OptionValue(l,s,d){} - bool setValue(const vstring& value){ + IntOptionValue(std::string l,std::string s, int d) : OptionValue(l,s,d){} + bool setValue(const std::string& value){ return Int::stringToInt(value.c_str(),actualValue); } - vstring getStringOfValue(int value) const{ return Lib::Int::toString(value); } + std::string getStringOfValue(int value) const{ return Lib::Int::toString(value); } }; struct UnsignedOptionValue : public OptionValue { UnsignedOptionValue(){} - UnsignedOptionValue(vstring l,vstring s, unsigned d) : OptionValue(l,s,d){} + UnsignedOptionValue(std::string l,std::string s, unsigned d) : OptionValue(l,s,d){} - bool setValue(const vstring& value){ + bool setValue(const std::string& value){ return Int::stringToUnsignedInt(value.c_str(),actualValue); } - vstring getStringOfValue(unsigned value) const{ return Lib::Int::toString(value); } + std::string getStringOfValue(unsigned value) const{ return Lib::Int::toString(value); } }; - struct StringOptionValue : public OptionValue { + struct StringOptionValue : public OptionValue { StringOptionValue(){} - StringOptionValue(vstring l,vstring s, vstring d) : OptionValue(l,s,d){} - bool setValue(const vstring& value){ + StringOptionValue(std::string l,std::string s, std::string d) : OptionValue(l,s,d){} + bool setValue(const std::string& value){ actualValue = (value=="") ? "" : value; return true; } - vstring getStringOfValue(vstring value) const{ + std::string getStringOfValue(std::string value) const{ if(value.empty()) return ""; return value; } @@ -1179,20 +1177,20 @@ class Options struct LongOptionValue : public OptionValue { LongOptionValue(){} - LongOptionValue(vstring l,vstring s, long d) : OptionValue(l,s,d){} - bool setValue(const vstring& value){ + LongOptionValue(std::string l,std::string s, long d) : OptionValue(l,s,d){} + bool setValue(const std::string& value){ return Int::stringToLong(value.c_str(),actualValue); } - vstring getStringOfValue(long value) const{ return Lib::Int::toString(value); } + std::string getStringOfValue(long value) const{ return Lib::Int::toString(value); } }; struct FloatOptionValue : public OptionValue{ FloatOptionValue(){} -FloatOptionValue(vstring l,vstring s, float d) : OptionValue(l,s,d){} -bool setValue(const vstring& value){ +FloatOptionValue(std::string l,std::string s, float d) : OptionValue(l,s,d){} +bool setValue(const std::string& value){ return Int::stringToFloat(value.c_str(),actualValue); } -vstring getStringOfValue(float value) const{ return Lib::Int::toString(value); } +std::string getStringOfValue(float value) const{ return Lib::Int::toString(value); } }; /** @@ -1202,7 +1200,7 @@ vstring getStringOfValue(float value) const{ return Lib::Int::toString(value); } */ struct RatioOptionValue : public OptionValue { RatioOptionValue(){} -RatioOptionValue(vstring l, vstring s, int def, int other, char sp=':') : +RatioOptionValue(std::string l, std::string s, int def, int other, char sp=':') : OptionValue(l,s,def), sep(sp), defaultOtherValue(other), otherValue(other) {}; virtual OptionValueConstraintUP getNotDefault() override { return isNotDefaultRatio(); } @@ -1214,7 +1212,7 @@ void addConstraintIfNotDefault(AbstractWrappedConstraintUP c){ } bool readRatio(const char* val,char seperator); -bool setValue(const vstring& value) override { +bool setValue(const std::string& value) override { return readRatio(value.c_str(),sep); } @@ -1228,8 +1226,8 @@ virtual void output(std::ostream& out,bool linewrap) const override { out << "\tdefault right: " << defaultOtherValue << std::endl; } -virtual vstring getStringOfValue(int value) const override { ASSERTION_VIOLATION;} -virtual vstring getStringOfActual() const override { +virtual std::string getStringOfValue(int value) const override { ASSERTION_VIOLATION;} +virtual std::string getStringOfActual() const override { return Lib::Int::toString(actualValue)+sep+Lib::Int::toString(otherValue); } @@ -1244,17 +1242,17 @@ virtual vstring getStringOfActual() const override { */ struct NonGoalWeightOptionValue : public OptionValue{ NonGoalWeightOptionValue(){} -NonGoalWeightOptionValue(vstring l, vstring s, float def) : +NonGoalWeightOptionValue(std::string l, std::string s, float def) : OptionValue(l,s,def), numerator(1), denominator(1) {}; -bool setValue(const vstring& value); +bool setValue(const std::string& value); // output does not output numerator and denominator as they // are produced from defaultValue int numerator; int denominator; -virtual vstring getStringOfValue(float value) const{ return Lib::Int::toString(value); } +virtual std::string getStringOfValue(float value) const{ return Lib::Int::toString(value); } }; /** @@ -1264,17 +1262,17 @@ virtual vstring getStringOfValue(float value) const{ return Lib::Int::toString(v */ struct SelectionOptionValue : public OptionValue{ SelectionOptionValue(){} -SelectionOptionValue(vstring l,vstring s, int def): +SelectionOptionValue(std::string l,std::string s, int def): OptionValue(l,s,def){}; -bool setValue(const vstring& value); +bool setValue(const std::string& value); virtual void output(std::ostream& out,bool linewrap) const { AbstractOptionValue::output(out,linewrap); out << "\tdefault: " << defaultValue << std::endl;; } -virtual vstring getStringOfValue(int value) const{ return Lib::Int::toString(value); } +virtual std::string getStringOfValue(int value) const{ return Lib::Int::toString(value); } AbstractWrappedConstraintUP isLookAheadSelection(){ return AbstractWrappedConstraintUP(new WrappedConstraint(*this,OptionValueConstraintUP(new isLookAheadSelectionConstraint()))); @@ -1285,18 +1283,18 @@ AbstractWrappedConstraintUP isLookAheadSelection(){ * This also updates problemName * @author Giles */ -struct InputFileOptionValue : public OptionValue{ +struct InputFileOptionValue : public OptionValue{ InputFileOptionValue(){} -InputFileOptionValue(vstring l,vstring s, vstring def,Options* p): +InputFileOptionValue(std::string l,std::string s, std::string def,Options* p): OptionValue(l,s,def), parent(p){}; -bool setValue(const vstring& value); +bool setValue(const std::string& value); virtual void output(std::ostream& out,bool linewrap) const { AbstractOptionValue::output(out,linewrap); out << "\tdefault: " << defaultValue << std::endl;; } -virtual vstring getStringOfValue(vstring value) const{ return value; } +virtual std::string getStringOfValue(std::string value) const{ return value; } private: Options* parent; @@ -1305,16 +1303,16 @@ Options* parent; * We need to decode the encoded option string * @author Giles */ -struct DecodeOptionValue : public OptionValue{ +struct DecodeOptionValue : public OptionValue{ DecodeOptionValue(){ AbstractOptionValue::_should_copy=false;} -DecodeOptionValue(vstring l,vstring s,Options* p): +DecodeOptionValue(std::string l,std::string s,Options* p): OptionValue(l,s,""), parent(p){ AbstractOptionValue::_should_copy=false;} -bool setValue(const vstring& value){ +bool setValue(const std::string& value){ parent->readFromEncodedOptions(value); return true; } -virtual vstring getStringOfValue(vstring value) const{ return value; } +virtual std::string getStringOfValue(std::string value) const{ return value; } private: Options* parent; @@ -1327,16 +1325,16 @@ Options* parent; */ struct TimeLimitOptionValue : public OptionValue{ TimeLimitOptionValue(){} -TimeLimitOptionValue(vstring l, vstring s, float def) : +TimeLimitOptionValue(std::string l, std::string s, float def) : OptionValue(l,s,def) {}; -bool setValue(const vstring& value); +bool setValue(const std::string& value); virtual void output(std::ostream& out,bool linewrap) const { AbstractOptionValue::output(out,linewrap); out << "\tdefault: " << defaultValue << "d" << std::endl; } -virtual vstring getStringOfValue(int value) const{ return Lib::Int::toString(value)+"d"; } +virtual std::string getStringOfValue(int value) const{ return Lib::Int::toString(value)+"d"; } }; /** @@ -1386,7 +1384,7 @@ OptionValueConstraint() : _hard(false) {} virtual ~OptionValueConstraint() {} // virtual methods present -> there should be virtual destructor virtual bool check(const OptionValue& value) = 0; -virtual vstring msg(const OptionValue& value) = 0; +virtual std::string msg(const OptionValue& value) = 0; // By default cannot force constraint virtual bool force(OptionValue* value){ return false;} @@ -1400,7 +1398,7 @@ bool _hard; // It allows us to supply a constraint on another OptionValue in an If constraint for example struct AbstractWrappedConstraint { virtual bool check() = 0; - virtual vstring msg() = 0; + virtual std::string msg() = 0; virtual ~AbstractWrappedConstraint() {}; }; @@ -1411,7 +1409,7 @@ bool _hard; bool check() override { return con->check(value); } - vstring msg() override { + std::string msg() override { return con->msg(value); } @@ -1424,7 +1422,7 @@ bool _hard; bool check() override { return left->check() || right->check(); } - vstring msg() override { return left->msg() + " or " + right->msg(); } + std::string msg() override { return left->msg() + " or " + right->msg(); } AbstractWrappedConstraintUP left; AbstractWrappedConstraintUP right; @@ -1435,7 +1433,7 @@ bool _hard; bool check() override { return left->check() && right->check(); } - vstring msg() override { return left->msg() + " and " + right->msg(); } + std::string msg() override { return left->msg() + " and " + right->msg(); } AbstractWrappedConstraintUP left; AbstractWrappedConstraintUP right; @@ -1447,7 +1445,7 @@ bool _hard; bool check(const OptionValue& value){ return left->check(value) || right->check(value); } - vstring msg(const OptionValue& value){ return left->msg(value) + " or " + right->msg(value); } + std::string msg(const OptionValue& value){ return left->msg(value) + " or " + right->msg(value); } OptionValueConstraintUP left; OptionValueConstraintUP right; @@ -1459,7 +1457,7 @@ bool _hard; bool check(const OptionValue& value){ return left->check(value) && right->check(value); } - vstring msg(const OptionValue& value){ return left->msg(value) + " and " + right->msg(value); } + std::string msg(const OptionValue& value){ return left->msg(value) + " and " + right->msg(value); } OptionValueConstraintUP left; OptionValueConstraintUP right; @@ -1470,7 +1468,7 @@ bool _hard; UnWrappedConstraint(AbstractWrappedConstraintUP c) : con(std::move(c)) {} bool check(const OptionValue&){ return con->check(); } - vstring msg(const OptionValue&){ return con->msg(); } + std::string msg(const OptionValue&){ return con->msg(); } AbstractWrappedConstraintUP con; }; @@ -1533,7 +1531,7 @@ bool _hard; bool check(const OptionValue& value){ return value.actualValue == _goodvalue; } - vstring msg(const OptionValue& value){ + std::string msg(const OptionValue& value){ return value.longName+"("+value.getStringOfActual()+") is equal to " + value.getStringOfValue(_goodvalue); } T _goodvalue; @@ -1549,7 +1547,7 @@ bool _hard; bool check(const OptionValue& value){ return value.actualValue != _badvalue; } - vstring msg(const OptionValue& value){ return value.longName+"("+value.getStringOfActual()+") is not equal to " + value.getStringOfValue(_badvalue); } + std::string msg(const OptionValue& value){ return value.longName+"("+value.getStringOfActual()+") is not equal to " + value.getStringOfValue(_badvalue); } T _badvalue; }; template @@ -1565,7 +1563,7 @@ bool _hard; bool check(const OptionValue& value){ return (value.actualValue < _goodvalue || (_orequal && value.actualValue==_goodvalue)); } - vstring msg(const OptionValue& value){ + std::string msg(const OptionValue& value){ if(_orequal) return value.longName+"("+value.getStringOfActual()+") is less than or equal to " + value.getStringOfValue(_goodvalue); return value.longName+"("+value.getStringOfActual()+") is less than "+ value.getStringOfValue(_goodvalue); } @@ -1591,7 +1589,7 @@ bool _hard; return (value.actualValue > _goodvalue || (_orequal && value.actualValue==_goodvalue)); } - vstring msg(const OptionValue& value){ + std::string msg(const OptionValue& value){ if(_orequal) return value.longName+"("+value.getStringOfActual()+") is greater than or equal to " + value.getStringOfValue(_goodvalue); return value.longName+"("+value.getStringOfActual()+") is greater than "+ value.getStringOfValue(_goodvalue); } @@ -1617,7 +1615,7 @@ bool _hard; return (value.actualValue < _goodvalue || (_orequal && value.actualValue==_goodvalue)); } - vstring msg(const OptionValue& value){ + std::string msg(const OptionValue& value){ if(_orequal) return value.longName+"("+value.getStringOfActual()+") is smaller than or equal to " + value.getStringOfValue(_goodvalue); return value.longName+"("+value.getStringOfActual()+") is smaller than "+ value.getStringOfValue(_goodvalue); } @@ -1651,7 +1649,7 @@ bool _hard; return !if_con->check(value) || then_con->check(value); } - vstring msg(const OptionValue& value){ + std::string msg(const OptionValue& value){ return "if "+if_con->msg(value)+" then "+ then_con->msg(value); } @@ -1692,7 +1690,7 @@ bool _hard; bool check(const OptionValue& value) override { return value.is_set; } - vstring msg(const OptionValue& value) override { return value.longName+"("+value.getStringOfActual()+") has been set";} + std::string msg(const OptionValue& value) override { return value.longName+"("+value.getStringOfActual()+") has been set";} }; template @@ -1710,7 +1708,7 @@ bool _hard; bool check(const OptionValue& value){ return value.defaultValue != value.actualValue; } - vstring msg(const OptionValue& value) { return value.longName+"("+value.getStringOfActual()+") is not default("+value.getStringOfValue(value.defaultValue)+")";} + std::string msg(const OptionValue& value) { return value.longName+"("+value.getStringOfActual()+") is not default("+value.getStringOfValue(value.defaultValue)+")";} }; struct NotDefaultRatioConstraint : public OptionValueConstraint { NotDefaultRatioConstraint() {} @@ -1720,7 +1718,7 @@ bool _hard; return (rvalue.defaultValue != rvalue.actualValue || rvalue.defaultOtherValue != rvalue.otherValue); } - vstring msg(const OptionValue& value) { return value.longName+"("+value.getStringOfActual()+") is not default";} + std::string msg(const OptionValue& value) { return value.longName+"("+value.getStringOfActual()+") is not default";} }; @@ -1739,7 +1737,7 @@ bool _hard; bool check(const OptionValue& value){ return value.actualValue == 11 || value.actualValue == 1011 || value.actualValue == -11 || value.actualValue == -1011; } - vstring msg(const OptionValue& value){ + std::string msg(const OptionValue& value){ return value.longName+"("+value.getStringOfActual()+") is not lookahead selection"; } }; @@ -1757,7 +1755,7 @@ bool _hard; struct OptionProblemConstraint{ virtual bool check(Property* p) = 0; - virtual vstring msg() = 0; + virtual std::string msg() = 0; virtual ~OptionProblemConstraint() {}; }; @@ -1767,8 +1765,8 @@ bool _hard; ASS(p); return has ? p->category()==cat : p->category()!=cat; } - vstring msg(){ - vstring m =" not useful for property "; + std::string msg(){ + std::string m =" not useful for property "; if(has) m+="not"; return m+" in category "+Property::categoryToString(cat); } @@ -1783,7 +1781,7 @@ bool _hard; // theories may introduce equality at various places of the pipeline! HasTheories::actualCheck(p); } - vstring msg(){ return " only useful with equality"; } + std::string msg(){ return " only useful with equality"; } }; struct HasHigherOrder : OptionProblemConstraint{ @@ -1791,7 +1789,7 @@ bool _hard; ASS(p) return (p->higherOrder()); } - vstring msg(){ return " only useful with higher-order problems"; } + std::string msg(){ return " only useful with higher-order problems"; } }; struct OnlyFirstOrder : OptionProblemConstraint{ @@ -1799,7 +1797,7 @@ bool _hard; ASS(p) return (!p->higherOrder()); } - vstring msg(){ return " not compatible with higher-order problems"; } + std::string msg(){ return " not compatible with higher-order problems"; } }; struct MayHaveNonUnits : OptionProblemConstraint{ @@ -1807,14 +1805,14 @@ bool _hard; return (p->formulas() > 0) // let's not try to guess what kind of clauses these will give rise to || (p->clauses() > p->unitClauses()); } - vstring msg(){ return " only useful with non-unit clauses"; } + std::string msg(){ return " only useful with non-unit clauses"; } }; struct NotJustEquality : OptionProblemConstraint{ bool check(Property*p){ return (p->category()!=Property::PEQ || p->category()!=Property::UEQ); } - vstring msg(){ return " not useful with just equality"; } + std::string msg(){ return " not useful with just equality"; } }; struct AtomConstraint : OptionProblemConstraint{ @@ -1825,8 +1823,8 @@ bool _hard; return greater ? p->atoms()>atoms : p->atoms()hasFormulas(); } - vstring msg(){ return " only useful with (non-cnf) formulas"; } + std::string msg(){ return " only useful with (non-cnf) formulas"; } }; struct HasGoal : OptionProblemConstraint { bool check(Property*p){ return p->hasGoal(); } - vstring msg(){ return " only useful with a goal: (conjecture) formulas or (negated_conjecture) clauses"; } + std::string msg(){ return " only useful with a goal: (conjecture) formulas or (negated_conjecture) clauses"; } }; // Factory methods @@ -1882,11 +1880,11 @@ bool _hard; // set of options will not be randomized and some will be randomized first struct OptionHasValue : OptionProblemConstraint{ - OptionHasValue(vstring ov,vstring v) : option_value(ov),value(v) {} + OptionHasValue(std::string ov,std::string v) : option_value(ov),value(v) {} bool check(Property*p); - vstring msg(){ return option_value+" has value "+value; } - vstring option_value; - vstring value; + std::string msg(){ return option_value+" has value "+value; } + std::string option_value; + std::string value; }; struct ManyOptionProblemConstraints : OptionProblemConstraint { @@ -1900,8 +1898,8 @@ bool _hard; return res; } - vstring msg(){ - vstring res=""; + std::string msg(){ + std::string res=""; Stack::RefIterator it(cons); if(it.hasNext()){ res=it.next()->msg();} while(it.hasNext()){ res+=",and\n"+it.next()->msg();} @@ -1950,10 +1948,10 @@ bool _hard; bool encodeStrategy() const{ return _encode.actualValue;} BadOption getBadOptionChoice() const { return _badOption.actualValue; } void setBadOptionChoice(BadOption newVal) { _badOption.actualValue = newVal; } - vstring forcedOptions() const { return _forcedOptions.actualValue; } - vstring forbiddenOptions() const { return _forbiddenOptions.actualValue; } - vstring testId() const { return _testId.actualValue; } - vstring protectedPrefix() const { return _protectedPrefix.actualValue; } + std::string forcedOptions() const { return _forcedOptions.actualValue; } + std::string forbiddenOptions() const { return _forbiddenOptions.actualValue; } + std::string testId() const { return _testId.actualValue; } + std::string protectedPrefix() const { return _protectedPrefix.actualValue; } Statistics statistics() const { return _statistics.actualValue; } void setStatistics(Statistics newVal) { _statistics.actualValue=newVal; } Proof proof() const { return _proof.actualValue; } @@ -1961,7 +1959,7 @@ bool _hard; ProofExtra proofExtra() const { return _proofExtra.actualValue; } bool traceback() const { return _traceback.actualValue; } void setTraceback(bool traceback) { _traceback.actualValue = traceback; } - vstring printProofToFile() const { return _printProofToFile.actualValue; } + std::string printProofToFile() const { return _printProofToFile.actualValue; } int naming() const { return _naming.actualValue; } bool fmbNonGroundDefs() const { return _fmbNonGroundDefs.actualValue; } @@ -1980,9 +1978,9 @@ bool _hard; Mode mode() const { return _mode.actualValue; } void setMode(Mode mode) { _mode.actualValue = mode; } Schedule schedule() const { return _schedule.actualValue; } - vstring scheduleName() const { return _schedule.getStringOfValue(_schedule.actualValue); } + std::string scheduleName() const { return _schedule.getStringOfValue(_schedule.actualValue); } void setSchedule(Schedule newVal) { _schedule.actualValue = newVal; } - vstring scheduleFile() const { return _scheduleFile.actualValue; } + std::string scheduleFile() const { return _scheduleFile.actualValue; } unsigned multicore() const { return _multicore.actualValue; } void setMulticore(unsigned newVal) { _multicore.actualValue = newVal; } float slowness() const {return _slowness.actualValue; } @@ -1995,14 +1993,14 @@ bool _hard; void setMaxXX(unsigned max) { _maximumXXNarrows.actualValue = max; } void setNaming(int n){ _naming.actualValue = n;} //TODO: ensure global constraints - vstring include() const { return _include.actualValue; } - void setInclude(vstring val) { _include.actualValue = val; } - vstring inputFile() const { return _inputFile.actualValue; } + std::string include() const { return _include.actualValue; } + void setInclude(std::string val) { _include.actualValue = val; } + std::string inputFile() const { return _inputFile.actualValue; } void resetInputFile() { _inputFile.actualValue = ""; } int activationLimit() const { return _activationLimit.actualValue; } unsigned randomSeed() const { return _randomSeed.actualValue; } void setRandomSeed(unsigned seed) { _randomSeed.actualValue = seed; } - const vstring& strategySamplerFilename() const { return _sampleStrategy.actualValue; } + const std::string& strategySamplerFilename() const { return _sampleStrategy.actualValue; } bool printClausifierPremises() const { return _printClausifierPremises.actualValue; } // IMPORTANT, if you add a showX command then include showAll @@ -2028,8 +2026,8 @@ bool _hard; #if VZ3 bool showZ3() const { return showAll() || _showZ3.actualValue; } - vstring const& exportAvatarProblem() const { return _exportAvatarProblem.actualValue; } - vstring const& exportThiProblem() const { return _exportThiProblem.actualValue; } + std::string const& exportAvatarProblem() const { return _exportAvatarProblem.actualValue; } + std::string const& exportThiProblem() const { return _exportThiProblem.actualValue; } #endif // end of show commands @@ -2041,7 +2039,7 @@ bool _hard; bool lineWrapInShowOptions() const { return _showOptionsLineWrap.actualValue; } bool showExperimentalOptions() const { return _showExperimentalOptions.actualValue; } bool showHelp() const { return _showHelp.actualValue; } - vstring explainOption() const { return _explainOption.actualValue; } + std::string explainOption() const { return _explainOption.actualValue; } bool printAllTheoryAxioms() const { return _printAllTheoryAxioms.actualValue; } @@ -2068,7 +2066,7 @@ bool _hard; void setSaturationAlgorithm(SaturationAlgorithm newVal) { _saturationAlgorithm.actualValue = newVal; } int selection() const { return _selection.actualValue; } void setSelection(int v) { _selection.actualValue=v;} - vstring latexOutput() const { return _latexOutput.actualValue; } + std::string latexOutput() const { return _latexOutput.actualValue; } bool latexUseDefault() const { return _latexUseDefaultSymbols.actualValue; } LiteralComparisonMode literalComparisonMode() const { return _literalComparisonMode.actualValue; } bool forwardSubsumptionResolution() const { return _forwardSubsumptionResolution.actualValue; } @@ -2111,11 +2109,11 @@ bool _hard; KboWeightGenerationScheme kboWeightGenerationScheme() const { return _kboWeightGenerationScheme.actualValue; } bool kboMaxZero() const { return _kboMaxZero.actualValue; } const KboAdmissibilityCheck kboAdmissabilityCheck() const { return _kboAdmissabilityCheck.actualValue; } - const vstring& functionWeights() const { return _functionWeights.actualValue; } - const vstring& predicateWeights() const { return _predicateWeights.actualValue; } - const vstring& functionPrecedence() const { return _functionPrecedence.actualValue; } - const vstring& typeConPrecedence() const { return _typeConPrecedence.actualValue; } - const vstring& predicatePrecedence() const { return _predicatePrecedence.actualValue; } + const std::string& functionWeights() const { return _functionWeights.actualValue; } + const std::string& predicateWeights() const { return _predicateWeights.actualValue; } + const std::string& functionPrecedence() const { return _functionPrecedence.actualValue; } + const std::string& typeConPrecedence() const { return _typeConPrecedence.actualValue; } + const std::string& predicatePrecedence() const { return _predicatePrecedence.actualValue; } // Return time limit in deciseconds, or 0 if there is no time limit int timeLimitInDeciseconds() const { return _timeLimitInDeciseconds.actualValue; } size_t memoryLimit() const { return _memoryLimit.actualValue; } @@ -2190,7 +2188,7 @@ bool _hard; Output outputMode() const { return _outputMode.actualValue; } void setOutputMode(Output newVal) { _outputMode.actualValue = newVal; } bool ignoreMissingInputsInUnsatCore() { return _ignoreMissingInputsInUnsatCore.actualValue; } - vstring thanks() const { return _thanks.actualValue; } + std::string thanks() const { return _thanks.actualValue; } void setQuestionAnswering(QuestionAnsweringMode newVal) { _questionAnswering.actualValue = newVal; } bool globalSubsumption() const { return _globalSubsumption.actualValue; } GlobalSubsumptionSatSolverPower globalSubsumptionSatSolverPower() const { return _globalSubsumptionSatSolverPower.actualValue; } @@ -2331,11 +2329,11 @@ bool _hard; if(!new_long || !new_short){ std::cout << "Bad " << option_value->longName << std::endl; } ASS(new_long && new_short); } - AbstractOptionValue* findLong(vstring longName) const{ + AbstractOptionValue* findLong(std::string longName) const{ if(!_longMap.find(longName)){ throw ValueNotFoundException(); } return _longMap.get(longName); } - AbstractOptionValue* findShort(vstring shortName) const{ + AbstractOptionValue* findShort(std::string shortName) const{ if(!_shortMap.find(shortName)){ throw ValueNotFoundException(); } return _shortMap.get(shortName); } @@ -2345,14 +2343,14 @@ bool _hard; } private: - DHMap _longMap; - DHMap _shortMap; + DHMap _longMap; + DHMap _shortMap; }; LookupWrapper _lookup; // The const is a lie - we can alter the resulting OptionValue - AbstractOptionValue* getOptionValueByName(vstring name) const{ + AbstractOptionValue* getOptionValueByName(std::string name) const{ try{ return _lookup.findLong(name); } @@ -2366,14 +2364,14 @@ bool _hard; } } - Stack getSimilarOptionNames(vstring name, bool is_short) const{ + Stack getSimilarOptionNames(std::string name, bool is_short) const{ - Stack similar_names; + Stack similar_names; VirtualIterator options = _lookup.values(); while(options.hasNext()){ AbstractOptionValue* opt = options.next(); - vstring opt_name = is_short ? opt->shortName : opt->longName; + std::string opt_name = is_short ? opt->shortName : opt->longName; size_t dif = 2; if(!is_short) dif += name.size()/4; if(name.size()!=0 && distance(name,opt_name) < dif) diff --git a/Shell/PredicateDefinition.cpp b/Shell/PredicateDefinition.cpp index ee0ec0376e..dc1fc95757 100644 --- a/Shell/PredicateDefinition.cpp +++ b/Shell/PredicateDefinition.cpp @@ -135,7 +135,7 @@ struct PredicateDefinition::PredData return docc==0 && ( (pocc==0) ^ (nocc==0) ); } - vstring stateToString() const { + std::string stateToString() const { return env.signature->predicateName(pred) + ": +(" + Int::toString(pocc) + ") -(" + Int::toString(nocc) + ") 0(" + Int::toString(docc) + ")"; } diff --git a/Shell/Property.cpp b/Shell/Property.cpp index e8430e6494..3acf74c632 100644 --- a/Shell/Property.cpp +++ b/Shell/Property.cpp @@ -787,11 +787,11 @@ void Property::scanForInterpreted(Term* t) /** * Return the string representation of the CASC category. */ -vstring Property::categoryString() const +std::string Property::categoryString() const { return categoryToString(_category); } -vstring Property::categoryToString(Category cat) +std::string Property::categoryToString(Category cat) { switch (cat) { @@ -824,9 +824,9 @@ vstring Property::categoryToString(Category cat) * ARE CURRENTLY OUTPUT. * @since 27/08/2003 Vienna */ -vstring Property::toString() const +std::string Property::toString() const { - vstring result("TPTP class: "); + std::string result("TPTP class: "); result += categoryString() + "\n"; if (clauses() > 0) { @@ -1037,9 +1037,9 @@ bool Property::hasXEqualsY(const Formula* f) * * @since 04/05/2005 Manchester */ -vstring Property::toSpider(const vstring& problemName) const +std::string Property::toSpider(const std::string& problemName) const { - return (vstring)"UPDATE problem SET property=" + return (std::string)"UPDATE problem SET property=" + Int::toString((int)_props) + ",category='" + categoryString() diff --git a/Shell/Property.hpp b/Shell/Property.hpp index c2626be032..09ba34ef3d 100644 --- a/Shell/Property.hpp +++ b/Shell/Property.hpp @@ -158,11 +158,11 @@ class Property /** Return the CASC category of the problem */ Category category() const { return _category;} - static vstring categoryToString(Category cat); - vstring categoryString() const; + static std::string categoryToString(Category cat); + std::string categoryString() const; - vstring toString() const; - vstring toSpider(const vstring& problemName) const; + std::string toString() const; + std::string toSpider(const std::string& problemName) const; /** Total number of clauses in the problem. */ int clauses() const { return _goalClauses + _axiomClauses; } diff --git a/Shell/Skolem.cpp b/Shell/Skolem.cpp index 56ec2a890b..cf15853558 100644 --- a/Shell/Skolem.cpp +++ b/Shell/Skolem.cpp @@ -122,7 +122,7 @@ unsigned Skolem::addSkolemFunction(unsigned arity, TermList* domainSorts, TermList rangeSort, unsigned var, unsigned taArity) { if(VarManager::varNamePreserving()) { - vstring varName=VarManager::getVarName(var); + std::string varName=VarManager::getVarName(var); return addSkolemFunction(arity, taArity, domainSorts, rangeSort, varName.c_str()); } else { @@ -146,7 +146,7 @@ unsigned Skolem::addSkolemFunction(unsigned arity, unsigned taArity, TermList* d unsigned Skolem::addSkolemTypeCon(unsigned arity, unsigned var) { if(VarManager::varNamePreserving()) { - vstring varName=VarManager::getVarName(var); + std::string varName=VarManager::getVarName(var); return addSkolemTypeCon(arity, varName.c_str()); } else { @@ -166,7 +166,7 @@ unsigned Skolem::addSkolemTypeCon(unsigned arity, const char* suffix) unsigned Skolem::addSkolemPredicate(unsigned arity, TermList* domainSorts, unsigned var, unsigned taArity) { if(VarManager::varNamePreserving()) { - vstring varName=VarManager::getVarName(var); + std::string varName=VarManager::getVarName(var); return addSkolemPredicate(arity, taArity, domainSorts, varName.c_str()); } else { diff --git a/Shell/Statistics.hpp b/Shell/Statistics.hpp index 1a5a6bef60..82c5c54e5c 100644 --- a/Shell/Statistics.hpp +++ b/Shell/Statistics.hpp @@ -332,7 +332,7 @@ class Statistics Kernel::UnitList* saturatedSet; /** if problem is satisfiable and we obtained a model, contains its * representation; otherwise it is an empty string */ - vstring model; + std::string model; enum ExecutionPhase { /** Whatever happens before we start parsing the problem */ diff --git a/Shell/TPTPPrinter.cpp b/Shell/TPTPPrinter.cpp index 694f108fbe..31e7f13b0c 100644 --- a/Shell/TPTPPrinter.cpp +++ b/Shell/TPTPPrinter.cpp @@ -51,7 +51,7 @@ TPTPPrinter::TPTPPrinter(ostream* tgtStream) */ void TPTPPrinter::print(Unit* u) { - vstring body = getBodyStr(u, true); + std::string body = getBodyStr(u, true); ensureHeadersPrinted(u); printTffWrapper(u, body); @@ -62,26 +62,26 @@ void TPTPPrinter::print(Unit* u) * @param name * @param u */ -void TPTPPrinter::printAsClaim(vstring name, Unit* u) +void TPTPPrinter::printAsClaim(std::string name, Unit* u) { printWithRole(name, "claim", u); } -void TPTPPrinter::printWithRole(vstring name, vstring role, Unit* u, bool includeSplitLevels) +void TPTPPrinter::printWithRole(std::string name, std::string role, Unit* u, bool includeSplitLevels) { - vstring body = getBodyStr(u, includeSplitLevels); + std::string body = getBodyStr(u, includeSplitLevels); ensureHeadersPrinted(u); tgt() << "tff(" << name << ", " << role << ", " << body << ")." << endl; } /** - * Return as a vstring the body of the Unit u + * Return as a std::string the body of the Unit u * @param u * @param includeSplitLevels - * @return the body vstring + * @return the body std::string */ -vstring TPTPPrinter::getBodyStr(Unit* u, bool includeSplitLevels) +std::string TPTPPrinter::getBodyStr(Unit* u, bool includeSplitLevels) { std::ostringstream res; @@ -147,10 +147,10 @@ vstring TPTPPrinter::getBodyStr(Unit* u, bool includeSplitLevels) * @param u * @param bodyStr */ -void TPTPPrinter::printTffWrapper(Unit* u, vstring bodyStr) +void TPTPPrinter::printTffWrapper(Unit* u, std::string bodyStr) { tgt() << "tff("; - vstring unitName; + std::string unitName; if(Parse::TPTP::findAxiomName(u, unitName)) { tgt() << unitName; } @@ -219,12 +219,12 @@ void TPTPPrinter::outputSymbolTypeDefinitions(unsigned symNumber, SymbolType sym } } - vstring cat = "tff("; + std::string cat = "tff("; if(env.getMainProblem()->isHigherOrder()){ cat = "thf("; } - vstring st = "func"; + std::string st = "func"; if(symType == SymbolType::PRED){ st = "pred"; } else if(symType == SymbolType::TYPE_CON){ @@ -329,16 +329,16 @@ ostream& TPTPPrinter::tgt() } /** - * Return the vstring representing the formula f. + * Return the std::string representing the formula f. */ -vstring TPTPPrinter::toString(const Formula* formula) +std::string TPTPPrinter::toString(const Formula* formula) { - static vstring names [] = + static std::string names [] = { "", " & ", " | ", " => ", " <=> ", " <~> ", "~", "!", "?", "$term", "$false", "$true", "", ""}; - ASS_EQ(sizeof(names)/sizeof(vstring), NOCONN+1); + ASS_EQ(sizeof(names)/sizeof(std::string), NOCONN+1); - vstring res; + std::string res; // render a connective if specified, and then a Formula (or ")" of formula is nullptr) typedef pair Todo; @@ -363,7 +363,7 @@ vstring TPTPPrinter::toString(const Formula* formula) switch (c) { case LITERAL: { - vstring result = f->literal()->toString(); + std::string result = f->literal()->toString(); if (f->literal()->isEquality()) { res += "(" + result + ")"; } else { @@ -416,7 +416,7 @@ vstring TPTPPrinter::toString(const Formula* formula) case FORALL: case EXISTS: { - vstring result = vstring("(") + names[c] + "["; + std::string result = std::string("(") + names[c] + "["; bool needsComma = false; VList::Iterator vs(f->vars()); SList::Iterator ss(f->sorts()); @@ -471,23 +471,23 @@ vstring TPTPPrinter::toString(const Formula* formula) } /** - * Output unit @param unit in TPTP format as a vstring + * Output unit @param unit in TPTP format as a std::string * * If the unit is a formula of type @b CONJECTURE, output the * negation of Vampire's internal representation with the * TPTP role conjecture. If it is a clause, just output it as * is, with the role negated_conjecture. */ -vstring TPTPPrinter::toString (const Unit* unit) +std::string TPTPPrinter::toString (const Unit* unit) { // const Inference* inf = unit->inference(); // Inference::Rule rule = inf->rule(); - vstring prefix; - vstring main = ""; + std::string prefix; + std::string main = ""; bool negate_formula = false; - vstring kind; + std::string kind; switch (unit->inputType()) { case UnitInputType::ASSUMPTION: kind = "hypothesis"; @@ -550,7 +550,7 @@ vstring TPTPPrinter::toString (const Unit* unit) } } - vstring unitName; + std::string unitName; if(!Parse::TPTP::findAxiomName(unit, unitName)) { unitName="u" + Int::toString(unit->number()); } @@ -560,11 +560,11 @@ vstring TPTPPrinter::toString (const Unit* unit) } -vstring TPTPPrinter::toString(const Term* t){ +std::string TPTPPrinter::toString(const Term* t){ NOT_IMPLEMENTED; } -vstring TPTPPrinter::toString(const Literal* l){ +std::string TPTPPrinter::toString(const Literal* l){ NOT_IMPLEMENTED; } diff --git a/Shell/TPTPPrinter.hpp b/Shell/TPTPPrinter.hpp index 4943b82a76..91c009db95 100644 --- a/Shell/TPTPPrinter.hpp +++ b/Shell/TPTPPrinter.hpp @@ -35,23 +35,23 @@ class TPTPPrinter { TPTPPrinter(std::ostream* tgtStream=0); void print(Unit* u); - void printAsClaim(vstring name, Unit* u); - void printWithRole(vstring name, vstring role, Unit* u, bool includeSplitLevels = true); + void printAsClaim(std::string name, Unit* u); + void printWithRole(std::string name, std::string role, Unit* u, bool includeSplitLevels = true); - static vstring toString(const Unit*); - static vstring toString(const Formula*); - static vstring toString(const Term*); - static vstring toString(const Literal*); + static std::string toString(const Unit*); + static std::string toString(const Formula*); + static std::string toString(const Term*); + static std::string toString(const Literal*); private: - vstring getBodyStr(Unit* u, bool includeSplitLevels); + std::string getBodyStr(Unit* u, bool includeSplitLevels); void ensureHeadersPrinted(Unit* u); void outputSymbolTypeDefinitions(unsigned symNumber, SymbolType symType); void ensureNecesarySorts(); - void printTffWrapper(Unit* u, vstring bodyStr); + void printTffWrapper(Unit* u, std::string bodyStr); std::ostream& tgt(); diff --git a/Shell/TermAlgebra.cpp b/Shell/TermAlgebra.cpp index f1551740a7..7b5d8dd401 100644 --- a/Shell/TermAlgebra.cpp +++ b/Shell/TermAlgebra.cpp @@ -115,12 +115,12 @@ bool TermAlgebraConstructor::recursive() return false; } -Lib::vstring TermAlgebraConstructor::discriminatorName() +std::string TermAlgebraConstructor::discriminatorName() { //Giles: the function name may contain quotes so we should remove them // before appending $is. - vstring name = env.signature->functionName(_functor); - vstring ret = "$is"; + std::string name = env.signature->functionName(_functor); + std::string ret = "$is"; for(size_t i = 0; i < name.size(); i++){ char c = name[i]; if(c != '\''){ ret+=c;} @@ -204,7 +204,7 @@ bool TermAlgebra::infiniteDomain() return false; } -Lib::vstring TermAlgebra::getSubtermPredicateName() { +std::string TermAlgebra::getSubtermPredicateName() { return "$subterm" + env.signature->getTypeCon(_sort.term()->functor())->name(); } diff --git a/Shell/TermAlgebra.hpp b/Shell/TermAlgebra.hpp index 6ce419522e..af992265da 100644 --- a/Shell/TermAlgebra.hpp +++ b/Shell/TermAlgebra.hpp @@ -71,7 +71,7 @@ namespace Shell { friend std::ostream& operator<<(std::ostream& out, TermAlgebraConstructor const& self); private: - Lib::vstring discriminatorName(); + std::string discriminatorName(); Kernel::OperatorType* _type; unsigned _functor; @@ -152,7 +152,7 @@ namespace Shell { /* The predicate of the subterm relation, used only if the option -tac is set to "axiom"*/ - Lib::vstring getSubtermPredicateName(); + std::string getSubtermPredicateName(); unsigned getSubtermPredicate(); void getTypeSub(Kernel::Term* t, Kernel::Substitution& subst); diff --git a/Shell/TheoryFinder.cpp b/Shell/TheoryFinder.cpp index 8037c31ed0..d575721005 100644 --- a/Shell/TheoryFinder.cpp +++ b/Shell/TheoryFinder.cpp @@ -1456,7 +1456,7 @@ bool TheoryFinder::matchAll (const Literal* lit) // void TheoryFinder::analyse (const Clause& clause) // { // const Term& answer = clause.literals().head().atom().args().head(); -// const vstring theory(answer.functor().name()); +// const std::string theory(answer.functor().name()); // if (theory == "group") { // _property->addProp(Property::PR_GROUP); // } diff --git a/Shell/Token.cpp b/Shell/Token.cpp index 2b91891c63..76b192f1c4 100644 --- a/Shell/Token.cpp +++ b/Shell/Token.cpp @@ -27,7 +27,7 @@ namespace Shell { * * @since 25/07/2004 Torrevieja */ -Lib::vstring Token::toString (TokenType tt) +std::string Token::toString (TokenType tt) { switch (tt) { case TT_INTEGER: diff --git a/Shell/Token.hpp b/Shell/Token.hpp index 76426ac95f..0836b2e7f5 100644 --- a/Shell/Token.hpp +++ b/Shell/Token.hpp @@ -229,10 +229,10 @@ class Token { public: TokenType tag; - Lib::vstring text; + std::string text; int line; - static Lib::vstring toString (TokenType); + static std::string toString (TokenType); }; } diff --git a/Shell/UIHelper.cpp b/Shell/UIHelper.cpp index eed9d54612..213cc0c252 100644 --- a/Shell/UIHelper.cpp +++ b/Shell/UIHelper.cpp @@ -91,17 +91,17 @@ void reportSpiderStatus(char status) UIHelper::spiderOutputDone = true; // compute Vampire Z3 version and commit - vstring version = VERSION_STRING; + std::string version = VERSION_STRING; size_t versionPosition = version.find("commit ") + strlen("commit "); size_t afterVersionPosition = version.find(" ",versionPosition + 1); - vstring commitNumber = version.substr(versionPosition,afterVersionPosition - versionPosition); - vstring z3Version = Z3Interfacing::z3_full_version(); + std::string commitNumber = version.substr(versionPosition,afterVersionPosition - versionPosition); + std::string z3Version = Z3Interfacing::z3_full_version(); size_t spacePosition = z3Version.find(" "); if (spacePosition != string::npos) { z3Version = z3Version.substr(0,spacePosition); } - vstring problemName = Lib::env.options->problemName(); + std::string problemName = Lib::env.options->problemName(); Timer* timer = Lib::env.timer; std::cout @@ -140,7 +140,7 @@ bool UIHelper::satisfiableStatusWasAlreadyOutput=false; bool UIHelper::spiderOutputDone = false; -void UIHelper::outputAllPremises(ostream& out, UnitList* units, vstring prefix) +void UIHelper::outputAllPremises(ostream& out, UnitList* units, std::string prefix) { #if 1 InferenceStore::instance()->outputProof(cerr, units); @@ -195,7 +195,7 @@ void UIHelper::outputSaturatedSet(ostream& out, UnitIterator uit) } // outputSaturatedSet // String utility function that probably belongs elsewhere -static bool hasEnding (vstring const &fullString, vstring const &ending) { +static bool hasEnding (std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) { return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); } else { @@ -233,7 +233,7 @@ void UIHelper::tryParseSMTLIB2(istream& input) } #if VDEBUG - const vstring& expected_status = parser.getStatus(); + const std::string& expected_status = parser.getStatus(); if (expected_status == "sat") { s_expecting_sat = true; } else if (expected_status == "unsat") { @@ -242,7 +242,7 @@ void UIHelper::tryParseSMTLIB2(istream& input) #endif } -void UIHelper::parseSingleLine(const vstring& lineToParse, Options::InputSyntax inputSyntax) +void UIHelper::parseSingleLine(const std::string& lineToParse, Options::InputSyntax inputSyntax) { LoadedPiece newPiece = _loadedPieces.top(); // copy everything newPiece._id = lineToParse; @@ -270,7 +270,7 @@ void UIHelper::parseSingleLine(const vstring& lineToParse, Options::InputSyntax } // Call this function to report a parsing attempt has failed and to reset the input -void resetParsing(ParsingRelatedException& exception, istream& input, vstring nowtry) +void resetParsing(ParsingRelatedException& exception, istream& input, std::string nowtry) { if (env.options->mode()!=Options::Mode::SPIDER) { addCommentSignForSZS(std::cout); @@ -342,7 +342,7 @@ void UIHelper::parseStandardInput(Options::InputSyntax inputSyntax) } } -void UIHelper::parseFile(const vstring& inputFile, Options::InputSyntax inputSyntax, bool verbose) +void UIHelper::parseFile(const std::string& inputFile, Options::InputSyntax inputSyntax, bool verbose) { LoadedPiece newPiece = _loadedPieces.top(); // copy everything newPiece._id = inputFile; @@ -679,7 +679,7 @@ void UIHelper::outputSymbolTypeDeclarationIfNeeded(ostream& out, bool function, //out << "tff(" << (function ? "func" : "pred") << "_def_" << symNumber << ", type, " // << sym->name() << ": "; - vstring symName = sym->name(); + std::string symName = sym->name(); if(typeCon && env.signature->isBoolCon(symNumber)){ ASS(env.options->showFOOL()); symName = "$bool"; diff --git a/Shell/UIHelper.hpp b/Shell/UIHelper.hpp index 97375c74eb..9dbca3ffe4 100644 --- a/Shell/UIHelper.hpp +++ b/Shell/UIHelper.hpp @@ -38,7 +38,7 @@ class UIHelper { // a helper class to live on a stack of loaded pieces in interactive metamode // (in the standard modes, only a single instance lives on top of _loadedPieces) struct LoadedPiece { - vstring _id; + std::string _id; UnitList::FIFO _units; SMTLIBLogic _smtLibLogic; bool _hasConjecture; @@ -50,11 +50,11 @@ class UIHelper { static void tryParseTPTP(std::istream& input); static void tryParseSMTLIB2(std::istream& input); public: - static void parseSingleLine(const vstring& lineToParse, Options::InputSyntax inputSyntax); + static void parseSingleLine(const std::string& lineToParse, Options::InputSyntax inputSyntax); static void parseStream(std::istream& input, Options::InputSyntax inputSyntax, bool verbose, bool preferSMTonAuto); static void parseStandardInput(Options::InputSyntax inputSyntax); - static void parseFile(const vstring& inputFile, Options::InputSyntax inputSyntax, bool verbose); + static void parseFile(const std::string& inputFile, Options::InputSyntax inputSyntax, bool verbose); static Problem* getInputProblem(); @@ -75,7 +75,7 @@ class UIHelper { static bool haveConjectureInProof() { return _loadedPieces.top()._proofHasConjecture; } static void setConjectureInProof(bool hasConjectureInProof) { _loadedPieces.top()._proofHasConjecture = hasConjectureInProof; } - static void outputAllPremises(std::ostream& out, UnitList* units, vstring prefix=""); + static void outputAllPremises(std::ostream& out, UnitList* units, std::string prefix=""); static void outputSatisfiableResult(std::ostream& out); static void outputSaturatedSet(std::ostream& out, UnitIterator uit); diff --git a/Shell/VarManager.cpp b/Shell/VarManager.cpp index 53f7becb66..a887368af2 100644 --- a/Shell/VarManager.cpp +++ b/Shell/VarManager.cpp @@ -30,7 +30,7 @@ unsigned VarManager::getVarAlias(unsigned var) return _fact->getVarAlias(var); } -vstring VarManager::getVarName(unsigned var) +std::string VarManager::getVarName(unsigned var) { ASS(_fact); diff --git a/Shell/VarManager.hpp b/Shell/VarManager.hpp index 510ff5f526..6b8f85b658 100644 --- a/Shell/VarManager.hpp +++ b/Shell/VarManager.hpp @@ -26,7 +26,7 @@ class VarManager { struct VarFactory { virtual unsigned getVarAlias(unsigned var) = 0; - virtual vstring getVarName(unsigned var) = 0; + virtual std::string getVarName(unsigned var) = 0; }; static bool varNamePreserving() { return _fact; } @@ -34,7 +34,7 @@ class VarManager { static VarFactory* varNamePreservingFactory() { return _fact; } static unsigned getVarAlias(unsigned var); - static vstring getVarName(unsigned var); + static std::string getVarName(unsigned var); private: static VarFactory* _fact; }; diff --git a/Test/GenerationTester.hpp b/Test/GenerationTester.hpp index 41dec9375e..38da480d20 100644 --- a/Test/GenerationTester.hpp +++ b/Test/GenerationTester.hpp @@ -33,13 +33,13 @@ namespace Test { #define TEST_FN_ASS_EQ(VAL1, VAL2) \ - [] (vstring& s1, vstring& s2) { \ + [] (std::string& s1, std::string& s2) { \ bool res = (VAL1 == VAL2); \ if (!res) { \ s1 = Int::toString(VAL1); \ s1.append(" != "); \ s1.append(Int::toString(VAL2)); \ - s2 = vstring(#VAL1); \ + s2 = std::string(#VAL1); \ s2.append(" == "); \ s2.append(#VAL2); \ } \ @@ -80,8 +80,8 @@ class GenerationTester class TestCase { using Clause = Kernel::Clause; - using OptionMap = Stack>; - using Condition = std::function; + using OptionMap = Stack>; + using Condition = std::function; Option _rule; Clause* _input; Stack _expected; @@ -160,7 +160,7 @@ class TestCase } // check that the preconditions hold - vstring s1, s2; + std::string s1, s2; for (auto c : _preConditions) { if (!c(s1, s2)) { s2.append(" (precondition)"); @@ -182,7 +182,7 @@ class TestCase } if (_premiseRedundant != res.premiseRedundant) { - auto wrapStr = [](bool b) -> vstring { return b ? "premise is redundant" : "premise is not redundant"; }; + auto wrapStr = [](bool b) -> std::string { return b ? "premise is redundant" : "premise is not redundant"; }; testFail( wrapStr(res.premiseRedundant), wrapStr(_premiseRedundant)); } diff --git a/Test/SyntaxSugar.hpp b/Test/SyntaxSugar.hpp index 32d1b95910..c250f9cd7a 100644 --- a/Test/SyntaxSugar.hpp +++ b/Test/SyntaxSugar.hpp @@ -540,7 +540,7 @@ class FuncSugar { : _functor(functor) , _arity(env.signature->getFunction(functor)->arity()) {} - FuncSugar(vstring const& name, std::initializer_list as_, + FuncSugar(std::string const& name, std::initializer_list as_, ExpressionSugar result, unsigned taArity = 0) { Stack as; diff --git a/Test/UnitTesting.cpp b/Test/UnitTesting.cpp index 47d07b4e7c..cab19075ef 100644 --- a/Test/UnitTesting.cpp +++ b/Test/UnitTesting.cpp @@ -33,7 +33,7 @@ using namespace std; using namespace Lib; using namespace Lib::Sys; -TestUnit::TestUnit(vstring const& name) +TestUnit::TestUnit(std::string const& name) : _tests(), _name(name) { } @@ -47,7 +47,7 @@ UnitTesting& UnitTesting::instance() return *_instance; } -bool UnitTesting::runTest(vstring const& unitId, vstring const& testName) +bool UnitTesting::runTest(std::string const& unitId, std::string const& testName) { auto unit = findUnit(unitId); if (unit == nullptr) return false; @@ -58,7 +58,7 @@ bool UnitTesting::runTest(vstring const& unitId, vstring const& testName) } } -TestUnit::Test* TestUnit::findTest(vstring const& testCase) +TestUnit::Test* TestUnit::findTest(std::string const& testCase) { for (auto& test : _tests) { if (test.name == testCase) { @@ -67,11 +67,11 @@ TestUnit::Test* TestUnit::findTest(vstring const& testCase) } return nullptr; } -bool TestUnit::hasTest(vstring const& name) +bool TestUnit::hasTest(std::string const& name) { return findTest(name) != nullptr; } -bool TestUnit::runTest(vstring const& name) +bool TestUnit::runTest(std::string const& name) { auto test = findTest(name); if (test != nullptr) { @@ -83,7 +83,7 @@ bool TestUnit::runTest(vstring const& name) } } -bool UnitTesting::run(Stack const& args) +bool UnitTesting::run(Stack const& args) { if (args.size() == 2) { return runTest(args[0], args[1]); @@ -95,7 +95,7 @@ bool UnitTesting::run(Stack const& args) } } -TestUnit* UnitTesting::findUnit(vstring const& id) +TestUnit* UnitTesting::findUnit(std::string const& id) { TestUnit* found = nullptr; for (auto& test : _units) { @@ -115,14 +115,14 @@ TestUnit* UnitTesting::findUnit(vstring const& id) return found; } -bool UnitTesting::runUnit(vstring const& id) +bool UnitTesting::runUnit(std::string const& id) { auto unit = findUnit(id); if (unit == nullptr) return false; else return unit->run(std::cout); } -bool UnitTesting::listTests(Stack const&) +bool UnitTesting::listTests(Stack const&) { auto& out = std::cout; for (auto unit : _units) { @@ -133,7 +133,7 @@ bool UnitTesting::listTests(Stack const&) return true; } -bool TestUnit::runTestsWithNameSubstring(vstring const& pref, ostream& out) +bool TestUnit::runTestsWithNameSubstring(std::string const& pref, ostream& out) { Stack::BottomFirstIterator uit(_tests); @@ -144,7 +144,7 @@ bool TestUnit::runTestsWithNameSubstring(vstring const& pref, ostream& out) unsigned cnt_ok = 0; while(uit.hasNext()) { TestUnit::Test t=uit.next(); - if (vstring(t.name).find(pref) != vstring::npos) { + if (std::string(t.name).find(pref) != std::string::npos) { out << "Running " << t.name << "... \r"; out.flush(); bool ok; @@ -202,7 +202,7 @@ bool TestUnit::spawnTest(TestProc proc) } } -bool UnitTesting::add(vstring const& testUnit, TestUnit::Test test) +bool UnitTesting::add(std::string const& testUnit, TestUnit::Test test) { for (auto& unit : _units) { if (unit.id() == testUnit) { @@ -230,10 +230,10 @@ int main(int argc, const char** argv) env.options->setTraceback(true); bool success; - auto cmd = vstring(argv[1]); - auto args = Stack(argc - 2); + auto cmd = std::string(argv[1]); + auto args = Stack(argc - 2); for (int i = 2; i < argc; i++) { - args.push(vstring(argv[i])); + args.push(std::string(argv[i])); } if (cmd == "ls") { success = Test::UnitTesting::instance().listTests(args); diff --git a/Test/UnitTesting.hpp b/Test/UnitTesting.hpp index b317457305..86e1204977 100644 --- a/Test/UnitTesting.hpp +++ b/Test/UnitTesting.hpp @@ -31,7 +31,7 @@ typedef void (*TestProc)(); class TestUnit { public: - TestUnit(vstring const&); + TestUnit(std::string const&); struct Test { @@ -50,20 +50,20 @@ class TestUnit * returns true iff all tests of the unit were successfull. */ bool run(std::ostream& out); - bool runTestsWithNameSubstring(vstring const& pref, std::ostream& out); - bool runTest(vstring const& name); + bool runTestsWithNameSubstring(std::string const& pref, std::ostream& out); + bool runTest(std::string const& name); - bool hasTest(vstring const& name); + bool hasTest(std::string const& name); friend std::ostream& operator<<(std::ostream& out, TestUnit const& t) { return out << t._name << t._tests; } - vstring const& id() const { return _name; } + std::string const& id() const { return _name; } Stack const& tests() { return _tests; } private: - Test* findTest(vstring const& testCase); + Test* findTest(std::string const& testCase); /** Runs a test as a single process and awaits its termination. * This is to provide isolation when running multiple tests in one go. * @@ -73,7 +73,7 @@ class TestUnit // TODO replace by Map as soon as integer-arithmetic PR with Map additions has landed Stack _tests; - vstring _name; + std::string _name; }; /** Main class for running tests */ @@ -85,12 +85,12 @@ class UnitTesting public: static UnitTesting& instance(); - bool add(vstring const& testUnit, TestUnit::Test test); - TestUnit* findUnit(vstring const& id); - bool listTests(Stackconst& args); - bool run(Stackconst& args); - bool runUnit(vstring const& args); - bool runTest(vstring const& unit, vstring const& testCase); + bool add(std::string const& testUnit, TestUnit::Test test); + TestUnit* findUnit(std::string const& id); + bool listTests(Stackconst& args); + bool run(Stackconst& args); + bool runUnit(std::string const& args); + bool runTest(std::string const& unit, std::string const& testCase); }; std::ostream& operator<<(std::ostream& out, TestUnit::Test const& t); diff --git a/UnitTests/tCoproduct.cpp b/UnitTests/tCoproduct.cpp index 9c4397e268..e4bd041207 100644 --- a/UnitTests/tCoproduct.cpp +++ b/UnitTests/tCoproduct.cpp @@ -95,7 +95,7 @@ TEST_FUN(examples__match_02) { // Further we can create polymorphic function structs if each match branch does the same thing auto x = Coproduct(1); - vstring str = x.apply([](auto const& c) { + std::string str = x.apply([](auto const& c) { std::stringstream out; out << c; return out.str(); diff --git a/UnitTests/tOption.cpp b/UnitTests/tOption.cpp index bfde7bdd45..76c4e99325 100644 --- a/UnitTests/tOption.cpp +++ b/UnitTests/tOption.cpp @@ -39,7 +39,7 @@ TEST_FUN(examples__match) { // we can also match on Options instead of testing with isSome and unwrap auto opt = Option(); auto result = opt.match( - [](int i) -> vstring { return "some integer"; }, + [](int i) -> std::string { return "some integer"; }, []( ) { return "nothing"; } ); ASS_EQ("nothing", result) @@ -63,9 +63,9 @@ TEST_FUN(examples__unwrapOrInit) { TEST_FUN(examples__toOwned) { // an option of a reference type can be turned into an option of the corresponding value, by coping it: - vstring str ("lala"); - auto opt = Option(str); - auto opt2 = Option("lala"); + std::string str ("lala"); + auto opt = Option(str); + auto opt2 = Option("lala"); // ASS_NEQ(opt, opt2) // <- does not compile. different types!! ASS_EQ(opt.toOwned(), opt2); } diff --git a/UnitTests/tOptionConstraints.cpp b/UnitTests/tOptionConstraints.cpp index 0d2748ad2e..444a471104 100644 --- a/UnitTests/tOptionConstraints.cpp +++ b/UnitTests/tOptionConstraints.cpp @@ -26,7 +26,7 @@ bool testGlobal(Options& o) } } -bool testOption(bool bad, vstring name,vstring value) +bool testOption(bool bad, std::string name,std::string value) { //cout << (bad ? "Should be bad" : "Should be good") << endl; Options options; @@ -35,8 +35,8 @@ bool testOption(bool bad, vstring name,vstring value) if(bad) res = !res; return res; } -bool testOptionBad(vstring name, vstring value){ return testOption(true,name,value); } -bool testOptionGood(vstring name, vstring value){ return testOption(false,name,value); } +bool testOptionBad(std::string name, std::string value){ return testOption(true,name,value); } +bool testOptionGood(std::string name, std::string value){ return testOption(false,name,value); } TEST_FUN(int_bounds) diff --git a/UnitTests/tSafeRecursion.cpp b/UnitTests/tSafeRecursion.cpp index 92317c97be..6ce164d5e0 100644 --- a/UnitTests/tSafeRecursion.cpp +++ b/UnitTests/tSafeRecursion.cpp @@ -79,9 +79,9 @@ TEST_FUN(safeRecMaxDeg) struct StrRepWorker : public SRWorkerBase { - vstring post(unsigned obj, size_t childCnt, vstring* childRes) + std::string post(unsigned obj, size_t childCnt, std::string* childRes) { - vstring res = Int::toString(obj); + std::string res = Int::toString(obj); if(childCnt==0) { return res; } @@ -101,7 +101,7 @@ TEST_FUN(safeRecStrRep) { StrRepWorker wrk; - vstring res = SafeRecursion(wrk)(0); + std::string res = SafeRecursion(wrk)(0); ASS_EQ(res,"0(1,2,3(4,5,6(8,9),7))"); } diff --git a/UnitTests/tTermIndex.cpp b/UnitTests/tTermIndex.cpp index b6c9595276..a59f296a9e 100644 --- a/UnitTests/tTermIndex.cpp +++ b/UnitTests/tTermIndex.cpp @@ -110,9 +110,9 @@ TEST_FUN(basic01) { template struct MyData { Key term; - vstring str; + std::string str; - MyData(Key t, vstring s) + MyData(Key t, std::string s) : term(t), str(s) {} auto asTuple() const @@ -179,20 +179,20 @@ TEST_FUN(custom_data_02) { DECL_CONST(b, srt) DECL_FUNC(f, {srt}, srt) - TermSubstitutionTree> tree; - auto dat = [](TermList t,vstring s) { return TermWithValue(t.term(), std::move(s)); }; + TermSubstitutionTree> tree; + auto dat = [](TermList t,std::string s) { return TermWithValue(t.term(), std::move(s)); }; tree.insert(dat(f(a), "a")); tree.insert(dat(f(a), "b")); tree.insert(dat(f(a), "c")); check_unify(tree, f(a), { dat(f(a), "a"), dat(f(a), "b"), dat(f(a), "c") }); - check_unify(tree, f(b), Stack>{}); + check_unify(tree, f(b), Stack>{}); check_unify(tree, f(x), { dat(f(a), "a"), dat(f(a), "b"), dat(f(a), "c") }); } struct MyData3 : public MyData { MyData3() = delete; - MyData3(TypedTermList t, vstring s) : MyData{t,s} {} + MyData3(TypedTermList t, std::string s) : MyData{t,s} {} }; TEST_FUN(custom_data_03_no_default_constructor) { @@ -204,7 +204,7 @@ TEST_FUN(custom_data_03_no_default_constructor) { DECL_FUNC(f, {srt}, srt) TermSubstitutionTree tree; - auto dat = [](TypedTermList t,vstring s) { return MyData3(t, std::move(s)); }; + auto dat = [](TypedTermList t,std::string s) { return MyData3(t, std::move(s)); }; tree.insert(dat(f(a), "a")); tree.insert(dat(f(a), "b")); tree.insert(dat(f(a), "c")); @@ -217,7 +217,7 @@ TEST_FUN(custom_data_03_no_default_constructor) { struct MyData4 : public MyData { MyData4(MyData const&) = delete; MyData4 operator=(MyData const&) = delete; - MyData4(TypedTermList t, vstring s) : MyData{t,s} {} + MyData4(TypedTermList t, std::string s) : MyData{t,s} {} }; TEST_FUN(custom_data_04_no_copy_constructor) { @@ -229,7 +229,7 @@ TEST_FUN(custom_data_04_no_copy_constructor) { DECL_FUNC(f, {srt}, srt) TermSubstitutionTree tree; - auto dat = [](TypedTermList t,vstring s) { return MyData4(t, std::move(s)); }; + auto dat = [](TypedTermList t,std::string s) { return MyData4(t, std::move(s)); }; tree.insert(dat(f(a), "a")); tree.insert(dat(f(a), "b")); tree.insert(dat(f(a), "c")); @@ -258,7 +258,7 @@ TEST_FUN(zero_arity_predicate) { using Data = MyData; LiteralSubstitutionTree tree; - auto dat = [](Literal* k,vstring s) { return Data(k, std::move(s)); }; + auto dat = [](Literal* k,std::string s) { return Data(k, std::move(s)); }; tree.insert(dat( p0() , " p0()")); tree.insert(dat( p1(a), " p1(a)")); tree.insert(dat( p1(b), " p1(b)")); diff --git a/vampire.cpp b/vampire.cpp index ad14bbe4ca..adf4aa328a 100644 --- a/vampire.cpp +++ b/vampire.cpp @@ -183,7 +183,7 @@ void profileMode(Problem* problem) // prints Unit u at an index to latexOut using the LaTeX object void outputUnitToLaTeX(LaTeX& latex, ofstream& latexOut, Unit* u,unsigned index) { - vstring stringform = latex.toString(u); + std::string stringform = latex.toString(u); latexOut << index++ << " & "; unsigned count = 0; for(const char* p = stringform.c_str();*p;p++){ @@ -679,7 +679,7 @@ void interactiveMetamode() prb = UIHelper::getInputProblem(); while (true) { - vstring line; + std::string line; if (!getline(cin, line) || line.rfind("exit",0) == 0) { cout << "Bye." << endl; break; @@ -691,7 +691,7 @@ void interactiveMetamode() // probably garbage at this point UIHelper::unsetExpecting(); - Stack pieces; + Stack pieces; StringUtils::splitStr(line.c_str(),' ',pieces); StringUtils::dropEmpty(pieces); Stack argv(pieces.size()); @@ -708,7 +708,7 @@ void interactiveMetamode() exit(vampireReturnValue); } } else if (line.rfind("load",0) == 0) { - Stack pieces; + Stack pieces; StringUtils::splitStr(line.c_str(),' ',pieces); StringUtils::dropEmpty(pieces); auto it = pieces.iterFifo(); @@ -734,7 +734,7 @@ void interactiveMetamode() } else if (line.rfind("list",0) == 0) { UIHelper::listLoadedPieces(cout); } else if (line.rfind("pop",0) == 0) { - Stack pieces; + Stack pieces; StringUtils::splitStr(line.c_str(),' ',pieces); StringUtils::dropEmpty(pieces); int numPops = 1;