-
Notifications
You must be signed in to change notification settings - Fork 0
/
coord.ads
42 lines (32 loc) · 1016 Bytes
/
coord.ads
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
with Ada.Containers.Vectors;
package Coord
is
type Coord is record
X : Integer;
Y : Integer;
end record;
Start_Coord : constant Coord := (0,0);
type Direction_T is (U, D, L, R, Error);
subtype Valid_Direction is Direction_T range U .. R;
-- function Char_To_Direction (Input : Character) return Direction_T is
-- (case Input is
-- when 'U' => Up,
-- when 'D' => Down,
-- when 'L' => Left,
-- when 'R' => Right,
-- when others => Error);
type Vector is record
Direction : Valid_Direction;
Size : Natural;
end record;
package Coord_Points is new Ada.Containers.Vectors
(Element_Type => Coord,
Index_Type => Natural);
function Dir_To_Point
(Dir : Valid_Direction;
Pos : Coord)
return Coord;
procedure Expand_Vec (Vec : in Vector;
Wire : in out Coord_Points.Vector;
Pos : in out Coord);
end Coord;