summary refs log tree commit diff stats
path: root/examples/cross_calculator/lazarus/unit1.pas
blob: 6091a61d373d1df1429f2f3afee1aa4872ee384d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit Unit1; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  Spin, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    SpinEdit1: TSpinEdit;
    SpinEdit2: TSpinEdit;
    procedure FormCreate(Sender: TObject);
    procedure SpinEdit1Change(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  Form1: TForm1; 

implementation

{ TForm1 }

{$link nimcache/lib/system.o}
{$link nimcache/backend.o}
{$link nimcache/nim__dat.o}
{$linklib c}

procedure NimMain; cdecl; external;
function myAdd(x, y: longint): longint; cdecl; external;

procedure TForm1.FormCreate(Sender: TObject);
begin
  // we initialize the Nim data structures here:
  NimMain();
end;

procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
  Edit1.text := IntToStr(myAdd(SpinEdit1.Value, SpinEdit2.Value));
end;

initialization
  {$I unit1.lrs}

end.