text
stringlengths
0
234
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_test");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
if gnat_argc = 0 then
gnat_argc := argc;
gnat_argv := argv;
end if;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
Function Definition: function Get_Distance(C_act, C_oth : Coord) return Integer is
Function Body: begin
return ((C_oth.x - C_act.x)**2 + (C_oth.y - C_act.y)**2);
Function Definition: function Get_Distance(AirC1,AirC2: Aircraft_Type) return Integer is
Function Body: Cord1 : Coord := AirC1.Pos_Airplane;
Cord2 : Coord := AirC2.Pos_Airplane;
begin
return Get_Distance(Cord1,Cord2);
exception
when others => return -1;
Function Definition: procedure Main is
Function Body: package GL_Double_IO is new Float_IO(GL.Types.Double);
use GL_Double_IO;
package Natural_IO is new Integer_IO(Natural);
use Natural_IO;
use GL.Types;
use GL.Types.Doubles;
use GL.Fixed.Matrix;
use GL.Buffers;
use type GL.Types.Double;
package CRV is new Curve(Base_Real_Type => GL.Types.Double,
Dimension => 2);
-- Constants
------------
D : constant Gl.Types.Double := 4.0; -- Diameter of a drawn point
WINDOW_WIDTH : constant := 800;
WINDOW_HEIGHT : constant := 600;
KNOTS_RULER_V_POS : constant Gl.Types.Double := GL.Types.Double(WINDOW_HEIGHT) - 50.0;
KNOTS_RULER_LEFT_COORDINATE : constant := 100.0;
KNOTS_RULER_RIGHT_COORDINATE : constant := GL.Types.Double(WINDOW_WIDTH) - 100.0;
-- Types
--------
type Algorithm_Type is (DE_CASTELIJAU, DE_BOOR, CATMULL_ROM, LAGRANGE_EQUIDISTANT, LAGRANGE_CHEBYSHEV);
subtype Num_Of_Control_Points_Type is Positive range 4 .. 99; -- Minumum 4 because of Catmull-Rom
subtype Num_Of_Knots_Type is Positive range 1 .. 99;
type Test_Window is new Glfw.Windows.Window with record
Control_Points : CRV.Control_Points_Array(1..Num_Of_Control_Points_Type'Last) :=
(1 => (CRV.X => 10.0, CRV.Y => 100.0),
2 => (CRV.X => 11.0, CRV.Y => 121.0),
3 => (CRV.X => 15.0, CRV.Y => 225.0),
4 => (CRV.X => 17.0, CRV.Y => 289.0),
5 => (CRV.X => 20.0, CRV.Y => 400.0),
6 => (CRV.X => 21.0, CRV.Y => 441.0),
7 => (CRV.X => 22.0, CRV.Y => 484.0),
8 => (CRV.X => 100.0, CRV.Y => 484.0),
9 => (CRV.X => 150.0, CRV.Y => 484.0),
10 => (CRV.X => 250.0, CRV.Y => 484.0),
others => (CRV.X => 0.0, CRV.Y => 0.0));
-- Note to self - this was bad idea to use static array of maximal size and a sepearte value to
-- represent it's actual size.
--
Num_Of_Control_Points : Num_Of_Control_Points_Type := 10;