diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh index fe6047c88..f8419bfb5 100644 --- a/mex/sources/bytecode/ErrorHandling.hh +++ b/mex/sources/bytecode/ErrorHandling.hh @@ -37,6 +37,8 @@ # define CHAR_LENGTH 2 #endif +#define ASCII_POUND_SIGN_CODE 156 + #ifdef _MSC_VER #include #define M_E 2.71828182845904523536 @@ -328,20 +330,24 @@ public: string temp; int pos1 = -1, pos2 = -1; string tmp_n(str.length(), ' '); + string dollar, pound, tilde; + dollar = "$"; + pound = (char)ASCII_POUND_SIGN_CODE; + tilde = "~"; for (unsigned int i = 0; i < str.length(); i++) { - if (str[i] != '$' && str[i] != '£') + if (dollar.compare(&str[i]) != 0 && pound.compare(&str[i]) != 0) temp += str[i]; else { - if (str[i] == '$') + if (dollar.compare(&str[i]) == 0) pos1 = int(temp.length()); else pos2 = int(temp.length()); if (pos1 >= 0 && pos2 >= 0) { tmp_n.erase(pos1, pos2-pos1+1); - tmp_n.insert(pos1, pos2-pos1, '~'); + tmp_n.insert(pos1, pos2-pos1, tilde[0]); pos1 = pos2 = -1; } } @@ -408,7 +414,7 @@ public: res << P_endo_names[CHAR_LENGTH*(variable_num+i*nb_endo)]; } else - mexPrintf("=> Unknown endogenous variable n° %d", variable_num); + mexPrintf("=> Unknown endogenous variable # %d", variable_num); break; case eExogenous: case eExogenousDet: @@ -419,7 +425,7 @@ public: res << P_exo_names[CHAR_LENGTH*(variable_num+i*nb_exo)]; } else - mexPrintf("=> Unknown exogenous variable n° %d", variable_num); + mexPrintf("=> Unknown exogenous variable # %d", variable_num); break; case eParameter: if (variable_num < nb_param) @@ -429,7 +435,7 @@ public: res << P_param_names[CHAR_LENGTH*(variable_num+i*nb_param)]; } else - mexPrintf("=> Unknown parameter n° %d", variable_num); + mexPrintf("=> Unknown parameter # %d", variable_num); break; default: break; @@ -1271,7 +1277,7 @@ public: tmp_out << "$"; tmp_out << " / "; if (isinf(r)) - tmp_out << "£"; + tmp_out << (char)ASCII_POUND_SIGN_CODE; } else tmp_out << " / "; @@ -1434,7 +1440,7 @@ public: if (compute) { if (isnan(r)) - tmp_out << "$ ^ £"; + tmp_out << "$ ^ " << (char)ASCII_POUND_SIGN_CODE; else tmp_out << " ^ "; } @@ -1476,7 +1482,7 @@ public: if (compute) { if (isnan(r)) - tmp_out << "$ PowerDeriv £"; + tmp_out << "$ PowerDeriv " << (char)ASCII_POUND_SIGN_CODE; else tmp_out << "PowerDeriv"; } @@ -1550,7 +1556,7 @@ public: if (compute) { if (isnan(r)) - tmp_out << "$log£(" << v1 << ")"; + tmp_out << "$log" << (char)ASCII_POUND_SIGN_CODE << "(" << v1 << ")"; else tmp_out << "log(" << v1 << ")"; } @@ -1568,7 +1574,7 @@ public: if (compute) { if (isnan(r)) - tmp_out << "$log10£(" << v1 << ")"; + tmp_out << "$log10" << (char)ASCII_POUND_SIGN_CODE << "(" << v1 << ")"; else tmp_out << "log10(" << v1 << ")"; } @@ -1774,11 +1780,7 @@ public: } tmp_out.str(""); tmp_out << function_name << "("; -#ifndef _MSC_VER - string ss[nb_input_arguments]; -#else vector ss(nb_input_arguments); -#endif for (unsigned int i = 0; i < nb_input_arguments; i++) { ss[nb_input_arguments-i-1] = Stack.top(); @@ -1832,11 +1834,7 @@ public: tmp_out.str(""); tmp_out << function_name << "("; tmp_out << arg_func_name.c_str() << ", " << fc->get_row() << ", {"; -#ifndef _MSC_VER - string ss[nb_add_input_arguments]; -#else vector ss(nb_input_arguments); -#endif for (unsigned int i = 0; i < nb_add_input_arguments; i++) { ss[nb_add_input_arguments-i-1] = Stack.top(); @@ -1867,11 +1865,7 @@ public: } tmp_out.str(""); tmp_out << function_name << "("; -#ifndef _MSC_VER - string ss[nb_input_arguments]; -#else vector ss(nb_input_arguments); -#endif for (unsigned int i = 0; i < nb_input_arguments; i++) { ss[nb_input_arguments-i-1] = Stack.top(); @@ -1924,11 +1918,7 @@ public: tmp_out.str(""); tmp_out << function_name << "("; tmp_out << arg_func_name.c_str() << ", " << fc->get_row() << ", " << fc->get_col() << ", {"; -#ifndef _MSC_VER - string ss[nb_add_input_arguments]; -#else vector ss(nb_input_arguments); -#endif for (unsigned int i = 0; i < nb_add_input_arguments; i++) { ss[nb_add_input_arguments-i-1] = Stack.top(); @@ -1959,11 +1949,7 @@ public: } tmp_out.str(""); tmp_out << function_name << "("; -#ifndef _MSC_VER - string ss[nb_input_arguments]; -#else vector ss(nb_input_arguments); -#endif for (unsigned int i = 0; i < nb_input_arguments; i++) { ss[nb_input_arguments-i-1] = Stack.top(); diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc index 98ee11402..3c2f29b6f 100644 --- a/mex/sources/bytecode/bytecode.cc +++ b/mex/sources/bytecode/bytecode.cc @@ -527,7 +527,7 @@ main(int nrhs, const char *prhs[]) for (vector::iterator it = splan.begin(); it != splan.end(); it++) { mexPrintf("----------------------------------------------------------------------------------------------------\n"); - mexPrintf("suprise n°%d\n", i+1); + mexPrintf("suprise #%d\n", i+1); if (it->exo.length()) mexPrintf(" plan fliping var=%s (%d) exo=%s (%d) for the following periods and with the following values:\n", it->var.c_str(), it->var_num, it->exo.c_str(), it->exo_num); else @@ -605,7 +605,7 @@ main(int nrhs, const char *prhs[]) for (vector::iterator it = spfplan.begin(); it != spfplan.end(); it++) { mexPrintf("----------------------------------------------------------------------------------------------------\n"); - mexPrintf("perfect foresight n°%d\n", i+1); + mexPrintf("perfect foresight #%d\n", i+1); if (it->exo.length()) mexPrintf(" plan flipping var=%s (%d) exo=%s (%d) for the following periods and with the following values:\n", it->var.c_str(), it->var_num, it->exo.c_str(), it->exo_num); else diff --git a/mex/sources/estimation/libmat/DiscLyapFast.hh b/mex/sources/estimation/libmat/DiscLyapFast.hh index dc08bb8e9..cd0b014c0 100644 --- a/mex/sources/estimation/libmat/DiscLyapFast.hh +++ b/mex/sources/estimation/libmat/DiscLyapFast.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Dynare Team + * Copyright (C) 2010-2013 Dynare Team * * This file is part of Dynare. * @@ -62,13 +62,13 @@ public: }; virtual ~DiscLyapFast() {}; template - void solve_lyap(const MatG &G, const MatV &V, MatX &X, double tol, size_t flag_ch) throw (DLPException); + void solve_lyap(const MatG &G, const MatV &V, MatX &X, double tol = 1e-16, size_t flag_ch = 0) throw (DLPException); }; template void -DiscLyapFast::solve_lyap(const MatG &G, const MatV &V, MatX &X, double tol = 1e-16, size_t flag_ch = 0) throw (DLPException) +DiscLyapFast::solve_lyap(const MatG &G, const MatV &V, MatX &X, double tol, size_t flag_ch) throw (DLPException) { P0 = V; P1 = V; diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index 8c47907c3..5f6b5bbe1 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -210,7 +210,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const ostringstream tmp_output, tmp1_output, global_output; expr_t lhs = NULL, rhs = NULL; BinaryOpNode *eq_node; - ostringstream Uf[symbol_table.endo_nbr()]; + vector Uf(symbol_table.endo_nbr()); map reference_count; temporary_terms_t local_temporary_terms; ofstream output;