From: Pavel Shramov <p...@lebu.psha.org.ru> When instruction iterpreted with INTERP_EXECUTE_FINISH return value is found in O-call set mdi_interrupt flag so subsequent calls to Interp::execute(0) will continue execution. Also don't reset on such errors.
Also added call_level function to get current call stack depth. Signed-off-by: Pavel Shramov <shra...@mexmat.net> --- src/emc/rs274ngc/interp_internal.cc | 1 + src/emc/rs274ngc/interp_internal.hh | 1 + src/emc/rs274ngc/rs274ngc_interp.hh | 1 + src/emc/rs274ngc/rs274ngc_pre.cc | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/emc/rs274ngc/interp_internal.cc b/src/emc/rs274ngc/interp_internal.cc index 63baedb..b0a3909 100644 --- a/src/emc/rs274ngc/interp_internal.cc +++ b/src/emc/rs274ngc/interp_internal.cc @@ -456,3 +456,4 @@ int Interp::set_probe_data(setup_pointer settings) //!< pointer to machine return INTERP_OK; } +int Interp::call_level(void) { return _setup.call_level; } diff --git a/src/emc/rs274ngc/interp_internal.hh b/src/emc/rs274ngc/interp_internal.hh index d03b223..575cd57 100644 --- a/src/emc/rs274ngc/interp_internal.hh +++ b/src/emc/rs274ngc/interp_internal.hh @@ -489,6 +489,7 @@ typedef struct setup_struct int c_indexer; bool lathe_diameter_mode; //Lathe diameter mode (g07/G08) + bool mdi_interrupt; } setup; diff --git a/src/emc/rs274ngc/rs274ngc_interp.hh b/src/emc/rs274ngc/rs274ngc_interp.hh index 74ae5eb..2581e9a 100644 --- a/src/emc/rs274ngc/rs274ngc_interp.hh +++ b/src/emc/rs274ngc/rs274ngc_interp.hh @@ -98,6 +98,7 @@ public: int ini_load(const char *filename); int line() { return sequence_number(); } + int call_level(); char *command(char *buf, int len) { line_text(buf, len); return buf; } diff --git a/src/emc/rs274ngc/rs274ngc_pre.cc b/src/emc/rs274ngc/rs274ngc_pre.cc index b9e02f3..71428a4 100644 --- a/src/emc/rs274ngc/rs274ngc_pre.cc +++ b/src/emc/rs274ngc/rs274ngc_pre.cc @@ -224,8 +224,9 @@ int Interp::execute(const char *command) logDebug("Interp::execute(%s)", command); // process control functions -- will skip if skipping // if (_setup.block1.o_number != 0) - if ((_setup.block1.o_number != 0) || (_setup.block1.o_name != 0) ) + if ((_setup.block1.o_number != 0) || (_setup.block1.o_name != 0) || (_setup.mdi_interrupt)) { + logDebug("Convert control functions"); CHP(convert_control_functions(&(_setup.block1), &_setup)); #if 1 @@ -236,6 +237,10 @@ int Interp::execute(const char *command) // NOTE: the last executed file will still be open, because "close" // is really a lazy close. + if (_setup.mdi_interrupt) { + _setup.mdi_interrupt = false; + MDImode = 1; + } logDebug("!!!KL Open file is:%s:", _setup.filename); logDebug("MDImode = %d", MDImode); while(MDImode && _setup.call_level) // we are still in a subroutine @@ -247,10 +252,14 @@ int Interp::execute(const char *command) } status = execute(); // special handling for mdi errors if (status != INTERP_OK) { - reset(); + if (status == INTERP_EXECUTE_FINISH) { + _setup.mdi_interrupt = true; + } else + reset(); CHP(status); } } + _setup.mdi_interrupt = false; #endif return INTERP_OK; } @@ -970,6 +979,8 @@ int Interp::reset() _setup.skipping_o = 0; _setup.oword_labels = 0; + _setup.mdi_interrupt = false; + qc_reset(); return INTERP_OK; -- 1.7.1 ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers