-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathuPSI_PathFinder.pas
More file actions
101 lines (80 loc) · 3.27 KB
/
uPSI_PathFinder.pas
File metadata and controls
101 lines (80 loc) · 3.27 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
unit uPSI_PathFinder;
{$MODE Delphi}
{
This file has been generated by UnitParser v0.7, written by M. Knight
and updated by NP. v/d Spek and George Birbilis.
Source Code from Carlo Kok has been used to implement various sections of
UnitParser. Components of ROPS are used in the construction of UnitParser,
code implementing the class wrapper is taken from Carlo Kok's conv utility
}
interface
uses
SysUtils
,Classes
,uPSComponent
,uPSRuntime
,uPSCompiler
;
type
(*----------------------------------------------------------------------------*)
TPSImport_PathFinder = class(TPSPlugin)
protected
procedure CompileImport1(CompExec: TPSScript); override;
procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
end;
{ compile-time registration functions }
procedure SIRegister_PathFinder(CL: TPSPascalCompiler);
{ run-time registration functions }
procedure RIRegister_PathFinder_Routines(S: TPSExec);
procedure Register;
implementation
uses
windows
,extctrls
,Graphics
,Math
,AStar
,PathFinder
;
procedure Register;
begin
RegisterComponents('Pascal Script', [TPSImport_PathFinder]);
end;
(* === compile-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure SIRegister_PathFinder(CL: TPSPascalCompiler);
begin
CL.AddDelphiFunction('Procedure ClearAStarMap');
CL.AddDelphiFunction('Procedure SetupAStarMap( xi, yi, xt, yt : integer; nEucliDistK : double)');
CL.AddDelphiFunction('Procedure AddAStarObstacleCircle( xc, yc, r : double)');
CL.AddDelphiFunction('Procedure AddAStarObstacleRect( xi, yi, xf, yf : double)');
CL.AddDelphiFunction('Procedure CalcAStarPath');
CL.AddDelphiFunction('Function GetAStarPathPoint( i : integer) : TPoint');
CL.AddDelphiFunction('function GetAStarPathCount: integer');
end;
(* === run-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure RIRegister_PathFinder_Routines(S: TPSExec);
begin
S.RegisterDelphiFunction(@ClearAStarMap, 'ClearAStarMap', cdRegister);
S.RegisterDelphiFunction(@SetupAStarMap, 'SetupAStarMap', cdRegister);
S.RegisterDelphiFunction(@AddAStarObstacleCircle, 'AddAStarObstacleCircle', cdRegister);
S.RegisterDelphiFunction(@AddAStarObstacleRect, 'AddAStarObstacleRect', cdRegister);
S.RegisterDelphiFunction(@CalcAStarPath, 'CalcAStarPath', cdRegister);
S.RegisterDelphiFunction(@GetAStarPathPoint, 'GetAStarPathPoint', cdRegister);
S.RegisterDelphiFunction(@GetAStarPathCount, 'GetAStarPathCount', cdRegister);
end;
{ TPSImport_PathFinder }
(*----------------------------------------------------------------------------*)
procedure TPSImport_PathFinder.CompileImport1(CompExec: TPSScript);
begin
SIRegister_PathFinder(CompExec.Comp);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_PathFinder.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
// RIRegister_PathFinder(ri);
RIRegister_PathFinder_Routines(CompExec.Exec); // comment it if no routines
end;
(*----------------------------------------------------------------------------*)
end.