diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh index 83ec6136ad2caaaded74123c26c948b2bb8df0c2..a331cee32c7cc94258ab17073f630a3653e3561f 100644 --- a/mex/sources/bytecode/ErrorHandling.hh +++ b/mex/sources/bytecode/ErrorHandling.hh @@ -42,8 +42,7 @@ using namespace std; constexpr int NO_ERROR_ON_EXIT = 0, ERROR_ON_EXIT = 1; -using code_liste_type = vector<pair<Tags, void *>>; -using it_code_type = code_liste_type::const_iterator; +using it_code_type = instructions_list_t::const_iterator; class GeneralExceptionHandling { @@ -431,10 +430,10 @@ protected: if (utIsInterruptPending()) throw UserExceptionHandling(); #endif - switch (it_code->first) + switch ((*it_code)->op_code) { case Tags::FNUMEXPR: - switch (static_cast<FNUMEXPR_ *>(it_code->second)->get_expression_type()) + switch (static_cast<FNUMEXPR_ *>(*it_code)->get_expression_type()) { case ExpressionType::TemporaryTerm: equation_type = ExpressionType::TemporaryTerm; @@ -456,21 +455,21 @@ protected: break; default: ostringstream tmp; - tmp << " in print_expression, expression type " << static_cast<int>(static_cast<FNUMEXPR_ *>(it_code->second)->get_expression_type()) << " not implemented yet\n"; + tmp << " in print_expression, expression type " << static_cast<int>(static_cast<FNUMEXPR_ *>(*it_code)->get_expression_type()) << " not implemented yet\n"; throw FatalExceptionHandling(tmp.str()); } break; case Tags::FLDV: //load a variable in the processor - switch (static_cast<FLDV_ *>(it_code->second)->get_type()) + switch (static_cast<FLDV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FLDV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDV_ *>(*it_code)->get_pos(); Stack.push(get_variable(SymbolType::parameter, var)); break; case SymbolType::endogenous: - var = static_cast<FLDV_ *>(it_code->second)->get_pos(); - lag = static_cast<FLDV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FLDV_ *>(*it_code)->get_pos(); + lag = static_cast<FLDV_ *>(*it_code)->get_lead_lag(); tmp_out.str(""); if (lag > 0) tmp_out << get_variable(SymbolType::endogenous, var) << "(+" << lag << ")"; @@ -481,8 +480,8 @@ protected: Stack.push(tmp_out.str()); break; case SymbolType::exogenous: - var = static_cast<FLDV_ *>(it_code->second)->get_pos(); - lag = static_cast<FLDV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FLDV_ *>(*it_code)->get_pos(); + lag = static_cast<FLDV_ *>(*it_code)->get_lead_lag(); tmp_out.str(""); if (lag != 0) tmp_out << get_variable(SymbolType::exogenous, var) << "(" << lag << ")"; @@ -502,18 +501,18 @@ protected: case Tags::FLDSV: case Tags::FLDVS: //load a variable in the processor - switch (static_cast<FLDSV_ *>(it_code->second)->get_type()) + switch (static_cast<FLDSV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FLDSV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSV_ *>(*it_code)->get_pos(); Stack.push(get_variable(SymbolType::parameter, var)); break; case SymbolType::endogenous: - var = static_cast<FLDSV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSV_ *>(*it_code)->get_pos(); Stack.push(get_variable(SymbolType::endogenous, var)); break; case SymbolType::exogenous: - var = static_cast<FLDSV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSV_ *>(*it_code)->get_pos(); Stack.push(get_variable(SymbolType::exogenous, var)); break; case SymbolType::exogenousDet: @@ -527,34 +526,34 @@ protected: break; case Tags::FLDT: //load a temporary variable in the processor - var = static_cast<FLDT_ *>(it_code->second)->get_pos(); + var = static_cast<FLDT_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "T" << var+1; Stack.push(tmp_out.str()); break; case Tags::FLDST: //load a temporary variable in the processor - var = static_cast<FLDST_ *>(it_code->second)->get_pos(); + var = static_cast<FLDST_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "T" << var+1; Stack.push(tmp_out.str()); break; case Tags::FLDU: //load u variable in the processor - var = static_cast<FLDU_ *>(it_code->second)->get_pos(); + var = static_cast<FLDU_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "u(" << var+1 << " + it_)"; Stack.push(tmp_out.str()); break; case Tags::FLDSU: //load u variable in the processor - var = static_cast<FLDSU_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSU_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "u(" << var+1 << ")"; Stack.push(tmp_out.str()); break; case Tags::FLDR: - var = static_cast<FLDR_ *>(it_code->second)->get_pos(); + var = static_cast<FLDR_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "residual(" << var+1 << ")"; Stack.push(tmp_out.str()); @@ -567,7 +566,7 @@ protected: break; case Tags::FLDC: //load a numerical constant in the processor - ll = static_cast<FLDC_ *>(it_code->second)->get_value(); + ll = static_cast<FLDC_ *>(*it_code)->get_value(); tmp_out.str(""); tmp_out << ll; Stack.push(tmp_out.str()); @@ -575,10 +574,10 @@ protected: case Tags::FSTPV: //load a variable in the processor go_on = false; - switch (static_cast<FSTPV_ *>(it_code->second)->get_type()) + switch (static_cast<FSTPV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FSTPV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPV_ *>(*it_code)->get_pos(); tmp_out2.str(""); tmp_out2 << Stack.top(); tmp_out.str(""); @@ -586,8 +585,8 @@ protected: Stack.pop(); break; case SymbolType::endogenous: - var = static_cast<FSTPV_ *>(it_code->second)->get_pos(); - lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FSTPV_ *>(*it_code)->get_pos(); + lag = static_cast<FSTPV_ *>(*it_code)->get_lead_lag(); tmp_out2.str(""); tmp_out2 << Stack.top(); tmp_out.str(""); @@ -600,8 +599,8 @@ protected: Stack.pop(); break; case SymbolType::exogenous: - var = static_cast<FSTPV_ *>(it_code->second)->get_pos(); - lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FSTPV_ *>(*it_code)->get_pos(); + lag = static_cast<FSTPV_ *>(*it_code)->get_lead_lag(); tmp_out2.str(""); tmp_out2 << Stack.top(); tmp_out.str(""); @@ -621,10 +620,10 @@ protected: case Tags::FSTPSV: go_on = false; //load a variable in the processor - switch (static_cast<FSTPSV_ *>(it_code->second)->get_type()) + switch (static_cast<FSTPSV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FSTPSV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSV_ *>(*it_code)->get_pos(); tmp_out2.str(""); tmp_out2 << Stack.top(); tmp_out.str(""); @@ -633,7 +632,7 @@ protected: Stack.pop(); break; case SymbolType::endogenous: - var = static_cast<FSTPSV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSV_ *>(*it_code)->get_pos(); tmp_out2.str(""); tmp_out2 << Stack.top(); tmp_out.str(""); @@ -642,7 +641,7 @@ protected: Stack.pop(); break; case SymbolType::exogenous: - var = static_cast<FSTPSV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSV_ *>(*it_code)->get_pos(); tmp_out2.str(""); tmp_out2 << Stack.top(); tmp_out.str(""); @@ -660,7 +659,7 @@ protected: case Tags::FSTPT: go_on = false; //store in a temporary variable from the processor - var = static_cast<FSTPT_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPT_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "T" << var+1 << " = " << Stack.top(); Stack.pop(); @@ -668,7 +667,7 @@ protected: case Tags::FSTPST: go_on = false; //store in a temporary variable from the processor - var = static_cast<FSTPST_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPST_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "T" << var+1 << " = " << Stack.top(); Stack.pop(); @@ -676,7 +675,7 @@ protected: case Tags::FSTPU: go_on = false; //store in u variable from the processor - var = static_cast<FSTPU_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPU_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "u(" << var+1 << " + it_) = " << Stack.top(); Stack.pop(); @@ -684,7 +683,7 @@ protected: case Tags::FSTPSU: go_on = false; //store in u variable from the processor - var = static_cast<FSTPSU_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSU_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "u(" << var+1 << ") = " << Stack.top(); Stack.pop(); @@ -692,7 +691,7 @@ protected: case Tags::FSTPR: go_on = false; //store in residual variable from the processor - var = static_cast<FSTPR_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPR_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "residual(" << var+1 << ") = " << Stack.top(); Stack.pop(); @@ -700,7 +699,7 @@ protected: case Tags::FSTPG: go_on = false; //store in derivative (g) variable from the processor - var = static_cast<FSTPG_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPG_ *>(*it_code)->get_pos(); tmp_out.str(""); tmp_out << "g1[" << var+1 << "] = " << Stack.top(); Stack.pop(); @@ -708,8 +707,8 @@ protected: case Tags::FSTPG2: go_on = false; //store in derivative (g) variable from the processor - eq = static_cast<FSTPG2_ *>(it_code->second)->get_row(); - var = static_cast<FSTPG2_ *>(it_code->second)->get_col(); + eq = static_cast<FSTPG2_ *>(*it_code)->get_row(); + var = static_cast<FSTPG2_ *>(*it_code)->get_col(); tmp_out.str(""); tmp_out << "jacob(" << eq+1 << ", " << var+1 << ") = " << Stack.top(); Stack.pop(); @@ -718,10 +717,10 @@ protected: //store in derivative (g) variable from the processor go_on = false; int pos_col; - eq = static_cast<FSTPG3_ *>(it_code->second)->get_row(); - var = static_cast<FSTPG3_ *>(it_code->second)->get_col(); - lag = static_cast<FSTPG3_ *>(it_code->second)->get_lag(); - pos_col = static_cast<FSTPG3_ *>(it_code->second)->get_col_pos(); + eq = static_cast<FSTPG3_ *>(*it_code)->get_row(); + var = static_cast<FSTPG3_ *>(*it_code)->get_col(); + lag = static_cast<FSTPG3_ *>(*it_code)->get_lag(); + pos_col = static_cast<FSTPG3_ *>(*it_code)->get_col_pos(); tmp_out.str(""); switch (equation_type) { @@ -747,7 +746,7 @@ protected: Stack.pop(); break; case Tags::FBINARY: - op2 = static_cast<FBINARY_ *>(it_code->second)->get_op_type(); + op2 = static_cast<FBINARY_ *>(*it_code)->get_op_type(); v2 = Stack.top(); Stack.pop(); v1 = Stack.top(); @@ -965,7 +964,7 @@ protected: } break; case Tags::FUNARY: - op1 = static_cast<FUNARY_ *>(it_code->second)->get_op_type(); + op1 = static_cast<FUNARY_ *>(*it_code)->get_op_type(); v1 = Stack.top(); Stack.pop(); switch (op1) @@ -1079,7 +1078,7 @@ protected: } break; case Tags::FTRINARY: - op3 = static_cast<FTRINARY_ *>(it_code->second)->get_op_type(); + op3 = static_cast<FTRINARY_ *>(*it_code)->get_op_type(); v3 = Stack.top(); Stack.pop(); v2 = Stack.top(); @@ -1104,7 +1103,7 @@ protected: break; case Tags::FCALL: { - auto *fc = static_cast<FCALL_ *>(it_code->second); + auto *fc = static_cast<FCALL_ *>(*it_code); string function_name = fc->get_function_name(); int nb_input_arguments{fc->get_nb_input_arguments()}; @@ -1222,7 +1221,7 @@ protected: } case Tags::FSTPTEF: go_on = false; - var = static_cast<FSTPTEF_ *>(it_code->second)->get_number(); + var = static_cast<FSTPTEF_ *>(*it_code)->get_number(); tmp_out.str(""); switch (call_type) { @@ -1241,7 +1240,7 @@ protected: Stack.pop(); break; case Tags::FLDTEF: - var = static_cast<FLDTEF_ *>(it_code->second)->get_number(); + var = static_cast<FLDTEF_ *>(*it_code)->get_number(); tmp_out.str(""); tmp_out << "TEF(" << var << ")"; Stack.push(tmp_out.str()); @@ -1250,8 +1249,8 @@ protected: case Tags::FSTPTEFD: { go_on = false; - int indx{static_cast<FSTPTEFD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FSTPTEFD_ *>(it_code->second)->get_row()}; + int indx{static_cast<FSTPTEFD_ *>(*it_code)->get_indx()}; + int row{static_cast<FSTPTEFD_ *>(*it_code)->get_row()}; tmp_out.str(""); if (call_type == ExternalFunctionCallType::numericalFirstDerivative) tmp_out << "TEFD(" << indx << ", " << row << ") = " << Stack.top(); @@ -1262,8 +1261,8 @@ protected: break; case Tags::FLDTEFD: { - int indx{static_cast<FLDTEFD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FLDTEFD_ *>(it_code->second)->get_row()}; + int indx{static_cast<FLDTEFD_ *>(*it_code)->get_indx()}; + int row{static_cast<FLDTEFD_ *>(*it_code)->get_row()}; tmp_out.str(""); tmp_out << "TEFD(" << indx << ", " << row << ")"; Stack.push(tmp_out.str()); @@ -1272,9 +1271,9 @@ protected: case Tags::FSTPTEFDD: { go_on = false; - int indx{static_cast<FSTPTEFDD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FSTPTEFDD_ *>(it_code->second)->get_row()}; - int col{static_cast<FSTPTEFDD_ *>(it_code->second)->get_col()}; + int indx{static_cast<FSTPTEFDD_ *>(*it_code)->get_indx()}; + int row{static_cast<FSTPTEFDD_ *>(*it_code)->get_row()}; + int col{static_cast<FSTPTEFDD_ *>(*it_code)->get_col()}; tmp_out.str(""); if (call_type == ExternalFunctionCallType::numericalSecondDerivative) tmp_out << "TEFDD(" << indx << ", " << row << ", " << col << ") = " << Stack.top(); @@ -1286,9 +1285,9 @@ protected: break; case Tags::FLDTEFDD: { - int indx{static_cast<FLDTEFDD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FLDTEFDD_ *>(it_code->second)->get_row()}; - int col{static_cast<FSTPTEFDD_ *>(it_code->second)->get_col()}; + int indx{static_cast<FLDTEFDD_ *>(*it_code)->get_indx()}; + int row{static_cast<FLDTEFDD_ *>(*it_code)->get_row()}; + int col{static_cast<FSTPTEFDD_ *>(*it_code)->get_col()}; tmp_out.str(""); tmp_out << "TEFDD(" << indx << ", " << row << ", " << col << ")"; Stack.push(tmp_out.str()); @@ -1309,9 +1308,9 @@ protected: go_on = false; break; default: - mexPrintf("Error it_code->first=%d unknown\n", it_code->first); mexEvalString("drawnow;"); + mexPrintf("Error tag=%d unknown\n", (*it_code)->op_code); mexEvalString("drawnow;"); throw FatalExceptionHandling(" in print_expression, unknown opcode " - + to_string(static_cast<int>(it_code->first)) + + to_string(static_cast<int>((*it_code)->op_code)) + "!! FENDEQU=" + to_string(static_cast<int>(Tags::FENDEQU)) + "\n"); } diff --git a/mex/sources/bytecode/Evaluate.cc b/mex/sources/bytecode/Evaluate.cc index bb5c15f450f64df13f135c35402dc0930c42f0f9..a5cc260a2f300a05a4888497e88bb156cab62f94 100644 --- a/mex/sources/bytecode/Evaluate.cc +++ b/mex/sources/bytecode/Evaluate.cc @@ -140,21 +140,21 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) while (go_on) { - switch (it_code->first) + switch ((*it_code)->op_code) { case Tags::FNUMEXPR: #ifdef DEBUG mexPrintf("FNUMEXPR\n"); #endif it_code_expr = it_code; - switch (static_cast<FNUMEXPR_ *>(it_code->second)->get_expression_type()) + switch (static_cast<FNUMEXPR_ *>(*it_code)->get_expression_type()) { case ExpressionType::TemporaryTerm: #ifdef DEBUG mexPrintf("TemporaryTerm\n"); #endif EQN_type = ExpressionType::TemporaryTerm; - EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation(); + EQN_equation = static_cast<FNUMEXPR_ *>(*it_code)->get_equation(); #ifdef DEBUG mexPrintf("EQN_equation=%d\n", EQN_equation); mexEvalString("drawnow;"); #endif @@ -164,52 +164,52 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) mexPrintf("ModelEquation\n"); #endif EQN_type = ExpressionType::ModelEquation; - EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation(); + EQN_equation = static_cast<FNUMEXPR_ *>(*it_code)->get_equation(); break; case ExpressionType::FirstEndoDerivative: #ifdef DEBUG mexPrintf("FirstEndoDerivative\n"); #endif EQN_type = ExpressionType::FirstEndoDerivative; - EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation(); - EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1(); - EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1(); + EQN_equation = static_cast<FNUMEXPR_ *>(*it_code)->get_equation(); + EQN_dvar1 = static_cast<FNUMEXPR_ *>(*it_code)->get_dvariable1(); + EQN_lag1 = static_cast<FNUMEXPR_ *>(*it_code)->get_lag1(); break; case ExpressionType::FirstOtherEndoDerivative: #ifdef DEBUG mexPrintf("FirstOtherEndoDerivative\n"); #endif EQN_type = ExpressionType::FirstOtherEndoDerivative; - EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation(); - EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1(); - EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1(); + EQN_equation = static_cast<FNUMEXPR_ *>(*it_code)->get_equation(); + EQN_dvar1 = static_cast<FNUMEXPR_ *>(*it_code)->get_dvariable1(); + EQN_lag1 = static_cast<FNUMEXPR_ *>(*it_code)->get_lag1(); break; case ExpressionType::FirstExoDerivative: #ifdef DEBUG mexPrintf("FirstExoDerivative\n"); #endif EQN_type = ExpressionType::FirstExoDerivative; - EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation(); - EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1(); - EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1(); + EQN_equation = static_cast<FNUMEXPR_ *>(*it_code)->get_equation(); + EQN_dvar1 = static_cast<FNUMEXPR_ *>(*it_code)->get_dvariable1(); + EQN_lag1 = static_cast<FNUMEXPR_ *>(*it_code)->get_lag1(); break; case ExpressionType::FirstExodetDerivative: #ifdef DEBUG mexPrintf("FirstExodetDerivative\n"); #endif EQN_type = ExpressionType::FirstExodetDerivative; - EQN_equation = static_cast<FNUMEXPR_ *>(it_code->second)->get_equation(); - EQN_dvar1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_dvariable1(); - EQN_lag1 = static_cast<FNUMEXPR_ *>(it_code->second)->get_lag1(); + EQN_equation = static_cast<FNUMEXPR_ *>(*it_code)->get_equation(); + EQN_dvar1 = static_cast<FNUMEXPR_ *>(*it_code)->get_dvariable1(); + EQN_lag1 = static_cast<FNUMEXPR_ *>(*it_code)->get_lag1(); break; } break; case Tags::FLDV: //load a variable in the processor - switch (static_cast<FLDV_ *>(it_code->second)->get_type()) + switch (static_cast<FLDV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FLDV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDV_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDV Param[var=%d]\n", var); tmp_out << " params[" << var << "](" << params[var] << ")"; @@ -217,8 +217,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.push(params[var]); break; case SymbolType::endogenous: - var = static_cast<FLDV_ *>(it_code->second)->get_pos(); - lag = static_cast<FLDV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FLDV_ *>(*it_code)->get_pos(); + lag = static_cast<FLDV_ *>(*it_code)->get_lead_lag(); #ifdef DEBUG if (evaluate) mexPrintf("FLDV y[var=%d, lag=%d, it_=%d], y_size=%d evaluate=%d, ya[%d]=%f\n", var, lag, it_, y_size, evaluate, (it_+lag)*y_size+var, ya[(it_+lag)*y_size+var]); @@ -234,8 +234,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) #endif break; case SymbolType::exogenous: - var = static_cast<FLDV_ *>(it_code->second)->get_pos(); - lag = static_cast<FLDV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FLDV_ *>(*it_code)->get_pos(); + lag = static_cast<FLDV_ *>(*it_code)->get_lead_lag(); #ifdef DEBUG mexPrintf("FLDV x[var=%d, lag=%d, it_=%d], nb_row_x=%d evaluate=%d x[%d]=%f\n", var, lag, it_, nb_row_x, evaluate, it_+lag+var*nb_row_x, x[it_+lag+var*nb_row_x]); //tmp_out << " x[" << it_+lag << ", " << var << "](" << x[it_+lag+var*nb_row_x] << ")"; @@ -257,10 +257,10 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDSV: //load a variable in the processor - switch (static_cast<FLDSV_ *>(it_code->second)->get_type()) + switch (static_cast<FLDSV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FLDSV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSV_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDSV Param[var=%d]=%f\n", var, params[var]); tmp_out << " params[" << var << "](" << params[var] << ")"; @@ -268,7 +268,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.push(params[var]); break; case SymbolType::endogenous: - var = static_cast<FLDSV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSV_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDSV y[var=%d]=%f\n", var, ya[var]); tmp_out << " y[" << var << "](" << y[var] << ")"; @@ -279,7 +279,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.push(y[var]); break; case SymbolType::exogenous: - var = static_cast<FLDSV_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSV_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDSV x[var=%d]\n", var); tmp_out << " x[" << var << "](" << x[var] << ")"; @@ -301,24 +301,24 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDVS: //load a variable in the processor - switch (static_cast<FLDVS_ *>(it_code->second)->get_type()) + switch (static_cast<FLDVS_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FLDVS_ *>(it_code->second)->get_pos(); + var = static_cast<FLDVS_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("params[%d]\n", var); #endif Stack.push(params[var]); break; case SymbolType::endogenous: - var = static_cast<FLDVS_ *>(it_code->second)->get_pos(); + var = static_cast<FLDVS_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDVS steady_y[%d]\n", var); #endif Stack.push(steady_y[var]); break; case SymbolType::exogenous: - var = static_cast<FLDVS_ *>(it_code->second)->get_pos(); + var = static_cast<FLDVS_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDVS x[%d] \n", var); #endif @@ -339,7 +339,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDT: //load a temporary variable in the processor - var = static_cast<FLDT_ *>(it_code->second)->get_pos(); + var = static_cast<FLDT_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDT T[it_=%d var=%d, y_kmin=%d, y_kmax=%d == %d]=>%f\n", it_, var, y_kmin, y_kmax, var*(periods+y_kmin+y_kmax)+it_, T[var*(periods+y_kmin+y_kmax)+it_]); tmp_out << " T[" << it_ << ", " << var << "](" << T[var*(periods+y_kmin+y_kmax)+it_] << ")"; @@ -348,7 +348,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDST: //load a temporary variable in the processor - var = static_cast<FLDST_ *>(it_code->second)->get_pos(); + var = static_cast<FLDST_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDST T[%d]", var); #endif @@ -360,7 +360,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDU: //load u variable in the processor - var = static_cast<FLDU_ *>(it_code->second)->get_pos(); + var = static_cast<FLDU_ *>(*it_code)->get_pos(); var += Per_u_; #ifdef DEBUG mexPrintf("FLDU u[%d]\n", var); @@ -370,7 +370,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDSU: //load u variable in the processor - var = static_cast<FLDSU_ *>(it_code->second)->get_pos(); + var = static_cast<FLDSU_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDSU u[%d]\n", var); tmp_out << " u[" << var << "](" << u[var] << ")"; @@ -379,7 +379,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDR: //load u variable in the processor - var = static_cast<FLDR_ *>(it_code->second)->get_pos(); + var = static_cast<FLDR_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FLDR r[%d]\n", var); #endif @@ -397,7 +397,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDC: //load a numerical constant in the processor - ll = static_cast<FLDC_ *>(it_code->second)->get_value(); + ll = static_cast<FLDC_ *>(*it_code)->get_value(); #ifdef DEBUG mexPrintf("FLDC = %f\n", ll); tmp_out << " " << ll; @@ -407,10 +407,10 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPV: //load a variable in the processor - switch (static_cast<FSTPV_ *>(it_code->second)->get_type()) + switch (static_cast<FSTPV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FSTPV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPV_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("FSTPV params[%d]\n", var); #endif @@ -418,8 +418,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.pop(); break; case SymbolType::endogenous: - var = static_cast<FSTPV_ *>(it_code->second)->get_pos(); - lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FSTPV_ *>(*it_code)->get_pos(); + lag = static_cast<FSTPV_ *>(*it_code)->get_lead_lag(); y[(it_+lag)*y_size+var] = Stack.top(); #ifdef DEBUG tmp_out << "=>"; @@ -429,8 +429,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.pop(); break; case SymbolType::exogenous: - var = static_cast<FSTPV_ *>(it_code->second)->get_pos(); - lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag(); + var = static_cast<FSTPV_ *>(*it_code)->get_pos(); + lag = static_cast<FSTPV_ *>(*it_code)->get_lead_lag(); x[it_+lag+var*nb_row_x] = Stack.top(); #ifdef DEBUG tmp_out << "=>"; @@ -449,15 +449,15 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPSV: //load a variable in the processor - switch (static_cast<FSTPSV_ *>(it_code->second)->get_type()) + switch (static_cast<FSTPSV_ *>(*it_code)->get_type()) { case SymbolType::parameter: - var = static_cast<FSTPSV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSV_ *>(*it_code)->get_pos(); params[var] = Stack.top(); Stack.pop(); break; case SymbolType::endogenous: - var = static_cast<FSTPSV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSV_ *>(*it_code)->get_pos(); y[var] = Stack.top(); #ifdef DEBUG tmp_out << "=>"; @@ -467,7 +467,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.pop(); break; case SymbolType::exogenous: - var = static_cast<FSTPSV_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSV_ *>(*it_code)->get_pos(); x[var] = Stack.top(); #ifdef DEBUG tmp_out << "=>"; @@ -488,7 +488,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) #ifdef DEBUG mexPrintf("FSTPT\n"); #endif - var = static_cast<FSTPT_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPT_ *>(*it_code)->get_pos(); T[var*(periods+y_kmin+y_kmax)+it_] = Stack.top(); #ifdef DEBUG tmp_out << "=>"; @@ -503,7 +503,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) #ifdef DEBUG mexPrintf("FSTPST\n"); #endif - var = static_cast<FSTPST_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPST_ *>(*it_code)->get_pos(); #ifdef DEBUG mexPrintf("var=%d\n", var); #endif @@ -517,7 +517,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPU: //store in u variable from the processor - var = static_cast<FSTPU_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPU_ *>(*it_code)->get_pos(); var += Per_u_; #ifdef DEBUG mexPrintf("FSTPU\n"); @@ -533,7 +533,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPSU: //store in u variable from the processor - var = static_cast<FSTPSU_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPSU_ *>(*it_code)->get_pos(); #ifdef DEBUG /*if (var >= u_count_alloc || var < 0) mexPrintf("Erreur var=%d\n", var);*/ @@ -548,7 +548,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPR: //store in residual variable from the processor - var = static_cast<FSTPR_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPR_ *>(*it_code)->get_pos(); #ifdef DEBUG tmp_out << "=>"; mexPrintf("FSTPR r[%d]", var); @@ -568,7 +568,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) mexPrintf("FSTPG\n"); mexEvalString("drawnow;"); #endif - var = static_cast<FSTPG_ *>(it_code->second)->get_pos(); + var = static_cast<FSTPG_ *>(*it_code)->get_pos(); g1[var] = Stack.top(); #ifdef DEBUG tmp_out << "=>"; @@ -583,8 +583,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) rr = Stack.top(); if (EQN_type != ExpressionType::FirstEndoDerivative) throw FatalExceptionHandling(" in compute_block_time, impossible case " + to_string(static_cast<int>(EQN_type)) + " not implement in static jacobian\n"); - eq = static_cast<FSTPG2_ *>(it_code->second)->get_row(); - var = static_cast<FSTPG2_ *>(it_code->second)->get_col(); + eq = static_cast<FSTPG2_ *>(*it_code)->get_row(); + var = static_cast<FSTPG2_ *>(*it_code)->get_col(); #ifdef DEBUG mexPrintf("FSTPG2 eq=%d, var=%d\n", eq, var); mexEvalString("drawnow;"); @@ -607,10 +607,10 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) switch (EQN_type) { case ExpressionType::FirstEndoDerivative: - eq = static_cast<FSTPG3_ *>(it_code->second)->get_row(); - var = static_cast<FSTPG3_ *>(it_code->second)->get_col(); - lag = static_cast<FSTPG3_ *>(it_code->second)->get_lag(); - pos_col = static_cast<FSTPG3_ *>(it_code->second)->get_col_pos(); + eq = static_cast<FSTPG3_ *>(*it_code)->get_row(); + var = static_cast<FSTPG3_ *>(*it_code)->get_col(); + lag = static_cast<FSTPG3_ *>(*it_code)->get_lag(); + pos_col = static_cast<FSTPG3_ *>(*it_code)->get_col_pos(); #ifdef DEBUG mexPrintf("Endo eq=%d, pos_col=%d, size=%d, jacob=%x\n", eq, pos_col, size, jacob); mexPrintf("jacob=%x\n", jacob); @@ -618,11 +618,11 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) jacob[eq + size*pos_col] = rr; break; case ExpressionType::FirstOtherEndoDerivative: - //eq = static_cast<FSTPG3_ *>(it_code->second)->get_row(); + //eq = static_cast<FSTPG3_ *>(*it_code)->get_row(); eq = EQN_equation; - var = static_cast<FSTPG3_ *>(it_code->second)->get_col(); - lag = static_cast<FSTPG3_ *>(it_code->second)->get_lag(); - pos_col = static_cast<FSTPG3_ *>(it_code->second)->get_col_pos(); + var = static_cast<FSTPG3_ *>(*it_code)->get_col(); + lag = static_cast<FSTPG3_ *>(*it_code)->get_lag(); + pos_col = static_cast<FSTPG3_ *>(*it_code)->get_col_pos(); #ifdef DEBUG mexPrintf("other_endo eq=%d, pos_col=%d, size=%d\n", eq, pos_col, size); mexEvalString("drawnow;"); @@ -630,11 +630,11 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) jacob_other_endo[eq + size*pos_col] = rr; break; case ExpressionType::FirstExoDerivative: - //eq = static_cast<FSTPG3_ *>(it_code->second)->get_row(); + //eq = static_cast<FSTPG3_ *>(*it_code)->get_row(); eq = EQN_equation; - var = static_cast<FSTPG3_ *>(it_code->second)->get_col(); - lag = static_cast<FSTPG3_ *>(it_code->second)->get_lag(); - pos_col = static_cast<FSTPG3_ *>(it_code->second)->get_col_pos(); + var = static_cast<FSTPG3_ *>(*it_code)->get_col(); + lag = static_cast<FSTPG3_ *>(*it_code)->get_lag(); + pos_col = static_cast<FSTPG3_ *>(*it_code)->get_col_pos(); #ifdef DEBUG mexPrintf("Exo eq=%d, pos_col=%d, size=%d\n", eq, pos_col, size); mexEvalString("drawnow;"); @@ -642,11 +642,11 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) jacob_exo[eq + size*pos_col] = rr; break; case ExpressionType::FirstExodetDerivative: - //eq = static_cast<FSTPG3_ *>(it_code->second)->get_row(); + //eq = static_cast<FSTPG3_ *>(*it_code)->get_row(); eq = EQN_equation; - var = static_cast<FSTPG3_ *>(it_code->second)->get_col(); - lag = static_cast<FSTPG3_ *>(it_code->second)->get_lag(); - pos_col = static_cast<FSTPG3_ *>(it_code->second)->get_col_pos(); + var = static_cast<FSTPG3_ *>(*it_code)->get_col(); + lag = static_cast<FSTPG3_ *>(*it_code)->get_lag(); + pos_col = static_cast<FSTPG3_ *>(*it_code)->get_col_pos(); #ifdef DEBUG mexPrintf("Exo det eq=%d, pos_col=%d, size=%d\n", eq, pos_col, size); mexEvalString("drawnow;"); @@ -666,7 +666,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FBINARY: - op2 = static_cast<FBINARY_ *>(it_code->second)->get_op_type(); + op2 = static_cast<FBINARY_ *>(*it_code)->get_op_type(); #ifdef DEBUG mexPrintf("FBINARY, op=%d\n", static_cast<int>(op2)); #endif @@ -821,7 +821,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) } break; case Tags::FUNARY: - op1 = static_cast<FUNARY_ *>(it_code->second)->get_op_type(); + op1 = static_cast<FUNARY_ *>(*it_code)->get_op_type(); v1 = Stack.top(); Stack.pop(); #ifdef DEBUG @@ -974,7 +974,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) } break; case Tags::FTRINARY: - op3 = static_cast<FTRINARY_ *>(it_code->second)->get_op_type(); + op3 = static_cast<FTRINARY_ *>(*it_code)->get_op_type(); v3 = Stack.top(); Stack.pop(); v2 = Stack.top(); @@ -1009,7 +1009,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) mexPrintf("------------------------------\n"); mexPrintf("CALL "); mexEvalString("drawnow;"); #endif - auto *fc = static_cast<FCALL_ *>(it_code->second); + auto *fc = static_cast<FCALL_ *>(*it_code); string function_name = fc->get_function_name(); #ifdef DEBUG mexPrintf("function_name=%s ", function_name.c_str()); mexEvalString("drawnow;"); @@ -1197,7 +1197,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) } break; case Tags::FSTPTEF: - var = static_cast<FSTPTEF_ *>(it_code->second)->get_number(); + var = static_cast<FSTPTEF_ *>(*it_code)->get_number(); #ifdef DEBUG mexPrintf("FSTPTEF\n"); mexPrintf("var=%d Stack.size()=%d\n", var, Stack.size()); @@ -1210,7 +1210,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) Stack.pop(); break; case Tags::FLDTEF: - var = static_cast<FLDTEF_ *>(it_code->second)->get_number(); + var = static_cast<FLDTEF_ *>(*it_code)->get_number(); #ifdef DEBUG mexPrintf("FLDTEF\n"); mexPrintf("var=%d Stack.size()=%d\n", var, Stack.size()); @@ -1221,8 +1221,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPTEFD: { - int indx{static_cast<FSTPTEFD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FSTPTEFD_ *>(it_code->second)->get_row()}; + int indx{static_cast<FSTPTEFD_ *>(*it_code)->get_indx()}; + int row{static_cast<FSTPTEFD_ *>(*it_code)->get_row()}; #ifdef DEBUG mexPrintf("FSTPTEFD\n"); mexPrintf("indx=%d Stack.size()=%d\n", indx, Stack.size()); @@ -1241,8 +1241,8 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDTEFD: { - int indx{static_cast<FLDTEFD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FLDTEFD_ *>(it_code->second)->get_row()}; + int indx{static_cast<FLDTEFD_ *>(*it_code)->get_indx()}; + int row{static_cast<FLDTEFD_ *>(*it_code)->get_row()}; #ifdef DEBUG mexPrintf("FLDTEFD\n"); mexPrintf("indx=%d row=%d Stack.size()=%d\n", indx, row, Stack.size()); @@ -1254,9 +1254,9 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FSTPTEFDD: { - int indx{static_cast<FSTPTEFDD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FSTPTEFDD_ *>(it_code->second)->get_row()}; - int col{static_cast<FSTPTEFDD_ *>(it_code->second)->get_col()}; + int indx{static_cast<FSTPTEFDD_ *>(*it_code)->get_indx()}; + int row{static_cast<FSTPTEFDD_ *>(*it_code)->get_row()}; + int col{static_cast<FSTPTEFDD_ *>(*it_code)->get_col()}; #ifdef DEBUG mexPrintf("FSTPTEFD\n"); mexPrintf("indx=%d Stack.size()=%d\n", indx, Stack.size()); @@ -1275,9 +1275,9 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) break; case Tags::FLDTEFDD: { - int indx{static_cast<FLDTEFDD_ *>(it_code->second)->get_indx()}; - int row{static_cast<FLDTEFDD_ *>(it_code->second)->get_row()}; - int col{static_cast<FSTPTEFDD_ *>(it_code->second)->get_col()}; + int indx{static_cast<FLDTEFDD_ *>(*it_code)->get_indx()}; + int row{static_cast<FLDTEFDD_ *>(*it_code)->get_row()}; + int col{static_cast<FSTPTEFDD_ *>(*it_code)->get_col()}; #ifdef DEBUG mexPrintf("FLDTEFD\n"); mexPrintf("indx=%d Stack.size()=%d\n", indx, Stack.size()); @@ -1305,21 +1305,21 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative) if (evaluate) { #ifdef DEBUG - mexPrintf("FJMPIFEVAL length=%d\n", static_cast<FJMPIFEVAL_ *>(it_code->second)->get_pos()); + mexPrintf("FJMPIFEVAL length=%d\n", static_cast<FJMPIFEVAL_ *>(*it_code)->get_pos()); mexEvalString("drawnow;"); #endif - it_code += static_cast<FJMPIFEVAL_ *>(it_code->second)->get_pos() /* - 1*/; + it_code += static_cast<FJMPIFEVAL_ *>(*it_code)->get_pos() /* - 1*/; } break; case Tags::FJMP: #ifdef DEBUG - mexPrintf("FJMP length=%d\n", static_cast<FJMP_ *>(it_code->second)->get_pos()); + mexPrintf("FJMP length=%d\n", static_cast<FJMP_ *>(*it_code)->get_pos()); mexEvalString("drawnow;"); #endif - it_code += static_cast<FJMP_ *>(it_code->second)->get_pos() /*- 1 */; + it_code += static_cast<FJMP_ *>(*it_code)->get_pos() /*- 1 */; break; default: - throw FatalExceptionHandling(" in compute_block_time, unknown opcode " + to_string(static_cast<int>(it_code->first)) + "\n"); + throw FatalExceptionHandling(" in compute_block_time, unknown opcode " + to_string(static_cast<int>((*it_code)->op_code)) + "\n"); } it_code++; } diff --git a/mex/sources/bytecode/Evaluate.hh b/mex/sources/bytecode/Evaluate.hh index da9258798544de054aba6bdfe0b950b5be112c69..9c8f665918dd3983ed1bf25041e82027ba0d98b6 100644 --- a/mex/sources/bytecode/Evaluate.hh +++ b/mex/sources/bytecode/Evaluate.hh @@ -58,7 +58,7 @@ protected: void solve_simple_one_periods(); void solve_simple_over_periods(bool forward); void compute_block_time(int Per_u_, bool evaluate, bool no_derivatives); - code_liste_type code_liste; + instructions_list_t code_liste; it_code_type it_code; int Block_Count, Per_u_, Per_y_; int it_; diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc index 750266637cbaa0455bb94813dc8f4ae8e7ed470b..98544030fab9553c0abf3edbca932f386262f419 100644 --- a/mex/sources/bytecode/Interpreter.cc +++ b/mex/sources/bytecode/Interpreter.cc @@ -525,7 +525,7 @@ Interpreter::print_a_block() bool space = false; while (go_on) { - if (it_code->first == Tags::FENDBLOCK) + if ((*it_code)->op_code == Tags::FENDBLOCK) { go_on = false; it_code++; @@ -619,7 +619,7 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva while (go_on) { - switch (it_code->first) + switch ((*it_code)->op_code) { case Tags::FBEGINBLOCK: Block_Count++; @@ -632,7 +632,7 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva #endif //it's a new block { - auto *fb = static_cast<FBEGINBLOCK_ *>(it_code->second); + auto *fb = static_cast<FBEGINBLOCK_ *>(*it_code); Block_Contain = fb->get_Block_Contain(); it_code++; if (constrained) @@ -720,9 +720,9 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva break; case Tags::FDIMT: #ifdef DEBUG - mexPrintf("FDIMT size=%d\n", static_cast<FDIMT_ *>(it_code->second)->get_size()); + mexPrintf("FDIMT size=%d\n", static_cast<FDIMT_ *>(*it_code)->get_size()); #endif - var = static_cast<FDIMT_ *>(it_code->second)->get_size(); + var = static_cast<FDIMT_ *>(*it_code)->get_size(); if (T) mxFree(T); T = static_cast<double *>(mxMalloc(var*(periods+y_kmin+y_kmax)*sizeof(double))); @@ -734,9 +734,9 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva break; case Tags::FDIMST: #ifdef DEBUG - mexPrintf("FDIMST size=%d\n", static_cast<FDIMST_ *>(it_code->second)->get_size()); + mexPrintf("FDIMST size=%d\n", static_cast<FDIMST_ *>(*it_code)->get_size()); #endif - var = static_cast<FDIMST_ *>(it_code->second)->get_size(); + var = static_cast<FDIMST_ *>(*it_code)->get_size(); if (T) mxFree(T); if (global_temporary_terms) @@ -763,7 +763,7 @@ Interpreter::MainLoop(const string &bin_basename, const CodeLoad &code, bool eva break; default: throw FatalExceptionHandling(" in compute_blocks, unknown command " - + to_string(static_cast<int>(it_code->first)) + " (block=" + + to_string(static_cast<int>((*it_code)->op_code)) + " (block=" + to_string(Block_Count) + ")\n"); } } @@ -908,8 +908,8 @@ Interpreter::extended_path(const string &file_name, const string &bin_basename, y[i] = y_save[i]; for (int j = 0; j < col_x * nb_row_x; j++) x[j] = x_save[j]; - if (Init_Code->second) - mxFree(Init_Code->second); + if (*Init_Code) + mxFree(*Init_Code); if (y_save) mxFree(y_save); if (x_save) @@ -934,7 +934,7 @@ Interpreter::compute_blocks(const string &file_name, const string &bin_basename, MainLoop(bin_basename, code, evaluate, block, true, false, s_plan_junk, vector_table_conditional_local_junk); - mxFree(Init_Code->second); + mxFree(*Init_Code); nb_blocks = Block_Count+1; if (T && !global_temporary_terms) mxFree(T); diff --git a/preprocessor b/preprocessor index 21cecee5990e1541d0721c2a7a554da15b5e8011..c3cb7ca534b27e3c763f1dba62892b92d9c3f234 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 21cecee5990e1541d0721c2a7a554da15b5e8011 +Subproject commit c3cb7ca534b27e3c763f1dba62892b92d9c3f234