#include <yafl_rnt.h>

extern void yafl_terminate YPARAMS0 ;
int yafl_error_code, yafl_err_line_nr;
extern void do_exception();

void (*err_function) YPARAMS0;
void (*term_function) YPARAMS0;

static int guard = 0;

void yafl_err YPARAMS2(int, code)
{
  if (guard)
    {
/*
    exec_ls();
    dump_trace();
*/    
    return;
    }
  guard = 1;
  yafl_error_code = code;
  yafl_err_line_nr = yafl_line_nr;
  do_exception();
  yafl_terminate();
  if (err_function)
  {
    (*err_function)();
  }
}


void yafl_term YPARAMS0
{
  if (term_function)
    (*term_function)();
}
