From 95a3c08799ebdf0979ca7d527f12b8daaccd2c96 Mon Sep 17 00:00:00 2001 From: sebastien Date: Wed, 6 Jun 2007 10:17:27 +0000 Subject: [PATCH] v4 parser: cosmetic changes git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1302 ac1d8469-bf42-47a9-8791-bf33cf982152 --- parser.src/ExprNode.cc | 8 +++----- parser.src/InterfaceMatlab.cc | 16 ++++++++-------- parser.src/InterfaceScilab.cc | 16 ++++++++-------- parser.src/include/Interface.hh | 18 ++++++++++-------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/parser.src/ExprNode.cc b/parser.src/ExprNode.cc index 0425f940f..d94593e4d 100644 --- a/parser.src/ExprNode.cc +++ b/parser.src/ExprNode.cc @@ -340,11 +340,9 @@ VariableNode::eval(const eval_context_type &eval_context) const throw (EvalExcep eval_context_type::const_iterator it = eval_context.find(make_pair(symb_id, type)); if (it == eval_context.end()) { - if (eval_context.size()>0) - { - cout << "Error: the variable or parameter (" << datatree.symbol_table.getNameByID( type, symb_id) << ") has not been initialized (in derivatives evaluation)\n"; - cout.flush(); - } + if (eval_context.size() > 0) + cerr << "Error: the variable or parameter (" << datatree.symbol_table.getNameByID(type, symb_id) << ") has not been initialized (in derivatives evaluation)" << endl; + throw EvalException(); } return it->second; diff --git a/parser.src/InterfaceMatlab.cc b/parser.src/InterfaceMatlab.cc index 4a502803b..f3fcfbd1d 100644 --- a/parser.src/InterfaceMatlab.cc +++ b/parser.src/InterfaceMatlab.cc @@ -4,42 +4,42 @@ namespace interfaces { - std::string comment() + string comment() { return "% "; } - std::string delete_file(std::string s) + string delete_file(string s) { return "delete " + s; } - std::string file_exist(std::string s) + string file_exist(string s) { return "exist('" + s + "')"; } - std::string compile(std::string s) + string compile(string s) { return "mex -O " + s + "\n"; } - std::string function_close() + string function_close() { return ""; } - std::string function_file_extension() + string function_file_extension() { return ".m"; } - std::string strvcat(std::string s1, std::string s2) + string strvcat(string s1, string s2) { return "strvcat(" + s1 + "," + s2 + ")"; } - std::string load_model_function_files(std::string filename) + string load_model_function_files(string filename) { return ""; } diff --git a/parser.src/InterfaceScilab.cc b/parser.src/InterfaceScilab.cc index 67f38a2f8..1fabcbce6 100644 --- a/parser.src/InterfaceScilab.cc +++ b/parser.src/InterfaceScilab.cc @@ -4,42 +4,42 @@ namespace interfaces { - std::string comment() + string comment() { return "// "; } - std::string delete_file(std::string s) + string delete_file(string s) { return "mdelete " + s; } - std::string file_exist(std::string s) + string file_exist(string s) { return "file_exist(" + s + ")"; } - std::string compile(std::string s) + string compile(string s) { return ""; } - std::string function_close() + string function_close() { return "endfunction\n"; } - std::string function_file_extension() + string function_file_extension() { return ".sci"; } - std::string strvcat(std::string s1, std::string s2) + string strvcat(string s1, string s2) { return "[" + s1 + ";" + s2 + "]"; } - std::string load_model_function_files(std::string filename) + string load_model_function_files(string filename) { return "getf('" + filename + "_static.sci');\ngetf('" + filename + "_dynamic.sci');\n"; } diff --git a/parser.src/include/Interface.hh b/parser.src/include/Interface.hh index 4a45444d6..767887530 100644 --- a/parser.src/include/Interface.hh +++ b/parser.src/include/Interface.hh @@ -1,15 +1,17 @@ #ifndef _INTERFACE_HH #define _INTERFACE_HH +using namespace std; + namespace interfaces { - std::string comment(); - std::string delete_file(std::string s); - std::string file_exist(std::string s); - std::string compile(std::string s); - std::string function_close(); - std::string function_file_extension(); - std::string strvcat(std::string s1, std::string s2); - std::string load_model_function_files(std::string filename); + string comment(); + string delete_file(string s); + string file_exist(string s); + string compile(string s); + string function_close(); + string function_file_extension(); + string strvcat(string s1, string s2); + string load_model_function_files(string filename); } #endif