unit uIdAntiFreeze;

interface

uses Classes, Rubies;

var
  cIdAntiFreeze: Tvalue;

function ap_cIdAntiFreeze: Tvalue;
procedure Init_IdAntiFreeze;

implementation

uses
  SysUtils, uDefUtils, Pythia, IdAntiFreeze, IdHandle, uIndy, uIdAntiFreezeBase;

function ap_cIdAntiFreeze: Tvalue;
begin
  result := cIdAntiFreeze;
end;

procedure IdAntiFreeze_setup(obj: Tvalue; real: TIdAntiFreeze);
begin
end;

function IdAntiFreeze_event_handle(This, name: Tvalue): Tvalue; cdecl;
begin
  EventHandle(This, name, [Handle, PhiGetHandle]);
  result := Qnil;
end;

function IdAntiFreeze_alloc(This: Tvalue; real: TIdAntiFreeze): Tvalue;
begin
  result := ChildAlloc(This, real);
  IdAntiFreeze_setup(result, real);
end;

function ap_iIdAntiFreeze(real: TIdAntiFreeze; owner: Tvalue): Tvalue;
begin
  result := IdAntiFreeze_alloc(cIdAntiFreeze, real);
  ap_owner(result, owner);
end;

function ap_iIdAntiFreeze_v(var obj; owner: Tvalue): Tvalue;
begin
  result := ap_iIdAntiFreeze(TIdAntiFreeze(obj), owner);
end;

function IdAntiFreeze_allocate(This: Tvalue): Tvalue; cdecl;
var
  real: TIdAntiFreeze;
begin
  real := TIdAntiFreeze.Create(nil);
  result := CompoAlloc(This, real);
  IdAntiFreeze_setup(result, real);
end;

procedure Init_IdAntiFreeze;
begin
  cIdAntiFreeze := DefinePersistentClass(mIndy, TIdAntiFreeze, cIdAntiFreezeBase, ap_iIdAntiFreeze_v);
  rb_define_alloc_func(cIdAntiFreeze, @IdAntiFreeze_allocate);
  rb_define_method(cIdAntiFreeze, 'event_handle', @IdAntiFreeze_event_handle, 1);
end;

end.
