unit uSys;

interface

uses Rubies, SysUtils;

procedure Init_Sys;

implementation

uses uStrUtils, uDefUtils, uPhi;

function Sys_abort(This: Tvalue): Tvalue; cdecl;
begin
  Abort;
  result := Qnil;
end;

function Sys_beep(This: Tvalue): Tvalue; cdecl;
begin
  beep;
  result := Qnil;
end;

function Sys_FInit(This: Tvalue): Tvalue; cdecl;
begin
asm
  FInit;
end;
  result := Qnil;
end;

procedure Init_Sys;
begin
  ap_define_const(mPhi, 'fmOpenRead', INT2FIX(fmOpenRead));
  ap_define_const(mPhi, 'fmOpenWrite', INT2FIX(fmOpenWrite));
  ap_define_const(mPhi, 'fmOpenReadWrite', INT2FIX(fmOpenReadWrite));
  ap_define_const(mPhi, 'fmShareCompat', INT2FIX(fmShareCompat));
  ap_define_const(mPhi, 'fmShareExclusive', INT2FIX(fmShareExclusive));
  ap_define_const(mPhi, 'fmShareDenyWrite', INT2FIX(fmShareDenyWrite));
  ap_define_const(mPhi, 'fmShareDenyRead', INT2FIX(fmShareDenyRead));
  ap_define_const(mPhi, 'fmShareDenyNone', INT2FIX(fmShareDenyNone));

  rb_define_module_function(mPhi, 'abort', @Sys_abort, 0);
  rb_define_module_function(mPhi, 'beep', @Sys_beep, 0);
  rb_define_module_function(mPhi, 'FInit', @Sys_FInit, 0);
end;

end.
