unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

uses Rubies, Pythia, uAppInit;

{$R *.DFM}

procedure Stdout(S: string);
begin
  with Form1.Memo1, Lines do
  begin
    Text := Text+S;
    SelStart := Length(Text);
    Perform(EM_SCROLLCARET, 0, 0);
  end;
end;

//procedure init;
//begin
//  PhiExport('Apollo');
//end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  PhiAppInit;
  PhiSetStdoutProc(Stdout);
//  PhiSetInitProc(init);
end;

procedure TForm1.Button1Click(Sender: TObject);
//var
//  btn1: TButton;
begin
  PhiLoadProtect('./foo.rb', nil);
//  btn1 := TButton.Create(nil);
//  btn1.Parent := Form1;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  ruby_finalize;
end;

end.
