package nxm.sys.intr;

import nxm.sys.lib.Intrinsic;
import nxm.sys.lib.Midas;

/**
  Handles returning from a macro.

  @author Jeff Schoen

*/
public class Stop extends Intrinsic {

  /** default constructor */
  public Stop () {}

  public int process() {
    if (M.macro == null) {
      M.warning("No macro executing ...");
    }
    else if (M.pipeMode != Midas.POFF) {
      M.pipeMode = Midas.PSTOP;
    }
    else {
      M.macro.nextIndex = -1;
      String text = MA.getU("TEXT");
      if (text.length()>0) M.warning(text);
      M.macro.setState(FINISH);
    }
    return (FINISH);
  }
}

