ブレークポイント

ブレークポイント機能を実装しました。
IDEが無いので、今のところあまり存在価値は無いです。

using namespace xtal;

void debug_break_point(const debug::InfoPtr& info){
  puts("break point");
}

int main(){
  try{
    initialize();
    debug::enable();
    debug::set_break_point_hook(fun(&debug_break_point)); // ブレークポイントフック関数を登録する

    CodePtr p = compile_file("test.xtal"); // xtalソースファイルをコンパイルしてCodeオブジェクトにする
    p->add_break_point(6); // 6行目でブレークポイントフック関数が呼ばれるようにする

    p(); // Codeオブジェクトを実行する
  }catch(AnyPtr e){
    stderr_stream()->put_s(e->to_s());
    stderr_stream()->put_s("\n");
  }

  uninitialize();
  return 0;
}