From 19b50c265b6f8e4f7b68c3fadf4264aa0af5bdda Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Thu, 4 May 2017 16:50:19 +0200 Subject: [PATCH] preprocessor: aesthetic fix: make writing to .m file nicer --- preprocessor/ComputingTasks.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index c51a29edc..7a8fe14d0 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -221,8 +221,19 @@ VarModelStatement::createVarModelMFunction(ostream &output, const map horizons = var_expectation_functions_to_write.find(name)->second; for (set::const_iterator it = horizons.begin(); it != horizons.end(); it++) - ss << *it << " "; - output << "writeVarExpectationFunction('" << name << "', [" << ss.rdbuf() << "]);" << endl; + { + if (it != horizons.begin()) + ss << " "; + ss << *it; + } + + output << "writeVarExpectationFunction('" << name << "', "; + if (horizons.size() > 1) + output << "["; + output << ss.rdbuf(); + if (horizons.size() > 1) + output << "]"; + output << ");" << endl; } StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg,