hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
sequencelengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
sequencelengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
sequencelengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
df43a1f913fadb9ba4bd65dd8f123d34cf485902 | 125 | ads | Ada | src/licensing.ads | mosteo/licensing | 439d7e8b8ed1f9d5879570112017aeaa5044e5f7 | [
"MIT"
] | null | null | null | src/licensing.ads | mosteo/licensing | 439d7e8b8ed1f9d5879570112017aeaa5044e5f7 | [
"MIT"
] | null | null | null | src/licensing.ads | mosteo/licensing | 439d7e8b8ed1f9d5879570112017aeaa5044e5f7 | [
"MIT"
] | null | null | null | with Licensing_Raw;
package Licensing with Preelaborate is
type Licenses is new Licensing_Raw.Licenses;
end Licensing;
| 15.625 | 47 | 0.808 |
500efe0ce1d82846a45480bcd7a82f58f6105f02 | 126 | ads | Ada | stm32f4/stm32gd-usart.ads | ekoeppen/STM32_Generic_Ada_Drivers | 4ff29c3026c4b24280baf22a5b81ea9969375466 | [
"MIT"
] | 1 | 2021-04-06T07:57:56.000Z | 2021-04-06T07:57:56.000Z | stm32f4/stm32gd-usart.ads | ekoeppen/STM32_Generic_Ada_Drivers | 4ff29c3026c4b24280baf22a5b81ea9969375466 | [
"MIT"
] | null | null | null | stm32f4/stm32gd-usart.ads | ekoeppen/STM32_Generic_Ada_Drivers | 4ff29c3026c4b24280baf22a5b81ea9969375466 | [
"MIT"
] | 2 | 2018-05-29T13:59:31.000Z | 2019-02-03T19:48:08.000Z | package STM32GD.USART is
pragma Preelaborate;
type USART_Instance is (USART_1, USART_2, USART_6);
end STM32GD.USART;
| 15.75 | 54 | 0.753968 |
1c3272b240301384fbecb99f995f3707ebba5c63 | 293 | ads | Ada | regtests/expect/ada/bundle.ads | stcarrez/resource-embedder | b1134306db459f87506703ba0a266c0b5e0045b9 | [
"Apache-2.0"
] | 7 | 2021-06-04T16:58:59.000Z | 2021-06-14T08:51:11.000Z | regtests/expect/ada/bundle.ads | stcarrez/resource-embedder | b1134306db459f87506703ba0a266c0b5e0045b9 | [
"Apache-2.0"
] | 2 | 2021-07-20T15:25:33.000Z | 2021-08-20T18:39:58.000Z | regtests/expect/ada/bundle.ads | stcarrez/resource-embedder | b1134306db459f87506703ba0a266c0b5e0045b9 | [
"Apache-2.0"
] | null | null | null | -- Advanced Resource Embedder 1.2.0
with Ada.Streams;
package Bundle is
type Content_Access is access constant Ada.Streams.Stream_Element_Array;
-- Returns the data stream with the given name or null.
function Get_Content (Name : String) return
Content_Access;
end Bundle;
| 24.416667 | 75 | 0.750853 |
121708cdbcd81018a29a9e40441ebdf1c3756efd | 39,991 | adb | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cfhase.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cfhase.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-cfhase.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . F O R M A L _ H A S H E D _ S E T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
with Ada.Containers.Hash_Tables.Generic_Bounded_Operations;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Operations);
with Ada.Containers.Hash_Tables.Generic_Bounded_Keys;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Keys);
with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers;
with System; use type System.Address;
package body Ada.Containers.Formal_Hashed_Sets with
SPARK_Mode => Off
is
-----------------------
-- Local Subprograms --
-----------------------
-- All need comments ???
procedure Difference (Left : Set; Right : Set; Target : in out Set);
function Equivalent_Keys
(Key : Element_Type;
Node : Node_Type) return Boolean;
pragma Inline (Equivalent_Keys);
procedure Free
(HT : in out Set;
X : Count_Type);
generic
with procedure Set_Element (Node : in out Node_Type);
procedure Generic_Allocate
(HT : in out Set;
Node : out Count_Type);
function Hash_Node (Node : Node_Type) return Hash_Type;
pragma Inline (Hash_Node);
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean);
procedure Intersection
(Left : Set;
Right : Set;
Target : in out Set);
function Is_In
(HT : Set;
Key : Node_Type) return Boolean;
pragma Inline (Is_In);
procedure Set_Element (Node : in out Node_Type; Item : Element_Type);
pragma Inline (Set_Element);
function Next (Node : Node_Type) return Count_Type;
pragma Inline (Next);
procedure Set_Next (Node : in out Node_Type; Next : Count_Type);
pragma Inline (Set_Next);
function Vet (Container : Set; Position : Cursor) return Boolean;
--------------------------
-- Local Instantiations --
--------------------------
package HT_Ops is new Hash_Tables.Generic_Bounded_Operations
(HT_Types => HT_Types,
Hash_Node => Hash_Node,
Next => Next,
Set_Next => Set_Next);
package Element_Keys is new Hash_Tables.Generic_Bounded_Keys
(HT_Types => HT_Types,
Next => Next,
Set_Next => Set_Next,
Key_Type => Element_Type,
Hash => Hash,
Equivalent_Keys => Equivalent_Keys);
procedure Replace_Element is
new Element_Keys.Generic_Replace_Element (Hash_Node, Set_Element);
---------
-- "=" --
---------
function "=" (Left, Right : Set) return Boolean is
begin
if Length (Left) /= Length (Right) then
return False;
end if;
if Length (Left) = 0 then
return True;
end if;
declare
Node : Count_Type;
ENode : Count_Type;
begin
Node := First (Left).Node;
while Node /= 0 loop
ENode :=
Find
(Container => Right,
Item => Left.Nodes (Node).Element).Node;
if ENode = 0
or else Right.Nodes (ENode).Element /= Left.Nodes (Node).Element
then
return False;
end if;
Node := HT_Ops.Next (Left, Node);
end loop;
return True;
end;
end "=";
------------
-- Assign --
------------
procedure Assign (Target : in out Set; Source : Set) is
procedure Insert_Element (Source_Node : Count_Type);
procedure Insert_Elements is
new HT_Ops.Generic_Iteration (Insert_Element);
--------------------
-- Insert_Element --
--------------------
procedure Insert_Element (Source_Node : Count_Type) is
N : Node_Type renames Source.Nodes (Source_Node);
X : Count_Type;
B : Boolean;
begin
Insert (Target, N.Element, X, B);
pragma Assert (B);
end Insert_Element;
-- Start of processing for Assign
begin
if Target'Address = Source'Address then
return;
end if;
if Target.Capacity < Length (Source) then
raise Storage_Error with "not enough capacity"; -- SE or CE? ???
end if;
HT_Ops.Clear (Target);
Insert_Elements (Source);
end Assign;
--------------
-- Capacity --
--------------
function Capacity (Container : Set) return Count_Type is
begin
return Container.Nodes'Length;
end Capacity;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Set) is
begin
HT_Ops.Clear (Container);
end Clear;
--------------
-- Contains --
--------------
function Contains (Container : Set; Item : Element_Type) return Boolean is
begin
return Find (Container, Item) /= No_Element;
end Contains;
----------
-- Copy --
----------
function Copy
(Source : Set;
Capacity : Count_Type := 0) return Set
is
C : constant Count_Type :=
Count_Type'Max (Capacity, Source.Capacity);
Cu : Cursor;
H : Hash_Type;
N : Count_Type;
Target : Set (C, Source.Modulus);
begin
if 0 < Capacity and then Capacity < Source.Capacity then
raise Capacity_Error;
end if;
Target.Length := Source.Length;
Target.Free := Source.Free;
H := 1;
while H <= Source.Modulus loop
Target.Buckets (H) := Source.Buckets (H);
H := H + 1;
end loop;
N := 1;
while N <= Source.Capacity loop
Target.Nodes (N) := Source.Nodes (N);
N := N + 1;
end loop;
while N <= C loop
Cu := (Node => N);
Free (Target, Cu.Node);
N := N + 1;
end loop;
return Target;
end Copy;
---------------------
-- Default_Modulus --
---------------------
function Default_Modulus (Capacity : Count_Type) return Hash_Type is
begin
return To_Prime (Capacity);
end Default_Modulus;
------------
-- Delete --
------------
procedure Delete (Container : in out Set; Item : Element_Type) is
X : Count_Type;
begin
Element_Keys.Delete_Key_Sans_Free (Container, Item, X);
if X = 0 then
raise Constraint_Error with "attempt to delete element not in set";
end if;
Free (Container, X);
end Delete;
procedure Delete (Container : in out Set; Position : in out Cursor) is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor has no element";
end if;
pragma Assert (Vet (Container, Position), "bad cursor in Delete");
HT_Ops.Delete_Node_Sans_Free (Container, Position.Node);
Free (Container, Position.Node);
Position := No_Element;
end Delete;
----------------
-- Difference --
----------------
procedure Difference (Target : in out Set; Source : Set) is
Src_Last : Count_Type;
Src_Length : Count_Type;
Src_Node : Count_Type;
Tgt_Node : Count_Type;
TN : Nodes_Type renames Target.Nodes;
SN : Nodes_Type renames Source.Nodes;
begin
if Target'Address = Source'Address then
Clear (Target);
return;
end if;
Src_Length := Source.Length;
if Src_Length = 0 then
return;
end if;
if Src_Length >= Target.Length then
Tgt_Node := HT_Ops.First (Target);
while Tgt_Node /= 0 loop
if Element_Keys.Find (Source, TN (Tgt_Node).Element) /= 0 then
declare
X : constant Count_Type := Tgt_Node;
begin
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
HT_Ops.Delete_Node_Sans_Free (Target, X);
Free (Target, X);
end;
else
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
end if;
end loop;
return;
else
Src_Node := HT_Ops.First (Source);
Src_Last := 0;
end if;
while Src_Node /= Src_Last loop
Tgt_Node := Element_Keys.Find (Target, SN (Src_Node).Element);
if Tgt_Node /= 0 then
HT_Ops.Delete_Node_Sans_Free (Target, Tgt_Node);
Free (Target, Tgt_Node);
end if;
Src_Node := HT_Ops.Next (Source, Src_Node);
end loop;
end Difference;
procedure Difference (Left : Set; Right : Set; Target : in out Set) is
procedure Process (L_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (L_Node : Count_Type) is
B : Boolean;
E : Element_Type renames Left.Nodes (L_Node).Element;
X : Count_Type;
begin
if Find (Right, E).Node = 0 then
Insert (Target, E, X, B);
pragma Assert (B);
end if;
end Process;
-- Start of processing for Difference
begin
Iterate (Left);
end Difference;
function Difference (Left : Set; Right : Set) return Set is
C : Count_Type;
H : Hash_Type;
begin
if Left'Address = Right'Address then
return Empty_Set;
end if;
if Length (Left) = 0 then
return Empty_Set;
end if;
if Length (Right) = 0 then
return Left.Copy;
end if;
C := Length (Left);
H := Default_Modulus (C);
return S : Set (C, H) do
Difference (Left, Right, Target => S);
end return;
end Difference;
-------------
-- Element --
-------------
function Element
(Container : Set;
Position : Cursor) return Element_Type
is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
pragma Assert
(Vet (Container, Position), "bad cursor in function Element");
return Container.Nodes (Position.Node).Element;
end Element;
---------------------
-- Equivalent_Sets --
---------------------
function Equivalent_Sets (Left, Right : Set) return Boolean is
function Find_Equivalent_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean;
pragma Inline (Find_Equivalent_Key);
function Is_Equivalent is
new HT_Ops.Generic_Equal (Find_Equivalent_Key);
-------------------------
-- Find_Equivalent_Key --
-------------------------
function Find_Equivalent_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean
is
R_Index : constant Hash_Type :=
Element_Keys.Index (R_HT, L_Node.Element);
R_Node : Count_Type := R_HT.Buckets (R_Index);
RN : Nodes_Type renames R_HT.Nodes;
begin
loop
if R_Node = 0 then
return False;
end if;
if Equivalent_Elements
(L_Node.Element, RN (R_Node).Element)
then
return True;
end if;
R_Node := HT_Ops.Next (R_HT, R_Node);
end loop;
end Find_Equivalent_Key;
-- Start of processing for Equivalent_Sets
begin
return Is_Equivalent (Left, Right);
end Equivalent_Sets;
---------------------
-- Equivalent_Keys --
---------------------
function Equivalent_Keys
(Key : Element_Type;
Node : Node_Type) return Boolean
is
begin
return Equivalent_Elements (Key, Node.Element);
end Equivalent_Keys;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Set; Item : Element_Type) is
X : Count_Type;
begin
Element_Keys.Delete_Key_Sans_Free (Container, Item, X);
Free (Container, X);
end Exclude;
----------
-- Find --
----------
function Find
(Container : Set;
Item : Element_Type) return Cursor
is
Node : constant Count_Type := Element_Keys.Find (Container, Item);
begin
if Node = 0 then
return No_Element;
end if;
return (Node => Node);
end Find;
-----------
-- First --
-----------
function First (Container : Set) return Cursor is
Node : constant Count_Type := HT_Ops.First (Container);
begin
if Node = 0 then
return No_Element;
end if;
return (Node => Node);
end First;
------------------
-- Formal_Model --
------------------
package body Formal_Model is
-------------------------
-- E_Elements_Included --
-------------------------
function E_Elements_Included
(Left : E.Sequence;
Right : E.Sequence) return Boolean
is
begin
for I in 1 .. E.Length (Left) loop
if not E.Contains (Right, 1, E.Length (Right), E.Get (Left, I))
then
return False;
end if;
end loop;
return True;
end E_Elements_Included;
function E_Elements_Included
(Left : E.Sequence;
Model : M.Set;
Right : E.Sequence) return Boolean
is
begin
for I in 1 .. E.Length (Left) loop
declare
Item : constant Element_Type := E.Get (Left, I);
begin
if M.Contains (Model, Item) then
if not E.Contains (Right, 1, E.Length (Right), Item) then
return False;
end if;
end if;
end;
end loop;
return True;
end E_Elements_Included;
function E_Elements_Included
(Container : E.Sequence;
Model : M.Set;
Left : E.Sequence;
Right : E.Sequence) return Boolean
is
begin
for I in 1 .. E.Length (Container) loop
declare
Item : constant Element_Type := E.Get (Container, I);
begin
if M.Contains (Model, Item) then
if not E.Contains (Left, 1, E.Length (Left), Item) then
return False;
end if;
else
if not E.Contains (Right, 1, E.Length (Right), Item) then
return False;
end if;
end if;
end;
end loop;
return True;
end E_Elements_Included;
----------
-- Find --
----------
function Find
(Container : E.Sequence;
Item : Element_Type) return Count_Type
is
begin
for I in 1 .. E.Length (Container) loop
if Equivalent_Elements (Item, E.Get (Container, I)) then
return I;
end if;
end loop;
return 0;
end Find;
--------------
-- Elements --
--------------
function Elements (Container : Set) return E.Sequence is
Position : Count_Type := HT_Ops.First (Container);
R : E.Sequence;
begin
-- Can't use First, Next or Element here, since they depend on models
-- for their postconditions.
while Position /= 0 loop
R := E.Add (R, Container.Nodes (Position).Element);
Position := HT_Ops.Next (Container, Position);
end loop;
return R;
end Elements;
----------------------------
-- Lift_Abstraction_Level --
----------------------------
procedure Lift_Abstraction_Level (Container : Set) is null;
-----------------------
-- Mapping_Preserved --
-----------------------
function Mapping_Preserved
(E_Left : E.Sequence;
E_Right : E.Sequence;
P_Left : P.Map;
P_Right : P.Map) return Boolean
is
begin
for C of P_Left loop
if not P.Has_Key (P_Right, C)
or else P.Get (P_Left, C) > E.Length (E_Left)
or else P.Get (P_Right, C) > E.Length (E_Right)
or else E.Get (E_Left, P.Get (P_Left, C)) /=
E.Get (E_Right, P.Get (P_Right, C))
then
return False;
end if;
end loop;
return True;
end Mapping_Preserved;
------------------------------
-- Mapping_Preserved_Except --
------------------------------
function Mapping_Preserved_Except
(E_Left : E.Sequence;
E_Right : E.Sequence;
P_Left : P.Map;
P_Right : P.Map;
Position : Cursor) return Boolean
is
begin
for C of P_Left loop
if C /= Position
and (not P.Has_Key (P_Right, C)
or else P.Get (P_Left, C) > E.Length (E_Left)
or else P.Get (P_Right, C) > E.Length (E_Right)
or else E.Get (E_Left, P.Get (P_Left, C)) /=
E.Get (E_Right, P.Get (P_Right, C)))
then
return False;
end if;
end loop;
return True;
end Mapping_Preserved_Except;
-----------
-- Model --
-----------
function Model (Container : Set) return M.Set is
Position : Count_Type := HT_Ops.First (Container);
R : M.Set;
begin
-- Can't use First, Next or Element here, since they depend on models
-- for their postconditions.
while Position /= 0 loop
R :=
M.Add
(Container => R,
Item => Container.Nodes (Position).Element);
Position := HT_Ops.Next (Container, Position);
end loop;
return R;
end Model;
---------------
-- Positions --
---------------
function Positions (Container : Set) return P.Map is
I : Count_Type := 1;
Position : Count_Type := HT_Ops.First (Container);
R : P.Map;
begin
-- Can't use First, Next or Element here, since they depend on models
-- for their postconditions.
while Position /= 0 loop
R := P.Add (R, (Node => Position), I);
pragma Assert (P.Length (R) = I);
Position := HT_Ops.Next (Container, Position);
I := I + 1;
end loop;
return R;
end Positions;
end Formal_Model;
----------
-- Free --
----------
procedure Free (HT : in out Set; X : Count_Type) is
begin
if X /= 0 then
pragma Assert (X <= HT.Capacity);
HT.Nodes (X).Has_Element := False;
HT_Ops.Free (HT, X);
end if;
end Free;
----------------------
-- Generic_Allocate --
----------------------
procedure Generic_Allocate (HT : in out Set; Node : out Count_Type) is
procedure Allocate is new HT_Ops.Generic_Allocate (Set_Element);
begin
Allocate (HT, Node);
HT.Nodes (Node).Has_Element := True;
end Generic_Allocate;
package body Generic_Keys with SPARK_Mode => Off is
-----------------------
-- Local Subprograms --
-----------------------
function Equivalent_Key_Node
(Key : Key_Type;
Node : Node_Type) return Boolean;
pragma Inline (Equivalent_Key_Node);
--------------------------
-- Local Instantiations --
--------------------------
package Key_Keys is new Hash_Tables.Generic_Bounded_Keys
(HT_Types => HT_Types,
Next => Next,
Set_Next => Set_Next,
Key_Type => Key_Type,
Hash => Hash,
Equivalent_Keys => Equivalent_Key_Node);
--------------
-- Contains --
--------------
function Contains
(Container : Set;
Key : Key_Type) return Boolean
is
begin
return Find (Container, Key) /= No_Element;
end Contains;
------------
-- Delete --
------------
procedure Delete (Container : in out Set; Key : Key_Type) is
X : Count_Type;
begin
Key_Keys.Delete_Key_Sans_Free (Container, Key, X);
if X = 0 then
raise Constraint_Error with "attempt to delete key not in set";
end if;
Free (Container, X);
end Delete;
-------------
-- Element --
-------------
function Element
(Container : Set;
Key : Key_Type) return Element_Type
is
Node : constant Count_Type := Find (Container, Key).Node;
begin
if Node = 0 then
raise Constraint_Error with "key not in map";
end if;
return Container.Nodes (Node).Element;
end Element;
-------------------------
-- Equivalent_Key_Node --
-------------------------
function Equivalent_Key_Node
(Key : Key_Type;
Node : Node_Type) return Boolean
is
begin
return Equivalent_Keys (Key, Generic_Keys.Key (Node.Element));
end Equivalent_Key_Node;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Set; Key : Key_Type) is
X : Count_Type;
begin
Key_Keys.Delete_Key_Sans_Free (Container, Key, X);
Free (Container, X);
end Exclude;
----------
-- Find --
----------
function Find
(Container : Set;
Key : Key_Type) return Cursor
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
return (if Node = 0 then No_Element else (Node => Node));
end Find;
------------------
-- Formal_Model --
------------------
package body Formal_Model is
-----------------------
-- M_Included_Except --
-----------------------
function M_Included_Except
(Left : M.Set;
Right : M.Set;
Key : Key_Type) return Boolean
is
begin
for E of Left loop
if not Contains (Right, E)
and not Equivalent_Keys (Generic_Keys.Key (E), Key)
then
return False;
end if;
end loop;
return True;
end M_Included_Except;
end Formal_Model;
---------
-- Key --
---------
function Key (Container : Set; Position : Cursor) return Key_Type is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor has no element";
end if;
pragma Assert
(Vet (Container, Position), "bad cursor in function Key");
declare
N : Node_Type renames Container.Nodes (Position.Node);
begin
return Key (N.Element);
end;
end Key;
-------------
-- Replace --
-------------
procedure Replace
(Container : in out Set;
Key : Key_Type;
New_Item : Element_Type)
is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
begin
if Node = 0 then
raise Constraint_Error with "attempt to replace key not in set";
end if;
Replace_Element (Container, Node, New_Item);
end Replace;
end Generic_Keys;
-----------------
-- Has_Element --
-----------------
function Has_Element (Container : Set; Position : Cursor) return Boolean is
begin
if Position.Node = 0
or else not Container.Nodes (Position.Node).Has_Element
then
return False;
end if;
return True;
end Has_Element;
---------------
-- Hash_Node --
---------------
function Hash_Node (Node : Node_Type) return Hash_Type is
begin
return Hash (Node.Element);
end Hash_Node;
-------------
-- Include --
-------------
procedure Include (Container : in out Set; New_Item : Element_Type) is
Inserted : Boolean;
Position : Cursor;
begin
Insert (Container, New_Item, Position, Inserted);
if not Inserted then
Container.Nodes (Position.Node).Element := New_Item;
end if;
end Include;
------------
-- Insert --
------------
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
is
begin
Insert (Container, New_Item, Position.Node, Inserted);
end Insert;
procedure Insert (Container : in out Set; New_Item : Element_Type) is
Inserted : Boolean;
Position : Cursor;
begin
Insert (Container, New_Item, Position, Inserted);
if not Inserted then
raise Constraint_Error with
"attempt to insert element already in set";
end if;
end Insert;
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Node : out Count_Type;
Inserted : out Boolean)
is
procedure Allocate_Set_Element (Node : in out Node_Type);
pragma Inline (Allocate_Set_Element);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Local_Insert is
new Element_Keys.Generic_Conditional_Insert (New_Node);
procedure Allocate is
new Generic_Allocate (Allocate_Set_Element);
---------------------------
-- Allocate_Set_Element --
---------------------------
procedure Allocate_Set_Element (Node : in out Node_Type) is
begin
Node.Element := New_Item;
end Allocate_Set_Element;
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Container, Result);
return Result;
end New_Node;
-- Start of processing for Insert
begin
Local_Insert (Container, New_Item, Node, Inserted);
end Insert;
------------------
-- Intersection --
------------------
procedure Intersection (Target : in out Set; Source : Set) is
Tgt_Node : Count_Type;
TN : Nodes_Type renames Target.Nodes;
begin
if Target'Address = Source'Address then
return;
end if;
if Source.Length = 0 then
Clear (Target);
return;
end if;
Tgt_Node := HT_Ops.First (Target);
while Tgt_Node /= 0 loop
if Find (Source, TN (Tgt_Node).Element).Node /= 0 then
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
else
declare
X : constant Count_Type := Tgt_Node;
begin
Tgt_Node := HT_Ops.Next (Target, Tgt_Node);
HT_Ops.Delete_Node_Sans_Free (Target, X);
Free (Target, X);
end;
end if;
end loop;
end Intersection;
procedure Intersection (Left : Set; Right : Set; Target : in out Set) is
procedure Process (L_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (L_Node : Count_Type) is
E : Element_Type renames Left.Nodes (L_Node).Element;
X : Count_Type;
B : Boolean;
begin
if Find (Right, E).Node /= 0 then
Insert (Target, E, X, B);
pragma Assert (B);
end if;
end Process;
-- Start of processing for Intersection
begin
Iterate (Left);
end Intersection;
function Intersection (Left : Set; Right : Set) return Set is
C : Count_Type;
H : Hash_Type;
begin
if Left'Address = Right'Address then
return Left.Copy;
end if;
C := Count_Type'Min (Length (Left), Length (Right)); -- ???
H := Default_Modulus (C);
return S : Set (C, H) do
if Length (Left) /= 0 and Length (Right) /= 0 then
Intersection (Left, Right, Target => S);
end if;
end return;
end Intersection;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Set) return Boolean is
begin
return Length (Container) = 0;
end Is_Empty;
-----------
-- Is_In --
-----------
function Is_In (HT : Set; Key : Node_Type) return Boolean is
begin
return Element_Keys.Find (HT, Key.Element) /= 0;
end Is_In;
---------------
-- Is_Subset --
---------------
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is
Subset_Node : Count_Type;
Subset_Nodes : Nodes_Type renames Subset.Nodes;
begin
if Subset'Address = Of_Set'Address then
return True;
end if;
if Length (Subset) > Length (Of_Set) then
return False;
end if;
Subset_Node := First (Subset).Node;
while Subset_Node /= 0 loop
declare
N : Node_Type renames Subset_Nodes (Subset_Node);
E : Element_Type renames N.Element;
begin
if Find (Of_Set, E).Node = 0 then
return False;
end if;
end;
Subset_Node := HT_Ops.Next (Subset, Subset_Node);
end loop;
return True;
end Is_Subset;
------------
-- Length --
------------
function Length (Container : Set) return Count_Type is
begin
return Container.Length;
end Length;
----------
-- Move --
----------
-- Comments???
procedure Move (Target : in out Set; Source : in out Set) is
NN : HT_Types.Nodes_Type renames Source.Nodes;
X, Y : Count_Type;
begin
if Target'Address = Source'Address then
return;
end if;
if Target.Capacity < Length (Source) then
raise Constraint_Error with -- ???
"Source length exceeds Target capacity";
end if;
Clear (Target);
if Source.Length = 0 then
return;
end if;
X := HT_Ops.First (Source);
while X /= 0 loop
Insert (Target, NN (X).Element); -- optimize???
Y := HT_Ops.Next (Source, X);
HT_Ops.Delete_Node_Sans_Free (Source, X);
Free (Source, X);
X := Y;
end loop;
end Move;
----------
-- Next --
----------
function Next (Node : Node_Type) return Count_Type is
begin
return Node.Next;
end Next;
function Next (Container : Set; Position : Cursor) return Cursor is
begin
if Position.Node = 0 then
return No_Element;
end if;
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position has no element";
end if;
pragma Assert (Vet (Container, Position), "bad cursor in Next");
return (Node => HT_Ops.Next (Container, Position.Node));
end Next;
procedure Next (Container : Set; Position : in out Cursor) is
begin
Position := Next (Container, Position);
end Next;
-------------
-- Overlap --
-------------
function Overlap (Left, Right : Set) return Boolean is
Left_Node : Count_Type;
Left_Nodes : Nodes_Type renames Left.Nodes;
begin
if Length (Right) = 0 or Length (Left) = 0 then
return False;
end if;
if Left'Address = Right'Address then
return True;
end if;
Left_Node := First (Left).Node;
while Left_Node /= 0 loop
declare
N : Node_Type renames Left_Nodes (Left_Node);
E : Element_Type renames N.Element;
begin
if Find (Right, E).Node /= 0 then
return True;
end if;
end;
Left_Node := HT_Ops.Next (Left, Left_Node);
end loop;
return False;
end Overlap;
-------------
-- Replace --
-------------
procedure Replace (Container : in out Set; New_Item : Element_Type) is
Node : constant Count_Type := Element_Keys.Find (Container, New_Item);
begin
if Node = 0 then
raise Constraint_Error with "attempt to replace element not in set";
end if;
Container.Nodes (Node).Element := New_Item;
end Replace;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Set;
Position : Cursor;
New_Item : Element_Type)
is
begin
if not Has_Element (Container, Position) then
raise Constraint_Error with "Position cursor equals No_Element";
end if;
pragma Assert
(Vet (Container, Position), "bad cursor in Replace_Element");
Replace_Element (Container, Position.Node, New_Item);
end Replace_Element;
----------------------
-- Reserve_Capacity --
----------------------
procedure Reserve_Capacity
(Container : in out Set;
Capacity : Count_Type)
is
begin
if Capacity > Container.Capacity then
raise Constraint_Error with "requested capacity is too large";
end if;
end Reserve_Capacity;
------------------
-- Set_Element --
------------------
procedure Set_Element (Node : in out Node_Type; Item : Element_Type) is
begin
Node.Element := Item;
end Set_Element;
--------------
-- Set_Next --
--------------
procedure Set_Next (Node : in out Node_Type; Next : Count_Type) is
begin
Node.Next := Next;
end Set_Next;
--------------------------
-- Symmetric_Difference --
--------------------------
procedure Symmetric_Difference (Target : in out Set; Source : Set) is
procedure Process (Source_Node : Count_Type);
pragma Inline (Process);
procedure Iterate is new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (Source_Node : Count_Type) is
B : Boolean;
N : Node_Type renames Source.Nodes (Source_Node);
X : Count_Type;
begin
if Is_In (Target, N) then
Delete (Target, N.Element);
else
Insert (Target, N.Element, X, B);
pragma Assert (B);
end if;
end Process;
-- Start of processing for Symmetric_Difference
begin
if Target'Address = Source'Address then
Clear (Target);
return;
end if;
if Length (Target) = 0 then
Assign (Target, Source);
return;
end if;
Iterate (Source);
end Symmetric_Difference;
function Symmetric_Difference (Left : Set; Right : Set) return Set is
C : Count_Type;
H : Hash_Type;
begin
if Left'Address = Right'Address then
return Empty_Set;
end if;
if Length (Right) = 0 then
return Left.Copy;
end if;
if Length (Left) = 0 then
return Right.Copy;
end if;
C := Length (Left) + Length (Right);
H := Default_Modulus (C);
return S : Set (C, H) do
Difference (Left, Right, S);
Difference (Right, Left, S);
end return;
end Symmetric_Difference;
------------
-- To_Set --
------------
function To_Set (New_Item : Element_Type) return Set is
X : Count_Type;
B : Boolean;
begin
return S : Set (Capacity => 1, Modulus => 1) do
Insert (S, New_Item, X, B);
pragma Assert (B);
end return;
end To_Set;
-----------
-- Union --
-----------
procedure Union (Target : in out Set; Source : Set) is
procedure Process (Src_Node : Count_Type);
procedure Iterate is
new HT_Ops.Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (Src_Node : Count_Type) is
N : Node_Type renames Source.Nodes (Src_Node);
E : Element_Type renames N.Element;
X : Count_Type;
B : Boolean;
begin
Insert (Target, E, X, B);
end Process;
-- Start of processing for Union
begin
if Target'Address = Source'Address then
return;
end if;
Iterate (Source);
end Union;
function Union (Left : Set; Right : Set) return Set is
C : Count_Type;
H : Hash_Type;
begin
if Left'Address = Right'Address then
return Left.Copy;
end if;
if Length (Right) = 0 then
return Left.Copy;
end if;
if Length (Left) = 0 then
return Right.Copy;
end if;
C := Length (Left) + Length (Right);
H := Default_Modulus (C);
return S : Set (C, H) do
Assign (Target => S, Source => Left);
Union (Target => S, Source => Right);
end return;
end Union;
---------
-- Vet --
---------
function Vet (Container : Set; Position : Cursor) return Boolean is
begin
if Position.Node = 0 then
return True;
end if;
declare
S : Set renames Container;
N : Nodes_Type renames S.Nodes;
X : Count_Type;
begin
if S.Length = 0 then
return False;
end if;
if Position.Node > N'Last then
return False;
end if;
if N (Position.Node).Next = Position.Node then
return False;
end if;
X := S.Buckets (Element_Keys.Index (S, N (Position.Node).Element));
for J in 1 .. S.Length loop
if X = Position.Node then
return True;
end if;
if X = 0 then
return False;
end if;
if X = N (X).Next then -- to prevent unnecessary looping
return False;
end if;
X := N (X).Next;
end loop;
return False;
end;
end Vet;
end Ada.Containers.Formal_Hashed_Sets;
| 25.358909 | 79 | 0.515141 |
a10192310c7dba9b663e2c51ac45bcc8175bce94 | 4,477 | ads | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-purexc.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-purexc.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-purexc.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P U R E _ E X C E P T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides an interface for raising predefined exceptions with
-- an exception message. It can be used from Pure units. This unit is for
-- internal use only, it is not generally available to applications.
pragma Compiler_Unit_Warning;
package System.Pure_Exceptions is
pragma Pure;
type Exception_Type is limited null record;
-- Type used to specify which exception to raise
-- Really Exception_Type is Exception_Id, but Exception_Id can't be
-- used directly since it is declared in the non-pure unit Ada.Exceptions,
-- Exception_Id is in fact simply a pointer to the type Exception_Data
-- declared in System.Standard_Library (which is also non-pure). So what
-- we do is to define it here as a by reference type (any by reference
-- type would do), and then Import the definitions from Standard_Library.
-- Since this is a by reference type, these will be passed by reference,
-- which has the same effect as passing a pointer.
-- This type is not private because keeping it by reference would require
-- defining it in a way (e.g. using a tagged type) that would drag in other
-- run-time files, which is unwanted in the case of e.g. Ravenscar, where
-- we want to minimize the number of run-time files needed by default.
CE : constant Exception_Type; -- Constraint_Error
PE : constant Exception_Type; -- Program_Error
SE : constant Exception_Type; -- Storage_Error
TE : constant Exception_Type; -- Tasking_Error
-- One of these constants is used in the call to specify the exception
procedure Raise_Exception (E : Exception_Type; Message : String);
pragma Import (Ada, Raise_Exception, "__gnat_raise_exception");
pragma No_Return (Raise_Exception);
-- Raise specified exception with specified message
private
pragma Import (C, CE, "constraint_error");
pragma Import (C, PE, "program_error");
pragma Import (C, SE, "storage_error");
pragma Import (C, TE, "tasking_error");
-- References to the exception structures in the standard library
end System.Pure_Exceptions;
| 57.397436 | 79 | 0.540541 |
d0e092a18058974fecd20e16de15a6872be0f00c | 813 | ads | Ada | gnu/src/gdb/gdb/testsuite/gdb.ada/O2_float_param/caller.ads | ghsecuritylab/ellcc-mirror | b03a4afac74d50cf0987554b8c0cd8209bcb92a2 | [
"BSD-2-Clause"
] | null | null | null | gnu/src/gdb/gdb/testsuite/gdb.ada/O2_float_param/caller.ads | ghsecuritylab/ellcc-mirror | b03a4afac74d50cf0987554b8c0cd8209bcb92a2 | [
"BSD-2-Clause"
] | null | null | null | gnu/src/gdb/gdb/testsuite/gdb.ada/O2_float_param/caller.ads | ghsecuritylab/ellcc-mirror | b03a4afac74d50cf0987554b8c0cd8209bcb92a2 | [
"BSD-2-Clause"
] | null | null | null | -- Copyright 2013-2015 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Caller is
procedure Verbose_Increment (Val : in out Float; Msg : String);
end Caller;
| 40.65 | 73 | 0.738007 |
fb80abdf8ff79817db1b0b8912ded4a2c5f1dc16 | 2,929 | ads | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-tienio.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-tienio.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-tienio.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T E X T _ I O . E N U M E R A T I O N _ I O --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
-- In Ada 95, the package Ada.Text_IO.Enumeration_IO is a subpackage of
-- Text_IO. This is for compatibility with Ada 83. In GNAT we make it a
-- child package to avoid loading the necessary code if Enumeration_IO is
-- not instantiated. See routine Rtsfind.Check_Text_IO_Special_Unit for a
-- description of how we patch up the difference in semantics so that it
-- is invisible to the Ada programmer.
private generic
type Enum is (<>);
package Ada.Text_IO.Enumeration_IO is
Default_Width : Field := 0;
Default_Setting : Type_Set := Upper_Case;
procedure Get (File : File_Type; Item : out Enum) with
Pre => Is_Open (File) and then Mode (File) = In_File,
Global => (In_Out => File_System);
procedure Get (Item : out Enum) with
Post =>
Line_Length'Old = Line_Length
and Page_Length'Old = Page_Length,
Global => (In_Out => File_System);
procedure Put
(File : File_Type;
Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting)
with
Pre => Is_Open (File) and then Mode (File) /= In_File,
Post =>
Line_Length (File)'Old = Line_Length (File)
and Page_Length (File)'Old = Page_Length (File),
Global => (In_Out => File_System);
procedure Put
(Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting)
with
Post =>
Line_Length'Old = Line_Length
and Page_Length'Old = Page_Length,
Global => (In_Out => File_System);
procedure Get
(From : String;
Item : out Enum;
Last : out Positive)
with
Global => null;
procedure Put
(To : out String;
Item : Enum;
Set : Type_Set := Default_Setting)
with
Global => null;
end Ada.Text_IO.Enumeration_IO;
| 38.038961 | 78 | 0.49505 |
0be8393da95eac47bc9668d20bfd52d8c07897db | 1,033 | adb | Ada | openapi-client/ada/src/-client.adb | interserver/mailbaby-api-samples | 0879348474e22463e77dc76ba5e5f7e6300a2b6c | [
"MIT"
] | null | null | null | openapi-client/ada/src/-client.adb | interserver/mailbaby-api-samples | 0879348474e22463e77dc76ba5e5f7e6300a2b6c | [
"MIT"
] | 185 | 2022-01-01T23:30:37.000Z | 2022-03-25T01:08:22.000Z | openapi-client/ada/src/-client.adb | interserver/mailbaby-api-samples | 0879348474e22463e77dc76ba5e5f7e6300a2b6c | [
"MIT"
] | null | null | null | with .Clients;
with .Models;
with Swagger;
with Util.Http.Clients.Curl;
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Calendar.Formatting;
with Ada.Exceptions;
procedure .Client is
use Ada.Text_IO;
procedure Usage;
Server : constant Swagger.UString := Swagger.To_UString ("http://localhost:8080/v2");
Arg_Count : constant Natural := Ada.Command_Line.Argument_Count;
Arg : Positive := 1;
procedure Usage is
begin
Put_Line ("Usage: defaultProject {params}...");
end Usage;
begin
if Arg_Count <= 1 then
Usage;
return;
end if;
Util.Http.Clients.Curl.Register;
declare
Command : constant String := Ada.Command_Line.Argument (Arg);
Item : constant String := Ada.Command_Line.Argument (Arg + 1);
C : .Clients.Client_Type;
begin
C.Set_Server (Server);
Arg := Arg + 2;
exception
when E : Constraint_Error =>
Put_Line ("Constraint error raised: " & Ada.Exceptions.Exception_Message (E));
end;
end .Client;
| 23.477273 | 91 | 0.656341 |
fb703c1a747b4030b22ca02350fa015d1bc3acf3 | 2,278 | ads | Ada | bb-runtimes/examples/monitor/armv7a/armv7a.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/examples/monitor/armv7a/armv7a.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/examples/monitor/armv7a/armv7a.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package Armv7a is
pragma Elaborate_Body (Armv7a);
end Armv7a;
| 69.030303 | 78 | 0.453029 |
0bab22e13b6adff733999720742963a370b5c3f3 | 20,079 | ads | Ada | gcc-gcc-7_3_0-release/gcc/ada/a-cbhama.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/a-cbhama.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/a-cbhama.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ M A P S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2015, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Iterator_Interfaces;
private with Ada.Containers.Hash_Tables;
private with Ada.Streams;
private with Ada.Finalization;
generic
type Key_Type is private;
type Element_Type is private;
with function Hash (Key : Key_Type) return Hash_Type;
with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Bounded_Hashed_Maps is
pragma Annotate (CodePeer, Skip_Analysis);
pragma Pure;
pragma Remote_Types;
type Map (Capacity : Count_Type; Modulus : Hash_Type) is tagged private with
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization (Map);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
-- Map objects declared without an initialization expression are
-- initialized to the value Empty_Map.
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
function Has_Element (Position : Cursor) return Boolean;
-- Equivalent to Position /= No_Element
package Map_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
function "=" (Left, Right : Map) return Boolean;
-- For each key/element pair in Left, equality attempts to find the key in
-- Right; if a search fails the equality returns False. The search works by
-- calling Hash to find the bucket in the Right map that corresponds to the
-- Left key. If bucket is non-empty, then equality calls Equivalent_Keys
-- to compare the key (in Left) to the key of each node in the bucket (in
-- Right); if the keys are equivalent, then the equality test for this
-- key/element pair (in Left) completes by calling the element equality
-- operator to compare the element (in Left) to the element of the node
-- (in Right) whose key matched.
function Capacity (Container : Map) return Count_Type;
-- Returns the current capacity of the map. Capacity is the maximum length
-- before which rehashing in guaranteed not to occur.
procedure Reserve_Capacity (Container : in out Map; Capacity : Count_Type);
-- If the value of the Capacity actual parameter is less or equal to
-- Container.Capacity, then the operation has no effect. Otherwise it
-- raises Capacity_Error (as no expansion of capacity is possible for a
-- bounded form).
function Default_Modulus (Capacity : Count_Type) return Hash_Type;
-- Returns a modulus value (hash table size) which is optimal for the
-- specified capacity (which corresponds to the maximum number of items).
function Length (Container : Map) return Count_Type;
-- Returns the number of items in the map
function Is_Empty (Container : Map) return Boolean;
-- Equivalent to Length (Container) = 0
procedure Clear (Container : in out Map);
-- Removes all of the items from the map
function Key (Position : Cursor) return Key_Type;
-- Returns the key of the node designated by the cursor
function Element (Position : Cursor) return Element_Type;
-- Returns the element of the node designated by the cursor
procedure Replace_Element
(Container : in out Map;
Position : Cursor;
New_Item : Element_Type);
-- Assigns the value New_Item to the element designated by the cursor
procedure Query_Element
(Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type));
-- Calls Process with the key and element (both having only a constant
-- view) of the node designed by the cursor.
procedure Update_Element
(Container : in out Map;
Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
-- Calls Process with the key (with only a constant view) and element (with
-- a variable view) of the node designed by the cursor.
type Constant_Reference_Type
(Element : not null access constant Element_Type) is
private
with
Implicit_Dereference => Element;
type Reference_Type (Element : not null access Element_Type) is private
with
Implicit_Dereference => Element;
function Constant_Reference
(Container : aliased Map;
Position : Cursor) return Constant_Reference_Type;
function Reference
(Container : aliased in out Map;
Position : Cursor) return Reference_Type;
function Constant_Reference
(Container : aliased Map;
Key : Key_Type) return Constant_Reference_Type;
function Reference
(Container : aliased in out Map;
Key : Key_Type) return Reference_Type;
procedure Assign (Target : in out Map; Source : Map);
-- If Target denotes the same object as Source, then the operation has no
-- effect. If the Target capacity is less than the Source length, then
-- Assign raises Capacity_Error. Otherwise, Assign clears Target and then
-- copies the (active) elements from Source to Target.
function Copy
(Source : Map;
Capacity : Count_Type := 0;
Modulus : Hash_Type := 0) return Map;
-- Constructs a new set object whose elements correspond to Source. If the
-- Capacity parameter is 0, then the capacity of the result is the same as
-- the length of Source. If the Capacity parameter is equal or greater than
-- the length of Source, then the capacity of the result is the specified
-- value. Otherwise, Copy raises Capacity_Error. If the Modulus parameter
-- is 0, then the modulus of the result is the value returned by a call to
-- Default_Modulus with the capacity parameter determined as above;
-- otherwise the modulus of the result is the specified value.
procedure Move (Target : in out Map; Source : in out Map);
-- Clears Target (if it's not empty), and then moves (not copies) the
-- buckets array and nodes from Source to Target.
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean);
-- Conditionally inserts New_Item into the map. If Key is already in the
-- map, then Inserted returns False and Position designates the node
-- containing the existing key/element pair (neither of which is modified).
-- If Key is not already in the map, the Inserted returns True and Position
-- designates the newly-inserted node container Key and New_Item. The
-- search for the key works as follows. Hash is called to determine Key's
-- bucket; if the bucket is non-empty, then Equivalent_Keys is called to
-- compare Key to each node in that bucket. If the bucket is empty, or
-- there were no matching keys in the bucket, the search "fails" and the
-- key/item pair is inserted in the map (and Inserted returns True);
-- otherwise, the search "succeeds" (and Inserted returns False).
procedure Insert
(Container : in out Map;
Key : Key_Type;
Position : out Cursor;
Inserted : out Boolean);
-- The same as the (conditional) Insert that accepts an element parameter,
-- with the difference that if Inserted returns True, then the element of
-- the newly-inserted node is initialized to its default value.
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
-- Attempts to insert Key into the map, performing the usual search (which
-- involves calling both Hash and Equivalent_Keys); if the search succeeds
-- (because Key is already in the map), then it raises Constraint_Error.
-- (This version of Insert is similar to Replace, but having the opposite
-- exception behavior. It is intended for use when you want to assert that
-- Key is not already in the map.)
procedure Include
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
-- Attempts to insert Key into the map. If Key is already in the map, then
-- both the existing key and element are assigned the values of Key and
-- New_Item, respectively. (This version of Insert only raises an exception
-- if cursor tampering occurs. It is intended for use when you want to
-- insert the key/element pair in the map, and you don't care whether Key
-- is already present.)
procedure Replace
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
-- Searches for Key in the map; if the search fails (because Key was not in
-- the map), then it raises Constraint_Error. Otherwise, both the existing
-- key and element are assigned the values of Key and New_Item rsp. (This
-- is similar to Insert, but with the opposite exception behavior. It is to
-- be used when you want to assert that Key is already in the map.)
procedure Exclude (Container : in out Map; Key : Key_Type);
-- Searches for Key in the map, and if found, removes its node from the map
-- and then deallocates it. The search works as follows. The operation
-- calls Hash to determine the key's bucket; if the bucket is not empty, it
-- calls Equivalent_Keys to compare Key to each key in the bucket. (This is
-- the deletion analog of Include. It is intended for use when you want to
-- remove the item from the map, but don't care whether the key is already
-- in the map.)
procedure Delete (Container : in out Map; Key : Key_Type);
-- Searches for Key in the map (which involves calling both Hash and
-- Equivalent_Keys). If the search fails, then the operation raises
-- Constraint_Error. Otherwise it removes the node from the map and then
-- deallocates it. (This is the deletion analog of non-conditional
-- Insert. It is intended for use when you want to assert that the item is
-- already in the map.)
procedure Delete (Container : in out Map; Position : in out Cursor);
-- Removes the node designated by Position from the map, and then
-- deallocates the node. The operation calls Hash to determine the bucket,
-- and then compares Position to each node in the bucket until there's a
-- match (it does not call Equivalent_Keys).
function First (Container : Map) return Cursor;
-- Returns a cursor that designates the first non-empty bucket, by
-- searching from the beginning of the buckets array.
function Next (Position : Cursor) return Cursor;
-- Returns a cursor that designates the node that follows the current one
-- designated by Position. If Position designates the last node in its
-- bucket, the operation calls Hash to compute the index of this bucket,
-- and searches the buckets array for the first non-empty bucket, starting
-- from that index; otherwise, it simply follows the link to the next node
-- in the same bucket.
procedure Next (Position : in out Cursor);
-- Equivalent to Position := Next (Position)
function Find (Container : Map; Key : Key_Type) return Cursor;
-- Searches for Key in the map. Find calls Hash to determine the key's
-- bucket; if the bucket is not empty, it calls Equivalent_Keys to compare
-- Key to each key in the bucket. If the search succeeds, Find returns a
-- cursor designating the matching node; otherwise, it returns No_Element.
function Contains (Container : Map; Key : Key_Type) return Boolean;
-- Equivalent to Find (Container, Key) /= No_Element
function Element (Container : Map; Key : Key_Type) return Element_Type;
-- Equivalent to Element (Find (Container, Key))
function Equivalent_Keys (Left, Right : Cursor) return Boolean;
-- Returns the result of calling Equivalent_Keys with the keys of the nodes
-- designated by cursors Left and Right.
function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean;
-- Returns the result of calling Equivalent_Keys with key of the node
-- designated by Left and key Right.
function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean;
-- Returns the result of calling Equivalent_Keys with key Left and the node
-- designated by Right.
procedure Iterate
(Container : Map;
Process : not null access procedure (Position : Cursor));
-- Calls Process for each node in the map
function Iterate (Container : Map)
return Map_Iterator_Interfaces.Forward_Iterator'class;
private
pragma Inline (Length);
pragma Inline (Is_Empty);
pragma Inline (Clear);
pragma Inline (Key);
pragma Inline (Element);
pragma Inline (Move);
pragma Inline (Contains);
pragma Inline (Capacity);
pragma Inline (Reserve_Capacity);
pragma Inline (Has_Element);
pragma Inline (Next);
type Node_Type is record
Key : Key_Type;
Element : aliased Element_Type;
Next : Count_Type;
end record;
package HT_Types is
new Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type);
type Map (Capacity : Count_Type; Modulus : Hash_Type) is
new HT_Types.Hash_Table_Type (Capacity, Modulus) with null record;
use HT_Types, HT_Types.Implementation;
use Ada.Streams;
use Ada.Finalization;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Map);
for Map'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Map);
for Map'Read use Read;
type Map_Access is access all Map;
for Map_Access'Storage_Size use 0;
-- Note: If a Cursor object has no explicit initialization expression,
-- it must default initialize to the same value as constant No_Element.
-- The Node component of type Cursor has scalar type Count_Type, so it
-- requires an explicit initialization expression of its own declaration,
-- in order for objects of record type Cursor to properly initialize.
type Cursor is record
Container : Map_Access;
Node : Count_Type := 0;
end record;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor);
for Cursor'Read use Read;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor);
for Cursor'Write use Write;
subtype Reference_Control_Type is Implementation.Reference_Control_Type;
-- It is necessary to rename this here, so that the compiler can find it
type Constant_Reference_Type
(Element : not null access constant Element_Type) is
record
Control : Reference_Control_Type :=
raise Program_Error with "uninitialized reference";
-- The RM says, "The default initialization of an object of
-- type Constant_Reference_Type or Reference_Type propagates
-- Program_Error."
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type);
for Constant_Reference_Type'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type);
for Constant_Reference_Type'Read use Read;
type Reference_Type (Element : not null access Element_Type) is record
Control : Reference_Control_Type :=
raise Program_Error with "uninitialized reference";
-- The RM says, "The default initialization of an object of
-- type Constant_Reference_Type or Reference_Type propagates
-- Program_Error."
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type);
for Reference_Type'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type);
for Reference_Type'Read use Read;
-- Three operations are used to optimize in the expansion of "for ... of"
-- loops: the Next(Cursor) procedure in the visible part, and the following
-- Pseudo_Reference and Get_Element_Access functions. See Sem_Ch5 for
-- details.
function Pseudo_Reference
(Container : aliased Map'Class) return Reference_Control_Type;
pragma Inline (Pseudo_Reference);
-- Creates an object of type Reference_Control_Type pointing to the
-- container, and increments the Lock. Finalization of this object will
-- decrement the Lock.
type Element_Access is access all Element_Type with
Storage_Size => 0;
function Get_Element_Access
(Position : Cursor) return not null Element_Access;
-- Returns a pointer to the element designated by Position.
Empty_Map : constant Map :=
(Hash_Table_Type with Capacity => 0, Modulus => 0);
No_Element : constant Cursor := (Container => null, Node => 0);
type Iterator is new Limited_Controlled and
Map_Iterator_Interfaces.Forward_Iterator with
record
Container : Map_Access;
end record
with Disable_Controlled => not T_Check;
overriding procedure Finalize (Object : in out Iterator);
overriding function First (Object : Iterator) return Cursor;
overriding function Next
(Object : Iterator;
Position : Cursor) return Cursor;
end Ada.Containers.Bounded_Hashed_Maps;
| 42.812367 | 79 | 0.66582 |
121396d183bc2f899ffc2c19beea1fc1929348b1 | 8,067 | ads | Ada | tools-src/gnu/gcc/gcc/ada/i-cexten.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/i-cexten.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/i-cexten.ads | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . C . E X T E N S I O N S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994,1995 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains additional C-related definitions, intended for use
-- with either manually or automatically generated bindings to C libraries.
with System;
package Interfaces.C.Extensions is
subtype void is System.Address;
subtype void_ptr is System.Address;
subtype opaque_structure_def is System.Address;
type opaque_structure_def_ptr is access opaque_structure_def;
subtype incomplete_class_def is System.Address;
type incomplete_class_def_ptr is access incomplete_class_def;
--
-- 64bit integer types
--
subtype long_long is Long_Long_Integer;
type unsigned_long_long is mod 2 ** 64;
--
-- Types for bitfields
--
type Unsigned_1 is mod 2 ** 1;
for Unsigned_1'Size use 1;
type Unsigned_2 is mod 2 ** 2;
for Unsigned_2'Size use 2;
type Unsigned_3 is mod 2 ** 3;
for Unsigned_3'Size use 3;
type Unsigned_4 is mod 2 ** 4;
for Unsigned_4'Size use 4;
type Unsigned_5 is mod 2 ** 5;
for Unsigned_5'Size use 5;
type Unsigned_6 is mod 2 ** 6;
for Unsigned_6'Size use 6;
type Unsigned_7 is mod 2 ** 7;
for Unsigned_7'Size use 7;
type Unsigned_8 is mod 2 ** 8;
for Unsigned_8'Size use 8;
type Unsigned_9 is mod 2 ** 9;
for Unsigned_9'Size use 9;
type Unsigned_10 is mod 2 ** 10;
for Unsigned_10'Size use 10;
type Unsigned_11 is mod 2 ** 11;
for Unsigned_11'Size use 11;
type Unsigned_12 is mod 2 ** 12;
for Unsigned_12'Size use 12;
type Unsigned_13 is mod 2 ** 13;
for Unsigned_13'Size use 13;
type Unsigned_14 is mod 2 ** 14;
for Unsigned_14'Size use 14;
type Unsigned_15 is mod 2 ** 15;
for Unsigned_15'Size use 15;
type Unsigned_16 is mod 2 ** 16;
for Unsigned_16'Size use 16;
type Unsigned_17 is mod 2 ** 17;
for Unsigned_17'Size use 17;
type Unsigned_18 is mod 2 ** 18;
for Unsigned_18'Size use 18;
type Unsigned_19 is mod 2 ** 19;
for Unsigned_19'Size use 19;
type Unsigned_20 is mod 2 ** 20;
for Unsigned_20'Size use 20;
type Unsigned_21 is mod 2 ** 21;
for Unsigned_21'Size use 21;
type Unsigned_22 is mod 2 ** 22;
for Unsigned_22'Size use 22;
type Unsigned_23 is mod 2 ** 23;
for Unsigned_23'Size use 23;
type Unsigned_24 is mod 2 ** 24;
for Unsigned_24'Size use 24;
type Unsigned_25 is mod 2 ** 25;
for Unsigned_25'Size use 25;
type Unsigned_26 is mod 2 ** 26;
for Unsigned_26'Size use 26;
type Unsigned_27 is mod 2 ** 27;
for Unsigned_27'Size use 27;
type Unsigned_28 is mod 2 ** 28;
for Unsigned_28'Size use 28;
type Unsigned_29 is mod 2 ** 29;
for Unsigned_29'Size use 29;
type Unsigned_30 is mod 2 ** 30;
for Unsigned_30'Size use 30;
type Unsigned_31 is mod 2 ** 31;
for Unsigned_31'Size use 31;
type Unsigned_32 is mod 2 ** 32;
for Unsigned_32'Size use 32;
type Signed_2 is range -2 ** 1 .. 2 ** 1 - 1;
for Signed_2'Size use 2;
type Signed_3 is range -2 ** 2 .. 2 ** 2 - 1;
for Signed_3'Size use 3;
type Signed_4 is range -2 ** 3 .. 2 ** 3 - 1;
for Signed_4'Size use 4;
type Signed_5 is range -2 ** 4 .. 2 ** 4 - 1;
for Signed_5'Size use 5;
type Signed_6 is range -2 ** 5 .. 2 ** 5 - 1;
for Signed_6'Size use 6;
type Signed_7 is range -2 ** 6 .. 2 ** 6 - 1;
for Signed_7'Size use 7;
type Signed_8 is range -2 ** 7 .. 2 ** 7 - 1;
for Signed_8'Size use 8;
type Signed_9 is range -2 ** 8 .. 2 ** 8 - 1;
for Signed_9'Size use 9;
type Signed_10 is range -2 ** 9 .. 2 ** 9 - 1;
for Signed_10'Size use 10;
type Signed_11 is range -2 ** 10 .. 2 ** 10 - 1;
for Signed_11'Size use 11;
type Signed_12 is range -2 ** 11 .. 2 ** 11 - 1;
for Signed_12'Size use 12;
type Signed_13 is range -2 ** 12 .. 2 ** 12 - 1;
for Signed_13'Size use 13;
type Signed_14 is range -2 ** 13 .. 2 ** 13 - 1;
for Signed_14'Size use 14;
type Signed_15 is range -2 ** 14 .. 2 ** 14 - 1;
for Signed_15'Size use 15;
type Signed_16 is range -2 ** 15 .. 2 ** 15 - 1;
for Signed_16'Size use 16;
type Signed_17 is range -2 ** 16 .. 2 ** 16 - 1;
for Signed_17'Size use 17;
type Signed_18 is range -2 ** 17 .. 2 ** 17 - 1;
for Signed_18'Size use 18;
type Signed_19 is range -2 ** 18 .. 2 ** 18 - 1;
for Signed_19'Size use 19;
type Signed_20 is range -2 ** 19 .. 2 ** 19 - 1;
for Signed_20'Size use 20;
type Signed_21 is range -2 ** 20 .. 2 ** 20 - 1;
for Signed_21'Size use 21;
type Signed_22 is range -2 ** 21 .. 2 ** 21 - 1;
for Signed_22'Size use 22;
type Signed_23 is range -2 ** 22 .. 2 ** 22 - 1;
for Signed_23'Size use 23;
type Signed_24 is range -2 ** 23 .. 2 ** 23 - 1;
for Signed_24'Size use 24;
type Signed_25 is range -2 ** 24 .. 2 ** 24 - 1;
for Signed_25'Size use 25;
type Signed_26 is range -2 ** 25 .. 2 ** 25 - 1;
for Signed_26'Size use 26;
type Signed_27 is range -2 ** 26 .. 2 ** 26 - 1;
for Signed_27'Size use 27;
type Signed_28 is range -2 ** 27 .. 2 ** 27 - 1;
for Signed_28'Size use 28;
type Signed_29 is range -2 ** 28 .. 2 ** 28 - 1;
for Signed_29'Size use 29;
type Signed_30 is range -2 ** 29 .. 2 ** 29 - 1;
for Signed_30'Size use 30;
type Signed_31 is range -2 ** 30 .. 2 ** 30 - 1;
for Signed_31'Size use 31;
type Signed_32 is range -2 ** 31 .. 2 ** 31 - 1;
for Signed_32'Size use 32;
end Interfaces.C.Extensions;
| 31.759843 | 78 | 0.554357 |
4d6aed5f56318266b946fc410574682d26f21d0c | 2,369 | adb | Ada | tests/main.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 30 | 2018-05-18T09:11:50.000Z | 2021-05-18T16:29:14.000Z | tests/main.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 15 | 2018-12-13T07:53:36.000Z | 2019-09-24T19:43:35.000Z | tests/main.adb | Componolit/libsparkcrypto | 8531a07b6e9f5eb33eae0fa32759b4cbd3509d95 | [
"OpenSSL",
"Unlicense"
] | 3 | 2019-04-04T17:41:29.000Z | 2021-05-07T22:28:46.000Z | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2019, Alexander Senier <[email protected]>
-- Copyright (C) 2010, Alexander Senier
-- Copyright (C) 2010, secunet Security Networks AG
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Tests;
with AUnit.Run;
with AUnit.Reporter.Text;
with Ada.Command_Line;
procedure Main
is
function Run is new AUnit.Run.Test_Runner_With_Status (Tests.Suite);
Reporter : AUnit.Reporter.Text.Text_Reporter;
use AUnit;
S : Status;
begin
Reporter.Set_Use_ANSI_Colors (True);
S := Run (Reporter);
Ada.Command_Line.Set_Exit_Status ((if (S = Success) then 0 else 1));
end Main;
| 45.557692 | 80 | 0.677923 |
12a3634d4e65c33fedee8e53e51c0e9fb63e8d5c | 6,215 | ads | Ada | src/vulkan-math/numerics/vulkan-math-numerics.ads | zrmyers/VulkanAda | ed8c46d923bc8936db3a5d55d36afebb928a9ede | [
"MIT"
] | 1 | 2021-01-29T21:10:45.000Z | 2021-01-29T21:10:45.000Z | src/vulkan-math/numerics/vulkan-math-numerics.ads | zrmyers/VulkanAda | ed8c46d923bc8936db3a5d55d36afebb928a9ede | [
"MIT"
] | 8 | 2020-04-22T14:55:20.000Z | 2021-11-22T03:58:08.000Z | src/vulkan-math/numerics/vulkan-math-numerics.ads | zrmyers/VulkanAda | ed8c46d923bc8936db3a5d55d36afebb928a9ede | [
"MIT"
] | 1 | 2021-04-05T13:19:21.000Z | 2021-04-05T13:19:21.000Z | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 Zane Myers
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--< @group Vulkan Math Numerics
--------------------------------------------------------------------------------
--< @summary
--< This package instantiates Ada generic numerical operations for use by the
--< Vulkan Math Library.
--<
--< @description
--< The Ada Numerics Generic Elementary Functions are instantiated for the Vkm_Double
--< and Vkm_Float types. Additional generic algorithms for Ada floating point types
--< are provided.
--------------------------------------------------------------------------------
package Vulkan.Math.Numerics is
pragma Preelaborate;
pragma Pure;
----------------------------------------------------------------------------
--< @summary
--< Algorithm for computing the "modf" for a floating point type.
--<
--< @description
--< This operation separates the floating point into its integer part and its
--< fraction part.
--<
--< @param x
--< Mixed integer and fraction number.
--<
--< @param i
--< The integer part of 'x'.
--<
--< @return
--< The fraction part of 'x'
----------------------------------------------------------------------------
generic
type Floating_Point is digits <>;
function Compute_Modf (x : in Floating_Point;
i : out Floating_Point) return Floating_Point;
----------------------------------------------------------------------------
--< @summary
--< Algorithm for computing a smooth step function.
--<
--< @description
--< Computes smooth step as follows:
--< t = Clamp((x - edge0) / (edge1 - edge0), 0, 1)
--< t = t * t * (3 - 2 * t)
--< return t
--<
--< @param edge0
--< The first edge to interpolate between.
--<
--< @param edge1
--< The second edge to interpolate between.
--<
--< @param x
--< The value to apply the step function to.
--<
--< @return
--< The smooth step function of x.
----------------------------------------------------------------------------
generic
type Floating_Point is digits <>;
with function Clamp (edge0, edge1, x : in Floating_Point) return Floating_Point;
function Smooth_Step (edge0, edge1, x : in Floating_Point) return Floating_Point;
----------------------------------------------------------------------------
--< @summary
--< Determine whether the input holds an Inf.
--<
--< @description
--< Determine whether the input holds an Inf. Always returns false.
--<
--< @param x
--< The value to test.
--<
--< @return
--< False, always.
----------------------------------------------------------------------------
generic
type Floating_Point is digits <>;
function Is_Inf (x : in Floating_Point) return Vkm_Bool;
----------------------------------------------------------------------------
--< @summary
--< Determine whether the input holds a NaN.
--<
--< @description
--< Determine whether the input holds a NaN. Always returns false.
--<
--< @param x
--< The value to test.
--<
--< @return
--< False, always.
----------------------------------------------------------------------------
generic
type Floating_Point is digits <>;
function Is_Nan (x : in Floating_Point) return Vkm_Bool;
----------------------------------------------------------------------------
--< @summary
--< Break a floating point value into its significand and exponent parts.
--<
--< @description
--< Break a floating point value into its significand and exponent parts.
--<
--< @param x
--< The input parameter..
--<
--< @param exponent
--< The exponent part of x.
--<
--< @return
--< The significand part of x.
----------------------------------------------------------------------------
generic
type Floating_Point is digits <>;
function Frexp (x : in Floating_Point;
exponent : out Vkm_Int) return Floating_Point;
----------------------------------------------------------------------------
--< @summary
--< Form a floating point value from a significand and exponent.
--<
--< @description
--< Form a floating point value from a significand and exponent.
--<
--< @param significand
--< The significand.
--<
--< @param exponent
--< The exponent.
--<
--< @return
--< x = significand * 2^exponent.
----------------------------------------------------------------------------
generic
type Floating_Point is digits <>;
function Ldexp (significand : in Floating_Point;
exponent : in Vkm_Int) return Floating_Point;
end Vulkan.Math.Numerics;
| 36.558824 | 92 | 0.488496 |
df835a4810d95f1763a949235ca6c78805a1c931 | 2,158 | adb | Ada | src/vt100-utils.adb | darkestkhan/vt100 | e5e508f994414959bf98a7b6a6df944a64156d1b | [
"0BSD"
] | 8 | 2016-06-10T00:33:41.000Z | 2021-03-28T18:32:56.000Z | src/vt100-utils.adb | darkestkhan/vt100 | e5e508f994414959bf98a7b6a6df944a64156d1b | [
"0BSD"
] | null | null | null | src/vt100-utils.adb | darkestkhan/vt100 | e5e508f994414959bf98a7b6a6df944a64156d1b | [
"0BSD"
] | 1 | 2018-02-11T15:14:59.000Z | 2018-02-11T15:14:59.000Z | ------------------------------------------------------------------------------
-- EMAIL: <[email protected]> --
-- License: ISC License (see COPYING file) --
-- --
-- Copyright © 2012 - 2015 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
with Ada.Environment_Variables;
package body VT100.Utils is
---------------
-- L I N E S --
---------------
function Lines return Natural
is
begin
if Ada.Environment_Variables.Exists ("LINES") then
return Natural'Value (Ada.Environment_Variables.Value (Name => "LINES"));
else
return 0;
end if;
end Lines;
-------------------
-- C O L U M N S --
-------------------
function Columns return Natural
is
begin
if Ada.Environment_Variables.Exists ("COLUMNS") then
return Natural'Value (Ada.Environment_Variables.Value
(Name => "COLUMNS"));
else
return 0;
end if;
end Columns;
end VT100.Utils;
| 41.5 | 79 | 0.483318 |
50b806a2a841db51ed73e0280cb87081ab264f70 | 1,052 | ads | Ada | libs/sfmlAudio/snd4ada_hpp.ads | jfuica/bingada | 9e048ad6b347f0093553705cfacbc5b9473efca1 | [
"MIT"
] | 4 | 2020-05-29T19:46:05.000Z | 2022-01-13T20:51:20.000Z | libs/sfmlAudio/snd4ada_hpp.ads | jfuica/bingada | 9e048ad6b347f0093553705cfacbc5b9473efca1 | [
"MIT"
] | 5 | 2020-05-05T20:29:39.000Z | 2020-09-15T19:49:50.000Z | libs/sfmlAudio/snd4ada_hpp.ads | jfuica/bingada | 9e048ad6b347f0093553705cfacbc5b9473efca1 | [
"MIT"
] | 1 | 2020-04-27T19:22:44.000Z | 2020-04-27T19:22:44.000Z | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
package snd4ada_hpp is
procedure termSnds; -- snd4ada.hpp:5
pragma Import (CPP, termSnds, "_Z8termSndsv");
function initLoop (pc : Interfaces.C.Strings.chars_ptr; vol : int) return int; -- snd4ada.hpp:7
pragma Import (CPP, initLoop, "_Z8initLoopPKci");
procedure initSnds; -- snd4ada.hpp:9
pragma Import (CPP, initSnds, "_Z8initSndsv");
function initSnd (pc : Interfaces.C.Strings.chars_ptr; vol : int) return int; -- snd4ada.hpp:11
pragma Import (CPP, initSnd, "_Z7initSndPKci");
procedure stopLoop (nbuf : int); -- snd4ada.hpp:13
pragma Import (CPP, stopLoop, "_Z8stopLoopi");
procedure stopLoops; -- snd4ada.hpp:15
pragma Import (CPP, stopLoops, "_Z9stopLoopsv");
procedure playLoop (nbuf : int); -- snd4ada.hpp:17
pragma Import (CPP, playLoop, "_Z8playLoopi");
procedure playSnd (nbuf : int); -- snd4ada.hpp:19
pragma Import (CPP, playSnd, "_Z7playSndi");
end snd4ada_hpp;
| 30.941176 | 99 | 0.702471 |
1c30bd4a3dacafd8de11b160f59efe831108b8a0 | 894 | ads | Ada | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/fun_renaming/pack.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 31 | 2018-08-01T21:25:24.000Z | 2022-02-14T07:52:34.000Z | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/fun_renaming/pack.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 40 | 2018-12-03T19:48:52.000Z | 2021-03-10T06:34:26.000Z | src/gdb/gdb-7.11/gdb/testsuite/gdb.ada/fun_renaming/pack.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 20 | 2018-11-16T21:19:22.000Z | 2021-10-18T23:08:24.000Z | -- Copyright 2015-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pack is
function Next (I : Integer) return Integer;
function Renamed_Next (I : Integer) return Integer renames Next;
procedure Discard (I : Integer);
end Pack;
| 38.869565 | 73 | 0.734899 |
4dfc9107ef0fa255e1711ce4f4f1e04a88d2865f | 10,947 | adb | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-tpopmo.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-tpopmo.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-tpopmo.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.TASK_PRIMITIVES.OPERATIONS.MONOTONIC --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Monotonic version of this package for Posix and Linux targets.
separate (System.Task_Primitives.Operations)
package body Monotonic is
-----------------------
-- Local Subprograms --
-----------------------
procedure Compute_Deadline
(Time : Duration;
Mode : ST.Delay_Modes;
Check_Time : out Duration;
Abs_Time : out Duration);
-- Helper for Timed_Sleep and Timed_Delay: given a deadline specified by
-- Time and Mode, compute the current clock reading (Check_Time), and the
-- target absolute and relative clock readings (Abs_Time). The
-- epoch for Time depends on Mode; the epoch for Check_Time and Abs_Time
-- is always that of CLOCK_RT_Ada.
---------------------
-- Monotonic_Clock --
---------------------
function Monotonic_Clock return Duration is
TS : aliased timespec;
Result : Interfaces.C.int;
begin
Result := clock_gettime
(clock_id => OSC.CLOCK_RT_Ada, tp => TS'Unchecked_Access);
pragma Assert (Result = 0);
return To_Duration (TS);
end Monotonic_Clock;
-------------------
-- RT_Resolution --
-------------------
function RT_Resolution return Duration is
TS : aliased timespec;
Result : Interfaces.C.int;
begin
Result := clock_getres (OSC.CLOCK_REALTIME, TS'Unchecked_Access);
pragma Assert (Result = 0);
return To_Duration (TS);
end RT_Resolution;
----------------------
-- Compute_Deadline --
----------------------
procedure Compute_Deadline
(Time : Duration;
Mode : ST.Delay_Modes;
Check_Time : out Duration;
Abs_Time : out Duration)
is
begin
Check_Time := Monotonic_Clock;
-- Relative deadline
if Mode = Relative then
Abs_Time := Duration'Min (Time, Max_Sensible_Delay) + Check_Time;
pragma Warnings (Off);
-- Comparison "OSC.CLOCK_RT_Ada = OSC.CLOCK_REALTIME" is compile
-- time known.
-- Absolute deadline specified using the tasking clock (CLOCK_RT_Ada)
elsif Mode = Absolute_RT
or else OSC.CLOCK_RT_Ada = OSC.CLOCK_REALTIME
then
pragma Warnings (On);
Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
-- Absolute deadline specified using the calendar clock, in the
-- case where it is not the same as the tasking clock: compensate for
-- difference between clock epochs (Base_Time - Base_Cal_Time).
else
declare
Cal_Check_Time : constant Duration := OS_Primitives.Clock;
RT_Time : constant Duration :=
Time + Check_Time - Cal_Check_Time;
begin
Abs_Time :=
Duration'Min (Check_Time + Max_Sensible_Delay, RT_Time);
end;
end if;
end Compute_Deadline;
-----------------
-- Timed_Sleep --
-----------------
-- This is for use within the run-time system, so abort is
-- assumed to be already deferred, and the caller should be
-- holding its own ATCB lock.
procedure Timed_Sleep
(Self_ID : ST.Task_Id;
Time : Duration;
Mode : ST.Delay_Modes;
Reason : System.Tasking.Task_States;
Timedout : out Boolean;
Yielded : out Boolean)
is
pragma Unreferenced (Reason);
Base_Time : Duration;
Check_Time : Duration;
Abs_Time : Duration;
P_Abs_Time : Duration;
Request : aliased timespec;
Result : Interfaces.C.int;
Exit_Outer : Boolean := False;
begin
Timedout := True;
Yielded := False;
Compute_Deadline
(Time => Time,
Mode => Mode,
Check_Time => Check_Time,
Abs_Time => Abs_Time);
Base_Time := Check_Time;
-- To keep a sensible Max_Sensible_Delay on a target whose system
-- maximum is less than sensible, we split the delay into manageable
-- chunks of time less than or equal to the Max_System_Delay.
if Abs_Time > Check_Time then
Outer : loop
pragma Warnings (Off, "condition is always *");
if Max_System_Delay < Max_Sensible_Delay and then
Abs_Time > Check_Time + Max_System_Delay
then
P_Abs_Time := Check_Time + Max_System_Delay;
else
P_Abs_Time := Abs_Time;
Exit_Outer := True;
end if;
pragma Warnings (On);
Request := To_Timespec (P_Abs_Time);
Inner : loop
exit Outer
when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
Result :=
pthread_cond_timedwait
(cond => Self_ID.Common.LL.CV'Access,
mutex => (if Single_Lock
then Single_RTS_Lock'Access
else Self_ID.Common.LL.L'Access),
abstime => Request'Access);
case Result is
when 0 | EINTR =>
-- Somebody may have called Wakeup for us
Timedout := False;
exit Outer;
when ETIMEDOUT =>
exit Outer when Exit_Outer;
Check_Time := Monotonic_Clock;
exit Inner;
when others =>
pragma Assert (False);
end case;
exit Outer
when Abs_Time <= Check_Time or else Check_Time < Base_Time;
end loop Inner;
end loop Outer;
end if;
end Timed_Sleep;
-----------------
-- Timed_Delay --
-----------------
-- This is for use in implementing delay statements, so we assume the
-- caller is abort-deferred but is holding no locks.
procedure Timed_Delay
(Self_ID : ST.Task_Id;
Time : Duration;
Mode : ST.Delay_Modes)
is
Base_Time : Duration;
Check_Time : Duration;
Abs_Time : Duration;
P_Abs_Time : Duration;
Request : aliased timespec;
Result : Interfaces.C.int;
Exit_Outer : Boolean := False;
begin
if Single_Lock then
Lock_RTS;
end if;
Write_Lock (Self_ID);
Compute_Deadline
(Time => Time,
Mode => Mode,
Check_Time => Check_Time,
Abs_Time => Abs_Time);
Base_Time := Check_Time;
-- To keep a sensible Max_Sensible_Delay on a target whose system
-- maximum is less than sensible, we split the delay into manageable
-- chunks of time less than or equal to the Max_System_Delay.
if Abs_Time > Check_Time then
Self_ID.Common.State := Delay_Sleep;
Outer : loop
pragma Warnings (Off, "condition is always *");
if Max_System_Delay < Max_Sensible_Delay and then
Abs_Time > Check_Time + Max_System_Delay
then
P_Abs_Time := Check_Time + Max_System_Delay;
else
P_Abs_Time := Abs_Time;
Exit_Outer := True;
end if;
pragma Warnings (On);
Request := To_Timespec (P_Abs_Time);
Inner : loop
exit Outer
when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
Result :=
pthread_cond_timedwait
(cond => Self_ID.Common.LL.CV'Access,
mutex => (if Single_Lock
then Single_RTS_Lock'Access
else Self_ID.Common.LL.L'Access),
abstime => Request'Access);
case Result is
when ETIMEDOUT =>
exit Outer when Exit_Outer;
Check_Time := Monotonic_Clock;
exit Inner;
when 0 | EINTR => null;
when others =>
pragma Assert (False);
end case;
exit Outer
when Abs_Time <= Check_Time or else Check_Time < Base_Time;
end loop Inner;
end loop Outer;
Self_ID.Common.State := Runnable;
end if;
Unlock (Self_ID);
if Single_Lock then
Unlock_RTS;
end if;
pragma Unreferenced (Result);
Result := sched_yield;
end Timed_Delay;
end Monotonic;
| 33.477064 | 78 | 0.506075 |
fbc4c72f7a4966078565b82502cd14b5dc20e196 | 793 | ads | Ada | src/rejuvenation-patterns.ads | TNO/Rejuvenation-Ada | 8113ec28da3923ccde40d76cbab70e0e614f4b75 | [
"BSD-3-Clause"
] | 1 | 2022-03-08T13:00:47.000Z | 2022-03-08T13:00:47.000Z | src/libraries/Rejuvenation_Lib/src/rejuvenation-patterns.ads | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | src/libraries/Rejuvenation_Lib/src/rejuvenation-patterns.ads | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | private with Ada.Strings.Unbounded;
package Rejuvenation.Patterns is
type Pattern is tagged private;
function Get_String (P : Pattern) return String;
function Get_Rule (P : Pattern) return Grammar_Rule;
function As_Ada_Node (P : Pattern) return Ada_Node;
function Make_Pattern
(Fragment : String; Rule : Grammar_Rule) return Pattern;
private
use Ada.Strings.Unbounded;
type Pattern is tagged record
UStr : Unbounded_String;
Rule : Grammar_Rule;
Unit : Analysis_Unit;
end record;
function Get_String (P : Pattern) return String is (To_String (P.UStr));
function Get_Rule (P : Pattern) return Grammar_Rule is (P.Rule);
function As_Ada_Node (P : Pattern) return Ada_Node is (P.Unit.Root);
end Rejuvenation.Patterns;
| 24.78125 | 75 | 0.709962 |
4de7172da7feec3bf6592bc29a9b56e79f6415fe | 5,766 | ads | Ada | ADL/hal/hal.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | 192 | 2016-06-01T18:32:04.000Z | 2022-03-26T22:52:31.000Z | hal/src/hal.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 239 | 2016-05-26T20:02:01.000Z | 2022-03-31T09:46:56.000Z | hal/src/hal.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 142 | 2016-06-05T08:12:20.000Z | 2022-03-24T17:37:17.000Z | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Interfaces;
package HAL is
pragma Pure;
type Bit is mod 2**1
with Size => 1;
type UInt2 is mod 2**2
with Size => 2;
type UInt3 is mod 2**3
with Size => 3;
type UInt4 is mod 2**4
with Size => 4;
type UInt5 is mod 2**5
with Size => 5;
type UInt6 is mod 2**6
with Size => 6;
type UInt7 is mod 2**7
with Size => 7;
type UInt9 is mod 2**9
with Size => 9;
type UInt8 is new Interfaces.Unsigned_8;
type UInt10 is mod 2**10
with Size => 10;
type UInt11 is mod 2**11
with Size => 11;
type UInt12 is mod 2**12
with Size => 12;
type UInt13 is mod 2**13
with Size => 13;
type UInt14 is mod 2**14
with Size => 14;
type UInt15 is mod 2**15
with Size => 15;
type UInt16 is new Interfaces.Unsigned_16;
type UInt17 is mod 2**17
with Size => 17;
type UInt18 is mod 2**18
with Size => 18;
type UInt19 is mod 2**19
with Size => 19;
type UInt20 is mod 2**20
with Size => 20;
type UInt21 is mod 2**21
with Size => 21;
type UInt22 is mod 2**22
with Size => 22;
type UInt23 is mod 2**23
with Size => 23;
type UInt24 is mod 2**24
with Size => 24;
type UInt25 is mod 2**25
with Size => 25;
type UInt26 is mod 2**26
with Size => 26;
type UInt27 is mod 2**27
with Size => 27;
type UInt28 is mod 2**28
with Size => 28;
type UInt29 is mod 2**29
with Size => 29;
type UInt30 is mod 2**30
with Size => 30;
type UInt31 is mod 2**31
with Size => 31;
type UInt32 is new Interfaces.Unsigned_32;
type UInt33 is mod 2**33
with Size => 33;
type UInt34 is mod 2**34
with Size => 34;
type UInt35 is mod 2**35
with Size => 35;
type UInt36 is mod 2**36
with Size => 36;
type UInt37 is mod 2**37
with Size => 37;
type UInt38 is mod 2**38
with Size => 38;
type UInt39 is mod 2**39
with Size => 39;
type UInt40 is mod 2**40
with Size => 40;
type UInt41 is mod 2**41
with Size => 41;
type UInt42 is mod 2**42
with Size => 42;
type UInt43 is mod 2**43
with Size => 43;
type UInt44 is mod 2**44
with Size => 44;
type UInt45 is mod 2**45
with Size => 45;
type UInt46 is mod 2**46
with Size => 46;
type UInt47 is mod 2**47
with Size => 47;
type UInt48 is mod 2**48
with Size => 48;
type UInt49 is mod 2**49
with Size => 49;
type UInt50 is mod 2**50
with Size => 50;
type UInt51 is mod 2**51
with Size => 51;
type UInt52 is mod 2**52
with Size => 52;
type UInt53 is mod 2**53
with Size => 53;
type UInt54 is mod 2**54
with Size => 54;
type UInt55 is mod 2**55
with Size => 55;
type UInt56 is mod 2**56
with Size => 56;
type UInt57 is mod 2**57
with Size => 57;
type UInt58 is mod 2**58
with Size => 58;
type UInt59 is mod 2**59
with Size => 59;
type UInt60 is mod 2**60
with Size => 60;
type UInt61 is mod 2**61
with Size => 61;
type UInt62 is mod 2**62
with Size => 62;
type UInt63 is mod 2**63
with Size => 63;
type UInt64 is new Interfaces.Unsigned_64;
type UInt8_Array is array (Natural range <>) of UInt8;
type UInt16_Array is array (Natural range <>) of UInt16;
type UInt32_Array is array (Natural range <>) of UInt32;
end HAL;
| 34.526946 | 78 | 0.54804 |
12b8aff7f44f9502ab05a8796498fab544ea604d | 2,812 | ads | Ada | source/adam-exception_handler.ads | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | 3 | 2017-04-29T14:25:22.000Z | 2017-09-29T10:15:28.000Z | source/adam-exception_handler.ads | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | source/adam-exception_handler.ads | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | with
AdaM.Entity,
AdaM.Declaration.of_exception,
ada.Streams,
ada.Containers.Vectors;
limited
with
adam.Block;
package AdaM.exception_Handler
is
type Item is new Entity.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
function to_Source (the_exception_Handlers : in Vector) return text_Vectors.Vector;
-- Forge
--
type Block_view is access all Block.item'Class;
procedure Block_view_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in Block_view);
procedure Block_view_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out Block_view);
for Block_view'write use Block_view_write;
for Block_view'read use Block_view_read;
function new_Handler (-- Name : in String := "";
Parent : in AdaM.Block.view) return exception_Handler.view;
procedure free (Self : in out exception_Handler.view);
procedure destruct (Self : in out Item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
function is_Free (Self : in Item; Slot : in Positive) return Boolean;
function my_Exception (Self : in Item; Id : in Positive) return Declaration.of_exception.view;
procedure my_Exception_is (Self : in out Item; Id : in Positive;
Now : in Declaration.of_exception.view);
procedure add_Exception (Self : in out Item; the_Exception : in AdaM.Declaration.of_exception.view);
function exception_Count (Self : in Item) return Natural;
overriding
function to_Source (Self : in Item) return text_Lines;
function Handler (Self : in Item) return access AdaM.Block.item'Class;
overriding
function Name (Self : in Item) return Identifier;
-- Operations
--
private
type Item is new Entity.item with
record
Exceptions : AdaM.Declaration.of_exception.vector;
Handler : Block_view; -- access AdaM.Block.item'Class;
Parent : Block_view; -- access AdaM.Block.item'Class;
end record;
end AdaM.exception_Handler;
| 27.300971 | 108 | 0.6234 |
0baf0098beaa42d636d54f3a22fed858009dd5c1 | 779 | ads | Ada | src/Parsers/project_processor-parsers.ads | fintatarta/eugen | 2c384838ff0e81b51172310ce5d0e47d71ffd4fd | [
"MIT"
] | null | null | null | src/Parsers/project_processor-parsers.ads | fintatarta/eugen | 2c384838ff0e81b51172310ce5d0e47d71ffd4fd | [
"MIT"
] | null | null | null | src/Parsers/project_processor-parsers.ads | fintatarta/eugen | 2c384838ff0e81b51172310ce5d0e47d71ffd4fd | [
"MIT"
] | null | null | null | with Plugins;
with EU_Projects.Projects;
package Project_Processor.Parsers is
subtype Parser_Parameter is Plugins.Parameter_Map;
subtype Parser_Parameter_access is Plugins.Parameter_Map_Access;
type Parser_ID is new String;
No_Parser : constant Parser_ID := "";
function Find_Parser (File_Extension : String) return Parser_ID;
function Parse_Project (Input : String;
Format : Parser_ID;
Parameters : Parser_Parameter_access)
return EU_Projects.Projects.Project_Descriptor;
Parsing_Error : exception;
private
procedure Register_Extension (Parser : Parser_ID;
File_Extension : String);
end Project_Processor.Parsers;
| 28.851852 | 74 | 0.662388 |
c5d99b47b0f38f22e4edb1bee4dc3068b5a30c7c | 1,103 | adb | Ada | 3-mid/opengl/source/lean/text/opengl-glyph.adb | charlie5/lace | e9b7dc751d500ff3f559617a6fc3089ace9dc134 | [
"0BSD"
] | 20 | 2015-11-04T09:23:59.000Z | 2022-01-14T10:21:42.000Z | 3-mid/opengl/source/lean/text/opengl-glyph.adb | charlie5/lace-alire | 9ace9682cf4daac7adb9f980c2868d6225b8111c | [
"0BSD"
] | 2 | 2015-11-04T17:05:56.000Z | 2015-12-08T03:16:13.000Z | 3-mid/opengl/source/lean/text/opengl-glyph.adb | charlie5/lace-alire | 9ace9682cf4daac7adb9f980c2868d6225b8111c | [
"0BSD"
] | 1 | 2015-12-07T12:53:52.000Z | 2015-12-07T12:53:52.000Z | with
ada.unchecked_Deallocation;
package body openGL.Glyph
is
---------
-- Forge
--
procedure define (Self : in out Item; glyth_Slot : in freetype_c.FT_GlyphSlot.item)
is
begin
Self.Impl := new GlyphImpl.item;
Self.Impl.define (glyth_Slot);
end define;
procedure define (Self : in out Item; pImpl : in GlyphImpl.view)
is
begin
Self.Impl := pImpl;
end define;
procedure destruct (Self : in out Item)
is
procedure deallocate is new ada.unchecked_Deallocation (GlyphImpl.item'Class,
GlyphImpl.view);
begin
deallocate (Self.Impl);
end destruct;
--------------
-- Attributes
--
function Advance (Self : in Item) return Real
is
begin
return Self.Impl.Advance;
end Advance;
function BBox (Self : in Item) return Bounds
is
begin
return Self.Impl.BBox;
end BBox;
function Error (Self : in Item) return GlyphImpl.Error_Kind
is
begin
return Self.Impl.Error;
end Error;
end openGL.Glyph;
| 18.081967 | 88 | 0.594742 |
50154c20c03117b7535968c8079bb87a36d0b93a | 104 | ads | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt48_pkg1.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt48_pkg1.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt48_pkg1.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | with Opt48_Pkg2; use Opt48_Pkg2;
package Opt48_Pkg1 is
function Get_Z return Rec;
end Opt48_Pkg1;
| 13 | 32 | 0.778846 |
cb57b5e00e142caeb692e1567df21a285a8a7794 | 4,858 | adb | Ada | gcc-gcc-7_3_0-release/gcc/ada/s-tfsetr-vxworks.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/s-tfsetr-vxworks.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/s-tfsetr-vxworks.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T R A C E S . S E N D --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2016, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This version is for VxWorks targets
-- Trace information is sent to WindView using the wvEvent function
-- Note that wvEvent is from the VxWorks API
-- When adding a new event, just give an Id to then event, and then modify
-- the WindView events database.
-- Refer to WindView User's Guide for more details on how to add new events
-- to the events database.
----------------
-- Send_Trace --
----------------
-- This procedure formats the string, maps the event Id to an Id
-- recognized by WindView, and send the event using wvEvent
separate (System.Traces.Format)
procedure Send_Trace (Id : Trace_T; Info : String) is
procedure Wv_Event
(Id : Integer;
Buffer : System.Address;
Size : Integer);
pragma Import (C, Wv_Event, "wvEvent");
Info_Trace : String_Trace;
Id_Event : Integer;
begin
Info_Trace := Format_Trace (Info);
case Id is
when M_Accept_Complete => Id_Event := 30000;
when M_Select_Else => Id_Event := 30001;
when M_RDV_Complete => Id_Event := 30002;
when M_Call_Complete => Id_Event := 30003;
when M_Delay => Id_Event := 30004;
when E_Kill => Id_Event := 30005;
when E_Missed => Id_Event := 30006;
when E_Timeout => Id_Event := 30007;
when W_Call => Id_Event := 30010;
when W_Accept => Id_Event := 30011;
when W_Select => Id_Event := 30012;
when W_Completion => Id_Event := 30013;
when W_Delay => Id_Event := 30014;
when WT_Select => Id_Event := 30015;
when WT_Call => Id_Event := 30016;
when WT_Completion => Id_Event := 30017;
when WU_Delay => Id_Event := 30018;
when PO_Call => Id_Event := 30020;
when POT_Call => Id_Event := 30021;
when PO_Run => Id_Event := 30022;
when PO_Lock => Id_Event := 30023;
when PO_Unlock => Id_Event := 30024;
when PO_Done => Id_Event := 30025;
when T_Create => Id_Event := 30030;
when T_Activate => Id_Event := 30031;
when T_Abort => Id_Event := 30032;
when T_Terminate => Id_Event := 30033;
-- Unrecognized events are given the special Id_Event value 29999
when others => Id_Event := 29999;
end case;
Wv_Event (Id_Event, Info_Trace'Address, Max_Size);
end Send_Trace;
| 46.266667 | 78 | 0.480033 |
dfdf713546138c66994ee97ff62be83cebf2fdb6 | 478 | ads | Ada | source/web_callbacks.ads | jquorning/iDoNu | 1618b679f7d0895729dded62f22b0826e7da7cb1 | [
"blessing"
] | 1 | 2016-08-09T20:47:23.000Z | 2016-08-09T20:47:23.000Z | source/web_callbacks.ads | jquorning/iDoNu | 1618b679f7d0895729dded62f22b0826e7da7cb1 | [
"blessing"
] | null | null | null | source/web_callbacks.ads | jquorning/iDoNu | 1618b679f7d0895729dded62f22b0826e7da7cb1 | [
"blessing"
] | null | null | null | --
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
with AWS.Response;
with AWS.Status;
package Web_Callbacks is
procedure Initialize;
function Main (Request : in AWS.Status.Data)
return AWS.Response.Data;
end Web_Callbacks;
| 22.761905 | 68 | 0.690377 |
5062def189bb8e070e7db7bd8b0310e5da073b00 | 4,858 | ads | Ada | examples/shared/serial_ports/src/serial_io-streaming.ads | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 192 | 2016-06-01T18:32:04.000Z | 2022-03-26T22:52:31.000Z | examples/shared/serial_ports/src/serial_io-streaming.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 239 | 2016-05-26T20:02:01.000Z | 2022-03-31T09:46:56.000Z | examples/shared/serial_ports/src/serial_io-streaming.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 142 | 2016-06-05T08:12:20.000Z | 2022-03-24T17:37:17.000Z | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- A demonstration of a higher-level USART interface using streams. In
-- particular, the serial port is presented as a stream type, so these ports
-- can be used with stream attributes to send values or arbitrary types, not
-- just characters or Strings.
-- Polling is used within the procedures to determine when characters are sent
-- and received.
with Ada.Streams;
with Ada.Real_Time; use Ada.Real_Time;
package Serial_IO.Streaming is
pragma Elaborate_Body;
type Serial_Port (Device : not null access Peripheral_Descriptor) is
new Ada.Streams.Root_Stream_Type with private;
procedure Initialize (This : out Serial_Port)
with Post => Initialized (This);
function Initialized (This : Serial_Port) return Boolean with Inline;
procedure Configure
(This : in out Serial_Port;
Baud_Rate : Baud_Rates;
Parity : Parities := No_Parity;
Data_Bits : Word_Lengths := Word_Length_8;
End_Bits : Stop_Bits := Stopbits_1;
Control : Flow_Control := No_Flow_Control)
with
Pre => Initialized (This);
procedure Set_Read_Timeout
(This : in out Serial_Port;
Wait : Time_Span := Time_Span_Last);
-- Stream attributes that call Read (below) can either wait indefinitely or
-- can be set to return any current values received after a given interval.
-- If the default value of Time_Span_Last is taken on a call, the effect is
-- essentially to wait forever, i.e., blocking. That is also the effect if
-- this routine is never called.
overriding
procedure Read
(This : in out Serial_Port;
Buffer : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
overriding
procedure Write
(This : in out Serial_Port;
Buffer : Ada.Streams.Stream_Element_Array);
private
type Serial_Port (Device : access Peripheral_Descriptor) is
new Ada.Streams.Root_Stream_Type with
record
Initialized : Boolean := False;
Timeout : Time_Span := Time_Span_Last;
end record;
procedure Await_Send_Ready (This : USART) with Inline;
procedure Await_Data_Available
(This : USART;
Timeout : Time_Span := Time_Span_Last;
Timed_Out : out Boolean)
with Inline;
use Ada.Streams;
function Last_Index
(First : Stream_Element_Offset;
Count : Long_Integer)
return Stream_Element_Offset
with Inline;
end Serial_IO.Streaming;
| 44.163636 | 79 | 0.602305 |
4d922a971585d1071ec6d9a1fe00f51301246666 | 1,447 | ads | Ada | source/oasis/program-elements-array_aggregates.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | null | null | null | source/oasis/program-elements-array_aggregates.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | null | null | null | source/oasis/program-elements-array_aggregates.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | 1 | 2019-10-16T09:05:27.000Z | 2019-10-16T09:05:27.000Z | -- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Array_Component_Associations;
package Program.Elements.Array_Aggregates is
pragma Pure (Program.Elements.Array_Aggregates);
type Array_Aggregate is
limited interface and Program.Elements.Expressions.Expression;
type Array_Aggregate_Access is access all Array_Aggregate'Class
with Storage_Size => 0;
not overriding function Components
(Self : Array_Aggregate)
return Program.Elements.Array_Component_Associations
.Array_Component_Association_Vector_Access is abstract;
type Array_Aggregate_Text is limited interface;
type Array_Aggregate_Text_Access is access all Array_Aggregate_Text'Class
with Storage_Size => 0;
not overriding function To_Array_Aggregate_Text
(Self : in out Array_Aggregate)
return Array_Aggregate_Text_Access is abstract;
not overriding function Left_Bracket_Token
(Self : Array_Aggregate_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Right_Bracket_Token
(Self : Array_Aggregate_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Array_Aggregates;
| 32.155556 | 76 | 0.755356 |
a12d1dd409553f8310976d3297e16bb339cf379f | 927 | ads | Ada | src/gdb/gdb-8.3/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 31 | 2018-08-01T21:25:24.000Z | 2022-02-14T07:52:34.000Z | src/gdb/gdb-8.3/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 40 | 2018-12-03T19:48:52.000Z | 2021-03-10T06:34:26.000Z | src/gdb/gdb-8.3/gdb/testsuite/gdb.ada/enum_idx_packed/pck.ads | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 20 | 2018-11-16T21:19:22.000Z | 2021-10-18T23:08:24.000Z | -- Copyright 2012-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
type Color is (Black, Red, Green, Blue, White);
type Full_Table is array (Color) of Boolean;
pragma Pack (Full_Table);
procedure Do_Nothing (A : System.Address);
end Pck;
| 38.625 | 73 | 0.730313 |
1243b89a1c946abf31143eafe9dc0ef14405dd09 | 8,517 | adb | Ada | 3-mid/impact/source/2d/dynamics/joints/impact-d2-joint-gear.adb | charlie5/lace | e9b7dc751d500ff3f559617a6fc3089ace9dc134 | [
"0BSD"
] | 20 | 2015-11-04T09:23:59.000Z | 2022-01-14T10:21:42.000Z | 3-mid/impact/source/2d/dynamics/joints/impact-d2-joint-gear.adb | charlie5/lace | e9b7dc751d500ff3f559617a6fc3089ace9dc134 | [
"0BSD"
] | 2 | 2015-11-04T17:05:56.000Z | 2015-12-08T03:16:13.000Z | 3-mid/impact/source/2d/dynamics/joints/impact-d2-joint-gear.adb | charlie5/lace | e9b7dc751d500ff3f559617a6fc3089ace9dc134 | [
"0BSD"
] | 1 | 2015-12-07T12:53:52.000Z | 2015-12-07T12:53:52.000Z | package body impact.d2.Joint.gear
is
procedure dummy is begin null; end dummy;
-- #include <Box2D/Dynamics/Joints/b2GearJoint.h>
-- #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
-- #include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
-- #include <Box2D/Dynamics/b2Body.h>
-- #include <Box2D/Dynamics/b2TimeStep.h>
--
-- // Gear Joint:
-- // C0 = (coordinate1 + ratio * coordinate2)_initial
-- // C = C0 - (cordinate1 + ratio * coordinate2) = 0
-- // Cdot = -(Cdot1 + ratio * Cdot2)
-- // J = -[J1 ratio * J2]
-- // K = J * invM * JT
-- // = J1 * invM1 * J1T + ratio * ratio * J2 * invM2 * J2T
-- //
-- // Revolute:
-- // coordinate = rotation
-- // Cdot = angularVelocity
-- // J = [0 0 1]
-- // K = J * invM * JT = invI
-- //
-- // Prismatic:
-- // coordinate = dot(p - pg, ug)
-- // Cdot = dot(v + cross(w, r), ug)
-- // J = [ug cross(r, ug)]
-- // K = J * invM * JT = invMass + invI * cross(r, ug)^2
--
-- b2GearJoint::b2GearJoint(const b2GearJointDef* def)
-- : b2Joint(def)
-- {
-- b2JointType type1 = def->joint1->GetType();
-- b2JointType type2 = def->joint2->GetType();
--
-- b2Assert(type1 == e_revoluteJoint || type1 == e_prismaticJoint);
-- b2Assert(type2 == e_revoluteJoint || type2 == e_prismaticJoint);
-- b2Assert(def->joint1->GetBodyA()->GetType() == b2_staticBody);
-- b2Assert(def->joint2->GetBodyA()->GetType() == b2_staticBody);
--
-- m_revolute1 = NULL;
-- m_prismatic1 = NULL;
-- m_revolute2 = NULL;
-- m_prismatic2 = NULL;
--
-- float32 coordinate1, coordinate2;
--
-- m_ground1 = def->joint1->GetBodyA();
-- m_bodyA = def->joint1->GetBodyB();
-- if (type1 == e_revoluteJoint)
-- {
-- m_revolute1 = (b2RevoluteJoint*)def->joint1;
-- m_groundAnchor1 = m_revolute1->m_localAnchor1;
-- m_localAnchor1 = m_revolute1->m_localAnchor2;
-- coordinate1 = m_revolute1->GetJointAngle();
-- }
-- else
-- {
-- m_prismatic1 = (b2PrismaticJoint*)def->joint1;
-- m_groundAnchor1 = m_prismatic1->m_localAnchor1;
-- m_localAnchor1 = m_prismatic1->m_localAnchor2;
-- coordinate1 = m_prismatic1->GetJointTranslation();
-- }
--
-- m_ground2 = def->joint2->GetBodyA();
-- m_bodyB = def->joint2->GetBodyB();
-- if (type2 == e_revoluteJoint)
-- {
-- m_revolute2 = (b2RevoluteJoint*)def->joint2;
-- m_groundAnchor2 = m_revolute2->m_localAnchor1;
-- m_localAnchor2 = m_revolute2->m_localAnchor2;
-- coordinate2 = m_revolute2->GetJointAngle();
-- }
-- else
-- {
-- m_prismatic2 = (b2PrismaticJoint*)def->joint2;
-- m_groundAnchor2 = m_prismatic2->m_localAnchor1;
-- m_localAnchor2 = m_prismatic2->m_localAnchor2;
-- coordinate2 = m_prismatic2->GetJointTranslation();
-- }
--
-- m_ratio = def->ratio;
--
-- m_constant = coordinate1 + m_ratio * coordinate2;
--
-- m_impulse = 0.0f;
-- }
--
-- void b2GearJoint::InitVelocityConstraints(const b2TimeStep& step)
-- {
-- b2Body* g1 = m_ground1;
-- b2Body* g2 = m_ground2;
-- b2Body* b1 = m_bodyA;
-- b2Body* b2 = m_bodyB;
--
-- float32 K = 0.0f;
-- m_J.SetZero();
--
-- if (m_revolute1)
-- {
-- m_J.angularA = -1.0f;
-- K += b1->m_invI;
-- }
-- else
-- {
-- b2Vec2 ug = b2Mul(g1->GetTransform().R, m_prismatic1->m_localXAxis1);
-- b2Vec2 r = b2Mul(b1->GetTransform().R, m_localAnchor1 - b1->GetLocalCenter());
-- float32 crug = b2Cross(r, ug);
-- m_J.linearA = -ug;
-- m_J.angularA = -crug;
-- K += b1->m_invMass + b1->m_invI * crug * crug;
-- }
--
-- if (m_revolute2)
-- {
-- m_J.angularB = -m_ratio;
-- K += m_ratio * m_ratio * b2->m_invI;
-- }
-- else
-- {
-- b2Vec2 ug = b2Mul(g2->GetTransform().R, m_prismatic2->m_localXAxis1);
-- b2Vec2 r = b2Mul(b2->GetTransform().R, m_localAnchor2 - b2->GetLocalCenter());
-- float32 crug = b2Cross(r, ug);
-- m_J.linearB = -m_ratio * ug;
-- m_J.angularB = -m_ratio * crug;
-- K += m_ratio * m_ratio * (b2->m_invMass + b2->m_invI * crug * crug);
-- }
--
-- // Compute effective mass.
-- m_mass = K > 0.0f ? 1.0f / K : 0.0f;
--
-- if (step.warmStarting)
-- {
-- // Warm starting.
-- b1->m_linearVelocity += b1->m_invMass * m_impulse * m_J.linearA;
-- b1->m_angularVelocity += b1->m_invI * m_impulse * m_J.angularA;
-- b2->m_linearVelocity += b2->m_invMass * m_impulse * m_J.linearB;
-- b2->m_angularVelocity += b2->m_invI * m_impulse * m_J.angularB;
-- }
-- else
-- {
-- m_impulse = 0.0f;
-- }
-- }
--
-- void b2GearJoint::SolveVelocityConstraints(const b2TimeStep& step)
-- {
-- B2_NOT_USED(step);
--
-- b2Body* b1 = m_bodyA;
-- b2Body* b2 = m_bodyB;
--
-- float32 Cdot = m_J.Compute( b1->m_linearVelocity, b1->m_angularVelocity,
-- b2->m_linearVelocity, b2->m_angularVelocity);
--
-- float32 impulse = m_mass * (-Cdot);
-- m_impulse += impulse;
--
-- b1->m_linearVelocity += b1->m_invMass * impulse * m_J.linearA;
-- b1->m_angularVelocity += b1->m_invI * impulse * m_J.angularA;
-- b2->m_linearVelocity += b2->m_invMass * impulse * m_J.linearB;
-- b2->m_angularVelocity += b2->m_invI * impulse * m_J.angularB;
-- }
--
-- bool b2GearJoint::SolvePositionConstraints(float32 baumgarte)
-- {
-- B2_NOT_USED(baumgarte);
--
-- float32 linearError = 0.0f;
--
-- b2Body* b1 = m_bodyA;
-- b2Body* b2 = m_bodyB;
--
-- float32 coordinate1, coordinate2;
-- if (m_revolute1)
-- {
-- coordinate1 = m_revolute1->GetJointAngle();
-- }
-- else
-- {
-- coordinate1 = m_prismatic1->GetJointTranslation();
-- }
--
-- if (m_revolute2)
-- {
-- coordinate2 = m_revolute2->GetJointAngle();
-- }
-- else
-- {
-- coordinate2 = m_prismatic2->GetJointTranslation();
-- }
--
-- float32 C = m_constant - (coordinate1 + m_ratio * coordinate2);
--
-- float32 impulse = m_mass * (-C);
--
-- b1->m_sweep.c += b1->m_invMass * impulse * m_J.linearA;
-- b1->m_sweep.a += b1->m_invI * impulse * m_J.angularA;
-- b2->m_sweep.c += b2->m_invMass * impulse * m_J.linearB;
-- b2->m_sweep.a += b2->m_invI * impulse * m_J.angularB;
--
-- b1->SynchronizeTransform();
-- b2->SynchronizeTransform();
--
-- // TODO_ERIN not implemented
-- return linearError < b2_linearSlop;
-- }
--
-- b2Vec2 b2GearJoint::GetAnchorA() const
-- {
-- return m_bodyA->GetWorldPoint(m_localAnchor1);
-- }
--
-- b2Vec2 b2GearJoint::GetAnchorB() const
-- {
-- return m_bodyB->GetWorldPoint(m_localAnchor2);
-- }
--
-- b2Vec2 b2GearJoint::GetReactionForce(float32 inv_dt) const
-- {
-- // TODO_ERIN not tested
-- b2Vec2 P = m_impulse * m_J.linearB;
-- return inv_dt * P;
-- }
--
-- float32 b2GearJoint::GetReactionTorque(float32 inv_dt) const
-- {
-- // TODO_ERIN not tested
-- b2Vec2 r = b2Mul(m_bodyB->GetTransform().R, m_localAnchor2 - m_bodyB->GetLocalCenter());
-- b2Vec2 P = m_impulse * m_J.linearB;
-- float32 L = m_impulse * m_J.angularB - b2Cross(r, P);
-- return inv_dt * L;
-- }
--
-- void b2GearJoint::SetRatio(float32 ratio)
-- {
-- b2Assert(b2IsValid(ratio));
-- m_ratio = ratio;
-- }
--
-- float32 b2GearJoint::GetRatio() const
-- {
-- return m_ratio;
-- }
end impact.d2.Joint.gear;
| 34.068 | 113 | 0.510978 |
4df38c98fdbeec013b0967f4fb06e9a11de4aa0d | 469 | ads | Ada | tests/bases-recruit_data_test_data-recruit_data_tests.ads | thindil/steamsky | d5d7fea622f7994c91017c4cd7ba5e188153556c | [
"TCL",
"MIT"
] | 80 | 2017-04-08T23:14:07.000Z | 2022-02-10T22:30:51.000Z | tests/bases-recruit_data_test_data-recruit_data_tests.ads | thindil/steamsky | d5d7fea622f7994c91017c4cd7ba5e188153556c | [
"TCL",
"MIT"
] | 89 | 2017-06-24T08:18:26.000Z | 2021-11-12T04:37:36.000Z | tests/bases-recruit_data_test_data-recruit_data_tests.ads | thindil/steamsky | d5d7fea622f7994c91017c4cd7ba5e188153556c | [
"TCL",
"MIT"
] | 9 | 2018-04-14T16:37:25.000Z | 2020-03-21T14:33:49.000Z | -- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with GNATtest_Generated;
package Bases.Recruit_Data_Test_Data.Recruit_Data_Tests is
type Test_Recruit_Data is new GNATtest_Generated.GNATtest_Standard.Bases
.Recruit_Data_Test_Data
.Test_Recruit_Data with
null record;
end Bases.Recruit_Data_Test_Data.Recruit_Data_Tests;
-- end read only
| 29.3125 | 76 | 0.799574 |
4d2cc4bec2d7d4f512a578d201fc781032ac4158 | 7,521 | ads | Ada | source/web/servlet/servlet-servlets.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/web/servlet/servlet-servlets.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/web/servlet/servlet-servlets.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2015, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Defines methods that all servlets must implement.
--
-- A servlet is a small Java program that runs within a Web server. Servlets
-- receive and respond to requests from Web clients, usually across HTTP, the
-- HyperText Transfer Protocol.
--
-- To implement this interface, you can write a generic servlet that extends
-- javax.servlet.GenericServlet or an HTTP servlet that extends
-- javax.servlet.http.HttpServlet.
--
-- This interface defines methods to initialize a servlet, to service
-- requests, and to remove a servlet from the server. These are known as
-- life-cycle methods and are called in the following sequence:
--
-- 1. The servlet is constructed, then initialized with the init method.
-- 2. Any calls from clients to the service method are handled.
-- 3. The servlet is taken out of service, then destroyed with the destroy
-- method, then garbage collected and finalized.
--
-- In addition to the life-cycle methods, this interface provides the
-- getServletConfig method, which the servlet can use to get any startup
-- information, and the getServletInfo method, which allows the servlet to
-- return basic information about itself, such as author, version, and
-- copyright.
------------------------------------------------------------------------------
with League.Strings;
with Servlet.Configs;
with Servlet.Requests;
with Servlet.Responses;
package Servlet.Servlets is
pragma Preelaborate;
type Servlet is limited interface;
not overriding procedure Destroy (Self : in out Servlet) is null;
-- Called by the servlet container to indicate to a servlet that the
-- servlet is being taken out of service. This method is only called once
-- all threads within the servlet's service method have exited or after a
-- timeout period has passed. After the servlet container calls this
-- method, it will not call the service method again on this servlet.
--
-- This method gives the servlet an opportunity to clean up any resources
-- that are being held (for example, memory, file handles, threads) and
-- make sure that any persistent state is synchronized with the servlet's
-- current state in memory.
not overriding function Get_Servlet_Config
(Self : Servlet)
return access Standard.Servlet.Configs.Servlet_Config'Class is abstract;
-- Returns a ServletConfig object, which contains initialization and
-- startup parameters for this servlet. The ServletConfig object returned
-- is the one passed to the init method.
--
-- Implementations of this interface are responsible for storing the
-- ServletConfig object so that this method can return it. The
-- GenericServlet class, which implements this interface, already does
-- this.
not overriding function Get_Servlet_Info
(Self : Servlet) return League.Strings.Universal_String is abstract;
-- Returns information about the servlet, such as author, version, and
-- copyright.
--
-- The string that this method returns should be plain text and not markup
-- of any kind (such as HTML, XML, etc.).
not overriding procedure Initialize
(Self : in out Servlet;
Config : not null access Standard.Servlet.Configs.Servlet_Config'Class)
is abstract;
-- Called by the servlet container to indicate to a servlet that the
-- servlet is being placed into service.
--
-- The servlet container calls the init method exactly once after
-- instantiating the servlet. The init method must complete successfully
-- before the servlet can receive any requests.
--
-- The servlet container cannot place the servlet into service if the init
-- method
--
-- 1. Throws a ServletException
-- 2. Does not return within a time period defined by the Web server
not overriding procedure Service
(Self : in out Servlet;
Request : Standard.Servlet.Requests.Servlet_Request'Class;
Response : in out Standard.Servlet.Responses.Servlet_Response'Class)
is abstract;
-- Called by the servlet container to allow the servlet to respond to a
-- request.
end Servlet.Servlets;
| 54.107914 | 79 | 0.570004 |
12aeea0caa2846989bc1e7347de707a0bc6dac9d | 3,681 | ads | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-pack38.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-pack38.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-pack38.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 3 8 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 38
package System.Pack_38 is
pragma Preelaborate;
Bits : constant := 38;
type Bits_38 is mod 2 ** Bits;
for Bits_38'Size use Bits;
function Get_38 (Arr : System.Address; N : Natural) return Bits_38;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_38 (Arr : System.Address; N : Natural; E : Bits_38);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
function GetU_38 (Arr : System.Address; N : Natural) return Bits_38;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned. This version
-- is used when Arr may represent an unaligned address.
procedure SetU_38 (Arr : System.Address; N : Natural; E : Bits_38);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value. This version
-- is used when Arr may represent an unaligned address
end System.Pack_38;
| 58.428571 | 78 | 0.499593 |
398610ffd70519e8cf00cb9a0124ffedaf11ad2e | 892 | adb | Ada | contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/mi_interface/foo.adb | TheSledgeHammer/2.11BSD | fe61f0b9aaa273783cd027c7b5ec77e95ead2153 | [
"BSD-3-Clause"
] | 3 | 2021-05-04T17:09:06.000Z | 2021-10-04T07:19:26.000Z | contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/mi_interface/foo.adb | TheSledgeHammer/2.11BSD | fe61f0b9aaa273783cd027c7b5ec77e95ead2153 | [
"BSD-3-Clause"
] | null | null | null | contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/mi_interface/foo.adb | TheSledgeHammer/2.11BSD | fe61f0b9aaa273783cd027c7b5ec77e95ead2153 | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2014-2020 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
Result1 : Data_Type;
GGG1 : GADataType'Class := GADataType'Class (Result1);
begin
Do_Nothing (GGG1'Address); -- BREAK
end Foo;
| 37.166667 | 73 | 0.727578 |
12547063c665bb4201eccd0c88b62f9755340d6e | 405 | adb | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr11.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr11.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr11.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- { dg-do compile }
-- { dg-options "-O" }
with Aggr11_Pkg; use Aggr11_Pkg;
procedure Aggr11 is
A : Arr := ((1 => (Kind => No_Error, B => True),
2 => (Kind => Error),
3 => (Kind => Error),
4 => (Kind => No_Error, B => True),
5 => (Kind => No_Error, B => True),
6 => (Kind => No_Error, B => True)));
begin
null;
end;
| 22.5 | 53 | 0.42716 |
121e4a86bcd82ec38e7b9c9bd64314b9231e507d | 3,796 | ads | Ada | testsuite/soap/soapconf-payloads.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | testsuite/soap/soapconf-payloads.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | testsuite/soap/soapconf-payloads.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Strings;
with Web_Services.SOAP.Payloads;
package SOAPConf.Payloads is
pragma Preelaborate;
type Echo_OK is
limited new Web_Services.SOAP.Payloads.Abstract_SOAP_Payload with record
Text : League.Strings.Universal_String;
end record;
type Response_OK is
limited new Web_Services.SOAP.Payloads.Abstract_SOAP_Payload with record
Text : League.Strings.Universal_String;
end record;
end SOAPConf.Payloads;
| 60.253968 | 78 | 0.43019 |
0b140f59c1d14488afb6e0b85d3ef80b105f8a4f | 4,257 | ada | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c93004b.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c93004b.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c93004b.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- C93004B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT WHEN AN EXCEPTION IS RAISED DURING THE ACTIVATION OF A
-- TASK, OTHER TASKS ARE UNAFFECTED.
-- THE ENCLOSING BLOCK RECEIVES TASKING_ERROR.
-- CHECK THAT TASKS WAITING ON ENTRIES OF SUCH TASKS RECEIVE
-- TASKING_ERROR
-- JEAN-PIERRE ROSEN 09-MAR-1984
-- JBG 06/01/84
-- JBG 05/23/85
-- EG 10/29/85 ELIMINATE THE USE OF NUMERIC_ERROR IN TEST.
-- PWN 11/30/94 REMOVED PRAGMA PRIORITY INSTANCES FOR ADA 9X.
WITH REPORT; USE REPORT;
WITH SYSTEM; USE SYSTEM;
PROCEDURE C93004B IS
BEGIN
TEST("C93004B", "EXCEPTIONS DURING ACTIVATION");
DECLARE
TASK TYPE T1 IS
END T1;
TASK TYPE T2 IS
ENTRY E;
END T2;
ARR_T2: ARRAY(INTEGER RANGE 1..1) OF T2;
TYPE AT1 IS ACCESS T1;
PACKAGE START_T1 IS -- THIS PACKAGE TO AVOID ACCESS BEFORE
END START_T1; -- ELABORATION ON T1.
TASK BODY T1 IS
BEGIN
DECLARE -- THIS BLOCK TO CHECK THAT T1BIS TERMINATES.
TASK T1BIS IS
END T1BIS;
TASK BODY T1BIS IS
BEGIN
ARR_T2(IDENT_INT(1)).E;
FAILED ("RENDEZVOUS COMPLETED - T1BIS");
EXCEPTION
WHEN TASKING_ERROR =>
NULL;
WHEN OTHERS =>
FAILED("ABNORMAL EXCEPTION - T1BIS");
END T1BIS;
BEGIN
NULL;
END;
ARR_T2(IDENT_INT(1)).E; -- ARR_T2(1) IS NOW TERMINATED.
FAILED ("RENDEZVOUS COMPLETED WITHOUT ERROR - T1");
EXCEPTION
WHEN TASKING_ERROR =>
NULL;
WHEN OTHERS =>
FAILED("ABNORMAL EXCEPTION - T1");
END;
PACKAGE BODY START_T1 IS
V_AT1 : AT1 := NEW T1;
END START_T1;
TASK BODY T2 IS
I : POSITIVE := IDENT_INT(0); -- RAISE CONSTRAINT_ERROR.
BEGIN
IF I /= IDENT_INT(2) OR I = IDENT_INT(1) + 1 THEN
FAILED("T2 ACTIVATED OK");
END IF;
END T2;
TASK T3 IS
ENTRY E;
END T3;
TASK BODY T3 IS
BEGIN -- T3 MUST BE ACTIVATED OK.
ACCEPT E;
END T3;
BEGIN
FAILED ("TASKING_ERROR NOT RAISED IN MAIN");
T3.E; -- CLEAN UP.
EXCEPTION
WHEN TASKING_ERROR =>
BEGIN
T3.E;
EXCEPTION
WHEN TASKING_ERROR =>
FAILED ("T3 NOT ACTIVATED");
END;
WHEN CONSTRAINT_ERROR =>
FAILED ("CONSTRAINT_ERROR RAISED IN MAIN");
WHEN OTHERS =>
FAILED ("ABNORMAL EXCEPTION IN MAIN-2");
END;
RESULT;
END C93004B;
| 32.007519 | 79 | 0.536293 |
fb1618e78f2c228f349bb076ec1de961371107bc | 1,015 | ads | Ada | source/Controller_MainWindow.ads | bracke/Meaning | 709f609df916aa9442f9b75c7dcb62ab807a48e9 | [
"MIT"
] | null | null | null | source/Controller_MainWindow.ads | bracke/Meaning | 709f609df916aa9442f9b75c7dcb62ab807a48e9 | [
"MIT"
] | null | null | null | source/Controller_MainWindow.ads | bracke/Meaning | 709f609df916aa9442f9b75c7dcb62ab807a48e9 | [
"MIT"
] | null | null | null | with RASCAL.ToolboxQuit; use RASCAL.ToolboxQuit;
with RASCAL.Toolbox; use RASCAL.Toolbox;
with RASCAL.OS; use RASCAL.OS;
package Controller_MainWindow is
type TEL_OpenWindow_Type is new Toolbox_UserEventListener(16#14#,-1,-1) with null record;
type TEL_OKButtonPressed_Type is new Toolbox_UserEventListener(16#30#,-1,-1) with null record;
type TEL_EscapeButtonPressed_Type is new Toolbox_UserEventListener(16#31#,-1,-1) with null record;
type TEL_RenewSelected_Type is new Toolbox_UserEventListener(16#33#,-1,-1) with null record;
--
--
--
procedure Handle (The : in TEL_OKButtonPressed_Type);
--
--
--
procedure Handle (The : in TEL_EscapeButtonPressed_Type);
--
--
--
procedure Handle (The : in TEL_RenewSelected_Type);
--
-- The user has clicked on the iconbar icon - open the amin window.
--
procedure Handle (The : in TEL_OpenWindow_Type);
end Controller_MainWindow;
| 29.852941 | 104 | 0.672906 |
128e43d48bb3b4c85dbe4f728fb3b8efda32db2e | 2,873 | adb | Ada | Lab2/test_create_vector_data.adb | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | 3 | 2020-01-27T10:04:20.000Z | 2022-02-11T23:17:00.000Z | Lab2/test_create_vector_data.adb | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | null | null | null | Lab2/test_create_vector_data.adb | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | null | null | null | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Create_Vector_Data;
procedure Test_Create_Vector_Data is
type Test_Data_Rec is
record
Xa, Ya, Za, Xb, Yb, Zb : Integer;
L, Vy_Min, Vy_Max, Vz_Min, Vz_Max : Integer;
end record;
type Test_Data_Type is
array (1 .. 17) of Test_Data_Rec;
T : Test_Data_Type :=
(( 0, 0, 0, 1000, 0, 0, 10, 90, 90, 0, 0),
( 0, 0, 0, 0, 1000, 0, 10, 90, 90, 90, 90),
( 0, 0, 0, 0, 0, 1000, 10, 0, 0, 0, 0),
( 0, 0, 0, -1000, 0, 0, 10, 90, 90, 180, 180),
( 0, 0, 0, 0, -1000, 0, 10, 90, 90, 270, 270),
( 0, 0, 0, 0, 0, -1000, 10, 180, 180, 0, 0),
( 0, 0, 0, 1000, 1000, 1000, 17, 54, 55, 45, 45),
( 0, 0, 0, -1000, -1000, 1000, 17, 54, 55, 225, 225),
( 0, 0, 0, -1000, -1000, -1000, 17, 125, 126, 225, 225),
(1000, 1000, 1000, -1000, -1000, -1000, 35, 125, 125, 225, 225),
( 0, 0, 0, 0, 0, 0, 0,
Integer'First, Integer'Last, Integer'First, Integer'Last),
( 500, 0, 500, 0, 500, 0, 9, 124, 125, 135, 135),
(-500, 500, -500, 500, -500, 500, 17, 54, 55, 315, 315),
( 0, 0, 0, 1000, -1000, -1000, 17, 125, 126, 315, 315),
( 123, 234, 345, 456, 567, 678, 6, 55, 56, 45, 45),
( 500, 500, 500, 1500, 0, 1200, 13, 57, 58, 333, 333),
( 127, 345, 789, -123, 1234, -543, 16, 145, 146, 106, 106));
L, Vy, Vz : Integer;
Ok : Boolean;
begin
for I in Test_Data_Type'Range loop
Put("(");
Put(T(I).Xa, Width => 4);
Put(", ");
Put(T(I).Ya, Width => 4);
Put(", ");
Put(T(I).Za, Width => 4);
Put(", ");
Put(T(I).Xb, Width => 5);
Put(", ");
Put(T(I).Yb, Width => 5);
Put(", ");
Put(T(I).Zb, Width => 5);
Put(") =>");
Create_Vector_Data(T(I).Xa, T(I).Ya, T(I).Za, T(I).Xb, T(I).Yb, T(I).Zb, L, Vy, Vz);
Ok := True;
if L /= T(I).L then
Put(" Fel?: L =");
Put(L, Width => 3);
Ok := False;
end if;
if ((Vy not in T(I).Vy_Min .. T(I).Vy_Max) and then
(Vy + 360 not in T(I).Vy_Min .. T(I).Vy_Max) and then
(Vy - 360 not in T(I).Vy_Min .. T(I).Vy_Max)) then
Put(" Fel?: Vy =");
Put(Vy, Width => 4);
Ok := False;
end if;
if ((Vz not in T(I).Vz_Min .. T(I).Vz_Max) and then
(Vz + 360 not in T(I).Vz_Min .. T(I).Vz_Max) and then
(Vz - 360 not in T(I).Vz_Min .. T(I).Vz_Max)) then
Put(" Fel?: Vz =");
Put(Vz, Width => 4);
Ok := False;
end if;
if Ok then
Put(" OK");
end if;
New_Line;
end loop;
end Test_Create_Vector_Data;
| 32.647727 | 88 | 0.44692 |
4d691918123b30b7c1879e2dc4d786257e0b14ce | 3,611 | ads | Ada | source/amf/ocl/amf-ocl-variable_exps-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/ocl/amf-ocl-variable_exps-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/ocl/amf-ocl-variable_exps-hash.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.Elements.Generic_Hash;
function AMF.OCL.Variable_Exps.Hash is
new AMF.Elements.Generic_Hash (OCL_Variable_Exp, OCL_Variable_Exp_Access);
| 72.22 | 78 | 0.402382 |
12d3d561dbe15250fdf52d3c4cb6b094f66986fa | 359 | ads | Ada | src/critical_section/atomic-critical_section.ads | Fabien-Chouteau/atomic | 14bb7db33dff4b6f1219967a809d0f787cae33cb | [
"MIT"
] | 3 | 2020-12-05T17:32:30.000Z | 2021-07-08T13:17:56.000Z | src/critical_section/atomic-critical_section.ads | Fabien-Chouteau/atomic | 14bb7db33dff4b6f1219967a809d0f787cae33cb | [
"MIT"
] | null | null | null | src/critical_section/atomic-critical_section.ads | Fabien-Chouteau/atomic | 14bb7db33dff4b6f1219967a809d0f787cae33cb | [
"MIT"
] | 1 | 2021-04-02T16:13:15.000Z | 2021-04-02T16:13:15.000Z | private with Interfaces;
package Atomic.Critical_Section
with
Preelaborate
is
type Interrupt_State is private;
procedure Enter (State : out Interrupt_State)
with Inline_Always;
procedure Leave (State : Interrupt_State)
with Inline_Always;
private
type Interrupt_State is new Interfaces.Unsigned_32;
end Atomic.Critical_Section;
| 17.095238 | 54 | 0.774373 |
12648e5a1dcc798c9f998c3b214f2c6d87edfa16 | 5,455 | adb | Ada | ncurses/ncurses-5.9/Ada95/src/terminal_interface-curses-forms-field_types-enumeration.adb | imx6uldev/depedency_tools | 0748392a4e97ded2a770b6fbcab281dd3fda2db7 | [
"MIT"
] | 1 | 2018-04-10T19:19:15.000Z | 2018-04-10T19:19:15.000Z | Ada95/src/terminal_interface-curses-forms-field_types-enumeration.adb | thabongshot/ncurses-5.9-mac | 8475dcacfcad55dda5e69f3c8d89de0264fc4429 | [
"DOC",
"Unlicense"
] | 1 | 2016-05-23T19:52:10.000Z | 2016-05-23T19:52:10.000Z | Ada95/src/terminal_interface-curses-forms-field_types-enumeration.adb | thabongshot/ncurses-5.9-mac | 8475dcacfcad55dda5e69f3c8d89de0264fc4429 | [
"DOC",
"Unlicense"
] | 1 | 2020-03-08T12:52:49.000Z | 2020-03-08T12:52:49.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.Enumeration --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.10 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration is
function Create (Info : Enumeration_Info;
Auto_Release_Names : Boolean := False)
return Enumeration_Field
is
procedure Release_String is
new Ada.Unchecked_Deallocation (String,
String_Access);
E : Enumeration_Field;
L : constant size_t := 1 + size_t (Info.C);
S : String_Access;
begin
E.Case_Sensitive := Info.Case_Sensitive;
E.Match_Must_Be_Unique := Info.Match_Must_Be_Unique;
E.Arr := new chars_ptr_array (size_t (1) .. L);
for I in 1 .. Positive (L - 1) loop
if Info.Names (I) = null then
raise Form_Exception;
end if;
E.Arr.all (size_t (I)) := New_String (Info.Names (I).all);
if Auto_Release_Names then
S := Info.Names (I);
Release_String (S);
end if;
end loop;
E.Arr.all (L) := Null_Ptr;
return E;
end Create;
procedure Release (Enum : in out Enumeration_Field)
is
I : size_t := 0;
P : chars_ptr;
begin
loop
P := Enum.Arr.all (I);
exit when P = Null_Ptr;
Free (P);
Enum.Arr.all (I) := Null_Ptr;
I := I + 1;
end loop;
Enum.Arr := null;
end Release;
procedure Set_Field_Type (Fld : Field;
Typ : Enumeration_Field)
is
function Set_Fld_Type (F : Field := Fld;
Arg1 : chars_ptr_array;
Arg2 : C_Int;
Arg3 : C_Int) return C_Int;
pragma Import (C, Set_Fld_Type, "set_field_type_enum");
Res : Eti_Error;
begin
if Typ.Arr = null then
raise Form_Exception;
end if;
Res := Set_Fld_Type (Arg1 => Typ.Arr.all,
Arg2 => C_Int (Boolean'Pos (Typ.Case_Sensitive)),
Arg3 => C_Int (Boolean'Pos
(Typ.Match_Must_Be_Unique)));
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Wrap_Builtin (Fld, Typ, C_Choice_Router);
end Set_Field_Type;
end Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
| 47.025862 | 78 | 0.476994 |
fb5737ac5c0c1643cf14d11527d878171fc63e52 | 15,998 | adb | Ada | regtests/stemmer-tests.adb | stcarrez/ada-stemmer | 08f540a33d471a9823d8f1a88ce2a2c4d40faaec | [
"Apache-2.0"
] | 3 | 2020-05-11T21:21:17.000Z | 2020-05-17T02:16:08.000Z | regtests/stemmer-tests.adb | stcarrez/ada-stemmer | 08f540a33d471a9823d8f1a88ce2a2c4d40faaec | [
"Apache-2.0"
] | null | null | null | regtests/stemmer-tests.adb | stcarrez/ada-stemmer | 08f540a33d471a9823d8f1a88ce2a2c4d40faaec | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- stemmer-stemmer-tests -- Tests for stemmer
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Text_IO;
with Util.Test_Caller;
with Util.Files;
with Util.Strings;
package body Stemmer.Tests is
use Stemmer.Factory;
package Caller is new Util.Test_Caller (Test, "stemmer");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Stemmer.Stem (French)",
Test_Stem_French'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (English)",
Test_Stem_English'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Greek)",
Test_Stem_Greek'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Spanish)",
Test_Stem_Spanish'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Swedish)",
Test_Stem_Swedish'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Russian)",
Test_Stem_Russian'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Serbian)",
Test_Stem_Serbian'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (French, Ref File)",
Test_Stem_French_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Spanish, Ref File)",
Test_Stem_Spanish_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (English, Ref File)",
Test_Stem_English_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Swedish, Ref File)",
Test_Stem_Swedish_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Russian, Ref File)",
Test_Stem_Russian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Serbian, Ref File)",
Test_Stem_Serbian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (German, Ref File)",
Test_Stem_German_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Italian, Ref File)",
Test_Stem_Italian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Greek, Ref File)",
Test_Stem_Greek_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Danish, Ref File)",
Test_Stem_Danish_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Dutch, Ref File)",
Test_Stem_Dutch_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Catalan, Ref File)",
Test_Stem_Catalan_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Basque, Ref File)",
Test_Stem_Basque_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Finnish, Ref File)",
Test_Stem_Finnish_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Hindi, Ref File)",
Test_Stem_Hindi_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Hungarian, Ref File)",
Test_Stem_Hungarian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Irish, Ref File)",
Test_Stem_Irish_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Indonesian, Ref File)",
Test_Stem_Indonesian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Nepali, Ref File)",
Test_Stem_Nepali_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Norwegian, Ref File)",
Test_Stem_Norwegian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Portuguese, Ref File)",
Test_Stem_Portuguese_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Romanian, Ref File)",
Test_Stem_Romanian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Porter, Ref File)",
Test_Stem_Porter_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Tamil, Ref File)",
Test_Stem_Tamil_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Turkish, Ref File)",
Test_Stem_Turkish_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Lithuanian, Ref File)",
Test_Stem_Lithuanian_Reference_File'Access);
Caller.Add_Test (Suite, "Test Stemmer.Stem (Arabic, Ref File)",
Test_Stem_Arabic_Reference_File'Access);
end Add_Tests;
procedure Verify (T : in out Test;
L : in Factory.Language_Type;
Source : in String) is
procedure Process (Line : in String);
Error : Boolean := False;
procedure Process (Line : in String) is
Pos : constant Natural := Util.Strings.Index (Line, ASCII.HT);
begin
if Pos > 0 then
declare
Word : constant String := Line (Line'First .. Pos - 1);
Expect : constant String := Line (Pos + 1 .. Line'Last);
Result : constant String := Stemmer.Factory.Stem (L, Word);
begin
if Result /= Expect then
Ada.Text_IO.Put_Line ("Bad [" & Word & "] -> [" & Result & "] <== " & Expect);
Error := True;
end if;
end;
end if;
end Process;
begin
Util.Files.Read_File (Source, Process'Access);
T.Assert (not Error, "Stemming error for " & Source);
end Verify;
procedure Verify (T : in out Test;
L : in Factory.Language_Type;
S : in String;
R : in String) is
Result : constant String := Stemmer.Factory.Stem (L, S);
begin
T.Assert_Equals (R, Result, S, "Invalid Stem for " & S);
end Verify;
-- Stem on French words.
procedure Test_Stem_French (T : in out Test) is
begin
T.Verify (L_FRENCH, "bonjour", "bonjour");
T.Verify (L_FRENCH, "chienne", "chien");
T.Verify (L_FRENCH, "chevalier", "chevali");
T.Verify (L_FRENCH, "échographe", "échograph");
T.Verify (L_FRENCH, "abandonnait", "abandon");
T.Verify (L_FRENCH, "affectées", "affect");
Verify (T, L_FRENCH, "regtests/files/fr-test.txt");
T.Verify (L_FRENCH, "affectionné", "affection");
T.Verify (L_FRENCH, "affectionnait", "affection");
end Test_Stem_French;
-- Stem on English words.
procedure Test_Stem_English (T : in out Test) is
begin
T.Verify (L_ENGLISH, "zealously", "zealous");
T.Verify (L_ENGLISH, "caesars", "caesar");
T.Verify (L_ENGLISH, "about", "about");
T.Verify (L_ENGLISH, "acceding", "acced");
T.Verify (L_ENGLISH, "younger", "younger");
T.Verify (L_ENGLISH, "skis", "ski");
T.Verify (L_ENGLISH, "ugly", "ugli");
T.Verify (L_ENGLISH, "dying", "die");
T.Verify (L_ENGLISH, "cosmos", "cosmos");
T.Verify (L_ENGLISH, "transitional", "transit");
T.Verify (L_ENGLISH, "academies", "academi");
T.Verify (L_ENGLISH, "abolished", "abolish");
end Test_Stem_English;
-- Stem on Greek words.
procedure Test_Stem_Greek (T : in out Test) is
begin
T.Verify (L_GREEK, "ΠΟΣΟΤΗΤΑ", "ποσοτητ");
T.Verify (L_GREEK, "ΜΝΗΜΕΙΩΔΕΣ", "μνημειωδ");
T.Verify (L_GREEK, "ΩΣΤΙΚΟ", "ωστ");
T.Verify (L_GREEK, "ΩΦΕΛΕΙ", "ωφελ");
end Test_Stem_Greek;
-- Stem on Spanish words.
procedure Test_Stem_Spanish (T : in out Test) is
begin
T.Verify (L_SPANISH, "abarcaría", "abarc");
T.Verify (L_SPANISH, "abarroteros", "abarroter");
T.Verify (L_SPANISH, "aseguramiento", "asegur");
T.Verify (L_SPANISH, "zubillaga", "zubillag");
end Test_Stem_Spanish;
-- Stem on Swedish words.
procedure Test_Stem_Swedish (T : in out Test) is
begin
T.Verify (L_SWEDISH, "ackompanjerade", "ackompanjer");
T.Verify (L_SWEDISH, "abskons", "abskon");
T.Verify (L_SWEDISH, "afhölja", "afhölj");
T.Verify (L_SWEDISH, "överändakastade", "överändakast");
end Test_Stem_Swedish;
-- Stem on Russian words.
procedure Test_Stem_Russian (T : in out Test) is
begin
T.Verify (L_RUSSIAN, "авдотьей", "авдот");
T.Verify (L_RUSSIAN, "адом", "ад");
T.Verify (L_RUSSIAN, "ячменный", "ячмен");
end Test_Stem_Russian;
-- Stem on Serbian words.
procedure Test_Stem_Serbian (T : in out Test) is
begin
T.Verify (L_SERBIAN, "abecendom", "abecend");
T.Verify (L_SERBIAN, "ocenjujući", "ocenjuj");
T.Verify (L_SERBIAN, "padobranskim", "padobransk");
end Test_Stem_Serbian;
-- Stem on French words using the reference file.
procedure Test_Stem_French_Reference_File (T : in out Test) is
begin
Verify (T, L_FRENCH, "regtests/files/fr-test.txt");
end Test_Stem_French_Reference_File;
-- Stem on Spanish words using the reference file.
procedure Test_Stem_Spanish_Reference_File (T : in out Test) is
begin
Verify (T, L_SPANISH, "regtests/files/es-test.txt");
end Test_Stem_Spanish_Reference_File;
-- Stem on English words using the reference file.
procedure Test_Stem_English_Reference_File (T : in out Test) is
begin
Verify (T, L_ENGLISH, "regtests/files/en-test.txt");
end Test_Stem_English_Reference_File;
-- Stem on Swedish words using the reference file.
procedure Test_Stem_Swedish_Reference_File (T : in out Test) is
begin
Verify (T, L_SWEDISH, "regtests/files/sv-test.txt");
end Test_Stem_Swedish_Reference_File;
-- Stem on Russian words using the reference file.
procedure Test_Stem_Russian_Reference_File (T : in out Test) is
begin
Verify (T, L_RUSSIAN, "regtests/files/ru-test.txt");
end Test_Stem_Russian_Reference_File;
-- Stem on Serbian words using the reference file.
procedure Test_Stem_Serbian_Reference_File (T : in out Test) is
begin
Verify (T, L_SERBIAN, "regtests/files/sr-test.txt");
end Test_Stem_Serbian_Reference_File;
-- Stem on German words using the reference file.
procedure Test_Stem_German_Reference_File (T : in out Test) is
begin
Verify (T, L_GERMAN, "regtests/files/gr-test.txt");
end Test_Stem_German_Reference_File;
-- Stem on Italian words using the reference file.
procedure Test_Stem_Italian_Reference_File (T : in out Test) is
begin
Verify (T, L_ITALIAN, "regtests/files/it-test.txt");
end Test_Stem_Italian_Reference_File;
-- Stem on Greek words using the reference file.
procedure Test_Stem_Greek_Reference_File (T : in out Test) is
begin
Verify (T, L_GREEK, "regtests/files/el-test.txt");
end Test_Stem_Greek_Reference_File;
-- Stem on Danish words using the reference file.
procedure Test_Stem_Danish_Reference_File (T : in out Test) is
begin
Verify (T, L_DANISH, "regtests/files/da-test.txt");
end Test_Stem_Danish_Reference_File;
-- Stem on Dutch words using the reference file.
procedure Test_Stem_Dutch_Reference_File (T : in out Test) is
begin
Verify (T, L_DUTCH, "regtests/files/nl-test.txt");
end Test_Stem_Dutch_Reference_File;
-- Stem on Dutch words using the reference file.
procedure Test_Stem_Catalan_Reference_File (T : in out Test) is
begin
Verify (T, L_CATALAN, "regtests/files/ca-test.txt");
end Test_Stem_Catalan_Reference_File;
-- Stem on Basque words using the reference file.
procedure Test_Stem_Basque_Reference_File (T : in out Test) is
begin
Verify (T, L_BASQUE, "regtests/files/eu-test.txt");
end Test_Stem_Basque_Reference_File;
-- Stem on Finnish words using the reference file.
procedure Test_Stem_Finnish_Reference_File (T : in out Test) is
begin
Verify (T, L_FINNISH, "regtests/files/fi-test.txt");
end Test_Stem_Finnish_Reference_File;
-- Stem on Hindi words using the reference file.
procedure Test_Stem_Hindi_Reference_File (T : in out Test) is
begin
Verify (T, L_HINDI, "regtests/files/hi-test.txt");
end Test_Stem_Hindi_Reference_File;
-- Stem on Hungarian words using the reference file.
procedure Test_Stem_Hungarian_Reference_File (T : in out Test) is
begin
Verify (T, L_HUNGARIAN, "regtests/files/hu-test.txt");
end Test_Stem_Hungarian_Reference_File;
-- Stem on Irish words using the reference file.
procedure Test_Stem_Irish_Reference_File (T : in out Test) is
begin
Verify (T, L_IRISH, "regtests/files/gd-ie-test.txt");
end Test_Stem_Irish_Reference_File;
-- Stem on Indonesian words using the reference file.
procedure Test_Stem_Indonesian_Reference_File (T : in out Test) is
begin
Verify (T, L_INDONESIAN, "regtests/files/id-test.txt");
end Test_Stem_Indonesian_Reference_File;
-- Stem on Nepali words using the reference file.
procedure Test_Stem_Nepali_Reference_File (T : in out Test) is
begin
Verify (T, L_NEPALI, "regtests/files/ne-test.txt");
end Test_Stem_Nepali_Reference_File;
-- Stem on Norwegian words using the reference file.
procedure Test_Stem_Norwegian_Reference_File (T : in out Test) is
begin
Verify (T, L_NORWEGIAN, "regtests/files/no-test.txt");
end Test_Stem_Norwegian_Reference_File;
-- Stem on Portuguese words using the reference file.
procedure Test_Stem_Portuguese_Reference_File (T : in out Test) is
begin
Verify (T, L_PORTUGUESE, "regtests/files/pt-test.txt");
end Test_Stem_Portuguese_Reference_File;
-- Stem on Romanian words using the reference file.
procedure Test_Stem_Romanian_Reference_File (T : in out Test) is
begin
Verify (T, L_ROMANIAN, "regtests/files/ro-test.txt");
end Test_Stem_Romanian_Reference_File;
-- Stem on English Porter words using the reference file.
procedure Test_Stem_Porter_Reference_File (T : in out Test) is
begin
Verify (T, L_PORTER, "regtests/files/en-porter-test.txt");
end Test_Stem_Porter_Reference_File;
-- Stem on Tamil words using the reference file.
procedure Test_Stem_Tamil_Reference_File (T : in out Test) is
begin
Verify (T, L_TAMIL, "regtests/files/ta-test.txt");
end Test_Stem_Tamil_Reference_File;
-- Stem on Turkish words using the reference file.
procedure Test_Stem_Turkish_Reference_File (T : in out Test) is
begin
Verify (T, L_TURKISH, "regtests/files/tr-test.txt");
end Test_Stem_Turkish_Reference_File;
-- Stem on Lithuanian words using the reference file.
procedure Test_Stem_Lithuanian_Reference_File (T : in out Test) is
begin
Verify (T, L_LITHUANIAN, "regtests/files/lt-test.txt");
end Test_Stem_Lithuanian_Reference_File;
-- Stem on Arabic words using the reference file.
procedure Test_Stem_Arabic_Reference_File (T : in out Test) is
begin
Verify (T, L_ARABIC, "regtests/files/ar-test.txt");
end Test_Stem_Arabic_Reference_File;
end Stemmer.Tests;
| 42.547872 | 96 | 0.657895 |
4d19c42e883f52257fadb9fbb4121ebc53aee57a | 3,701 | adb | Ada | Ada95/src/terminal_interface-curses-text_io-integer_io.adb | Ancient-Rom/android_external_libncurses | cfb80399910df8d55602d879d5cf0bc5ceaa2f89 | [
"X11"
] | 1,167 | 2017-08-21T21:21:24.000Z | 2022-03-31T15:42:10.000Z | Ada95/src/terminal_interface-curses-text_io-integer_io.adb | thabongshot/ncurses-5.9-mac | 8475dcacfcad55dda5e69f3c8d89de0264fc4429 | [
"DOC",
"Unlicense"
] | 374 | 2015-11-03T12:37:22.000Z | 2021-12-17T14:18:08.000Z | Ada95/src/terminal_interface-curses-text_io-integer_io.adb | thabongshot/ncurses-5.9-mac | 8475dcacfcad55dda5e69f3c8d89de0264fc4429 | [
"DOC",
"Unlicense"
] | 96 | 2015-11-22T07:47:26.000Z | 2022-01-20T19:52:19.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Text_IO.Integer_IO --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2003,2009 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.11 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Text_IO;
with Terminal_Interface.Curses.Text_IO.Aux;
package body Terminal_Interface.Curses.Text_IO.Integer_IO is
package Aux renames Terminal_Interface.Curses.Text_IO.Aux;
package IIO is new Ada.Text_IO.Integer_IO (Num);
procedure Put
(Win : Window;
Item : Num;
Width : Field := Default_Width;
Base : Number_Base := Default_Base)
is
Buf : String (1 .. Field'Last);
begin
IIO.Put (Buf, Item, Base);
Aux.Put_Buf (Win, Buf, Width);
end Put;
procedure Put
(Item : Num;
Width : Field := Default_Width;
Base : Number_Base := Default_Base)
is
begin
Put (Get_Window, Item, Width, Base);
end Put;
end Terminal_Interface.Curses.Text_IO.Integer_IO;
| 52.126761 | 78 | 0.459876 |
127c02dbd0819c42cd22e0563c5a39f973a328bc | 1,061 | ads | Ada | src/syscalls/ewok-syscalls-log.ads | vdh-anssi/ewok-kernel | 9a88dcae16659c212c4123b7a9272c9dfa51f85a | [
"Apache-2.0"
] | 65 | 2018-09-26T09:10:11.000Z | 2022-01-30T21:17:37.000Z | src/syscalls/ewok-syscalls-log.ads | vdh-anssi/ewok-kernel | 9a88dcae16659c212c4123b7a9272c9dfa51f85a | [
"Apache-2.0"
] | 22 | 2019-04-07T15:15:54.000Z | 2020-10-15T12:45:54.000Z | src/syscalls/ewok-syscalls-log.ads | vdh-anssi/ewok-kernel | 9a88dcae16659c212c4123b7a9272c9dfa51f85a | [
"Apache-2.0"
] | 10 | 2018-09-27T09:43:08.000Z | 2021-01-29T22:50:17.000Z | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks_shared;
package ewok.syscalls.log
with spark_mode => on
is
procedure svc_log
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
mode : in ewok.tasks_shared.t_task_mode);
end ewok.syscalls.log;
| 27.921053 | 79 | 0.683318 |
a12473563a4203fd4a9cfa346fc5f887943f4238 | 5,379 | adb | Ada | test/aircraft/test_aircraft-append.adb | skill-lang/skillAdaTestSuite | 279ea0c0cd489c2e39d7532a3b68c564497101e2 | [
"BSD-3-Clause"
] | 1 | 2019-02-09T22:04:10.000Z | 2019-02-09T22:04:10.000Z | test/aircraft/test_aircraft-append.adb | skill-lang/skillAdaTestSuite | 279ea0c0cd489c2e39d7532a3b68c564497101e2 | [
"BSD-3-Clause"
] | null | null | null | test/aircraft/test_aircraft-append.adb | skill-lang/skillAdaTestSuite | 279ea0c0cd489c2e39d7532a3b68c564497101e2 | [
"BSD-3-Clause"
] | null | null | null | package body Test_Aircraft.Append is
File_Name : constant String := "tmp/test-append-aircraft.sf";
procedure Initialize (T : in out Test) is
begin
Set_Name (T, "Test_Aircraft.Append");
Ahven.Framework.Add_Test_Routine (T, Create_Write_Read_Append_Write_Read'Access, "create, write, read, append, write, read");
Ahven.Framework.Add_Test_Routine (T, Check_Tags_After_Append'Access, "check tags after append");
end Initialize;
procedure Set_Up (T : in out Test) is
State : access Skill_State := new Skill_State;
begin
Skill.Create (State);
New_Airplane (State, new String'("Fokker 100"), True, 1);
New_Airplane (State, new String'("Bombardier Dash 8"), False, 2);
New_Helicopter (State, new String'("Bell 206"), False, 1);
New_Helicopter (State, new String'("Sikorsky S-76C+"), True, 2);
Skill.Write (State, File_Name);
end Set_Up;
procedure Tear_Down (T : in out Test) is
begin
Ada.Directories.Delete_File (File_Name);
end Tear_Down;
procedure Create_Write_Read_Append_Write_Read (T : in out Ahven.Framework.Test_Case'Class) is
use Ada.Strings.Unbounded;
begin
declare
State : access Skill_State := new Skill_State;
begin
Skill.Read (State, File_Name);
New_Airplane (State, new String'("General Dynamics F-16"), False, 14);
New_Airplane (State, new String'("Cessna 172"), False, 102);
Skill.Append (State);
end;
declare
State : access Skill_State := new Skill_State;
begin
Skill.Read (State, File_Name);
declare
X : Airplane_Type_Access := Skill.Get_Airplane (State, 1);
begin
Ahven.Assert (X.Get_Id = 1, "'first airplane'.Get_Id is not 1.");
Ahven.Assert (X.Get_Name.all = "Fokker 100", "'first airplane'.Get_Name is not 'Fokker 100'.");
Ahven.Assert (X.Get_Operational = True, "'first airplane'.Get_Operational is not true.");
end;
Ahven.Assert (Skill.Get_Airplane (State, 1).Get_Name.all = "Fokker 100", "Get_Name is not 'Fokker 100'.");
Ahven.Assert (Skill.Get_Airplane (State, 2).Get_Name.all = "Bombardier Dash 8", "Get_Name is not 'Bombardier Dash 8'.");
Ahven.Assert (Skill.Get_Airplane (State, 3).Get_Name.all = "General Dynamics F-16", "Get_Name is not 'General Dynamics F-16'.");
Ahven.Assert (Skill.Get_Airplane (State, 4).Get_Name.all = "Cessna 172", "Get_Name is not 'Cessna 172'.");
end;
end Create_Write_Read_Append_Write_Read;
procedure Check_Tags_After_Append (T : in out Ahven.Framework.Test_Case'Class) is
use Ada.Strings.Unbounded;
begin
declare
State : access Skill_State := new Skill_State;
begin
Skill.Read (State, File_Name);
New_Airplane (State, new String'("General Dynamics F-16"), False, 14);
New_Helicopter (State, new String'("Sikorsky R-4"), True, 99);
New_Airplane (State, new String'("Cessna 172"), False, 102);
Skill.Append (State);
end;
declare
use Ada.Tags;
State : access Skill_State := new Skill_State;
begin
Skill.Read (State, File_Name);
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 1))'Tag = Airplane_Type'Tag, "1 is not a airplane type.");
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 2))'Tag = Airplane_Type'Tag, "2 is not a airplane type.");
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 3))'Tag = Helicopter_Type'Tag, "3 is not a helicopter type.");
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 4))'Tag = Helicopter_Type'Tag, "4 is not a helicopter type.");
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 5))'Tag = Airplane_Type'Tag, "5 is not a airplane type.");
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 6))'Tag = Airplane_Type'Tag, "6 is not a airplane type.");
Ahven.Assert (Skill_Type_Access (Skill.Get_Aircraft (State, 7))'Tag = Helicopter_Type'Tag, "7 is not a helicopter type.");
Ahven.Assert (Skill.Get_Aircraft (State, 4).Get_Operational = True, "aircraft 4 Get_Operational is not true");
Ahven.Assert (Skill.Get_Aircraft (State, 5).Get_Operational = False, "aircraft 5 Get_Operational is not false");
Ahven.Assert (Skill.Get_Aircraft (State, 6).Get_Operational = False, "aircraft 6 Get_Operational is not false");
Ahven.Assert (Skill.Get_Aircraft (State, 7).Get_Operational = True, "aircraft 7 Get_Operational is not true");
Ahven.Assert (Skill.Get_Aircraft (State, 3).Get_Name.all = "Bell 206", "aircraft 3 Get_Name is not 'Bell 206'");
Ahven.Assert (Skill.Get_Aircraft (State, 6).Get_Name.all = "Cessna 172", "aircraft 6 Get_Name is not 'Cessna 172'");
Ahven.Assert (Skill.Get_Aircraft (State, 7).Get_Name.all = "Sikorsky R-4", "aircraft 7 Get_Name is not 'Sikorsky R-4'");
Ahven.Assert (Skill.Get_Helicopter (State, 1).Get_Id = 1, "helicopter 1 Get_Id is not 1");
Ahven.Assert (Skill.Get_Helicopter (State, 2).Get_Id = 2, "helicopter 2 Get_Id is not 2");
Ahven.Assert (Skill.Get_Helicopter (State, 3).Get_Id = 99, "helicopter 3 Get_Id is not 99");
end;
end Check_Tags_After_Append;
end Test_Aircraft.Append;
| 51.228571 | 137 | 0.664436 |
4d6de1f5c896d8bdd24a3dcd7a9882efaca40b26 | 3,818 | ads | Ada | src/svd/sam_svd-trng.ads | Fabien-Chouteau/samd51-hal | 54d4b29df100502d8b3e3b4680a198640faa5f4d | [
"BSD-3-Clause"
] | 1 | 2020-02-24T23:19:03.000Z | 2020-02-24T23:19:03.000Z | src/svd/sam_svd-trng.ads | Fabien-Chouteau/samd51-hal | 54d4b29df100502d8b3e3b4680a198640faa5f4d | [
"BSD-3-Clause"
] | null | null | null | src/svd/sam_svd-trng.ads | Fabien-Chouteau/samd51-hal | 54d4b29df100502d8b3e3b4680a198640faa5f4d | [
"BSD-3-Clause"
] | null | null | null | pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.TRNG is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Control A
type TRNG_CTRLA_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
-- Enable
ENABLE : Boolean := False;
-- unspecified
Reserved_2_5 : HAL.UInt4 := 16#0#;
-- Run in Standby
RUNSTDBY : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for TRNG_CTRLA_Register use record
Reserved_0_0 at 0 range 0 .. 0;
ENABLE at 0 range 1 .. 1;
Reserved_2_5 at 0 range 2 .. 5;
RUNSTDBY at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
end record;
-- Event Control
type TRNG_EVCTRL_Register is record
-- Data Ready Event Output
DATARDYEO : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for TRNG_EVCTRL_Register use record
DATARDYEO at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Enable Clear
type TRNG_INTENCLR_Register is record
-- Data Ready Interrupt Enable
DATARDY : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for TRNG_INTENCLR_Register use record
DATARDY at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Enable Set
type TRNG_INTENSET_Register is record
-- Data Ready Interrupt Enable
DATARDY : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for TRNG_INTENSET_Register use record
DATARDY at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Flag Status and Clear
type TRNG_INTFLAG_Register is record
-- Data Ready Interrupt Flag
DATARDY : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for TRNG_INTFLAG_Register use record
DATARDY at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-----------------
-- Peripherals --
-----------------
-- True Random Generator
type TRNG_Peripheral is record
-- Control A
CTRLA : aliased TRNG_CTRLA_Register;
-- Event Control
EVCTRL : aliased TRNG_EVCTRL_Register;
-- Interrupt Enable Clear
INTENCLR : aliased TRNG_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased TRNG_INTENSET_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased TRNG_INTFLAG_Register;
-- Output Data
DATA : aliased HAL.UInt32;
end record
with Volatile;
for TRNG_Peripheral use record
CTRLA at 16#0# range 0 .. 7;
EVCTRL at 16#4# range 0 .. 7;
INTENCLR at 16#8# range 0 .. 7;
INTENSET at 16#9# range 0 .. 7;
INTFLAG at 16#A# range 0 .. 7;
DATA at 16#20# range 0 .. 31;
end record;
-- True Random Generator
TRNG_Periph : aliased TRNG_Peripheral
with Import, Address => TRNG_Base;
end SAM_SVD.TRNG;
| 28.073529 | 68 | 0.611053 |
1c6ee94cc79d5e8dab76f5efa7dd7a20f369cf60 | 3,561 | adb | Ada | tests/src/cbap_inputs_detection.adb | darkestkhan/cbap | 5b7744a1714b74f803f7785b51fddfaa47b0cbf8 | [
"0BSD"
] | 6 | 2015-07-01T18:35:54.000Z | 2020-09-21T20:41:24.000Z | tests/src/cbap_inputs_detection.adb | darkestkhan/cbap | 5b7744a1714b74f803f7785b51fddfaa47b0cbf8 | [
"0BSD"
] | 1 | 2016-02-29T14:29:58.000Z | 2016-02-29T14:29:58.000Z | tests/src/cbap_inputs_detection.adb | darkestkhan/cbap | 5b7744a1714b74f803f7785b51fddfaa47b0cbf8 | [
"0BSD"
] | null | null | null | pragma License (GPL);
------------------------------------------------------------------------------
-- EMAIL: <[email protected]> --
-- License: GNU GPLv3 or any later as published by Free Software Foundation --
-- (see COPYING file) --
-- --
-- Copyright © 2015 darkestkhan --
------------------------------------------------------------------------------
-- This Program is Free Software: You can redistribute it and/or modify --
-- it under the terms of The GNU General Public License as published by --
-- the Free Software Foundation, either version 3 of the license, or --
-- (at Your option) any later version. --
-- --
-- This Program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the --
-- GNU General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- along with this program. If not, see <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
with Ada.Command_Line;
with Ada.Text_IO;
with CBAP;
procedure CBAP_Inputs_Detection is
---------------------------------------------------------------------------
-- Dummy callback.
procedure Help (Argument : in String) is null;
---------------------------------------------------------------------------
Input_Args : constant array (Positive range <>) of access String :=
( new String'("doing"), new String'("----"), new String'("--"),
new String'("help"), new String'("done")
);
---------------------------------------------------------------------------
Error_Count : Natural := 0;
Detected_Inputs : Natural := 0;
procedure Check_Args (Position : in CBAP.Argument_Lists.Cursor)
is
---------------------------------------------------------------------------
function Is_Correct_Input_Arg (Arg : in String) return Boolean
is
begin
for K in Input_Args'Range loop
if Input_Args (K).all = Arg then
return True;
end if;
end loop;
Ada.Text_IO.Put_Line ("Detected wrong argument: " & Arg);
return False;
end Is_Correct_Input_Arg;
---------------------------------------------------------------------------
begin
if not Is_Correct_Input_Arg (CBAP.Argument_Lists.Element (Position)) then
Error_Count := Error_Count + 1;
else
Detected_Inputs := Detected_Inputs + 1;
end if;
end Check_Args;
---------------------------------------------------------------------------
begin
CBAP.Register (Help'Unrestricted_Access, "help");
CBAP.Process_Arguments;
CBAP.Input_Arguments.Iterate (Check_Args'Unrestricted_Access);
if Detected_Inputs /= Input_Args'Length then
Error_Count := Error_Count + 1;
end if;
if Error_Count > 0 then
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
else
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Success);
end if;
end CBAP_Inputs_Detection;
| 40.011236 | 79 | 0.459983 |
12ed078ac1a7f93f3c19dffffce9c24fd54dd77b | 190 | ads | Ada | bucket_4C/AdaBrowse/patches/patch-ad-setup.ads | jrmarino/ravensource | 91d599fd1f2af55270258d15e72c62774f36033e | [
"FTL"
] | 17 | 2017-04-22T21:53:52.000Z | 2021-01-21T16:57:55.000Z | bucket_4C/AdaBrowse/patches/patch-ad-setup.ads | jrmarino/ravensource | 91d599fd1f2af55270258d15e72c62774f36033e | [
"FTL"
] | 186 | 2017-09-12T20:46:52.000Z | 2021-11-27T18:15:14.000Z | bucket_4C/AdaBrowse/patches/patch-ad-setup.ads | jrmarino/ravensource | 91d599fd1f2af55270258d15e72c62774f36033e | [
"FTL"
] | 74 | 2017-09-06T14:48:01.000Z | 2021-08-28T02:48:27.000Z | --- ad-setup.ads.orig 2021-09-04 15:36:33 UTC
+++ ad-setup.ads
@@ -11,6 +11,6 @@ package AD.Setup is
private
GNAT_Name : constant String :=
- "gcc";
+ "ada";
end AD.Setup;
| 17.272727 | 45 | 0.573684 |
fbda204e6123d4fb4c2da456f929a1e9313d4774 | 20,307 | adb | Ada | bb-runtimes/powerpc/gdbstub/gdbstub.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/powerpc/gdbstub/gdbstub.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/powerpc/gdbstub/gdbstub.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2010, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
------------------------------------------------------------------------------
with Gdbstub_Io; use Gdbstub_Io;
with Gdbstub.CPU;
with Interfaces; use Interfaces;
package body Gdbstub is
Flag_Debug : constant Boolean := False;
Exit_Stub_Loop : Boolean;
procedure Debug_Put (C : Character);
procedure Debug_Put (Msg : String);
procedure Debug_Newline;
procedure Debug_Put_Line (Msg : String);
-- Output on the debug port.
procedure Put_Line (Msg : String);
pragma Unreferenced (Put_Line);
-- Output on the serial port.
function To_Hex (C : Character) return Unsigned_8;
-- Convert a character to its value.
-- Invalid characters return 16#ff#.
procedure Read_Data (Start : Address;
Len : Storage_Count;
Success : in out Boolean);
-- Append data to the current packet.
procedure Write_Data (Start : Address;
Len : Storage_Count;
Success : in out Boolean);
procedure Handle_Packet;
procedure Handle_Query_Packet;
procedure Handle_Breakpoint_Packet;
procedure Handle_Cont_Packet;
procedure Handle_Step_Packet;
procedure Handle_Mem_Read_Packet;
procedure Handle_Mem_Write_Packet;
procedure Handle_Mem_Write_Binary_Packet;
procedure Handle_All_Regs_Read_Packet;
procedure Handle_All_Regs_Write_Packet;
procedure Handle_Reg_Write_Packet;
-- Handle incoming packet.
procedure Reply_Status;
procedure Reply_Ok;
procedure Reply_Error (Err : Unsigned_8);
-- Create a reply packet.
procedure Append_Hex (V : Unsigned_8; Success : in out Boolean);
-- Append a byte (in hex) to the current packet.
procedure Send_Packet;
-- Send the current packet.
procedure Get_Packet;
function Check_Packet_Checksum return Boolean;
function Get_Packet_Body return Boolean;
procedure Wait_Packet_Start;
-- Packet input procedures.
procedure Check_Hex_Digit (Success : in out Boolean);
-- Check that the next character in the packet is an hex-digit character.
-- Set Success to false in case of error.
procedure Extract_Byte (Res : out Unsigned_8; Success : in out Boolean);
procedure Extract_Address (Res : out Address; Success : in out Boolean);
procedure Extract_Char (C : Character; Success : in out Boolean);
procedure Extract_Len (Res : out Storage_Count; Success : in out Boolean);
-- Extract a field from the current packet. Set success to false in case
-- of error. Update Packet_Idx.
function Is_EOP return Boolean;
procedure Check_EOP (Success : in out Boolean);
-- Check for end of packet.
procedure Debug_Put (C : Character) is
begin
Write_Debug (C);
end Debug_Put;
procedure Debug_Put (Msg : String) is
begin
for I in Msg'Range loop
Debug_Put (Msg (I));
end loop;
end Debug_Put;
procedure Debug_Newline is
begin
Write_Debug (ASCII.CR);
Write_Debug (ASCII.LF);
end Debug_Newline;
procedure Debug_Put_Line (Msg : String) is
begin
Debug_Put (Msg);
Debug_Newline;
end Debug_Put_Line;
procedure Put_Line (Msg : String) is
begin
for I in Msg'Range loop
Write_Byte (Msg (I));
end loop;
Write_Byte (ASCII.CR);
Write_Byte (ASCII.LF);
end Put_Line;
Packet : String (1 .. 1024);
-- Current packet.
Packet_Len : Natural;
-- Length of Packet.
Packet_Idx : Natural;
-- Current index while parsing the packet.
Packet_Checksum : Unsigned_8;
To_Char : constant array (Unsigned_8 range 0 .. 15) of Character :=
"0123456789ABCDEF";
function To_Hex (C : Character) return Unsigned_8 is
begin
case C is
when '0' .. '9' =>
return Character'Pos (C) - Character'Pos ('0');
when 'a' .. 'f' =>
return Character'Pos (C) - Character'Pos ('a') + 10;
when 'A' .. 'F' =>
return Character'Pos (C) - Character'Pos ('a') + 10;
when others =>
return 255;
end case;
end To_Hex;
procedure Wait_Packet_Start is
C : Character;
begin
-- Wait for the start character.
loop
C := Read_Byte;
exit when C = '$';
end loop;
end Wait_Packet_Start;
function Get_Packet_Body return Boolean is
C : Character;
begin
loop
Packet_Len := 0;
Packet_Checksum := 0;
loop
if Packet_Len = Packet'Last then
if Flag_Debug then
Debug_Put_Line ("Packet too long");
return False;
end if;
end if;
C := Read_Byte;
exit when C = '$';
if C = '#' then
return True;
end if;
Packet_Checksum := Packet_Checksum + Character'Pos (C);
Packet_Len := Packet_Len + 1;
Packet (Packet_Len) := C;
end loop;
if Flag_Debug then
Debug_Put_Line ("start in the middle");
end if;
end loop;
end Get_Packet_Body;
function Check_Packet_Checksum return Boolean is
C : Character;
V : array (1 .. 2) of Unsigned_8;
begin
for I in V'Range loop
C := Read_Byte;
V (I) := To_Hex (C);
if V (I) > 15 then
return False;
end if;
end loop;
return V (1) * 16 + V (2) = Packet_Checksum;
end Check_Packet_Checksum;
procedure Get_Packet is
-- Wait for the sequence $<data>#<checksum>
begin
loop
Wait_Packet_Start;
if Get_Packet_Body then
if not Check_Packet_Checksum then
-- NAK
Write_Byte ('-');
Debug_Put_Line ("Bad checksum");
else
-- ACK
Write_Byte ('+');
return;
end if;
end if;
end loop;
end Get_Packet;
Last_Signal : Unsigned_8;
procedure Append_Hex (V : Unsigned_8; Success : in out Boolean) is
begin
if not Success then
return;
end if;
if Packet_Len + 2 > Packet'Last then
Success := False;
return;
end if;
Packet (Packet_Len + 1) := To_Char (V / 16);
Packet (Packet_Len + 2) := To_Char (V mod 16);
Packet_Len := Packet_Len + 2;
end Append_Hex;
procedure Reply_Status is
Succ : Boolean := True;
begin
Packet (1) := 'S';
Packet_Len := 1;
Append_Hex (Last_Signal, Succ);
pragma Assert (Succ);
end Reply_Status;
procedure Reply_Error (Err : Unsigned_8) is
Succ : Boolean := True;
begin
Packet (1) := 'E';
Packet_Len := 1;
Append_Hex (Err, Succ);
pragma Assert (Succ);
end Reply_Error;
procedure Reply_Ok is
begin
Packet (1) := 'O';
Packet (2) := 'K';
Packet_Len := 2;
end Reply_Ok;
procedure Read_Data (Start : Address;
Len : Storage_Count;
Success : in out Boolean) is
begin
for Off in 0 .. Len - 1 loop
exit when not Success;
declare
B : Unsigned_8;
for B'Address use Start + Off;
begin
Append_Hex (B, Success);
end;
end loop;
end Read_Data;
procedure Write_Data (Start : Address;
Len : Storage_Count;
Success : in out Boolean) is
begin
for Off in 0 .. Len - 1 loop
exit when not Success;
declare
B : Unsigned_8;
for B'Address use Start + Off;
begin
Extract_Byte (B, Success);
end;
end loop;
end Write_Data;
-- Handle 'q' packets.
procedure Handle_Query_Packet is
begin
if Flag_Debug then
Debug_Put ("query packet: ");
Debug_Put_Line (Packet (1 .. Packet_Len));
end if;
if Packet_Len >= 10 and then Packet (1 .. 10) = "qSupported" then
-- No extra features supported.
Packet_Len := 0;
elsif Packet_Len = 2 and then Packet (1 .. 2) = "qC" then
-- Current thread.
Packet (3) := '0';
Packet_Len := 3;
elsif Packet_Len = 9 and then Packet (1 .. 9) = "qSymbol::" then
-- We don't query symbols.
Reply_Ok;
else
-- Ignored.
Debug_Put ("ignored query packet: ");
Debug_Put_Line (Packet (1 .. Packet_Len));
Packet_Len := 0;
end if;
end Handle_Query_Packet;
-- Handle 'z'/'Z' packets.
procedure Handle_Breakpoint_Packet is
begin
if Flag_Debug then
Debug_Put ("breakpoint packet: ");
Debug_Put_Line (Packet (1 .. Packet_Len));
end if;
if True then
-- Ignored.
Debug_Put ("ignored break packet: ");
Debug_Put_Line (Packet (1 .. Packet_Len));
Packet_Len := 0;
end if;
end Handle_Breakpoint_Packet;
procedure Check_Hex_Digit (Success : in out Boolean) is
begin
if not Success then
return;
end if;
if Packet_Idx > Packet_Len then
Success := False;
return;
end if;
if To_Hex (Packet (Packet_Idx)) > 15 then
Success := False;
return;
end if;
end Check_Hex_Digit;
procedure Extract_Byte (Res : out Unsigned_8; Success : in out Boolean) is
Vh, Vl : Unsigned_8;
begin
Res := 0;
if not Success then
return;
end if;
if Packet_Idx + 1 > Packet_Len then
Success := False;
return;
end if;
Vh := To_Hex (Packet (Packet_Idx + 0));
Vl := To_Hex (Packet (Packet_Idx + 1));
Packet_Idx := Packet_Idx + 2;
if Vh > 15 or else Vl > 15 then
Success := False;
return;
end if;
Res := Vh * 16 + Vl;
end Extract_Byte;
procedure Extract_Address (Res : out Address; Success : in out Boolean) is
V : Unsigned_8;
Resint : Integer_Address;
begin
Check_Hex_Digit (Success);
if not Success then
return;
end if;
V := To_Hex (Packet (Packet_Idx));
Resint := 0;
loop
Resint := Resint * 16 + Integer_Address (V);
Packet_Idx := Packet_Idx + 1;
exit when Packet_Idx > Packet_Len;
V := To_Hex (Packet (Packet_Idx));
exit when V > 15;
end loop;
Res := To_Address (Resint);
end Extract_Address;
procedure Extract_Char (C : Character; Success : in out Boolean) is
begin
if not Success then
return;
end if;
if Packet_Idx > Packet_Len then
Success := False;
return;
end if;
if Packet (Packet_Idx) /= C then
Success := False;
return;
end if;
Packet_Idx := Packet_Idx + 1;
end Extract_Char;
procedure Extract_Len (Res : out Storage_Count; Success : in out Boolean) is
V : Unsigned_8;
Resint : Storage_Count;
begin
Check_Hex_Digit (Success);
if not Success then
Res := 0;
return;
end if;
V := To_Hex (Packet (Packet_Idx));
Resint := 0;
loop
Resint := Resint * 16 + Storage_Count (V);
Packet_Idx := Packet_Idx + 1;
exit when Packet_Idx > Packet_Len;
V := To_Hex (Packet (Packet_Idx));
exit when V > 15;
end loop;
Res := Resint;
end Extract_Len;
function Is_EOP return Boolean is
begin
return Packet_Idx = Packet_Len + 1;
end Is_EOP;
procedure Check_EOP (Success : in out Boolean) is
begin
if not Is_EOP then
Success := False;
end if;
end Check_EOP;
procedure Handle_Mem_Read_Packet is
Addr : Address;
Len : Storage_Count;
Success : Boolean;
begin
Packet_Idx := 2;
Success := True;
Extract_Address (Addr, Success);
Extract_Char (',', Success);
Extract_Len (Len, Success);
Check_EOP (Success);
if not Success then
Reply_Error (1);
return;
end if;
Packet_Len := 0;
Read_Data (Addr, Len, Success);
if not Success then
Reply_Error (2);
end if;
end Handle_Mem_Read_Packet;
procedure Handle_Mem_Write_Packet is
Addr : Address;
Len : Storage_Count;
Success : Boolean;
begin
Packet_Idx := 2;
Success := True;
Extract_Address (Addr, Success);
Extract_Char (',', Success);
Extract_Len (Len, Success);
Extract_Char (':', Success);
if not Success then
Reply_Error (1);
return;
end if;
Write_Data (Addr, Len, Success);
if Success then
CPU.Invalidate_Icache (Addr, Len);
Reply_Ok;
else
Reply_Error (1);
end if;
end Handle_Mem_Write_Packet;
procedure Handle_Mem_Write_Binary_Packet is
Addr : Address;
Len : Storage_Count;
Success : Boolean;
B : Unsigned_8;
begin
Packet_Idx := 2;
Success := True;
Extract_Address (Addr, Success);
Extract_Char (',', Success);
Extract_Len (Len, Success);
Extract_Char (':', Success);
if not Success then
Reply_Error (1);
return;
end if;
for I in 0 .. Len - 1 loop
if Packet_Idx > Packet_Len then
Success := False;
exit;
end if;
B := Character'Pos (Packet (Packet_Idx));
Packet_Idx := Packet_Idx + 1;
if B = 16#7d# then
-- Escape character.
if Packet_Idx > Packet_Len then
Success := False;
exit;
end if;
B := Character'Pos (Packet (Packet_Idx)) xor 16#20#;
Packet_Idx := Packet_Idx + 1;
end if;
declare
M : Unsigned_8;
for M'Address use Addr + I;
begin
M := B;
end;
end loop;
Check_EOP (Success);
if Success then
CPU.Invalidate_Icache (Addr, Len);
Reply_Ok;
else
Reply_Error (1);
end if;
end Handle_Mem_Write_Binary_Packet;
procedure Handle_All_Regs_Write_Packet is
Success : Boolean;
begin
Packet_Idx := 2;
Success := True;
Write_Data (Registers_Area, Registers_Size, Success);
if not Success then
Reply_Error (2);
elsif not Is_EOP then
Reply_Error (1);
else
Reply_Ok;
end if;
end Handle_All_Regs_Write_Packet;
procedure Handle_All_Regs_Read_Packet is
Success : Boolean;
begin
Packet_Len := 0;
Success := True;
Read_Data (Registers_Area, Registers_Size, Success);
if not Success then
Reply_Error (2);
end if;
end Handle_All_Regs_Read_Packet;
procedure Handle_Reg_Write_Packet is
Success : Boolean;
Len : Storage_Count;
Addr : Address;
Size : Storage_Count;
begin
Packet_Idx := 2;
Success := True;
Extract_Len (Len, Success);
Extract_Char ('=', Success);
if not Success
or else Len > Natural'Pos (Natural'Last)
then
Reply_Error (1);
return;
end if;
CPU.Get_Register_Area (Natural (Len), Addr, Size);
if Size = 0 then
Reply_Error (1);
return;
end if;
Write_Data (Addr, Size, Success);
if not Success then
Reply_Error (2);
elsif not Is_EOP then
Reply_Error (1);
else
Reply_Ok;
end if;
end Handle_Reg_Write_Packet;
procedure Handle_Cont_Packet is
begin
Packet_Idx := 2;
if Is_EOP then
CPU.Set_Trace_Flag (False);
Exit_Stub_Loop := True;
else
Reply_Error (1);
end if;
end Handle_Cont_Packet;
procedure Handle_Step_Packet is
begin
Packet_Idx := 2;
if Is_EOP then
CPU.Set_Trace_Flag (True);
Exit_Stub_Loop := True;
else
Reply_Error (1);
end if;
end Handle_Step_Packet;
procedure Handle_Packet is
begin
if Flag_Debug then
Debug_Put ("packet: ");
Debug_Put (Packet (1));
Debug_Newline;
end if;
case Packet (1) is
when '?' =>
-- Reason
Reply_Status;
when 'c' =>
Handle_Cont_Packet;
when 'g' =>
-- Get registers.
Handle_All_Regs_Read_Packet;
when 'G' =>
-- Write registers
Handle_All_Regs_Write_Packet;
when 'H' =>
-- Thread selection packet.
-- Ignore it.
Packet_Len := 0;
when 'k' =>
Packet_Len := 0;
Kill;
when 'm' =>
-- Memory read.
Handle_Mem_Read_Packet;
when 'M' =>
-- Memory write.
Handle_Mem_Write_Packet;
when 'P' =>
Handle_Reg_Write_Packet;
when 'q' =>
-- Query packet.
Handle_Query_Packet;
when 's' =>
Handle_Step_Packet;
when 'X' =>
-- Memory write in binary.
Handle_Mem_Write_Binary_Packet;
when 'z' | 'Z' =>
Handle_Breakpoint_Packet;
when others =>
-- Ignore other commands.
Debug_Put ("ignored packet: ");
Debug_Put (Packet (1));
Debug_Newline;
Packet_Len := 0;
end case;
end Handle_Packet;
procedure Send_Packet is
Checksum : Unsigned_8;
begin
Write_Byte ('$');
Checksum := 0;
for I in 1 .. Packet_Len loop
Checksum := Checksum + Character'Pos (Packet (I));
Write_Byte (Packet (I));
end loop;
Write_Byte ('#');
Write_Byte (To_Char (Checksum / 16));
Write_Byte (To_Char (Checksum mod 16));
end Send_Packet;
procedure Handle_Exception (Sig : Natural) is
begin
-- Send status.
Last_Signal := Unsigned_8 (Sig);
Reply_Status;
Send_Packet;
Exit_Stub_Loop := False;
loop
Get_Packet;
if Packet_Len /= 0 then
Handle_Packet;
exit when Exit_Stub_Loop;
Send_Packet;
end if;
end loop;
end Handle_Exception;
procedure Stub is
begin
Gdbstub_Io.Initialize;
-- Put_Line ("AdaCore GdbStub");
Debug_Put_Line ("AdaCore GdbStub - Debug port");
CPU.Setup_Handlers;
CPU.Breakpoint;
end Stub;
end Gdbstub;
| 27.971074 | 79 | 0.55572 |
1ce054cb7b7174692d65349cf43a63b208818538 | 7,285 | ada | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34007j.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34007j.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34007j.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- C34007J.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT THE REQUIRED PREDEFINED OPERATIONS ARE DECLARED
-- (IMPLICITLY) FOR DERIVED ACCESS TYPES WHOSE DESIGNATED TYPE
-- IS A TASK TYPE.
-- HISTORY:
-- JRK 09/26/86 CREATED ORIGINAL TEST.
-- JLH 09/25/87 REFORMATTED HEADER.
-- BCB 09/26/88 REMOVED COMPARISION INVOLVING OBJECT SIZE.
-- BCB 03/07/90 PUT CHECK FOR 'STORAGE_SIZE IN EXCEPTION HANDLER.
-- THS 09/18/90 REMOVED DECLARATION OF B, MADE THE BODY OF
-- PROCEDURE A NULL, AND DELETED ALL REFERENCES TO B.
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
WITH SYSTEM; USE SYSTEM;
WITH REPORT; USE REPORT;
PROCEDURE C34007J IS
TASK TYPE DESIGNATED IS
ENTRY E (I : IN OUT INTEGER);
ENTRY F (1 .. 3) (I : INTEGER; J : OUT INTEGER);
ENTRY R (I : OUT INTEGER);
ENTRY W (I : INTEGER);
END DESIGNATED;
TYPE PARENT IS ACCESS DESIGNATED;
TYPE T IS NEW PARENT;
X : T;
K : INTEGER := X'SIZE;
Y : T;
W : PARENT;
I : INTEGER := 0;
J : INTEGER := 0;
PROCEDURE A (X : ADDRESS) IS
BEGIN
NULL;
END A;
FUNCTION V RETURN T IS
BEGIN
RETURN NEW DESIGNATED;
END V;
FUNCTION IDENT (X : T) RETURN T IS
BEGIN
IF (X = NULL OR ELSE X'CALLABLE) OR IDENT_BOOL (TRUE) THEN
RETURN X; -- ALWAYS EXECUTED.
END IF;
RETURN NEW DESIGNATED;
END IDENT;
TASK BODY DESIGNATED IS
N : INTEGER := 1;
BEGIN
LOOP
SELECT
ACCEPT E (I : IN OUT INTEGER) DO
I := I + N;
END E;
OR
ACCEPT F (2) (I : INTEGER; J : OUT INTEGER) DO
J := I + N;
END F;
OR
ACCEPT R (I : OUT INTEGER) DO
I := N;
END R;
OR
ACCEPT W (I : INTEGER) DO
N := I;
END W;
OR
TERMINATE;
END SELECT;
END LOOP;
END DESIGNATED;
BEGIN
TEST ("C34007J", "CHECK THAT THE REQUIRED PREDEFINED OPERATIONS " &
"ARE DECLARED (IMPLICITLY) FOR DERIVED " &
"ACCESS TYPES WHOSE DESIGNATED TYPE IS A " &
"TASK TYPE");
X := NEW DESIGNATED;
Y := NEW DESIGNATED;
W := NEW DESIGNATED;
IF Y = NULL THEN
FAILED ("INCORRECT INITIALIZATION - 1");
ELSE Y.W (2);
Y.R (I);
IF I /= 2 THEN
FAILED ("INCORRECT INITIALIZATION - 2");
END IF;
END IF;
X := IDENT (Y);
IF X /= Y THEN
FAILED ("INCORRECT :=");
END IF;
IF T'(X) /= Y THEN
FAILED ("INCORRECT QUALIFICATION");
END IF;
IF T (X) /= Y THEN
FAILED ("INCORRECT SELF CONVERSION");
END IF;
IF EQUAL (3, 3) THEN
W := NEW DESIGNATED;
W.W (3);
END IF;
X := T (W);
IF X = NULL OR X = Y THEN
FAILED ("INCORRECT CONVERSION FROM PARENT - 1");
ELSE I := 5;
X.E (I);
IF I /= 8 THEN
FAILED ("INCORRECT CONVERSION FROM PARENT - 2");
END IF;
END IF;
X := IDENT (Y);
W := PARENT (X);
IF W = NULL OR T (W) /= Y THEN
FAILED ("INCORRECT CONVERSION TO PARENT - 1");
ELSE I := 5;
W.E (I);
IF I /= 7 THEN
FAILED ("INCORRECT CONVERSION TO PARENT - 2");
END IF;
END IF;
IF IDENT (NULL) /= NULL OR X = NULL THEN
FAILED ("INCORRECT NULL");
END IF;
X := IDENT (NEW DESIGNATED);
IF X = NULL OR X = Y THEN
FAILED ("INCORRECT ALLOCATOR - 1");
ELSE I := 5;
X.E (I);
IF I /= 6 THEN
FAILED ("INCORRECT ALLOCATOR - 2");
END IF;
END IF;
X := IDENT (Y);
I := 5;
X.E (I);
IF I /= 7 THEN
FAILED ("INCORRECT SELECTION (ENTRY)");
END IF;
I := 5;
X.F (IDENT_INT (2)) (I, J);
IF J /= 7 THEN
FAILED ("INCORRECT SELECTION (FAMILY)");
END IF;
I := 5;
X.ALL.E (I);
IF I /= 7 THEN
FAILED ("INCORRECT .ALL");
END IF;
X := IDENT (NULL);
BEGIN
IF X.ALL'CALLABLE THEN
FAILED ("NO EXCEPTION FOR NULL.ALL - 1");
ELSE FAILED ("NO EXCEPTION FOR NULL.ALL - 2");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION FOR NULL.ALL");
END;
X := IDENT (Y);
IF X = NULL OR X = NEW DESIGNATED OR NOT (X = Y) THEN
FAILED ("INCORRECT =");
END IF;
IF X /= Y OR NOT (X /= NULL) THEN
FAILED ("INCORRECT /=");
END IF;
IF NOT (X IN T) THEN
FAILED ("INCORRECT ""IN""");
END IF;
IF X NOT IN T THEN
FAILED ("INCORRECT ""NOT IN""");
END IF;
A (X'ADDRESS);
IF NOT X'CALLABLE THEN
FAILED ("INCORRECT OBJECT'CALLABLE");
END IF;
IF NOT V'CALLABLE THEN
FAILED ("INCORRECT VALUE'CALLABLE");
END IF;
BEGIN
IF T'STORAGE_SIZE /= PARENT'STORAGE_SIZE THEN
FAILED ("COLLECTION SIZE OF DERIVED TYPE IS NOT " &
"EQUAL TO COLLECTION SIZE OF PARENT TYPE");
END IF;
EXCEPTION
WHEN PROGRAM_ERROR =>
COMMENT ("PROGRAM_ERROR RAISED FOR " &
"UNDEFINED STORAGE_SIZE (AI-00608)");
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED");
END;
IF X'TERMINATED THEN
FAILED ("INCORRECT OBJECT'TERMINATED");
END IF;
IF V'TERMINATED THEN
FAILED ("INCORRECT VALUE'TERMINATED");
END IF;
RESULT;
END C34007J;
| 28.127413 | 79 | 0.510226 |
390f978a01b8f8cba779891ba0861eba4a1f01ed | 6,022 | ada | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41306b.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41306b.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c41306b.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- C41306B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT IF F IS A FUNCTION RETURNING AN ACCESS VALUE DESIGNATING
-- A TASK OF A TYPE HAVING
-- AN ENTRY E , AN ENTRY CALL OF THE FORM
--
-- F.ALL.E
--
-- IS PERMITTED.
-- RM 02/02/82
-- ABW 07/16/82
-- EG 05/28/85
WITH REPORT; USE REPORT;
PROCEDURE C41306B IS
BEGIN
TEST ( "C41306B" , "CHECK THAT IF F IS A FUNCTION RETURNING" &
" AN ACCESS VALUE DESIGNATING" &
" A TASK OF A TYPE HAVING AN ENTRY E , AN" &
" ENTRY CALL OF THE FORM F.ALL.E IS" &
" PERMITTED" );
-------------------------------------------------------------------
DECLARE
X : INTEGER := 0 ;
TASK TYPE T IS
ENTRY E ;
END T ;
TYPE A_T IS ACCESS T ;
TASK BODY T IS
BEGIN
ACCEPT E DO
X := IDENT_INT(17) ;
END E ;
END T ;
FUNCTION F1 RETURN A_T IS
A_T_VAR1 : A_T := NEW T ;
BEGIN
RETURN A_T_VAR1 ;
END F1 ;
FUNCTION F2 (A, B : BOOLEAN) RETURN A_T IS
A_T_VAR2 : A_T := NEW T;
BEGIN
IF A AND B THEN
NULL;
END IF;
RETURN A_T_VAR2;
END F2;
BEGIN
F1.ALL.E ; -- THE ELABOR. OF F1 (BODY) ACTIVATES THE TASK,
-- WHICH PROCEEDS TO WAIT FOR ENTRY E TO
-- BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE SET TO 17 .
IF X /= 17
THEN
FAILED( "WRONG VALUE FOR GLOBAL VARIABLE (1)" );
END IF;
X := 0;
F2(TRUE, TRUE).ALL.E; -- THE ELABORATION OF F2 (BODY)
-- ACTIVATES THE TASK, WHICH
-- PROCEEDS TO WAIT FOR THE
-- ENTRY E TO BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE
-- SET TO 17.
IF X /= 17 THEN
FAILED ("WRONG VALUE FOR GLOBAL VARIABLE (2)");
END IF;
END ;
-------------------------------------------------------------------
DECLARE
X : INTEGER := 0 ;
TASK TYPE T IS
ENTRY E ;
END T ;
TYPE A_T IS ACCESS T ;
TASK BODY T IS
BEGIN
ACCEPT E DO
X := IDENT_INT(17) ;
END E ;
END T ;
FUNCTION F3 RETURN A_T IS
BEGIN
RETURN NEW T ;
END F3;
FUNCTION F4 (C, D : BOOLEAN) RETURN A_T IS
BEGIN
IF C AND D THEN
NULL;
END IF;
RETURN NEW T;
END F4;
BEGIN
F3.ALL.E ; -- THE ELABOR. OF F3 (BODY) ACTIVATES THE TASK,
-- WHICH PROCEEDS TO WAIT FOR ENTRY E TO
-- BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE SET TO 17 .
IF X /= 17
THEN
FAILED( "WRONG VALUE FOR GLOBAL VARIABLE (3)" );
END IF;
X := 0;
F4(TRUE, TRUE).ALL.E; -- THE ELABORATION OF F4 (BODY)
-- ACTIVATES THE TASK, WHICH
-- PROCEEDS TO WAIT FOR THE
-- ENTRY E TO BE CALLED.
-- THE CALLED ENTRY CAUSES X TO BE
-- SET TO 17.
IF X /= 17 THEN
FAILED ("WRONG VALUE FOR GLOBAL VARIABLE (4)");
END IF;
END ;
-------------------------------------------------------------------
DECLARE
X : INTEGER := 0 ;
TASK TYPE T IS
ENTRY E ;
END T ;
TYPE A_T IS ACCESS T ;
TASK BODY T IS
BEGIN
ACCEPT E DO
X := IDENT_INT(17) ;
END E ;
END T ;
BEGIN
DECLARE
F3 : A_T := NEW T;
BEGIN
F3.ALL.E;
-- THE CALLED ENTRY CAUSES X TO BE SET TO 17 .
IF X /= 17 THEN
FAILED( "WRONG VALUE FOR GLOBAL VARIABLE (5)" );
END IF;
END;
END ;
-------------------------------------------------------------------
RESULT;
END C41306B;
| 27.623853 | 79 | 0.420956 |
23d3c60d23495b7f2276e0371f0e472f38792e7a | 3,726 | ada | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c85009a.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c85009a.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c8/c85009a.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- C85009A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT PREDEFINED AND USER-DEFINED EXCEPTIONS CAN BE RENAMED
-- AND THAT HANDLERS REFERRING TO EITHER NAME ARE INVOKED WHEN THE
-- EXCEPTION IS RAISED, EVEN BY AN EXPLICIT 'RAISE' STATEMENT
-- REFERRING TO THE OTHER NAME.
-- HISTORY:
-- JET 03/24/88 CREATED ORIGINAL TEST.
WITH REPORT; USE REPORT;
PROCEDURE C85009A IS
MY_EXCEPTION : EXCEPTION;
MY_EXCEPTION2 : EXCEPTION RENAMES MY_EXCEPTION;
CONSTRAINT_ERROR2 : EXCEPTION RENAMES CONSTRAINT_ERROR;
I : INTEGER := 1;
BEGIN
TEST ("C85009A", "CHECK THAT PREDEFINED AND USER-DEFINED " &
"EXCEPTIONS CAN BE RENAMED AND THAT HANDLERS " &
"REFERRING TO EITHER NAME ARE INVOKED WHEN " &
"THE EXCEPTION IS RAISED, EVEN BY AN EXPLICIT " &
"'RAISE' STATEMENT REFERRING TO THE OTHER NAME");
BEGIN
RAISE MY_EXCEPTION;
FAILED ("MY_EXCEPTION NOT RAISED");
EXCEPTION
WHEN MY_EXCEPTION2 =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY MY_EXCEPTION");
END;
BEGIN
RAISE MY_EXCEPTION2;
FAILED ("MY_EXCEPTION2 NOT RAISED");
EXCEPTION
WHEN MY_EXCEPTION =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY MY_EXCEPTION2");
END;
DECLARE
TYPE COLORS IS (RED, BLUE, YELLOW);
E : COLORS := RED;
BEGIN
E := COLORS'PRED(E);
IF NOT EQUAL(COLORS'POS(E),COLORS'POS(E)) THEN
COMMENT("DON'T OPTIMIZE E");
END IF;
FAILED ("CONSTRAINT_ERROR NOT RAISED BY PRED(RED)");
EXCEPTION
WHEN CONSTRAINT_ERROR2 =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY PRED(RED)");
END;
BEGIN
RAISE CONSTRAINT_ERROR;
FAILED ("CONSTRAINT_ERROR NOT RAISED");
EXCEPTION
WHEN CONSTRAINT_ERROR2 =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY CONSTRAINT_ERROR");
END;
BEGIN
RAISE CONSTRAINT_ERROR2;
FAILED ("CONSTRAINT_ERROR2 NOT RAISED");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED BY CONSTRAINT_ERROR2");
END;
RESULT;
END C85009A;
| 33.872727 | 79 | 0.602791 |
396d7a05f7264581aa581e57d840f2cb5922ecc1 | 6,846 | adb | Ada | src/lambda_repl.adb | ebolar/Unbounded | 6c19b6bbb1cb2b5eac7add0a324aaa4876d7b806 | [
"MIT"
] | null | null | null | src/lambda_repl.adb | ebolar/Unbounded | 6c19b6bbb1cb2b5eac7add0a324aaa4876d7b806 | [
"MIT"
] | null | null | null | src/lambda_repl.adb | ebolar/Unbounded | 6c19b6bbb1cb2b5eac7add0a324aaa4876d7b806 | [
"MIT"
] | null | null | null | -- Lambda Calculus interpreter
-- ---------------------------
-- Parses and reduces Lamdba Calculus statements.
--
-- Source:
-- lambda - definitions and helper functions
-- lambda_REPL - [This file] REPL and command line parsers
-- lambda_parser - parse tree generator
-- lambda_reducer - optimises and reduces lambda expressions
--
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Unbounded_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.IO_Exceptions;
with Ada.Containers; use Ada.Containers;
with Ada.Containers.Multiway_Trees;
with lambda; use lambda;
with lambda_parser; use lambda_parser;
with lambda_reducer; use lambda_reducer;
Package body Lambda_REPL is
-- The Read|Evaulate|Print Loop
procedure REPL is
I : Instructions.Tree := Instructions.Empty_Tree;
Prompt : constant string := "Unbounded> ";
S : Statement (1..Max_Statement_Length);
L : Natural;
begin
-- TBD: Load the environment context
-- (environment settings, eg trace on/off)
-- (library of Synonyms)
L := 0;
loop
L := L+1;
begin
--Put(Integer'Image(L) & " " & Prompt);
Put(Prompt);
-- Read a line
S := Get_Statement;
New_Line;
-- parse the line
if not parse_Commands(S) then
I := parse_Statement(S);
Log_Format(I);
-- reduce the line
I := reduce(I);
Log_Format(I);
-- print the line
Put_Line("-> " & format(I));
end if;
exception
when Ada.IO_Exceptions.END_ERROR =>
New_Line;
exit;
when E: others =>
Put_Line(Exception_Name(E) & ": "
& Exception_Message(E) & " in "
& Ada.Strings.Fixed.Trim(Source => S, Side => Both)
);
end;
end loop;
Put_Line("Bye");
-- TBD: Save the environment context if required
end;
-- Command line Lambda expression parser
procedure Evaluate ( S : in Statement ) is
begin
null;
end;
-- Parse commands from the REPL
--
-- Commands are:
-- : "EXIT" | "QUIT" : Exit
-- : "HELP" : Print the help/usage message
-- : "LS" : List saved expressions
-- : "RM <symbol>" : Delete an expression
-- : "TRACE" : Display tracing level
-- : "TRACE <feature> " : Set verbose tracing for [ON|OFF|PARSE|REDUCE|FORMAT] functions
function parse_Commands( S: Statement ) return Boolean is
X : SU.Unbounded_String;
Token : String := Empty_Statement;
From : Natural := 1;
-- REPL command tokeniser
-- Command => the statement to tokenise
-- From => current position in the Command. Returns = when end of Command reached
-- Token => next token extracted from the Command
--
procedure Next_Token( Command : Statement; From : in out Natural; Token : out Statement ) is
Cmd_Set : Character_Set := To_Set( Sequence => "ABCDEFGHIJKLMNOPQRSTUVWXYZ-abcdefghijklmnopqrstuvwxyz");
First : Positive;
Last : Natural;
begin
Find_Token(Command, Cmd_Set, From, Inside, First, Last);
if Last = 0
then
Token := Empty_Statement;
From := 0;
else
Token := Ada.Strings.Fixed.Head( Command(First..Last), Max_Statement_Length, ' ');
if Last < Command'Last
then
From := Last + 1;
else
From := 0;
end if;
end if;
end;
begin
From := 1;
next_token(S, From, Token);
X := SU.To_Unbounded_String(To_Upper(trim(Token, Both)));
if X = "EXIT" OR X = "QUIT"
then
Log("Exit");
raise Ada.IO_Exceptions.END_ERROR;
elsif X = "LS"
then
Log("List saved expressions");
List_Synonyms;
return True;
elsif X = "RM"
then
Log("Remove synonym");
loop
next_token(S, From, Token);
exit when From = 0;
Remove_Synonym(Token);
end loop;
return True;
-- This is a little ugly
elsif X = "TRACE"
then
loop
next_token(S, From, Token);
exit when From = 0;
X := SU.To_Unbounded_String(To_Upper(trim(Token, Both)));
if X = "PARSE" then
Trace_Parse := not Trace_Parse;
elsif X = "REDUCE" then
Trace_Reduce := not Trace_Reduce;
elsif X = "FORMAT" then
Trace_Format := not Trace_Format;
elsif X = "ON" then
Trace := TRUE;
elsif X = "OFF" then
Trace := FALSE;
else
raise Syntax_Error with "Invalid parameter: " & To_String(X);
end if;
end loop;
if Trace
then
Put(". Trace on");
if Trace_Parse then
Put(" - PARSE");
end if;
if Trace_Reduce then
Put(" - REDUCE");
end if;
if Trace_Format then
Put(" - FORMAT");
end if;
new_line;
else
Put_Line(". Trace off");
end if;
return True;
elsif X = "HELP"
then
Put_Line("EXIT | QUIT : Exit Unbounded");
Put_Line("HELP : Display this message");
Put_Line("LS : List all saved expressions");
Put_Line("RM <symbol> : Delete an expression");
Put_Line("TRACE : Display the tracing level");
Put_Line("TRACE <feature> : Set verbose tracing [ON|OFF|PARSE|REDUCE|FORMAT]");
return True;
end if;
return False;
end parse_Commands;
-- ==========================================================================================
-- Private functions
-- ==========================================================================================
--
-- Input a Lambda statement
function Get_Statement return Statement is
Buffer : SU.Unbounded_String := SU.Null_Unbounded_String;
begin
Buffer := Ada.Text_IO.Unbounded_IO.Get_Line;
return Ada.Strings.Fixed.Head(Source => SU.To_String(Buffer),
Count => Max_Statement_Length,
Pad => ' ');
end Get_Statement;
end Lambda_REPL;
| 28.764706 | 113 | 0.52381 |
4d320799dd3b1b1c39a7057fbe551a969b8c5119 | 2,675 | ads | Ada | boards/NRF52_DK/src/nrf52_dk-leds.ads | aiunderstand/ADA-Nano33BLE | c67d13e8e2b7f4e1872e4175f859c937ad3f0549 | [
"MIT"
] | null | null | null | boards/NRF52_DK/src/nrf52_dk-leds.ads | aiunderstand/ADA-Nano33BLE | c67d13e8e2b7f4e1872e4175f859c937ad3f0549 | [
"MIT"
] | null | null | null | boards/NRF52_DK/src/nrf52_dk-leds.ads | aiunderstand/ADA-Nano33BLE | c67d13e8e2b7f4e1872e4175f859c937ad3f0549 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with nRF.Device; use nRF.Device;
with nRF.GPIO; use nRF.GPIO;
package NRF52_DK.LEDs is
subtype User_LED is GPIO_Point;
LED13 : User_LED renames P13;
procedure Initialize_LEDs;
procedure Turn_On (This : in out User_LED);
procedure Turn_Off (This : in out User_LED);
end NRF52_DK.LEDs;
| 58.152174 | 78 | 0.528598 |
0b9af8f671fe16fcdbcfbe3c27bb2fb1f47b7a61 | 1,257 | ads | Ada | dcf/src/dcf-streams-calendar.ads | onox/dcf-ada | 47891e7789d3aa53d8f6632284cdf63dbd2ec7dd | [
"MIT"
] | 5 | 2019-05-31T00:00:15.000Z | 2022-02-11T23:11:54.000Z | dcf/src/dcf-streams-calendar.ads | onox/dcf-ada | 47891e7789d3aa53d8f6632284cdf63dbd2ec7dd | [
"MIT"
] | null | null | null | dcf/src/dcf-streams-calendar.ads | onox/dcf-ada | 47891e7789d3aa53d8f6632284cdf63dbd2ec7dd | [
"MIT"
] | null | null | null | with Ada.Calendar;
package DCF.Streams.Calendar is
-- Set_Time again, but with the standard Ada Time type.
-- Overriding is useless and potentially harmful, so we prevent it with
-- a class-wide profile.
procedure Set_Time (S : out Root_Zipstream_Type'Class; Modification_Time : Ada.Calendar.Time);
-- Get_Time again, but with the standard Ada Time type.
-- Overriding is useless and potentially harmful, so we prevent it with
-- a class-wide profile.
function Get_Time (S : in Root_Zipstream_Type'Class) return Ada.Calendar.Time;
----------------------------
-- Routines around Time --
----------------------------
function Convert (Date : in Ada.Calendar.Time) return Time;
function Convert (Date : in Time) return Ada.Calendar.Time;
use Ada.Calendar;
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration);
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration := 0.0) return Time;
function ">" (Left, Right : Time) return Boolean;
Time_Error : exception;
end DCF.Streams.Calendar;
| 29.928571 | 97 | 0.638027 |
12f7ae0d2f05940be4ad579b1e6957fdae9c541e | 845 | ads | Ada | contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/char_enum/pck.ads | TheSledgeHammer/2.11BSD | fe61f0b9aaa273783cd027c7b5ec77e95ead2153 | [
"BSD-3-Clause"
] | 3 | 2021-05-04T17:09:06.000Z | 2021-10-04T07:19:26.000Z | contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/char_enum/pck.ads | TheSledgeHammer/2.11BSD | fe61f0b9aaa273783cd027c7b5ec77e95ead2153 | [
"BSD-3-Clause"
] | null | null | null | contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/char_enum/pck.ads | TheSledgeHammer/2.11BSD | fe61f0b9aaa273783cd027c7b5ec77e95ead2153 | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2011-2020 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package Pck is
type Global_Enum_Type is ('x', 'Y', '+');
procedure Do_Nothing (A : System.Address);
end Pck;
| 36.73913 | 73 | 0.725444 |
4d16a2b358366011e0362c21bc558023c0a80b63 | 365 | adb | Ada | gb_01/src_wa1/run_wa1.adb | gerr135/gnat_bugs | e2e1c085c96919924c13bef99409766525a76712 | [
"Unlicense"
] | null | null | null | gb_01/src_wa1/run_wa1.adb | gerr135/gnat_bugs | e2e1c085c96919924c13bef99409766525a76712 | [
"Unlicense"
] | null | null | null | gb_01/src_wa1/run_wa1.adb | gerr135/gnat_bugs | e2e1c085c96919924c13bef99409766525a76712 | [
"Unlicense"
] | null | null | null | --
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with root;
procedure run_wa1 is
package R is new Root(Real => Float);
begin
null;
end run_wa1;
| 21.470588 | 66 | 0.717808 |
a10046fcba0a6fad6e090f40c2ff62d0733381b9 | 6,922 | adb | Ada | awa/plugins/awa-storages/regtests/awa-storages-services-tests.adb | twdroeger/ada-awa | 77b824773747aecb912c37b1b7b59ea414679b80 | [
"Apache-2.0"
] | null | null | null | awa/plugins/awa-storages/regtests/awa-storages-services-tests.adb | twdroeger/ada-awa | 77b824773747aecb912c37b1b7b59ea414679b80 | [
"Apache-2.0"
] | null | null | null | awa/plugins/awa-storages/regtests/awa-storages-services-tests.adb | twdroeger/ada-awa | 77b824773747aecb912c37b1b7b59ea414679b80 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- awa-storages-services-tests -- Unit tests for storage service
-- Copyright (C) 2012, 2016, 2019 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams;
with Ada.Strings.Unbounded;
with Util.Test_Caller;
with ADO;
with ADO.Objects;
with Security.Contexts;
with AWA.Services.Contexts;
with AWA.Storages.Modules;
with AWA.Storages.Beans.Factories;
with AWA.Tests.Helpers.Users;
package body AWA.Storages.Services.Tests is
use ADO;
package Caller is new Util.Test_Caller (Test, "Storages.Services");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Storages.Services.Save (DATABASE)",
Test_Create_Storage'Access);
Caller.Add_Test (Suite, "Test AWA.Storages.Services.Save (FILE)",
Test_File_Create_Storage'Access);
Caller.Add_Test (Suite, "Test AWA.Storages.Services.Delete",
Test_Delete_Storage'Access);
Caller.Add_Test (Suite, "Test AWA.Storages.Services.Save_Folder, Folder_Bean",
Test_Create_Folder'Access);
Caller.Add_Test (Suite, "Test AWA.Storages.Services.Get_Local_File",
Test_Get_Local_File'Access);
end Add_Tests;
-- ------------------------------
-- Save something in a storage element and keep track of the store id in the test <b>Id</b>.
-- ------------------------------
procedure Save (T : in out Test) is
Store : AWA.Storages.Models.Storage_Ref;
begin
T.Manager := AWA.Storages.Modules.Get_Storage_Manager;
T.Assert (T.Manager /= null, "Null storage manager");
Store.Set_Mime_Type ("text/plain");
Store.Set_Name ("Makefile");
Store.Set_File_Size (1000);
T.Manager.Save (Into => Store,
Path => "Makefile",
Storage => T.Kind);
T.Assert (not Store.Is_Null, "Storage object should not be null");
T.Id := Store.Get_Id;
T.Assert (T.Id > 0, "Invalid storage identifier");
end Save;
-- ------------------------------
-- Load the storage element refered to by the test <b>Id</b>.
-- ------------------------------
procedure Load (T : in out Test) is
use type Ada.Streams.Stream_Element_Offset;
Name : Ada.Strings.Unbounded.Unbounded_String;
Mime : Ada.Strings.Unbounded.Unbounded_String;
Date : Ada.Calendar.Time;
Data : ADO.Blob_Ref;
begin
T.Manager := AWA.Storages.Modules.Get_Storage_Manager;
T.Assert (T.Manager /= null, "Null storage manager");
T.Manager.Load (From => T.Id, Name => Name, Mime => Mime, Date => Date, Into => Data);
T.Assert (not Data.Is_Null, "Null blob returned by load");
T.Assert (Data.Value.Len > 100, "Invalid length for the blob data");
end Load;
-- ------------------------------
-- Test creation of a storage object
-- ------------------------------
procedure Test_Create_Storage (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]");
T.Save;
T.Load;
end Test_Create_Storage;
procedure Test_File_Create_Storage (T : in out Test) is
begin
T.Kind := AWA.Storages.Models.FILE;
T.Test_Create_Storage;
end Test_File_Create_Storage;
-- ------------------------------
-- Test creation of a storage object and local file access after its creation.
-- ------------------------------
procedure Test_Get_Local_File (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]");
T.Save;
declare
File : AWA.Storages.Storage_File (AWA.Storages.TMP);
begin
T.Manager.Get_Local_File (From => T.Id, Into => File);
T.Assert (AWA.Storages.Get_Path (File)'Length > 0, "Invalid local file path");
end;
end Test_Get_Local_File;
-- ------------------------------
-- Test deletion of a storage object
-- ------------------------------
procedure Test_Delete_Storage (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
Data : ADO.Blob_Ref;
Name : Ada.Strings.Unbounded.Unbounded_String;
Mime : Ada.Strings.Unbounded.Unbounded_String;
Date : Ada.Calendar.Time;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]");
T.Save;
T.Manager.Delete (T.Id);
begin
T.Manager.Load (From => T.Id, Name => Name, Mime => Mime, Date => Date, Into => Data);
T.Assert (False, "No exception raised");
exception
when ADO.Objects.NOT_FOUND =>
null;
end;
end Test_Delete_Storage;
-- ------------------------------
-- Test creation of a storage folder
-- ------------------------------
procedure Test_Create_Folder (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
Folder : AWA.Storages.Beans.Factories.Folder_Bean;
Outcome : Ada.Strings.Unbounded.Unbounded_String;
Upload : AWA.Storages.Beans.Factories.Upload_Bean;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "[email protected]");
Folder.Module := AWA.Storages.Modules.Get_Storage_Module;
Upload.Module := AWA.Storages.Modules.Get_Storage_Module;
Folder.Set_Name ("Test folder name");
Folder.Save (Outcome);
Util.Tests.Assert_Equals (T, "success", Outcome, "Invalid outcome returned by Save action");
Upload.Set_Value ("folderId", ADO.Objects.To_Object (Folder.Get_Key));
Util.Tests.Assert_Equals (T, "Test folder name", String '(Upload.Get_Folder.Get_Name),
"Invalid folder name");
end Test_Create_Folder;
end AWA.Storages.Services.Tests;
| 38.88764 | 98 | 0.607772 |
0b80d7f5364db72e09111cdd7484ebb2d9076f07 | 3,369 | ads | Ada | src/traces/agate-traces.ads | Fabien-Chouteau/AGATE | cd8dbc54c1c70379c833e7cd710e2326ad6e9a91 | [
"BSD-3-Clause"
] | 3 | 2017-12-23T10:25:07.000Z | 2021-06-09T13:47:19.000Z | src/traces/agate-traces.ads | Fabien-Chouteau/AGATE | cd8dbc54c1c70379c833e7cd710e2326ad6e9a91 | [
"BSD-3-Clause"
] | null | null | null | src/traces/agate-traces.ads | Fabien-Chouteau/AGATE | cd8dbc54c1c70379c833e7cd710e2326ad6e9a91 | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2020, Fabien Chouteau --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
private package AGATE.Traces is
-- Tasks --
procedure Register (ID : Task_ID;
Name : String);
procedure Resume (ID : Task_ID);
procedure Suspend (ID : Task_ID);
procedure Fault (ID : Task_ID);
procedure Running (ID : Task_ID);
procedure Change_Priority (ID : Task_ID;
New_Prio : Internal_Task_Priority);
procedure Context_Switch (Old, Next : Task_ID);
-- Semaphores --
procedure Register (ID : Semaphore_ID;
Name : String);
procedure Value_Changed (ID : Semaphore_ID;
Count : Semaphore_Count;
By : Task_ID);
-- Mutexes --
procedure Register (ID : Mutex_ID;
Name : String);
procedure Lock (ID : Mutex_ID;
By : Task_ID);
procedure Release (ID : Mutex_ID;
By : Task_ID);
-- System --
procedure Shutdown;
end AGATE.Traces;
| 46.150685 | 78 | 0.513802 |
0e84c479189e08fbaaa27c7ee1513770b719ff97 | 2,548 | adb | Ada | source/web-lock_files.adb | ytomino/web-ada | 376fe024e4c8784bd4350a343a1416b79292fbb5 | [
"FSFAP"
] | 2 | 2015-02-09T21:09:15.000Z | 2021-11-17T19:53:08.000Z | source/web-lock_files.adb | ytomino/web-ada | 376fe024e4c8784bd4350a343a1416b79292fbb5 | [
"FSFAP"
] | null | null | null | source/web-lock_files.adb | ytomino/web-ada | 376fe024e4c8784bd4350a343a1416b79292fbb5 | [
"FSFAP"
] | null | null | null | with Ada.Calendar;
with Ada.Directories;
package body Web.Lock_Files is
use type Ada.Calendar.Time;
function Lock (
Name : String;
Force : Duration := 0.0;
Timeout : Duration := 3.0;
Retry_Interval : Duration := 1.0;
Forced : access Boolean := null)
return Boolean
is
Gone : Duration := 0.0;
begin
if Forced /= null then
Forced.all := False;
end if;
loop
if Force /= 0.0 then
declare
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
if Now - Ada.Directories.Modification_Time (Name) >= Force then
Ada.Directories.Delete_Directory (Name);
if Forced /= null then
Forced.all := True;
end if;
end if;
exception
when Name_Error | Use_Error => null;
end;
end if;
begin
Ada.Directories.Create_Directory (Name);
return True;
exception
when Use_Error => null;
end;
declare
Interval : constant Duration := Duration'Min (Retry_Interval, Timeout - Gone);
begin
if Interval <= 0.0 then
return False;
end if;
delay Interval;
Gone := Gone + Interval;
end;
end loop;
end Lock;
procedure Lock (
Name : in String;
Force : in Duration := 0.0;
Timeout : in Duration := 3.0;
Retry_Interval : in Duration := 1.0;
Forced : access Boolean := null) is
begin
if not Lock (
Name,
Force => Force,
Timeout => Timeout,
Retry_Interval => Retry_Interval,
Forced => Forced)
then
raise Lock_Error;
end if;
end Lock;
procedure Unlock (Name : in String)
renames Ada.Directories.Delete_Directory;
function Lock (
Name : String;
Force : Duration := 0.0;
Timeout : Duration := 3.0;
Retry_Interval : Duration := 1.0)
return Lock_Type is
begin
return Result : Lock_Type :=
(Ada.Finalization.Limited_Controlled
with
Name_Length => Name'Length,
Locked => False,
Forced => False,
Name => Name)
do
Lock (
Name,
Force => Force,
Timeout => Timeout,
Retry_Interval => Retry_Interval,
Forced => Result.Forced'Access);
Result.Locked := True;
end return;
end Lock;
function Forced (Object : Lock_Type) return Boolean is
begin
return Object.Forced;
end Forced;
procedure Unlock (Object : in out Lock_Type) is
begin
if Object.Locked then
Unlock (Object.Name);
end if;
end Unlock;
overriding procedure Finalize (Object : in out Lock_Type) is
begin
Unlock (Object);
exception
when Name_Error | Use_Error => null; -- Finalize can not raise any exception
end Finalize;
end Web.Lock_Files;
| 21.59322 | 82 | 0.650706 |
4da7f3e70045756bc96022a2545c55aadb895f4e | 1,888 | adb | Ada | src/Internals/protypo-tokens.adb | fintatarta/protypo | c0c2bca17bc766ab95acc99b7422485388a10cb4 | [
"MIT"
] | null | null | null | src/Internals/protypo-tokens.adb | fintatarta/protypo | c0c2bca17bc766ab95acc99b7422485388a10cb4 | [
"MIT"
] | 4 | 2019-10-09T11:16:38.000Z | 2019-10-09T11:20:38.000Z | src/Internals/protypo-tokens.adb | fintatarta/protypo | c0c2bca17bc766ab95acc99b7422485388a10cb4 | [
"MIT"
] | null | null | null | package body Protypo.Tokens is
----------------
-- Make_Token --
----------------
function Make_Token (Builder : in out Token_Builder;
Class : Valued_Token;
Value : String)
return Token
is
Result : constant Token := Token'(Class => Class,
Value => To_Unbounded_String (Value),
Position => Builder.Position);
begin
Builder.Clear_Position;
return Result;
end Make_Token;
----------------
-- Make_Token --
----------------
function Make_Token (Builder : in out Token_Builder;
Class : Unvalued_Token)
return Token
is
Result : constant Token := Token'(Class => Class,
Value => Null_Unbounded_String,
Position => Builder.Position);
begin
Builder.Clear_Position;
return Result;
end Make_Token;
function Is_Position_Set (Builder : Token_Builder) return Boolean
is (Builder.Has_Position);
------------------
-- Set_Position --
------------------
procedure Set_Position (Builder : in out Token_Builder;
Position : Token_Position)
is
begin
if Builder.Has_Position then
raise Constraint_Error;
else
Builder.Has_Position := True;
Builder.Position := Position;
end if;
end Set_Position;
--------------------
-- Clear_Position --
--------------------
procedure Clear_Position (Builder : in out Token_Builder)
is
begin
if not Builder.Has_Position then
raise Constraint_Error;
else
Builder.Has_Position := False;
end if;
end Clear_Position;
end Protypo.Tokens;
| 26.971429 | 80 | 0.497881 |
12df50bd0be5aaee31ae730b4a29ed72b252126c | 21,223 | ads | Ada | src/gen-model-xmi.ads | Letractively/ada-gen | d06d03821057f9177f2350e32dd09e467df08612 | [
"Apache-2.0"
] | null | null | null | src/gen-model-xmi.ads | Letractively/ada-gen | d06d03821057f9177f2350e32dd09e467df08612 | [
"Apache-2.0"
] | null | null | null | src/gen-model-xmi.ads | Letractively/ada-gen | d06d03821057f9177f2350e32dd09e467df08612 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- gen-model-xmi -- UML-XMI model
-- Copyright (C) 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Hash;
with Ada.Containers.Vectors;
with Util.Beans.Objects;
with Util.Strings.Sets;
package Gen.Model.XMI is
use Ada.Strings.Unbounded;
type Element_Type is (XMI_UNKNOWN,
XMI_PACKAGE,
XMI_CLASS,
XMI_GENERALIZATION,
XMI_ASSOCIATION,
XMI_ASSOCIATION_END,
XMI_ATTRIBUTE,
XMI_OPERATION,
XMI_PARAMETER,
XMI_ENUMERATION,
XMI_ENUMERATION_LITERAL,
XMI_TAGGED_VALUE,
XMI_TAG_DEFINITION,
XMI_DATA_TYPE,
XMI_STEREOTYPE,
XMI_COMMENT);
-- Defines the visibility of an element (a package, class, attribute, operation).
type Visibility_Type is (VISIBILITY_PUBLIC,
VISIBILITY_PACKAGE,
VISIBILITY_PROTECTED,
VISIBILITY_PRIVATE);
-- Defines whether an attribute or association changes.
type Changeability_Type is (CHANGEABILITY_INSERT,
CHANGEABILITY_CHANGEABLE,
CHANGEABILITY_FROZEN);
type Parameter_Type is (PARAM_IN, PARAM_OUT, PARAM_INOUT, PARAM_RETURN);
type Model_Element;
type Tagged_Value_Element;
type Tag_Definition_Element;
type Model_Element_Access is access all Model_Element'Class;
type Tagged_Value_Element_Access is access all Tagged_Value_Element'Class;
type Tag_Definition_Element_Access is access all Tag_Definition_Element'Class;
-- Define a list of model elements.
package Model_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Model_Element_Access);
subtype Model_Vector is Model_Vectors.Vector;
subtype Model_Cursor is Model_Vectors.Cursor;
-- Define a map to search an element from its XMI ID.
package Model_Map is
new Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String,
Element_Type => Model_Element_Access,
Hash => Ada.Strings.Unbounded.Hash,
Equivalent_Keys => "=");
subtype Model_Map_Cursor is Model_Map.Cursor;
type Model_Map_Access is access all Model_Map.Map;
-- Returns true if the table cursor contains a valid table
function Has_Element (Position : in Model_Map_Cursor) return Boolean
renames Model_Map.Has_Element;
-- Returns the table definition.
function Element (Position : in Model_Map_Cursor) return Model_Element_Access
renames Model_Map.Element;
-- Move the iterator to the next table definition.
procedure Next (Position : in out Model_Map_Cursor)
renames Model_Map.Next;
-- Iterate on the model element of the type <tt>On</tt> and execute the <tt>Process</tt>
-- procedure.
procedure Iterate (Model : in Model_Map.Map;
On : in Element_Type;
Process : not null access procedure (Id : in Unbounded_String;
Node : in Model_Element_Access));
-- Generic procedure to iterate over the XMI elements of a vector
-- and having the entity name <b>name</b>.
generic
type T (<>) is limited private;
procedure Iterate_Elements (Closure : in out T;
List : in Model_Vector;
Process : not null access
procedure (Closure : in out T;
Node : in Model_Element_Access));
-- Map of UML models indexed on the model name.
package UML_Model_Map is new
Ada.Containers.Hashed_Maps (Key_Type => Unbounded_String,
Element_Type => Model_Map.Map,
Hash => Ada.Strings.Unbounded.Hash,
Equivalent_Keys => "=",
"=" => Model_Map."=");
subtype UML_Model is UML_Model_Map.Map;
type UML_Model_Access is access all UML_Model;
type Search_Type is (BY_NAME, BY_ID);
-- Find the model element with the given XMI id.
-- Returns null if the model element is not found.
function Find (Model : in Model_Map.Map;
Key : in String;
Mode : in Search_Type := BY_ID) return Model_Element_Access;
-- Find the model element within all loaded UML models.
-- Returns null if the model element is not found.
function Find (Model : in UML_Model;
Current : in Model_Map.Map;
Id : in Ada.Strings.Unbounded.Unbounded_String)
return Model_Element_Access;
-- Dump the XMI model elements.
procedure Dump (Map : in Model_Map.Map);
-- Reconcile all the UML model elements by resolving all the references to UML elements.
procedure Reconcile (Model : in out UML_Model;
Debug : in Boolean := False);
-- ------------------------------
-- Model Element
-- ------------------------------
type Model_Element (Model : Model_Map_Access) is abstract new Definition with record
-- Element XMI id.
XMI_Id : Ada.Strings.Unbounded.Unbounded_String;
-- List of tagged values for the element.
Tagged_Values : Model_Vector;
-- Elements contained.
Elements : Model_Vector;
-- Stereotypes associated with the element.
Stereotypes : Model_Vector;
-- The parent model element;
Parent : Model_Element_Access;
-- The location (file and line) where the definition was found in the XMI file.
Location : Ada.Strings.Unbounded.Unbounded_String;
end record;
-- Get the element type.
function Get_Type (Node : in Model_Element) return Element_Type is abstract;
-- Reconcile the element by resolving the references to other elements in the model.
procedure Reconcile (Node : in out Model_Element;
Model : in UML_Model);
-- Find the element with the given name. If the name is a qualified name, navigate
-- down the package/class to find the appropriate element.
-- Returns null if the element was not found.
function Find (Node : in Model_Element;
Name : in String) return Model_Element_Access;
-- Set the model name.
procedure Set_Name (Node : in out Model_Element;
Value : in Util.Beans.Objects.Object);
-- Set the model XMI unique id.
procedure Set_XMI_Id (Node : in out Model_Element;
Value : in Util.Beans.Objects.Object);
-- Set the location (file and line) where the model element is defined in the XMI file.
procedure Set_Location (Node : in out Model_Element;
Location : in String);
-- Validate the node definition as much as we can before the reconcile phase.
-- If an error is detected, return a message. Returns an empty string if everything is ok.
function Get_Error_Message (Node : in Model_Element) return String;
-- Find the tag value element with the given name.
-- Returns null if there is no such tag.
function Find_Tag_Value (Node : in Model_Element;
Name : in String) return Tagged_Value_Element_Access;
-- Find the tag value associated with the given tag definition.
-- Returns the tag value if it was found, otherwise returns the default
function Find_Tag_Value (Node : in Model_Element;
Definition : in Tag_Definition_Element_Access;
Default : in String := "") return String;
-- Get the documentation and comment associated with the model element.
-- Returns the empty string if there is no comment.
function Get_Comment (Node : in Model_Element) return String;
-- Get the full qualified name for the element.
function Get_Qualified_Name (Node : in Model_Element) return String;
-- Dump the node to get some debugging description about it.
procedure Dump (Node : in Model_Element);
-- Find from the model file identified by <tt>Name</tt>, the model element with the
-- identifier or name represented by <tt>Key</tt>.
-- Returns null if the model element is not found.
generic
type Element_Type is new Model_Element with private;
type Element_Type_Access is access all Element_Type'Class;
function Find_Element (Model : in UML_Model;
Name : in String;
Key : in String;
Mode : in Search_Type := BY_ID)
return Element_Type_Access;
-- ------------------------------
-- Data type
-- ------------------------------
type Ref_Type_Element is new Model_Element with record
Ref_Id : Unbounded_String;
Ref : Model_Element_Access;
end record;
type Ref_Type_Element_Access is access all Ref_Type_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Ref_Type_Element) return Element_Type;
-- Reconcile the element by resolving the references to other elements in the model.
overriding
procedure Reconcile (Node : in out Ref_Type_Element;
Model : in UML_Model);
-- Set the reference id and collect in the profiles set the UML profiles that must
-- be loaded to get the reference.
procedure Set_Reference_Id (Node : in out Ref_Type_Element;
Ref : in String;
Profiles : in out Util.Strings.Sets.Set);
-- ------------------------------
-- Data type
-- ------------------------------
type Data_Type_Element is new Model_Element with null record;
type Data_Type_Element_Access is access all Data_Type_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Data_Type_Element) return Element_Type;
-- ------------------------------
-- Enum
-- ------------------------------
type Enum_Element is new Data_Type_Element with null record;
type Enum_Element_Access is access all Enum_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Enum_Element) return Element_Type;
-- Validate the node definition as much as we can before the reconcile phase.
-- An enum must not be empty, it must have at least one literal.
-- If an error is detected, return a message. Returns an empty string if everything is ok.
overriding
function Get_Error_Message (Node : in Enum_Element) return String;
-- ------------------------------
-- Literal
-- ------------------------------
-- The literal describes a possible value for an enum.
type Literal_Element is new Model_Element with null record;
type Literal_Element_Access is access all Literal_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Literal_Element) return Element_Type;
-- Create an enum literal and add it to the enum.
procedure Add_Literal (Node : in out Enum_Element;
Id : in Util.Beans.Objects.Object;
Name : in Util.Beans.Objects.Object;
Literal : out Literal_Element_Access);
-- ------------------------------
-- Stereotype
-- ------------------------------
type Stereotype_Element is new Model_Element with null record;
type Stereotype_Element_Access is access all Stereotype_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Stereotype_Element) return Element_Type;
-- Returns True if the model element has the stereotype with the given name.
function Has_Stereotype (Node : in Model_Element'Class;
Stereotype : in Stereotype_Element_Access) return Boolean;
-- ------------------------------
-- Comment
-- ------------------------------
type Comment_Element is new Model_Element with record
Text : Ada.Strings.Unbounded.Unbounded_String;
Ref_Id : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Comment_Element_Access is access all Comment_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Comment_Element) return Element_Type;
-- ------------------------------
-- An operation
-- ------------------------------
type Operation_Element is new Model_Element with record
Visibility : Visibility_Type := VISIBILITY_PUBLIC;
end record;
type Operation_Element_Access is access all Operation_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Operation_Element) return Element_Type;
-- ------------------------------
-- An attribute
-- ------------------------------
type Attribute_Element is new Ref_Type_Element with record
Data_Type : Data_Type_Element_Access;
Visibility : Visibility_Type := VISIBILITY_PUBLIC;
Changeability : Changeability_Type := CHANGEABILITY_CHANGEABLE;
Initial_Value : Util.Beans.Objects.Object;
Multiplicity_Lower : Integer := 0;
Multiplicity_Upper : Integer := 1;
end record;
type Attribute_Element_Access is access all Attribute_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Attribute_Element) return Element_Type;
-- Reconcile the element by resolving the references to other elements in the model.
overriding
procedure Reconcile (Node : in out Attribute_Element;
Model : in UML_Model);
-- ------------------------------
-- A parameter
-- ------------------------------
type Parameter_Element is new Attribute_Element with record
Kind : Parameter_Type := PARAM_IN;
end record;
type Parameter_Element_Access is access all Parameter_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Parameter_Element) return Element_Type;
-- ------------------------------
-- An association end
-- ------------------------------
type Association_End_Element is new Ref_Type_Element with record
Visibility : Visibility_Type := VISIBILITY_PUBLIC;
Multiplicity_Lower : Integer := 0;
Multiplicity_Upper : Integer := 0;
Target_Element : Model_Element_Access;
Source_Element : Model_Element_Access;
Navigable : Boolean := True;
end record;
type Association_End_Element_Access is access all Association_End_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Association_End_Element) return Element_Type;
-- Get the documentation and comment associated with the model element.
-- Integrates the comment from the association itself as well as this association end.
-- Returns the empty string if there is no comment.
overriding
function Get_Comment (Node : in Association_End_Element) return String;
-- Reconcile the element by resolving the references to other elements in the model.
overriding
procedure Reconcile (Node : in out Association_End_Element;
Model : in UML_Model);
-- Make the association between the two ends.
procedure Make_Association (From : in out Association_End_Element;
To : in out Association_End_Element'Class;
Model : in UML_Model);
-- ------------------------------
-- An association
-- ------------------------------
type Association_Element is new Model_Element with record
Visibility : Visibility_Type := VISIBILITY_PUBLIC;
Connections : Model_Vector;
end record;
type Association_Element_Access is access all Association_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Association_Element) return Element_Type;
-- Validate the node definition as much as we can before the reconcile phase.
-- An association must contain two ends and a name is necessary on the navigable ends.
-- If an error is detected, return a message. Returns an empty string if everything is ok.
overriding
function Get_Error_Message (Node : in Association_Element) return String;
-- Reconcile the association between classes in the package. Find the association
-- ends and add the necessary links to the corresponding class elements.
overriding
procedure Reconcile (Node : in out Association_Element;
Model : in UML_Model);
-- ------------------------------
-- An association
-- ------------------------------
type Generalization_Element is new Ref_Type_Element with record
Child_Class : Model_Element_Access;
Child_Id : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Generalization_Element_Access is access all Generalization_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Generalization_Element) return Element_Type;
-- Reconcile the association between classes in the package. Find the association
-- ends and add the necessary links to the corresponding class elements.
overriding
procedure Reconcile (Node : in out Generalization_Element;
Model : in UML_Model);
-- ------------------------------
-- Tag Definition
-- ------------------------------
TAG_DOCUMENTATION : constant String := "documentation";
TAG_AUTHOR : constant String := "author";
type Tag_Definition_Element is new Model_Element with record
Multiplicity_Lower : Natural := 0;
Multiplicity_Upper : Natural := 0;
end record;
-- Get the element type.
overriding
function Get_Type (Node : in Tag_Definition_Element) return Element_Type;
-- ------------------------------
-- Tagged value
-- ------------------------------
type Tagged_Value_Element is new Ref_Type_Element with record
Value : Ada.Strings.Unbounded.Unbounded_String;
Value_Type : Ada.Strings.Unbounded.Unbounded_String;
Tag_Def : Tag_Definition_Element_Access;
end record;
-- Get the element type.
overriding
function Get_Type (Node : in Tagged_Value_Element) return Element_Type;
-- Reconcile the element by resolving the references to other elements in the model.
overriding
procedure Reconcile (Node : in out Tagged_Value_Element;
Model : in UML_Model);
-- ------------------------------
-- A class
-- ------------------------------
type Class_Element is new Data_Type_Element with record
Operations : Model_Vector;
Attributes : Model_Vector;
Associations : Model_Vector;
Visibility : Visibility_Type := VISIBILITY_PUBLIC;
Parent_Class : Ref_Type_Element_Access;
end record;
type Class_Element_Access is access all Class_Element'Class;
-- Get the element type.
overriding
function Get_Type (Node : in Class_Element) return Element_Type;
-- Reconcile the element by resolving the references to other elements in the model.
overriding
procedure Reconcile (Node : in out Class_Element;
Model : in UML_Model);
-- ------------------------------
-- A package
-- ------------------------------
type Package_Element;
type Package_Element_Access is access all Package_Element'Class;
type Package_Element is new Model_Element with record
Classes : Model_Vector;
Enums : Model_Vector;
Associations : Model_Vector;
Is_Profile : Boolean := False;
end record;
-- Get the element type.
overriding
function Get_Type (Node : in Package_Element) return Element_Type;
end Gen.Model.XMI;
| 40.501908 | 95 | 0.615417 |
4d15c2f6c2ce7cd633e57a8f65dae37e87944534 | 3,648 | ads | Ada | source/web-ui-widgets-spin_boxes-integers.ads | godunko/adawebui | ee524325fe701ef0a655cd0624e0ba701f0e8955 | [
"BSD-3-Clause"
] | 2 | 2020-01-31T07:00:09.000Z | 2021-06-25T15:50:00.000Z | source/web-ui-widgets-spin_boxes-integers.ads | godunko/adawebui | ee524325fe701ef0a655cd0624e0ba701f0e8955 | [
"BSD-3-Clause"
] | null | null | null | source/web-ui-widgets-spin_boxes-integers.ads | godunko/adawebui | ee524325fe701ef0a655cd0624e0ba701f0e8955 | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2018-2020, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision: 5903 $ $Date: 2018-12-26 22:07:33 +0300 (Wed, 26 Dec 2018) $
------------------------------------------------------------------------------
with Web.UI.Widgets.Spin_Boxes.Generic_Integers;
with Web.UI.Integer_Slots.Emitters;
package Web.UI.Widgets.Spin_Boxes.Integers is
new Web.UI.Widgets.Spin_Boxes.Generic_Integers
(Integer, Web.UI.Integer_Slots, Web.UI.Integer_Slots.Emitters);
| 70.153846 | 78 | 0.41886 |
dfc9c5ce5c07ab4f9cf1ae5eb695f989d5eac3dc | 33,392 | adb | Ada | apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b/conv2d_b2b/hls_target/.autopilot/db/hls_target.sched.adb | dillonhuff/Halide-HLS | e9f4c3ac7915e5a52f211ce65004ae17890515a0 | [
"MIT"
] | 1 | 2020-06-18T16:51:39.000Z | 2020-06-18T16:51:39.000Z | apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b/conv2d_b2b/hls_target/.autopilot/db/hls_target.sched.adb | dillonhuff/Halide-HLS | e9f4c3ac7915e5a52f211ce65004ae17890515a0 | [
"MIT"
] | null | null | null | apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b/conv2d_b2b/hls_target/.autopilot/db/hls_target.sched.adb | dillonhuff/Halide-HLS | e9f4c3ac7915e5a52f211ce65004ae17890515a0 | [
"MIT"
] | 1 | 2020-03-18T00:43:22.000Z | 2020-03-18T00:43:22.000Z | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="14">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName></userIPName>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>hls_target</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>hw_input_V_value_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>hw_input.V.value.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>hw_input_V_last_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>hw_input.V.last.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>0</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_3">
<Value>
<Obj>
<type>1</type>
<id>3</id>
<name>hw_output_V_value_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>hw_output.V.value.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>8</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_4">
<Value>
<Obj>
<type>1</type>
<id>4</id>
<name>hw_output_V_last_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>hw_output.V.last.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>1</bitwidth>
</Value>
<direction>1</direction>
<if_type>0</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>8</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_5">
<Value>
<Obj>
<type>0</type>
<id>11</id>
<name>p_hw_input_stencil_st</name>
<fileName>hls_target.cpp</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</fileDirectory>
<lineNumber>50</lineNumber>
<contextFuncName>hls_target</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</first>
<second class_id="11" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>hls_target.cpp</first>
<second>hls_target</second>
</first>
<second>50</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>_hw_input_stencil_stream.V.value.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>72</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>33</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_6">
<Value>
<Obj>
<type>0</type>
<id>15</id>
<name>p_mul_stencil_update_1</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>34</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_7">
<Value>
<Obj>
<type>0</type>
<id>19</id>
<name>p_mul_stencil_stream_s</name>
<fileName>hls_target.cpp</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</fileDirectory>
<lineNumber>164</lineNumber>
<contextFuncName>hls_target</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_target.cpp</first>
<second>hls_target</second>
</first>
<second>164</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName>_mul_stencil_stream.V.value.V</originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<oprand_edges>
<count>1</count>
<item_version>0</item_version>
<item>35</item>
</oprand_edges>
<opcode>alloca</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_8">
<Value>
<Obj>
<type>0</type>
<id>26</id>
<name></name>
<fileName>hls_target.cpp</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</fileDirectory>
<lineNumber>54</lineNumber>
<contextFuncName>hls_target</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_target.cpp</first>
<second>hls_target</second>
</first>
<second>54</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>4</count>
<item_version>0</item_version>
<item>37</item>
<item>38</item>
<item>39</item>
<item>40</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_9">
<Value>
<Obj>
<type>0</type>
<id>27</id>
<name></name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>42</item>
<item>43</item>
<item>44</item>
<item>247</item>
<item>248</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_10">
<Value>
<Obj>
<type>0</type>
<id>28</id>
<name></name>
<fileName>hls_target.cpp</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</fileDirectory>
<lineNumber>168</lineNumber>
<contextFuncName>hls_target</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_target.cpp</first>
<second>hls_target</second>
</first>
<second>168</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>5</count>
<item_version>0</item_version>
<item>46</item>
<item>47</item>
<item>48</item>
<item>246</item>
<item>249</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_11">
<Value>
<Obj>
<type>0</type>
<id>29</id>
<name></name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>6</count>
<item_version>0</item_version>
<item>50</item>
<item>51</item>
<item>52</item>
<item>53</item>
<item>245</item>
<item>250</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_12">
<Value>
<Obj>
<type>0</type>
<id>30</id>
<name></name>
<fileName>hls_target.cpp</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</fileDirectory>
<lineNumber>264</lineNumber>
<contextFuncName>hls_target</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/paper_apps_8_shifts/conv2d_b2b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>hls_target.cpp</first>
<second>hls_target</second>
</first>
<second>264</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>0</count>
<item_version>0</item_version>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>5</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_13">
<Value>
<Obj>
<type>2</type>
<id>32</id>
<name>empty</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>64</bitwidth>
</Value>
<const_type>0</const_type>
<content>1</content>
</item>
<item class_id_reference="16" object_id="_14">
<Value>
<Obj>
<type>2</type>
<id>36</id>
<name>linebuffer_1</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:linebuffer.1></content>
</item>
<item class_id_reference="16" object_id="_15">
<Value>
<Obj>
<type>2</type>
<id>41</id>
<name>Loop_1_proc</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:Loop_1_proc></content>
</item>
<item class_id_reference="16" object_id="_16">
<Value>
<Obj>
<type>2</type>
<id>45</id>
<name>linebuffer_2</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:linebuffer.2></content>
</item>
<item class_id_reference="16" object_id="_17">
<Value>
<Obj>
<type>2</type>
<id>49</id>
<name>Block_preheader39_p</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:Block_.preheader39.p></content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_18">
<Obj>
<type>3</type>
<id>31</id>
<name>hls_target</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>8</count>
<item_version>0</item_version>
<item>11</item>
<item>15</item>
<item>19</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>23</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_19">
<id>33</id>
<edge_type>1</edge_type>
<source_obj>32</source_obj>
<sink_obj>11</sink_obj>
</item>
<item class_id_reference="20" object_id="_20">
<id>34</id>
<edge_type>1</edge_type>
<source_obj>32</source_obj>
<sink_obj>15</sink_obj>
</item>
<item class_id_reference="20" object_id="_21">
<id>35</id>
<edge_type>1</edge_type>
<source_obj>32</source_obj>
<sink_obj>19</sink_obj>
</item>
<item class_id_reference="20" object_id="_22">
<id>37</id>
<edge_type>1</edge_type>
<source_obj>36</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_23">
<id>38</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_24">
<id>39</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_25">
<id>40</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>26</sink_obj>
</item>
<item class_id_reference="20" object_id="_26">
<id>42</id>
<edge_type>1</edge_type>
<source_obj>41</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_27">
<id>43</id>
<edge_type>1</edge_type>
<source_obj>11</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_28">
<id>44</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_29">
<id>46</id>
<edge_type>1</edge_type>
<source_obj>45</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_30">
<id>47</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_31">
<id>48</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_32">
<id>50</id>
<edge_type>1</edge_type>
<source_obj>49</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_33">
<id>51</id>
<edge_type>1</edge_type>
<source_obj>19</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_34">
<id>52</id>
<edge_type>1</edge_type>
<source_obj>3</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_35">
<id>53</id>
<edge_type>1</edge_type>
<source_obj>4</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_36">
<id>245</id>
<edge_type>4</edge_type>
<source_obj>28</source_obj>
<sink_obj>29</sink_obj>
</item>
<item class_id_reference="20" object_id="_37">
<id>246</id>
<edge_type>4</edge_type>
<source_obj>27</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_38">
<id>247</id>
<edge_type>4</edge_type>
<source_obj>26</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_39">
<id>248</id>
<edge_type>4</edge_type>
<source_obj>26</source_obj>
<sink_obj>27</sink_obj>
</item>
<item class_id_reference="20" object_id="_40">
<id>249</id>
<edge_type>4</edge_type>
<source_obj>27</source_obj>
<sink_obj>28</sink_obj>
</item>
<item class_id_reference="20" object_id="_41">
<id>250</id>
<edge_type>4</edge_type>
<source_obj>28</source_obj>
<sink_obj>29</sink_obj>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_42">
<mId>1</mId>
<mTag>hls_target</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>33</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>1</mIsDfPipe>
<mDfPipe class_id="23" tracking_level="1" version="0" object_id="_43">
<port_list class_id="24" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port_list>
<process_list class_id="25" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_44">
<type>0</type>
<name>linebuffer_1_U0</name>
<ssdmobj_id>26</ssdmobj_id>
<pins class_id="27" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_45">
<port class_id="29" tracking_level="1" version="0" object_id="_46">
<name>in_axi_stream_V_value_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id="30" tracking_level="1" version="0" object_id="_47">
<type>0</type>
<name>linebuffer_1_U0</name>
<ssdmobj_id>26</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_48">
<port class_id_reference="29" object_id="_49">
<name>in_axi_stream_V_last_V</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_47"></inst>
</item>
<item class_id_reference="28" object_id="_50">
<port class_id_reference="29" object_id="_51">
<name>out_stream_V_value_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_47"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_52">
<type>0</type>
<name>Loop_1_proc_U0</name>
<ssdmobj_id>27</ssdmobj_id>
<pins>
<count>2</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_53">
<port class_id_reference="29" object_id="_54">
<name>p_hw_input_stencil_stream_V_value_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_55">
<type>0</type>
<name>Loop_1_proc_U0</name>
<ssdmobj_id>27</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_56">
<port class_id_reference="29" object_id="_57">
<name>p_mul_stencil_update_stream_V_value_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_55"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_58">
<type>0</type>
<name>linebuffer_2_U0</name>
<ssdmobj_id>28</ssdmobj_id>
<pins>
<count>2</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_59">
<port class_id_reference="29" object_id="_60">
<name>in_stream_V_value_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_61">
<type>0</type>
<name>linebuffer_2_U0</name>
<ssdmobj_id>28</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_62">
<port class_id_reference="29" object_id="_63">
<name>out_stream_V_value_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_61"></inst>
</item>
</pins>
</item>
<item class_id_reference="26" object_id="_64">
<type>0</type>
<name>Block_preheader39_p_U0</name>
<ssdmobj_id>29</ssdmobj_id>
<pins>
<count>3</count>
<item_version>0</item_version>
<item class_id_reference="28" object_id="_65">
<port class_id_reference="29" object_id="_66">
<name>p_mul_stencil_stream_V_value_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id="_67">
<type>0</type>
<name>Block_preheader39_p_U0</name>
<ssdmobj_id>29</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_68">
<port class_id_reference="29" object_id="_69">
<name>hw_output_V_value_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_67"></inst>
</item>
<item class_id_reference="28" object_id="_70">
<port class_id_reference="29" object_id="_71">
<name>hw_output_V_last_V</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_67"></inst>
</item>
</pins>
</item>
</process_list>
<channel_list class_id="31" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="32" tracking_level="1" version="0" object_id="_72">
<type>1</type>
<name>p_hw_input_stencil_st</name>
<ssdmobj_id>11</ssdmobj_id>
<ctype>0</ctype>
<depth>1</depth>
<bitwidth>72</bitwidth>
<source class_id_reference="28" object_id="_73">
<port class_id_reference="29" object_id="_74">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_47"></inst>
</source>
<sink class_id_reference="28" object_id="_75">
<port class_id_reference="29" object_id="_76">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_55"></inst>
</sink>
</item>
<item class_id_reference="32" object_id="_77">
<type>1</type>
<name>p_mul_stencil_update_1</name>
<ssdmobj_id>15</ssdmobj_id>
<ctype>0</ctype>
<depth>1</depth>
<bitwidth>32</bitwidth>
<source class_id_reference="28" object_id="_78">
<port class_id_reference="29" object_id="_79">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_55"></inst>
</source>
<sink class_id_reference="28" object_id="_80">
<port class_id_reference="29" object_id="_81">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_61"></inst>
</sink>
</item>
<item class_id_reference="32" object_id="_82">
<type>1</type>
<name>p_mul_stencil_stream_s</name>
<ssdmobj_id>19</ssdmobj_id>
<ctype>0</ctype>
<depth>1</depth>
<bitwidth>128</bitwidth>
<source class_id_reference="28" object_id="_83">
<port class_id_reference="29" object_id="_84">
<name>in</name>
<dir>3</dir>
<type>0</type>
</port>
<inst class_id_reference="30" object_id_reference="_61"></inst>
</source>
<sink class_id_reference="28" object_id="_85">
<port class_id_reference="29" object_id="_86">
<name>out</name>
<dir>3</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_67"></inst>
</sink>
</item>
</channel_list>
<net_list class_id="33" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</net_list>
</mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="-1"></fsm>
<res class_id="-1"></res>
<node_label_latency class_id="36" tracking_level="0" version="0">
<count>8</count>
<item_version>0</item_version>
<item class_id="37" tracking_level="0" version="0">
<first>11</first>
<second class_id="38" tracking_level="0" version="0">
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>15</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>19</first>
<second>
<first>0</first>
<second>0</second>
</second>
</item>
<item>
<first>26</first>
<second>
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>27</first>
<second>
<first>2</first>
<second>1</second>
</second>
</item>
<item>
<first>28</first>
<second>
<first>4</first>
<second>1</second>
</second>
</item>
<item>
<first>29</first>
<second>
<first>6</first>
<second>1</second>
</second>
</item>
<item>
<first>30</first>
<second>
<first>7</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="39" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="40" tracking_level="0" version="0">
<first>31</first>
<second class_id="41" tracking_level="0" version="0">
<first>0</first>
<second>7</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="42" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="43" tracking_level="1" version="0" object_id="_87">
<region_name>hls_target</region_name>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>31</item>
</basic_blocks>
<nodes>
<count>26</count>
<item_version>0</item_version>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>16</region_type>
<interval>0</interval>
<pipe_depth>0</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="44" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="45" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="46" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_reg_nodes>
<dp_regname_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_regname_nodes>
<dp_reg_phi>
<count>0</count>
<item_version>0</item_version>
</dp_reg_phi>
<dp_regname_phi>
<count>0</count>
<item_version>0</item_version>
</dp_regname_phi>
<dp_port_io_nodes class_id="47" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_port_io_nodes>
<port2core class_id="48" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
| 28.885813 | 141 | 0.606882 |
4dc045407a26d99d8396cac162e63f17446daf70 | 749 | adb | Ada | examples/ada/default.adb | hsutter/compiler-explorer | 6ea766981424db1e7c952a1bb5161a6eaba6ddc6 | [
"BSD-2-Clause"
] | 4,668 | 2017-01-02T19:35:10.000Z | 2020-05-16T03:18:45.000Z | examples/ada/default.adb | hsutter/compiler-explorer | 6ea766981424db1e7c952a1bb5161a6eaba6ddc6 | [
"BSD-2-Clause"
] | 1,750 | 2017-01-02T19:37:06.000Z | 2020-05-16T14:54:29.000Z | examples/ada/default.adb | hsutter/compiler-explorer | 6ea766981424db1e7c952a1bb5161a6eaba6ddc6 | [
"BSD-2-Clause"
] | 620 | 2017-01-03T00:29:17.000Z | 2020-05-14T09:27:47.000Z | -- This pragma will remove the warning produced by the default
-- CE filename and the procedure name differing,
-- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName
pragma Source_File_Name (Square, Body_File_Name => "example.adb");
-- Type your code here, or load an example.
function Square(num : Integer) return Integer is
begin
return num**2;
end Square;
-- Ada 2012 also provides Expression Functions
-- (http://www.ada-auth.org/standards/12rm/html/RM-6-8.html)
-- as a short hand for functions whose body consists of a
-- single return statement. However they cannot be used as a
-- complication unit.
-- function Square(num : Integer) return Integer is (num**2);
| 41.611111 | 126 | 0.758344 |
188047dbc1d4fe23386408742b127ec72ea3becf | 1,512 | ads | Ada | orka_simd/src/x86/gnat/orka-simd-sse4_1-doubles-math.ads | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 52 | 2016-07-30T23:00:28.000Z | 2022-02-05T11:54:55.000Z | orka_simd/src/x86/gnat/orka-simd-sse4_1-doubles-math.ads | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 79 | 2016-08-01T18:36:48.000Z | 2022-02-27T12:14:20.000Z | orka_simd/src/x86/gnat/orka-simd-sse4_1-doubles-math.ads | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 4 | 2018-04-28T22:36:26.000Z | 2020-11-14T23:00:29.000Z | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Orka.SIMD.SSE2.Doubles;
package Orka.SIMD.SSE4_1.Doubles.Math is
pragma Pure;
use Orka.SIMD.SSE2.Doubles;
function Round (Elements : m128d; Rounding : Unsigned_32) return m128d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_roundpd";
function Round_Nearest_Integer (Elements : m128d) return m128d is
(Round (Elements, 0));
-- Round each element to the nearest integer
function Floor (Elements : m128d) return m128d is
(Round (Elements, 1));
-- Round each element down to an integer value
function Ceil (Elements : m128d) return m128d is
(Round (Elements, 2));
-- Round each element up to an integer value
function Round_Truncate (Elements : m128d) return m128d is
(Round (Elements, 3));
-- Round each element to zero
end Orka.SIMD.SSE4_1.Doubles.Math;
| 34.363636 | 85 | 0.714286 |
0b542646130fb62be9051de4c26c809d74024ff6 | 85 | ads | Ada | tests/syntax_examples/src/test_operator_attribute.ads | TNO/Dependency_Graph_Extractor-Ada | cfcc9132cf181e4db5139c14150f221efa69a6d6 | [
"BSD-3-Clause"
] | 1 | 2022-03-08T13:00:47.000Z | 2022-03-08T13:00:47.000Z | src/tools/Dependency_Graph_Extractor/tests/Syntax_Examples/src/test_operator_attribute.ads | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | src/tools/Dependency_Graph_Extractor/tests/Syntax_Examples/src/test_operator_attribute.ads | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | package Test_Operator_Attribute is
procedure Test;
end Test_Operator_Attribute;
| 14.166667 | 34 | 0.835294 |
127f0974d211099b4e7f51950d30dc2cd73472c2 | 3,879 | ads | Ada | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/s-veboop.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/s-veboop.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/ravenscar-full-stm32f3x4/gnat/s-veboop.ads | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . V E C T O R S . B O O L E A N _ O P E R A T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2002-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains functions for runtime operations on boolean vectors
package System.Vectors.Boolean_Operations is
pragma Pure;
-- Although in general the boolean operations on arrays of booleans are
-- identical to operations on arrays of unsigned words of the same size,
-- for the "not" operator this is not the case as False is typically
-- represented by 0 and true by 1.
function "not" (Item : Vectors.Vector) return Vectors.Vector;
-- The three boolean operations "nand", "nor" and "nxor" are needed
-- for cases where the compiler moves boolean array operations into
-- the body of the loop that iterates over the array elements.
-- Note the following equivalences:
-- (not X) or (not Y) = not (X and Y) = Nand (X, Y)
-- (not X) and (not Y) = not (X or Y) = Nor (X, Y)
-- (not X) xor (not Y) = X xor Y
-- X xor (not Y) = not (X xor Y) = Nxor (X, Y)
function Nand (Left, Right : Boolean) return Boolean;
function Nor (Left, Right : Boolean) return Boolean;
function Nxor (Left, Right : Boolean) return Boolean;
function Nand (Left, Right : Vectors.Vector) return Vectors.Vector;
function Nor (Left, Right : Vectors.Vector) return Vectors.Vector;
function Nxor (Left, Right : Vectors.Vector) return Vectors.Vector;
pragma Inline_Always ("not");
pragma Inline_Always (Nand);
pragma Inline_Always (Nor);
pragma Inline_Always (Nxor);
end System.Vectors.Boolean_Operations;
| 57.895522 | 78 | 0.450374 |
4d2361ef2b0ad09c4c40a50314879e2771e5d68a | 819 | adb | Ada | generated/natools-static_maps-s_expressions-templates-dates-t.adb | faelys/natools | 947c004e6f69ca144942c6af40e102d089223cf8 | [
"0BSD"
] | null | null | null | generated/natools-static_maps-s_expressions-templates-dates-t.adb | faelys/natools | 947c004e6f69ca144942c6af40e102d089223cf8 | [
"0BSD"
] | null | null | null | generated/natools-static_maps-s_expressions-templates-dates-t.adb | faelys/natools | 947c004e6f69ca144942c6af40e102d089223cf8 | [
"0BSD"
] | null | null | null | -- Generated at 2015-06-24 18:19:13 +0000 by Natools.Static_Hash_Maps
-- from src/natools-s_expressions-templates-dates-maps.sx
with Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds;
with Natools.Static_Maps.S_Expressions.Templates.Dates.Zones;
function Natools.Static_Maps.S_Expressions.Templates.Dates.T
return Boolean is
begin
for I in Map_1_Keys'Range loop
if Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds.Hash
(Map_1_Keys (I).all) /= I
then
return False;
end if;
end loop;
for I in Map_2_Keys'Range loop
if Natools.Static_Maps.S_Expressions.Templates.Dates.Zones.Hash
(Map_2_Keys (I).all) /= I
then
return False;
end if;
end loop;
return True;
end Natools.Static_Maps.S_Expressions.Templates.Dates.T;
| 30.333333 | 70 | 0.715507 |
fba241b57e00823396e4021ed0c3a532da14069d | 8,227 | adb | Ada | tools/aflex/src/scanner-io.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | tools/aflex/src/scanner-io.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | tools/aflex/src/scanner-io.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | package body scanner.IO is
use Ada.Wide_Wide_Text_IO;
-- Gets input and stuffs it into 'buf'. number of characters read, or
-- YY_NULL is returned in 'result'.
procedure YY_Input
(Buf : out Unbounded_Character_Array;
Result : out Integer;
Max_Size : integer)
is
C : Wide_Wide_character;
I : Integer := 1;
Loc : Integer := Buf'First;
begin
if Is_Open (User_Input_File) then
while I <= Max_Size loop
if End_Of_Line (User_Input_File) then
-- Ada ate our newline, put it back on the end.
Buf (Loc) := Ada.Characters.Wide_Wide_Latin_1.LF;
Skip_Line (User_Input_File, 1);
else
-- UCI CODES CHANGED:
-- The following codes are modified. Previous codes is commented out.
-- The purpose of doing this is to make it possible to set Temp_Line
-- in Ayacc-extension specific codes. Definitely, we can read the character
-- into the Temp_Line and then set the buf. But Temp_Line will only
-- be used in Ayacc-extension specific codes which makes this approach impossible.
Get (User_Input_File, C);
Buf (Loc) := C;
-- get(user_input_file, buf(loc));
end if;
Loc := Loc + 1;
I := I + 1;
end loop;
else
while I <= Max_Size loop
if end_of_line then
-- Ada ate our newline, put it back on the end.
Buf (Loc) := Ada.Characters.Wide_Wide_Latin_1.LF;
Skip_Line (1);
else
-- The following codes are modified. Previous codes is commented out.
-- The purpose of doing this is to make it possible to set Temp_Line
-- in Ayacc-extension specific codes. Definitely, we can read the character
-- into the Temp_Line and then set the buf. But Temp_Line will only
-- be used in Ayacc-extension specific codes which makes this approach impossible.
get(c);
buf(loc) := c;
-- get(buf(loc));
end if;
loc := loc + 1;
i := i + 1;
end loop;
end if; -- for input file being standard input
result := i - 1;
exception
when END_ERROR => result := i - 1;
-- when we hit EOF we need to set yy_eof_has_been_seen
yy_eof_has_been_seen := true;
end YY_INPUT;
-- yy_get_next_buffer - try to read in new buffer
--
-- returns a code representing an action
-- EOB_ACT_LAST_MATCH -
-- EOB_ACT_RESTART_SCAN - restart the scanner
-- EOB_ACT_END_OF_FILE - end of file
function yy_get_next_buffer return eob_action_type is
dest : integer := 0;
source : integer := yytext_ptr - 1; -- copy prev. char, too
number_to_move : integer;
ret_val : eob_action_type;
num_to_read : integer;
begin
if ( yy_c_buf_p > yy_n_chars + 1 ) then
raise NULL_IN_INPUT;
end if;
-- try to read more data
-- first move last chars to start of buffer
number_to_move := yy_c_buf_p - yytext_ptr;
for i in 0..number_to_move - 1 loop
yy_ch_buf.data (dest) := yy_ch_buf.data (source);
dest := dest + 1;
source := source + 1;
end loop;
if ( yy_eof_has_been_seen ) then
-- don't do the read, it's not guaranteed to return an EOF,
-- just force an EOF
yy_n_chars := 0;
else
num_to_read := YY_BUF_SIZE - number_to_move - 1;
if ( num_to_read > YY_READ_BUF_SIZE ) then
num_to_read := YY_READ_BUF_SIZE;
end if;
-- read in more data
YY_INPUT( yy_ch_buf.data (number_to_move..yy_ch_buf.data'last), yy_n_chars, num_to_read );
end if;
if ( yy_n_chars = 0 ) then
if ( number_to_move = 1 ) then
ret_val := EOB_ACT_END_OF_FILE;
else
ret_val := EOB_ACT_LAST_MATCH;
end if;
yy_eof_has_been_seen := true;
else
ret_val := EOB_ACT_RESTART_SCAN;
end if;
yy_n_chars := yy_n_chars + number_to_move;
yy_ch_buf.data (yy_n_chars) := YY_END_OF_BUFFER_CHAR;
yy_ch_buf.data (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR;
-- yytext begins at the second character in
-- yy_ch_buf; the first character is the one which
-- preceded it before reading in the latest buffer;
-- it needs to be kept around in case it's a
-- newline, so yy_get_previous_state() will have
-- with '^' rules active
yytext_ptr := 1;
return ret_val;
end yy_get_next_buffer;
procedure YYUnput (C : Wide_Wide_Character; YY_BP: in out Integer) is
number_to_move : Integer;
dest : integer;
source : integer;
tmp_yy_cp : integer;
begin
tmp_yy_cp := yy_c_buf_p;
if ( tmp_yy_cp < 2 ) then
-- need to shift things up to make room
number_to_move := yy_n_chars + 2; -- +2 for EOB chars
dest := YY_BUF_SIZE + 2;
source := number_to_move;
while ( source > 0 ) loop
dest := dest - 1;
source := source - 1;
yy_ch_buf.data (dest) := yy_ch_buf.data (source);
end loop;
tmp_yy_cp := tmp_yy_cp + dest - source;
yy_bp := yy_bp + dest - source;
yy_n_chars := YY_BUF_SIZE;
if ( tmp_yy_cp < 2 ) then
raise PUSHBACK_OVERFLOW;
end if;
end if;
if tmp_yy_cp > yy_bp
and then yy_ch_buf.data (tmp_yy_cp-1) = Ada.Characters.Wide_Wide_Latin_1.LF
then
yy_ch_buf.data (tmp_yy_cp-2) := Ada.Characters.Wide_Wide_Latin_1.LF;
end if;
tmp_yy_cp := tmp_yy_cp - 1;
yy_ch_buf.data (tmp_yy_cp) := c;
-- Note: this code is the text of YY_DO_BEFORE_ACTION, only
-- here we get different yy_cp and yy_bp's
yytext_ptr := yy_bp;
yy_c_buf_p := tmp_yy_cp;
end yyunput;
procedure Unput (C : Wide_Wide_Character) is
begin
YYUnput (C, yy_bp);
end Unput;
function Input return Wide_Wide_Character is
C : Wide_Wide_Character;
YY_CP : Integer := YY_C_Buf_P;
begin
if YY_CH_Buf.Data (YY_C_Buf_P) = YY_END_OF_BUFFER_CHAR then
-- need more input
yytext_ptr := yy_c_buf_p;
yy_c_buf_p := yy_c_buf_p + 1;
case yy_get_next_buffer is
-- this code, unfortunately, is somewhat redundant with
-- that above
when EOB_ACT_END_OF_FILE =>
if yywrap then
yy_c_buf_p := yytext_ptr;
return Ada.Characters.Wide_Wide_Latin_1.NUL;
end if;
yy_ch_buf.data (0) := Ada.Characters.Wide_Wide_Latin_1.LF;
yy_n_chars := 1;
yy_ch_buf.data (yy_n_chars) := YY_END_OF_BUFFER_CHAR;
yy_ch_buf.data (yy_n_chars + 1) := YY_END_OF_BUFFER_CHAR;
yy_eof_has_been_seen := false;
yy_c_buf_p := 1;
yytext_ptr := yy_c_buf_p;
return Input;
when EOB_ACT_RESTART_SCAN =>
yy_c_buf_p := yytext_ptr;
when EOB_ACT_LAST_MATCH =>
raise UNEXPECTED_LAST_MATCH;
when others => null;
end case;
end if;
c := yy_ch_buf.data (yy_c_buf_p);
yy_c_buf_p := yy_c_buf_p + 1;
return C;
end Input;
procedure Output (C : Wide_Wide_Character) is
begin
if Is_Open (User_Output_File) then
Put (User_Output_File, C);
else
Put (C);
end if;
end Output;
-- Default yywrap function - always treat EOF as an EOF
function YYWrap return Boolean is
begin
return True;
end YYWrap;
procedure Open_Input (FName : String) is
begin
YY_Init := True;
Open (User_Input_File, In_File, FName, "wcem=8");
end Open_Input;
procedure Create_Output (FName : String := "") is
begin
if fname /= "" then
Create (User_Output_File, Out_File, FName);
end if;
end Create_Output;
procedure Close_Input is
begin
if Is_Open (User_Input_File) then
Close (User_Input_File);
end if;
end Close_Input;
procedure Close_Output is
begin
if Is_Open (User_Output_File) then
Close (User_Output_File);
end if;
end Close_Output;
end scanner.IO;
| 28.866667 | 94 | 0.603622 |
4d985e117146e00b8cbfa44df2d4332fdc82f319 | 2,767 | ads | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-secain.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-secain.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-secain.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . S T R I N G S . E Q U A L _ C A S E _ I N S E N S I T I V E --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
function Ada.Strings.Equal_Case_Insensitive
(Left, Right : String) return Boolean;
pragma Pure (Ada.Strings.Equal_Case_Insensitive);
-- Performs a case-insensitive equality test of Left and Right. This is
-- useful as the generic actual equivalence operation (Equivalent_Keys)
-- when instantiating a hashed container package with type String as the
-- key. It is also useful as the generic actual equality operator when
-- instantiating a container package with type String as the element,
-- allowing case-insensitive container equality tests.
| 70.948718 | 78 | 0.452837 |
10f89efc992f86c51ceb3a90b2642b07c69856de | 97 | ada | Ada | hello_worlds/ADA.ada | TejasAvinashShetty/code2tex | a21e40dd144ab0eeef7a5214be01e41389e308e7 | [
"MIT"
] | 23 | 2016-04-14T13:01:33.000Z | 2022-02-18T07:33:37.000Z | hello_worlds/ADA.ada | TejasAvinashShetty/code2tex | a21e40dd144ab0eeef7a5214be01e41389e308e7 | [
"MIT"
] | 10 | 2016-12-08T16:15:16.000Z | 2021-01-18T15:58:13.000Z | hello_worlds/ADA.ada | TejasAvinashShetty/code2tex | a21e40dd144ab0eeef7a5214be01e41389e308e7 | [
"MIT"
] | 14 | 2016-05-27T19:34:45.000Z | 2021-05-21T03:35:27.000Z | with Ada.Text_Io;
procedure Hello_World is
begin
Ada.Text_Io.Put_Line("Hello World!");
end;
| 13.857143 | 41 | 0.742268 |
0b85c690b26ac4bf51ca190b6a1303310cc4254e | 2,130 | adb | Ada | unit_tests/colour_test_cases.adb | Fabien-Chouteau/sdlada | f08d72e3f5dcec228d68fb5b6681ea831f81ef47 | [
"Zlib"
] | 1 | 2021-10-30T14:41:56.000Z | 2021-10-30T14:41:56.000Z | unit_tests/colour_test_cases.adb | Fabien-Chouteau/sdlada | f08d72e3f5dcec228d68fb5b6681ea831f81ef47 | [
"Zlib"
] | null | null | null | unit_tests/colour_test_cases.adb | Fabien-Chouteau/sdlada | f08d72e3f5dcec228d68fb5b6681ea831f81ef47 | [
"Zlib"
] | null | null | null | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- Colour_Test_Cases
--------------------------------------------------------------------------------------------------------------------
with AUnit.Assertions; use AUnit.Assertions;
with SDL.Video.Palettes;
package body Colour_Test_Cases is
overriding
function Name (Test : Colour_Test_Case) return Message_String is
begin
return Format ("Colour test");
end Name;
overriding
procedure Run_Test (Test : in out Colour_Test_Case) is
use type SDL.Video.Palettes.Colour_Component;
Colour : SDL.Video.Palettes.Colour := (Red => 16#FF#, Green => 16#DD#, Blue => 16#AA#, Alpha => 16#88#);
begin
Assert (Colour.Red = C_Test.Red, "Red values do not match");
Assert (Colour.Green = C_Test.Green, "Green values do not match");
Assert (Colour.Blue = C_Test.Blue, "Blue values do not match");
Assert (Colour.Alpha = C_Test.Alpha, "Alpha values do not match");
end Run_Test;
end Colour_Test_Cases;
| 45.319149 | 116 | 0.59108 |
4ddb1b34294eb0963c941080b228a33f4c556b99 | 1,683 | ads | Ada | gdb/testsuite/gdb.ada/mi_variant/pck.ads | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | 1 | 2020-10-14T03:24:35.000Z | 2020-10-14T03:24:35.000Z | gdb/testsuite/gdb.ada/mi_variant/pck.ads | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | gdb/testsuite/gdb.ada/mi_variant/pck.ads | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2020-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pck is
type Rec_Type (C : Character := 'd') is record
case C is
when Character'First => X_First : Integer;
when Character'Val (127) => X_127 : Integer;
when Character'Val (128) => X_128 : Integer;
when Character'Last => X_Last : Integer;
when others => null;
end case;
end record;
type Second_Type (I : Integer) is record
One: Integer;
case I is
when -5 .. 5 =>
X : Integer;
when others =>
Y : Integer;
end case;
end record;
type Nested_And_Variable (One, Two: Integer) is record
Str : String (1 .. One);
case One is
when 0 =>
null;
when others =>
OneValue : Integer;
Str2 : String (1 .. Two);
case Two is
when 0 =>
null;
when others =>
TwoValue : Integer;
end case;
end case;
end record;
end Pck;
| 30.6 | 73 | 0.602496 |
0badcd019bac330ef95af403eaf834327dcb6592 | 837 | adb | Ada | gdb/testsuite/gdb.ada/packed_array/pck.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | 1 | 2020-10-14T03:24:35.000Z | 2020-10-14T03:24:35.000Z | gdb/testsuite/gdb.ada/packed_array/pck.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | gdb/testsuite/gdb.ada/packed_array/pck.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | -- Copyright (C) 2011-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
function Ident (I : Integer) return Integer is
begin
return I;
end Ident;
end Pck;
| 38.045455 | 73 | 0.725209 |
50a1a81e9e438e14c8df642d4b90ef2d7ccd1ba0 | 632 | adb | Ada | barrier.adb | philipbjorge/Parallel-Elliptic-Partial-Differential-Equation-Solver | b536f0a51c7fbceb13b2360fc7d3670f58a094fc | [
"MIT"
] | 1 | 2017-03-10T23:17:29.000Z | 2017-03-10T23:17:29.000Z | barrier.adb | philipbjorge/Parallel-Elliptic-Partial-Differential-Equation-Solver | b536f0a51c7fbceb13b2360fc7d3670f58a094fc | [
"MIT"
] | null | null | null | barrier.adb | philipbjorge/Parallel-Elliptic-Partial-Differential-Equation-Solver | b536f0a51c7fbceb13b2360fc7d3670f58a094fc | [
"MIT"
] | null | null | null | -- Philip Bjorge
-- Simple barrier using protected types that
-- waits on a certain number of entrants
package body Barrier is
protected body Barrier_Type is
entry Here when not leave is begin
count := count + 1;
if count < wait_for then
requeue Wait;
else
count := count - 1;
if count /= 0 then
leave := True;
end if;
end if;
end;
entry Wait when leave is begin
count := count - 1;
if count = 0 then
leave := False;
end if;
end;
end Barrier_Type;
end Barrier;
| 22.571429 | 44 | 0.530063 |
12c61b5816f627152f996b0f7c195485d001e3af | 2,422 | ads | Ada | src/skill-containers-arrays.ads | skill-lang/adaCommon | b27bccb8fa1c8b299ab98a82741a648183e41d3c | [
"BSD-3-Clause"
] | null | null | null | src/skill-containers-arrays.ads | skill-lang/adaCommon | b27bccb8fa1c8b299ab98a82741a648183e41d3c | [
"BSD-3-Clause"
] | null | null | null | src/skill-containers-arrays.ads | skill-lang/adaCommon | b27bccb8fa1c8b299ab98a82741a648183e41d3c | [
"BSD-3-Clause"
] | null | null | null | -- ___ _ ___ _ _ --
-- / __| |/ (_) | | Common SKilL implementation --
-- \__ \ ' <| | | |__ skills vector container implementation --
-- |___/_|\_\_|_|____| by: Dennis Przytarski, Timm Felden --
-- --
pragma Ada_2012;
with Ada.Finalization;
with Ada.Unchecked_Conversion;
with Skill.Types;
with Skill.Containers.Vectors;
-- arrays used by skill; those are basically ada vectors with template aware boxing
generic
type T is private;
package Skill.Containers.Arrays is
pragma Warnings(Off);
use Skill.Types;
function Cast is new Ada.Unchecked_Conversion (Box, T);
function Cast is new Ada.Unchecked_Conversion (T, Box);
package Vec is new Skill.Containers.Vectors (Natural, T);
type Array_T is new Boxed_Array_T with record
This : Vec.Vector;
end record;
type Ref is access Array_T;
type Iterator_T is new Array_Iterator_T with record
This : Vec.Vector;
Cursor : Natural;
end record;
function Has_Next (This : access Iterator_T) return Boolean is
(This.This.Check_Index (This.Cursor));
function Next (This : access Iterator_T) return Skill.Types.Box;
procedure Free (This : access Array_T);
procedure Free (This : access Iterator_T);
procedure Append (This : access Array_T; V : Box);
procedure Add (This : access Array_T; V : Box);
function Get
(This : access Array_T;
I : Natural) return Box is
(Cast (This.This.Element (I)));
-- append all elements of that to this
procedure Append_All(This : access Array_T; That : Ref);
-- prepend all elements of that to this
procedure Prepend_All(This : access Array_T; That : Ref);
procedure Update (This : access Array_T; I : Natural; V : Box);
procedure Ensure_Size (This : access Array_T; I : Natural);
function Length
(This : access Array_T) return Natural is
(Vec.Length (This.This));
overriding
function Iterator (This : access Array_T) return Array_Iterator is
(new Iterator_T'(This => This.This, Cursor => 0));
-- create a new container
function Make return Ref;
-- turn a box into a container of right type
function Unboxed is new Ada.Unchecked_Conversion (Box, Ref);
end Skill.Containers.Arrays;
| 31.051282 | 83 | 0.631709 |
1c690fa7518d50a213273c41f28f29f767fa5fb6 | 2,036 | adb | Ada | src/gl/implementation/gl-objects-lists.adb | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 79 | 2015-04-20T23:10:02.000Z | 2022-03-04T13:50:56.000Z | src/gl/implementation/gl-objects-lists.adb | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 126 | 2015-09-10T10:41:34.000Z | 2022-03-20T11:25:40.000Z | src/gl/implementation/gl-objects-lists.adb | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 20 | 2015-03-17T07:15:57.000Z | 2022-02-02T17:12:11.000Z | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
package body GL.Objects.Lists is
function Create (Raw : UInt_Array) return List is
begin
return List'(Count => Raw'Length, Contents => Raw);
end Create;
function First (Object : List) return Cursor is
begin
if Object.Count = 0 then
return No_Element;
else
return Cursor'(Object => Object'Unchecked_Access, Index => 1);
end if;
end First;
function Last (Object : List) return Cursor is
begin
if Object.Count = 0 then
return No_Element;
else
return Cursor'(Object => Object'Unchecked_Access,
Index => Object.Contents'Length);
end if;
end Last;
function Next (Current : Cursor) return Cursor is
begin
if Current = No_Element then
raise Constraint_Error;
elsif Current.Index = Current.Object.Contents'Length then
return No_Element;
else
return Cursor'(Current.Object, Current.Index + 1);
end if;
end Next;
function Previous (Current : Cursor) return Cursor is
begin
if Current = No_Element then
raise Constraint_Error;
elsif Current.Index = 1 then
return No_Element;
else
return Cursor'(Current.Object, Current.Index - 1);
end if;
end Previous;
function Has_Next (Current : Cursor) return Boolean is
begin
return Current /= No_Element and then
Current.Index /= Current.Object.Contents'Length;
end Has_Next;
function Has_Previous (Current : Cursor) return Boolean is
begin
return Current /= No_Element and then Current.Index /= 1;
end Has_Previous;
function Element (Current : Cursor) return Object_Type is
begin
if Current = No_Element then
raise Constraint_Error;
else
return Generate_From_Id (Current.Object.Contents (Current.Index));
end if;
end Element;
end GL.Objects.Lists;
| 27.890411 | 75 | 0.645874 |
a13711048c191fb8e2cc6dd2964e77e0e16cd880 | 659 | ada | Ada | examples/Ada/tasksink2.ada | dcramer/zguide | a07fe97c4c597e6401b4281ae07c3a156590f4c6 | [
"Zed",
"X11",
"MIT"
] | 2 | 2015-09-24T19:53:04.000Z | 2015-11-06T10:22:53.000Z | examples/Ada/tasksink2.ada | gaubert/zguide | e24c02481c47b129a37f261d1109140572f255f4 | [
"Zed",
"X11",
"MIT"
] | null | null | null | examples/Ada/tasksink2.ada | gaubert/zguide | e24c02481c47b129a37f261d1109140572f255f4 | [
"Zed",
"X11",
"MIT"
] | null | null | null | No-one has translated the tasksink2 example into Ada yet. Be the first to create
tasksink2 in Ada and get one free Internet! If you're the author of the Ada
binding, this is a great way to get people to use 0MQ in Ada.
To submit a new translation email it to [email protected]. Please:
* Stick to identical functionality and naming used in examples so that readers
can easily compare languages.
* You MUST place your name as author in the examples so readers can contact you.
* You MUST state in the email that you license your code under the MIT/X11
license.
Subscribe to this list at http://lists.zeromq.org/mailman/listinfo/zeromq-dev.
| 47.071429 | 81 | 0.776935 |
4de9c2c8aaec64b2b72b6d84574a72f98629fd78 | 13,304 | adb | Ada | bb-runtimes/src/s-bbbosu__erc32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/src/s-bbbosu__erc32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/src/s-bbbosu__erc32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . B O A R D _ S U P P O R T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2006 The European Space Agency --
-- Copyright (C) 2003-2016, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
-- There are page numbers in the comments below, please provide the reference
-- to the document (here in this header) to which these references apply ???
pragma Restrictions (No_Elaboration_Code);
with System.BB.Board_Support.ERC32;
with System.BB.Parameters;
package body System.BB.Board_Support is
use type ERC32.Scaler_8;
use type ERC32.Timers_Counter;
use CPU_Primitives;
package Registers renames ERC32;
-----------------------
-- Local Definitions --
-----------------------
Periodic_Scaler : constant := 0;
-- In order to obtain the highest granularity of the clock we set the
-- scaler to 0.
Alarm_Scaler : constant := 0;
-- In order to obtain the highest resolution of the alarm timer we set
-- the scaler to 0.
Periodic_Count : constant := Registers.Timers_Counter'Last - 1;
-- Value to be loaded in the clock counter to accomplish the
-- Clock_Interrupt_Period.
--
-- One is subtracted from Timers_Counter'Last because when the Scaler is
-- set to 0, the timeout period will be the counter reload value plus 1.
-- Constants defining the external interrupts
General_Purpose_Timer : constant System.BB.Interrupts.Interrupt_ID := 12;
Timer_Control_Mirror : Registers.Timer_Control_Register;
pragma Volatile (Timer_Control_Mirror);
-- Timer_Control register cannot be read. So the following object holds a
-- copy of the Timer_Control register value.
----------------------
-- Local Procedures --
----------------------
procedure Stop_Watch_Dog;
pragma Inline (Stop_Watch_Dog);
-- Stop the watch dog timer
procedure Initialize_Memory;
pragma Inline (Initialize_Memory);
-- Initialize the memory on the board
procedure Initialize_Clock;
-- Perform all the initialization related to the clock
------------------------
-- Alarm_Interrupt_ID --
------------------------
function Alarm_Interrupt_ID return Interrupts.Interrupt_ID is
begin
return General_Purpose_Timer;
end Alarm_Interrupt_ID;
---------------------------
-- Clear_Alarm_Interrupt --
---------------------------
procedure Clear_Alarm_Interrupt is
begin
-- From MEC Specification Document (MCD/SPC/0009/SE) page 35
-- The MEC includes a specific register called Interrupt Pending
-- Register, which reflects the pending interrupts.
-- The interrupts in the IPR are cleared automatically when the
-- interrupt is acknowledged. The MEC will sample the trap address in
-- order to know which bit to clear. Therefore, this procedure has a
-- null body for this target.
null;
end Clear_Alarm_Interrupt;
-----------------------------
-- Clear_Interrupt_Request --
-----------------------------
procedure Clear_Interrupt_Request
(Interrupt : System.BB.Interrupts.Interrupt_ID)
is
begin
-- Nothing to do for the IPIC
null;
end Clear_Interrupt_Request;
--------------------------
-- Clear_Poke_Interrupt --
--------------------------
procedure Clear_Poke_Interrupt is
begin
-- No Poke interrupt available for ERC32
raise Program_Error;
end Clear_Poke_Interrupt;
---------------------------
-- Priority_Of_Interrupt --
---------------------------
function Priority_Of_Interrupt
(Interrupt : System.BB.Interrupts.Interrupt_ID) return System.Any_Priority
is
begin
-- Assert that it is a real interrupt
pragma Assert (Interrupt /= System.BB.Interrupts.No_Interrupt);
return (Any_Priority (Interrupt) + Interrupt_Priority'First - 1);
end Priority_Of_Interrupt;
----------------------
-- Initialize_Board --
----------------------
procedure Initialize_Board is
begin
-- The initialization of the ERC32 board consists on stopping the watch
-- dog timer, initializing the memory, and initializing the clock in
-- order to have the desired granularity and range.
Stop_Watch_Dog;
Initialize_Memory;
Initialize_Clock;
end Initialize_Board;
----------------------
-- Initialize_Clock --
----------------------
procedure Initialize_Clock is
Real_Time_Clock_Scaler_Aux : Registers.Real_Time_Clock_Scaler_Register;
begin
-- Set the scaler for the clock
Real_Time_Clock_Scaler_Aux := Registers.Real_Time_Clock_Scaler;
Real_Time_Clock_Scaler_Aux.RTCS := Periodic_Scaler;
Registers.Real_Time_Clock_Scaler := Real_Time_Clock_Scaler_Aux;
-- Load the counter for the clock
Registers.Real_Time_Clock_Counter := Periodic_Count;
-- Set the proper bits in mirrored Timer Control Register. The timer
-- used for the clock is programmed in periodic mode.
-- From MEC Specification Document (MCD/SPC/0009/SE) page 50
-- NOTE: All reserved bits have to be written with zeros in order to
-- avoid parity error resulting in a MEC internal error.
Timer_Control_Mirror.Reserved4 := (others => False);
Timer_Control_Mirror.Reserved20 := (others => False);
Timer_Control_Mirror.RTCCR := True;
Timer_Control_Mirror.RTCCL := True;
Timer_Control_Mirror.RTCSL := True;
Timer_Control_Mirror.RTCSE := True;
-- Do not modify General Purpose Timer downcounter
Timer_Control_Mirror.GCL := False;
Timer_Control_Mirror.GSL := False;
-- Write MEC Timer Control Register
Registers.Timer_Control := Timer_Control_Mirror;
end Initialize_Clock;
-----------------------
-- Initialize_Memory --
-----------------------
procedure Initialize_Memory is
begin
-- Nothing to be done for the ERC32
null;
end Initialize_Memory;
------------------------
-- Max_Timer_Interval --
------------------------
function Max_Timer_Interval return Timer_Interval is
begin
return Timer_Interval'Last;
end Max_Timer_Interval;
-----------------------
-- Poke_Interrupt_ID --
-----------------------
function Poke_Interrupt_ID return Interrupts.Interrupt_ID is
begin
-- No Poke interrupt available for ERC32
raise Program_Error;
-- Unreachable code
return Interrupts.Interrupt_ID'First;
end Poke_Interrupt_ID;
---------------------------
-- Get_Interrupt_Request --
---------------------------
function Get_Interrupt_Request
(Vector : CPU_Primitives.Vector_Id)
return System.BB.Interrupts.Interrupt_ID
is
begin
-- The range corresponding to asynchronous traps is in 16#11# .. 16#1F#
pragma Assert (Vector in 16#11# .. 16#1F#);
return System.BB.Interrupts.Interrupt_ID (Vector - 16#10#);
end Get_Interrupt_Request;
-------------------------------
-- Install_Interrupt_Handler --
-------------------------------
procedure Install_Interrupt_Handler
(Handler : Address;
Interrupt : Interrupts.Interrupt_ID;
Prio : Interrupt_Priority)
is
pragma Unreferenced (Prio);
begin
CPU_Primitives.Install_Trap_Handler
(Handler, CPU_Primitives.Vector_Id (Interrupt + 16#10#));
end Install_Interrupt_Handler;
----------------
-- Read_Clock --
----------------
function Read_Clock return Timer_Interval is
begin
return
Timer_Interval (Periodic_Count - Registers.Real_Time_Clock_Counter);
end Read_Clock;
---------------
-- Set_Alarm --
---------------
procedure Set_Alarm (Ticks : Timer_Interval) is
General_Purpose_Timer_Scaler_Aux :
Registers.General_Purpose_Timer_Scaler_Register;
Interrupt_Mask_Aux : Registers.Interrupt_Mask_Register;
begin
-- Alarm Clock downcount will reach 0 in Ticks. The granularity of
-- time intervals is equal to Clock Period.
-- Set the scaler
General_Purpose_Timer_Scaler_Aux :=
Registers.General_Purpose_Timer_Scaler;
General_Purpose_Timer_Scaler_Aux.GPTS := Alarm_Scaler;
Registers.General_Purpose_Timer_Scaler :=
General_Purpose_Timer_Scaler_Aux;
-- Load the counter
Registers.General_Purpose_Timer_Counter :=
Registers.Timers_Counter (Ticks);
-- Set the proper bits in mirrored Timer Control Register.
-- General Purpose Timer is used in one-shot mode.
Timer_Control_Mirror.GCR := False;
Timer_Control_Mirror.GCL := True;
Timer_Control_Mirror.GSE := True;
Timer_Control_Mirror.GSL := True;
-- Do not modify Timer downcount
Timer_Control_Mirror.RTCCL := False;
Timer_Control_Mirror.RTCSL := False;
-- From MEC Specification Document (MCD/SPC/0009/SE) page 50
-- NOTE: All reserved bits have to be written with zeros in order to
-- avoid parity error resulting in a MEC internal error.
Timer_Control_Mirror.Reserved4 := (others => False);
Timer_Control_Mirror.Reserved20 := (others => False);
-- Write MEC Timer Control Register
Registers.Timer_Control := Timer_Control_Mirror;
-- Enable GPT Interrupts
Interrupt_Mask_Aux := Registers.Interrupt_Mask;
Interrupt_Mask_Aux.General_Purpose_Timer := False;
Registers.Interrupt_Mask := Interrupt_Mask_Aux;
end Set_Alarm;
--------------------------
-- Set_Current_Priority --
--------------------------
procedure Set_Current_Priority (Priority : Integer) is
begin
null; -- No board-specific actions necessary
end Set_Current_Priority;
--------------------
-- Stop_Watch_Dog --
--------------------
procedure Stop_Watch_Dog is
begin
-- From MEC Specification Document (MCD/SPC/0009/SE) page 39
-- After system reset or processor reset, the watch dog timer is enabled
-- and starts running. By writing to the Trap Door Set after system
-- reset, the timer can be disabled.
Registers.Watchdog_Trap_Door_Set := 0;
end Stop_Watch_Dog;
----------------------
-- Ticks_Per_Second --
----------------------
function Ticks_Per_Second return Natural is
begin
-- The prescaler is clocked by the system clock. When it underflows, it
-- is reloaded from the prescaler reload register and a timer tick is
-- generated. The effective division rate is therefore equal to the
-- prescaler reload register value plus 1.
return Parameters.Clock_Frequency / (Periodic_Scaler + 1);
end Ticks_Per_Second;
end System.BB.Board_Support;
| 33.59596 | 79 | 0.584185 |
20fc497ad802e3cb8ecd5919cbf37077f1ab467d | 15,815 | ads | Ada | software/hal/hpl/STM32/svd/stm32f40x/stm32_svd-usart.ads | TUM-EI-RCS/StratoX | 5fdd04e01a25efef6052376f43ce85b5bc973392 | [
"BSD-3-Clause"
] | 12 | 2017-06-08T14:19:57.000Z | 2022-03-09T02:48:59.000Z | software/hal/hpl/STM32/svd/stm32f40x/stm32_svd-usart.ads | TUM-EI-RCS/StratoX | 5fdd04e01a25efef6052376f43ce85b5bc973392 | [
"BSD-3-Clause"
] | 6 | 2017-06-08T13:13:50.000Z | 2020-05-15T09:32:43.000Z | software/hal/hpl/STM32/svd/stm32f40x/stm32_svd-usart.ads | TUM-EI-RCS/StratoX | 5fdd04e01a25efef6052376f43ce85b5bc973392 | [
"BSD-3-Clause"
] | 3 | 2017-06-30T14:05:06.000Z | 2022-02-17T12:20:45.000Z | -- This spec has been automatically generated from STM32F40x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.USART is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register is record
-- Read-only. Parity error
PE : Boolean := False;
-- Read-only. Framing error
FE : Boolean := False;
-- Read-only. Noise detected flag
NF : Boolean := False;
-- Read-only. Overrun error
ORE : Boolean := False;
-- Read-only. IDLE line detected
IDLE : Boolean := False;
-- Read data register not empty
RXNE : Boolean := False;
-- Transmission complete
TC : Boolean := False;
-- Read-only. Transmit data register empty
TXE : Boolean := False;
-- LIN break detection flag
LBD : Boolean := False;
-- CTS flag
CTS : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#3000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
PE at 0 range 0 .. 0;
FE at 0 range 1 .. 1;
NF at 0 range 2 .. 2;
ORE at 0 range 3 .. 3;
IDLE at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TXE at 0 range 7 .. 7;
LBD at 0 range 8 .. 8;
CTS at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- DR_Register --
-----------------
subtype DR_DR_Field is HAL.UInt9;
-- Data register
type DR_Register is record
-- Data value
DR : DR_DR_Field := 16#0#;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR_Register use record
DR at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
------------------
-- BRR_Register --
------------------
subtype BRR_DIV_Fraction_Field is HAL.UInt4;
subtype BRR_DIV_Mantissa_Field is HAL.UInt12;
-- Baud rate register
type BRR_Register is record
-- fraction of USARTDIV
DIV_Fraction : BRR_DIV_Fraction_Field := 16#0#;
-- mantissa of USARTDIV
DIV_Mantissa : BRR_DIV_Mantissa_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for BRR_Register use record
DIV_Fraction at 0 range 0 .. 3;
DIV_Mantissa at 0 range 4 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- CR1_Register --
------------------
-- Control register 1
type CR1_Register is record
-- Send break
SBK : Boolean := False;
-- Receiver wakeup
RWU : Boolean := False;
-- Receiver enable
RE : Boolean := False;
-- Transmitter enable
TE : Boolean := False;
-- IDLE interrupt enable
IDLEIE : Boolean := False;
-- RXNE interrupt enable
RXNEIE : Boolean := False;
-- Transmission complete interrupt enable
TCIE : Boolean := False;
-- TXE interrupt enable
TXEIE : Boolean := False;
-- PE interrupt enable
PEIE : Boolean := False;
-- Parity selection
PS : Boolean := False;
-- Parity control enable
PCE : Boolean := False;
-- Wakeup method
WAKE : Boolean := False;
-- Word length
M : Boolean := False;
-- USART enable
UE : Boolean := False;
-- unspecified
Reserved_14_14 : HAL.Bit := 16#0#;
-- Oversampling mode
OVER8 : Boolean := False;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR1_Register use record
SBK at 0 range 0 .. 0;
RWU at 0 range 1 .. 1;
RE at 0 range 2 .. 2;
TE at 0 range 3 .. 3;
IDLEIE at 0 range 4 .. 4;
RXNEIE at 0 range 5 .. 5;
TCIE at 0 range 6 .. 6;
TXEIE at 0 range 7 .. 7;
PEIE at 0 range 8 .. 8;
PS at 0 range 9 .. 9;
PCE at 0 range 10 .. 10;
WAKE at 0 range 11 .. 11;
M at 0 range 12 .. 12;
UE at 0 range 13 .. 13;
Reserved_14_14 at 0 range 14 .. 14;
OVER8 at 0 range 15 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- CR2_Register --
------------------
subtype CR2_ADD_Field is HAL.UInt4;
subtype CR2_STOP_Field is HAL.UInt2;
-- Control register 2
type CR2_Register is record
-- Address of the USART node
ADD : CR2_ADD_Field := 16#0#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- lin break detection length
LBDL : Boolean := False;
-- LIN break detection interrupt enable
LBDIE : Boolean := False;
-- unspecified
Reserved_7_7 : HAL.Bit := 16#0#;
-- Last bit clock pulse
LBCL : Boolean := False;
-- Clock phase
CPHA : Boolean := False;
-- Clock polarity
CPOL : Boolean := False;
-- Clock enable
CLKEN : Boolean := False;
-- STOP bits
STOP : CR2_STOP_Field := 16#0#;
-- LIN mode enable
LINEN : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register use record
ADD at 0 range 0 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
LBDL at 0 range 5 .. 5;
LBDIE at 0 range 6 .. 6;
Reserved_7_7 at 0 range 7 .. 7;
LBCL at 0 range 8 .. 8;
CPHA at 0 range 9 .. 9;
CPOL at 0 range 10 .. 10;
CLKEN at 0 range 11 .. 11;
STOP at 0 range 12 .. 13;
LINEN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
------------------
-- CR3_Register --
------------------
-- Control register 3
type CR3_Register is record
-- Error interrupt enable
EIE : Boolean := False;
-- IrDA mode enable
IREN : Boolean := False;
-- IrDA low-power
IRLP : Boolean := False;
-- Half-duplex selection
HDSEL : Boolean := False;
-- Smartcard NACK enable
NACK : Boolean := False;
-- Smartcard mode enable
SCEN : Boolean := False;
-- DMA enable receiver
DMAR : Boolean := False;
-- DMA enable transmitter
DMAT : Boolean := False;
-- RTS enable
RTSE : Boolean := False;
-- CTS enable
CTSE : Boolean := False;
-- CTS interrupt enable
CTSIE : Boolean := False;
-- One sample bit method enable
ONEBIT : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR3_Register use record
EIE at 0 range 0 .. 0;
IREN at 0 range 1 .. 1;
IRLP at 0 range 2 .. 2;
HDSEL at 0 range 3 .. 3;
NACK at 0 range 4 .. 4;
SCEN at 0 range 5 .. 5;
DMAR at 0 range 6 .. 6;
DMAT at 0 range 7 .. 7;
RTSE at 0 range 8 .. 8;
CTSE at 0 range 9 .. 9;
CTSIE at 0 range 10 .. 10;
ONEBIT at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-------------------
-- GTPR_Register --
-------------------
subtype GTPR_PSC_Field is HAL.Byte;
subtype GTPR_GT_Field is HAL.Byte;
-- Guard time and prescaler register
type GTPR_Register is record
-- Prescaler value
PSC : GTPR_PSC_Field := 16#0#;
-- Guard time value
GT : GTPR_GT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for GTPR_Register use record
PSC at 0 range 0 .. 7;
GT at 0 range 8 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register_1 is record
-- Read-only. Parity error
PE : Boolean := False;
-- Read-only. Framing error
FE : Boolean := False;
-- Read-only. Noise detected flag
NF : Boolean := False;
-- Read-only. Overrun error
ORE : Boolean := False;
-- Read-only. IDLE line detected
IDLE : Boolean := False;
-- Read data register not empty
RXNE : Boolean := False;
-- Transmission complete
TC : Boolean := False;
-- Read-only. Transmit data register empty
TXE : Boolean := False;
-- LIN break detection flag
LBD : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#6000#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register_1 use record
PE at 0 range 0 .. 0;
FE at 0 range 1 .. 1;
NF at 0 range 2 .. 2;
ORE at 0 range 3 .. 3;
IDLE at 0 range 4 .. 4;
RXNE at 0 range 5 .. 5;
TC at 0 range 6 .. 6;
TXE at 0 range 7 .. 7;
LBD at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
------------------
-- CR2_Register --
------------------
-- Control register 2
type CR2_Register_1 is record
-- Address of the USART node
ADD : CR2_ADD_Field := 16#0#;
-- unspecified
Reserved_4_4 : HAL.Bit := 16#0#;
-- lin break detection length
LBDL : Boolean := False;
-- LIN break detection interrupt enable
LBDIE : Boolean := False;
-- unspecified
Reserved_7_11 : HAL.UInt5 := 16#0#;
-- STOP bits
STOP : CR2_STOP_Field := 16#0#;
-- LIN mode enable
LINEN : Boolean := False;
-- unspecified
Reserved_15_31 : HAL.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR2_Register_1 use record
ADD at 0 range 0 .. 3;
Reserved_4_4 at 0 range 4 .. 4;
LBDL at 0 range 5 .. 5;
LBDIE at 0 range 6 .. 6;
Reserved_7_11 at 0 range 7 .. 11;
STOP at 0 range 12 .. 13;
LINEN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
------------------
-- CR3_Register --
------------------
-- Control register 3
type CR3_Register_1 is record
-- Error interrupt enable
EIE : Boolean := False;
-- IrDA mode enable
IREN : Boolean := False;
-- IrDA low-power
IRLP : Boolean := False;
-- Half-duplex selection
HDSEL : Boolean := False;
-- unspecified
Reserved_4_5 : HAL.UInt2 := 16#0#;
-- DMA enable receiver
DMAR : Boolean := False;
-- DMA enable transmitter
DMAT : Boolean := False;
-- unspecified
Reserved_8_10 : HAL.UInt3 := 16#0#;
-- One sample bit method enable
ONEBIT : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR3_Register_1 use record
EIE at 0 range 0 .. 0;
IREN at 0 range 1 .. 1;
IRLP at 0 range 2 .. 2;
HDSEL at 0 range 3 .. 3;
Reserved_4_5 at 0 range 4 .. 5;
DMAR at 0 range 6 .. 6;
DMAT at 0 range 7 .. 7;
Reserved_8_10 at 0 range 8 .. 10;
ONEBIT at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Universal synchronous asynchronous receiver transmitter
type USART2_Peripheral is record
-- Status register
SR : SR_Register;
-- Data register
DR : DR_Register;
-- Baud rate register
BRR : BRR_Register;
-- Control register 1
CR1 : CR1_Register;
-- Control register 2
CR2 : CR2_Register;
-- Control register 3
CR3 : CR3_Register;
-- Guard time and prescaler register
GTPR : GTPR_Register;
end record
with Volatile;
for USART2_Peripheral use record
SR at 0 range 0 .. 31;
DR at 4 range 0 .. 31;
BRR at 8 range 0 .. 31;
CR1 at 12 range 0 .. 31;
CR2 at 16 range 0 .. 31;
CR3 at 20 range 0 .. 31;
GTPR at 24 range 0 .. 31;
end record;
-- Universal synchronous asynchronous receiver transmitter
USART2_Periph : aliased USART2_Peripheral
with Import, Address => USART2_Base;
-- Universal synchronous asynchronous receiver transmitter
USART3_Periph : aliased USART2_Peripheral
with Import, Address => USART3_Base;
-- Universal synchronous asynchronous receiver transmitter
USART1_Periph : aliased USART2_Peripheral
with Import, Address => USART1_Base;
-- Universal synchronous asynchronous receiver transmitter
USART6_Periph : aliased USART2_Peripheral
with Import, Address => USART6_Base;
-- Universal synchronous asynchronous receiver transmitter
type UART4_Peripheral is record
-- Status register
SR : SR_Register_1;
-- Data register
DR : DR_Register;
-- Baud rate register
BRR : BRR_Register;
-- Control register 1
CR1 : CR1_Register;
-- Control register 2
CR2 : CR2_Register_1;
-- Control register 3
CR3 : CR3_Register_1;
end record
with Volatile;
for UART4_Peripheral use record
SR at 0 range 0 .. 31;
DR at 4 range 0 .. 31;
BRR at 8 range 0 .. 31;
CR1 at 12 range 0 .. 31;
CR2 at 16 range 0 .. 31;
CR3 at 20 range 0 .. 31;
end record;
-- Universal synchronous asynchronous receiver transmitter
UART4_Periph : aliased UART4_Peripheral
with Import, Address => UART4_Base;
-- Universal synchronous asynchronous receiver transmitter
UART5_Periph : aliased UART4_Peripheral
with Import, Address => UART5_Base;
end STM32_SVD.USART;
| 31.13189 | 65 | 0.511224 |
4de6489961de735d3523955ed5df0821b62109b0 | 541 | ada | Ada | Task/Loops-Foreach/Ada/loops-foreach-3.ada | mullikine/RosettaCodeData | 4f0027c6ce83daa36118ee8b67915a13cd23ab67 | [
"Info-ZIP"
] | 1 | 2018-11-09T22:08:38.000Z | 2018-11-09T22:08:38.000Z | Task/Loops-Foreach/Ada/loops-foreach-3.ada | mullikine/RosettaCodeData | 4f0027c6ce83daa36118ee8b67915a13cd23ab67 | [
"Info-ZIP"
] | null | null | null | Task/Loops-Foreach/Ada/loops-foreach-3.ada | mullikine/RosettaCodeData | 4f0027c6ce83daa36118ee8b67915a13cd23ab67 | [
"Info-ZIP"
] | 1 | 2018-11-09T22:08:40.000Z | 2018-11-09T22:08:40.000Z | with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists;
use Ada.Integer_Text_IO, Ada.Containers;
procedure Doubly_Linked_List is
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
use DL_List_Pkg;
procedure Print_Node (Position : Cursor) is
begin
Put (Element (Position));
end Print_Node;
DL_List : List;
begin
DL_List.Append (1);
DL_List.Append (2);
DL_List.Append (3);
-- Iterates through every node of the list.
DL_List.Iterate (Print_Node'Access);
end Doubly_Linked_List;
| 20.807692 | 61 | 0.726433 |
503199728f05d6506ddc425a6d7436313062a203 | 6,264 | adb | Ada | tools-src/gnu/gcc/gcc/ada/stand.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 80 | 2015-01-02T10:14:04.000Z | 2021-06-07T06:29:49.000Z | tools-src/gnu/gcc/gcc/ada/stand.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 9 | 2015-05-14T11:03:12.000Z | 2018-01-04T07:12:58.000Z | tools-src/gnu/gcc/gcc/ada/stand.adb | modern-tomato/tomato | 96f09fab4929c6ddde5c9113f1b2476ad37133c4 | [
"FSFAP"
] | 69 | 2015-01-02T10:45:56.000Z | 2021-09-06T07:52:13.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S T A N D --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992,1993,1994,1995 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System; use System;
with Tree_IO; use Tree_IO;
package body Stand is
---------------
-- Tree_Read --
---------------
procedure Tree_Read is
begin
Tree_Read_Data (Standard_Entity'Address,
Standard_Entity_Array_Type'Size / Storage_Unit);
Tree_Read_Int (Int (Standard_Package_Node));
Tree_Read_Int (Int (Last_Standard_Node_Id));
Tree_Read_Int (Int (Last_Standard_List_Id));
Tree_Read_Int (Int (Standard_Void_Type));
Tree_Read_Int (Int (Standard_Exception_Type));
Tree_Read_Int (Int (Standard_A_String));
Tree_Read_Int (Int (Any_Id));
Tree_Read_Int (Int (Any_Type));
Tree_Read_Int (Int (Any_Access));
Tree_Read_Int (Int (Any_Array));
Tree_Read_Int (Int (Any_Boolean));
Tree_Read_Int (Int (Any_Character));
Tree_Read_Int (Int (Any_Composite));
Tree_Read_Int (Int (Any_Discrete));
Tree_Read_Int (Int (Any_Fixed));
Tree_Read_Int (Int (Any_Integer));
Tree_Read_Int (Int (Any_Numeric));
Tree_Read_Int (Int (Any_Real));
Tree_Read_Int (Int (Any_Scalar));
Tree_Read_Int (Int (Any_String));
Tree_Read_Int (Int (Universal_Integer));
Tree_Read_Int (Int (Universal_Real));
Tree_Read_Int (Int (Universal_Fixed));
Tree_Read_Int (Int (Standard_Integer_8));
Tree_Read_Int (Int (Standard_Integer_16));
Tree_Read_Int (Int (Standard_Integer_32));
Tree_Read_Int (Int (Standard_Integer_64));
Tree_Read_Int (Int (Abort_Signal));
Tree_Read_Int (Int (Standard_Op_Rotate_Left));
Tree_Read_Int (Int (Standard_Op_Rotate_Right));
Tree_Read_Int (Int (Standard_Op_Shift_Left));
Tree_Read_Int (Int (Standard_Op_Shift_Right));
Tree_Read_Int (Int (Standard_Op_Shift_Right_Arithmetic));
end Tree_Read;
----------------
-- Tree_Write --
----------------
procedure Tree_Write is
begin
Tree_Write_Data (Standard_Entity'Address,
Standard_Entity_Array_Type'Size / Storage_Unit);
Tree_Write_Int (Int (Standard_Package_Node));
Tree_Write_Int (Int (Last_Standard_Node_Id));
Tree_Write_Int (Int (Last_Standard_List_Id));
Tree_Write_Int (Int (Standard_Void_Type));
Tree_Write_Int (Int (Standard_Exception_Type));
Tree_Write_Int (Int (Standard_A_String));
Tree_Write_Int (Int (Any_Id));
Tree_Write_Int (Int (Any_Type));
Tree_Write_Int (Int (Any_Access));
Tree_Write_Int (Int (Any_Array));
Tree_Write_Int (Int (Any_Boolean));
Tree_Write_Int (Int (Any_Character));
Tree_Write_Int (Int (Any_Composite));
Tree_Write_Int (Int (Any_Discrete));
Tree_Write_Int (Int (Any_Fixed));
Tree_Write_Int (Int (Any_Integer));
Tree_Write_Int (Int (Any_Numeric));
Tree_Write_Int (Int (Any_Real));
Tree_Write_Int (Int (Any_Scalar));
Tree_Write_Int (Int (Any_String));
Tree_Write_Int (Int (Universal_Integer));
Tree_Write_Int (Int (Universal_Real));
Tree_Write_Int (Int (Universal_Fixed));
Tree_Write_Int (Int (Standard_Integer_8));
Tree_Write_Int (Int (Standard_Integer_16));
Tree_Write_Int (Int (Standard_Integer_32));
Tree_Write_Int (Int (Standard_Integer_64));
Tree_Write_Int (Int (Abort_Signal));
Tree_Write_Int (Int (Standard_Op_Rotate_Left));
Tree_Write_Int (Int (Standard_Op_Rotate_Right));
Tree_Write_Int (Int (Standard_Op_Shift_Left));
Tree_Write_Int (Int (Standard_Op_Shift_Right));
Tree_Write_Int (Int (Standard_Op_Shift_Right_Arithmetic));
end Tree_Write;
end Stand;
| 47.454545 | 78 | 0.556194 |
4d024eef959a16d9a6976c31f9c68ff776d3700b | 4,010 | adb | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-imglli.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-imglli.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-imglli.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ L L I --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Img_LLI is
procedure Set_Digits
(T : Long_Long_Integer;
S : in out String;
P : in out Natural);
-- Set digits of absolute value of T, which is zero or negative. We work
-- with the negative of the value so that the largest negative number is
-- not a special case.
-----------------------------
-- Image_Long_Long_Integer --
-----------------------------
procedure Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
P : out Natural)
is
pragma Assert (S'First = 1);
begin
if V >= 0 then
S (1) := ' ';
P := 1;
else
P := 0;
end if;
Set_Image_Long_Long_Integer (V, S, P);
end Image_Long_Long_Integer;
----------------
-- Set_Digits --
----------------
procedure Set_Digits
(T : Long_Long_Integer;
S : in out String;
P : in out Natural)
is
begin
if T <= -10 then
Set_Digits (T / 10, S, P);
P := P + 1;
S (P) := Character'Val (48 - (T rem 10));
else
P := P + 1;
S (P) := Character'Val (48 - T);
end if;
end Set_Digits;
---------------------------------
-- Set_Image_Long_Long_Integer --
--------------------------------
procedure Set_Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
P : in out Natural) is
begin
if V >= 0 then
Set_Digits (-V, S, P);
else
P := P + 1;
S (P) := '-';
Set_Digits (V, S, P);
end if;
end Set_Image_Long_Long_Integer;
end System.Img_LLI;
| 38.932039 | 78 | 0.412968 |
12246af60c3991b7581d744286bda2d7d73adbfc | 3,227 | ads | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-pack37.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-pack37.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-pack37.ads | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 3 7 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 37
package System.Pack_37 is
pragma Preelaborate;
Bits : constant := 37;
type Bits_37 is mod 2 ** Bits;
for Bits_37'Size use Bits;
-- In all subprograms below, Rev_SSO is set True if the array has the
-- non-default scalar storage order.
function Get_37
(Arr : System.Address;
N : Natural;
Rev_SSO : Boolean) return Bits_37 with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_37
(Arr : System.Address;
N : Natural;
E : Bits_37;
Rev_SSO : Boolean) with Inline;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
end System.Pack_37;
| 52.901639 | 78 | 0.439727 |
1cc7d67ac17cd381519a7c8af4ceb00f8f6c9eb0 | 20,653 | adb | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-stwima.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-stwima.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-stwima.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . W I D E _ M A P S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Ada.Strings.Wide_Maps is
---------
-- "-" --
---------
function "-"
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set;
Result : Wide_Character_Ranges (1 .. LS'Last + RS'Last);
-- Each range on the right can generate at least one more range in
-- the result, by splitting one of the left operand ranges.
N : Natural := 0;
R : Natural := 1;
L : Natural := 1;
Left_Low : Wide_Character;
-- Left_Low is lowest character of the L'th range not yet dealt with
begin
if LS'Last = 0 or else RS'Last = 0 then
return Left;
end if;
Left_Low := LS (L).Low;
while R <= RS'Last loop
-- If next right range is below current left range, skip it
if RS (R).High < Left_Low then
R := R + 1;
-- If next right range above current left range, copy remainder
-- of the left range to the result
elsif RS (R).Low > LS (L).High then
N := N + 1;
Result (N).Low := Left_Low;
Result (N).High := LS (L).High;
L := L + 1;
exit when L > LS'Last;
Left_Low := LS (L).Low;
else
-- Next right range overlaps bottom of left range
if RS (R).Low <= Left_Low then
-- Case of right range complete overlaps left range
if RS (R).High >= LS (L).High then
L := L + 1;
exit when L > LS'Last;
Left_Low := LS (L).Low;
-- Case of right range eats lower part of left range
else
Left_Low := Wide_Character'Succ (RS (R).High);
R := R + 1;
end if;
-- Next right range overlaps some of left range, but not bottom
else
N := N + 1;
Result (N).Low := Left_Low;
Result (N).High := Wide_Character'Pred (RS (R).Low);
-- Case of right range splits left range
if RS (R).High < LS (L).High then
Left_Low := Wide_Character'Succ (RS (R).High);
R := R + 1;
-- Case of right range overlaps top of left range
else
L := L + 1;
exit when L > LS'Last;
Left_Low := LS (L).Low;
end if;
end if;
end if;
end loop;
-- Copy remainder of left ranges to result
if L <= LS'Last then
N := N + 1;
Result (N).Low := Left_Low;
Result (N).High := LS (L).High;
loop
L := L + 1;
exit when L > LS'Last;
N := N + 1;
Result (N) := LS (L);
end loop;
end if;
return (AF.Controlled with
Set => new Wide_Character_Ranges'(Result (1 .. N)));
end "-";
---------
-- "=" --
---------
-- The sorted, discontiguous form is canonical, so equality can be used
function "=" (Left, Right : Wide_Character_Set) return Boolean is
begin
return Left.Set.all = Right.Set.all;
end "=";
-----------
-- "and" --
-----------
function "and"
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set;
Result : Wide_Character_Ranges (1 .. LS'Last + RS'Last);
N : Natural := 0;
L, R : Natural := 1;
begin
-- Loop to search for overlapping character ranges
while L <= LS'Last and then R <= RS'Last loop
if LS (L).High < RS (R).Low then
L := L + 1;
elsif RS (R).High < LS (L).Low then
R := R + 1;
-- Here we have LS (L).High >= RS (R).Low
-- and RS (R).High >= LS (L).Low
-- so we have an overlapping range
else
N := N + 1;
Result (N).Low := Wide_Character'Max (LS (L).Low, RS (R).Low);
Result (N).High :=
Wide_Character'Min (LS (L).High, RS (R).High);
if RS (R).High = LS (L).High then
L := L + 1;
R := R + 1;
elsif RS (R).High < LS (L).High then
R := R + 1;
else
L := L + 1;
end if;
end if;
end loop;
return (AF.Controlled with
Set => new Wide_Character_Ranges'(Result (1 .. N)));
end "and";
-----------
-- "not" --
-----------
function "not"
(Right : Wide_Character_Set) return Wide_Character_Set
is
RS : constant Wide_Character_Ranges_Access := Right.Set;
Result : Wide_Character_Ranges (1 .. RS'Last + 1);
N : Natural := 0;
begin
if RS'Last = 0 then
N := 1;
Result (1) := (Low => Wide_Character'First,
High => Wide_Character'Last);
else
if RS (1).Low /= Wide_Character'First then
N := N + 1;
Result (N).Low := Wide_Character'First;
Result (N).High := Wide_Character'Pred (RS (1).Low);
end if;
for K in 1 .. RS'Last - 1 loop
N := N + 1;
Result (N).Low := Wide_Character'Succ (RS (K).High);
Result (N).High := Wide_Character'Pred (RS (K + 1).Low);
end loop;
if RS (RS'Last).High /= Wide_Character'Last then
N := N + 1;
Result (N).Low := Wide_Character'Succ (RS (RS'Last).High);
Result (N).High := Wide_Character'Last;
end if;
end if;
return (AF.Controlled with
Set => new Wide_Character_Ranges'(Result (1 .. N)));
end "not";
----------
-- "or" --
----------
function "or"
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
LS : constant Wide_Character_Ranges_Access := Left.Set;
RS : constant Wide_Character_Ranges_Access := Right.Set;
Result : Wide_Character_Ranges (1 .. LS'Last + RS'Last);
N : Natural;
L, R : Natural;
begin
N := 0;
L := 1;
R := 1;
-- Loop through ranges in output file
loop
-- If no left ranges left, copy next right range
if L > LS'Last then
exit when R > RS'Last;
N := N + 1;
Result (N) := RS (R);
R := R + 1;
-- If no right ranges left, copy next left range
elsif R > RS'Last then
N := N + 1;
Result (N) := LS (L);
L := L + 1;
else
-- We have two ranges, choose lower one
N := N + 1;
if LS (L).Low <= RS (R).Low then
Result (N) := LS (L);
L := L + 1;
else
Result (N) := RS (R);
R := R + 1;
end if;
-- Loop to collapse ranges into last range
loop
-- Collapse next length range into current result range
-- if possible.
if L <= LS'Last
and then LS (L).Low <= Wide_Character'Succ (Result (N).High)
then
Result (N).High :=
Wide_Character'Max (Result (N).High, LS (L).High);
L := L + 1;
-- Collapse next right range into current result range
-- if possible
elsif R <= RS'Last
and then RS (R).Low <=
Wide_Character'Succ (Result (N).High)
then
Result (N).High :=
Wide_Character'Max (Result (N).High, RS (R).High);
R := R + 1;
-- If neither range collapses, then done with this range
else
exit;
end if;
end loop;
end if;
end loop;
return (AF.Controlled with
Set => new Wide_Character_Ranges'(Result (1 .. N)));
end "or";
-----------
-- "xor" --
-----------
function "xor"
(Left, Right : Wide_Character_Set) return Wide_Character_Set
is
begin
return (Left or Right) - (Left and Right);
end "xor";
------------
-- Adjust --
------------
procedure Adjust (Object : in out Wide_Character_Mapping) is
begin
Object.Map := new Wide_Character_Mapping_Values'(Object.Map.all);
end Adjust;
procedure Adjust (Object : in out Wide_Character_Set) is
begin
Object.Set := new Wide_Character_Ranges'(Object.Set.all);
end Adjust;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Wide_Character_Mapping) is
procedure Free is new Ada.Unchecked_Deallocation
(Wide_Character_Mapping_Values,
Wide_Character_Mapping_Values_Access);
begin
if Object.Map /= Null_Map'Unrestricted_Access then
Free (Object.Map);
end if;
end Finalize;
procedure Finalize (Object : in out Wide_Character_Set) is
procedure Free is new Ada.Unchecked_Deallocation
(Wide_Character_Ranges,
Wide_Character_Ranges_Access);
begin
if Object.Set /= Null_Range'Unrestricted_Access then
Free (Object.Set);
end if;
end Finalize;
----------------
-- Initialize --
----------------
procedure Initialize (Object : in out Wide_Character_Mapping) is
begin
Object := Identity;
end Initialize;
procedure Initialize (Object : in out Wide_Character_Set) is
begin
Object := Null_Set;
end Initialize;
-----------
-- Is_In --
-----------
function Is_In
(Element : Wide_Character;
Set : Wide_Character_Set) return Boolean
is
L, R, M : Natural;
SS : constant Wide_Character_Ranges_Access := Set.Set;
begin
L := 1;
R := SS'Last;
-- Binary search loop. The invariant is that if Element is in any of
-- of the constituent ranges it is in one between Set (L) and Set (R).
loop
if L > R then
return False;
else
M := (L + R) / 2;
if Element > SS (M).High then
L := M + 1;
elsif Element < SS (M).Low then
R := M - 1;
else
return True;
end if;
end if;
end loop;
end Is_In;
---------------
-- Is_Subset --
---------------
function Is_Subset
(Elements : Wide_Character_Set;
Set : Wide_Character_Set) return Boolean
is
ES : constant Wide_Character_Ranges_Access := Elements.Set;
SS : constant Wide_Character_Ranges_Access := Set.Set;
S : Positive := 1;
E : Positive := 1;
begin
loop
-- If no more element ranges, done, and result is true
if E > ES'Last then
return True;
-- If more element ranges, but no more set ranges, result is false
elsif S > SS'Last then
return False;
-- Remove irrelevant set range
elsif SS (S).High < ES (E).Low then
S := S + 1;
-- Get rid of element range that is properly covered by set
elsif SS (S).Low <= ES (E).Low
and then ES (E).High <= SS (S).High
then
E := E + 1;
-- Otherwise we have a non-covered element range, result is false
else
return False;
end if;
end loop;
end Is_Subset;
---------------
-- To_Domain --
---------------
function To_Domain
(Map : Wide_Character_Mapping) return Wide_Character_Sequence
is
begin
return Map.Map.Domain;
end To_Domain;
----------------
-- To_Mapping --
----------------
function To_Mapping
(From, To : Wide_Character_Sequence) return Wide_Character_Mapping
is
Domain : Wide_Character_Sequence (1 .. From'Length);
Rangev : Wide_Character_Sequence (1 .. To'Length);
N : Natural := 0;
begin
if From'Length /= To'Length then
raise Translation_Error;
else
pragma Warnings (Off); -- apparent uninit use of Domain
for J in From'Range loop
for M in 1 .. N loop
if From (J) = Domain (M) then
raise Translation_Error;
elsif From (J) < Domain (M) then
Domain (M + 1 .. N + 1) := Domain (M .. N);
Rangev (M + 1 .. N + 1) := Rangev (M .. N);
Domain (M) := From (J);
Rangev (M) := To (J);
goto Continue;
end if;
end loop;
Domain (N + 1) := From (J);
Rangev (N + 1) := To (J);
<<Continue>>
N := N + 1;
end loop;
pragma Warnings (On);
return (AF.Controlled with
Map => new Wide_Character_Mapping_Values'(
Length => N,
Domain => Domain (1 .. N),
Rangev => Rangev (1 .. N)));
end if;
end To_Mapping;
--------------
-- To_Range --
--------------
function To_Range
(Map : Wide_Character_Mapping) return Wide_Character_Sequence
is
begin
return Map.Map.Rangev;
end To_Range;
---------------
-- To_Ranges --
---------------
function To_Ranges
(Set : Wide_Character_Set) return Wide_Character_Ranges
is
begin
return Set.Set.all;
end To_Ranges;
-----------------
-- To_Sequence --
-----------------
function To_Sequence
(Set : Wide_Character_Set) return Wide_Character_Sequence
is
SS : constant Wide_Character_Ranges_Access := Set.Set;
N : Natural := 0;
Count : Natural := 0;
begin
for J in SS'Range loop
Count :=
Count + (Wide_Character'Pos (SS (J).High) -
Wide_Character'Pos (SS (J).Low) + 1);
end loop;
return Result : Wide_String (1 .. Count) do
for J in SS'Range loop
for K in SS (J).Low .. SS (J).High loop
N := N + 1;
Result (N) := K;
end loop;
end loop;
end return;
end To_Sequence;
------------
-- To_Set --
------------
-- Case of multiple range input
function To_Set
(Ranges : Wide_Character_Ranges) return Wide_Character_Set
is
Result : Wide_Character_Ranges (Ranges'Range);
N : Natural := 0;
J : Natural;
begin
-- The output of To_Set is required to be sorted by increasing Low
-- values, and discontiguous, so first we sort them as we enter them,
-- using a simple insertion sort.
pragma Warnings (Off);
-- Kill bogus warning on Result being uninitialized
for J in Ranges'Range loop
for K in 1 .. N loop
if Ranges (J).Low < Result (K).Low then
Result (K + 1 .. N + 1) := Result (K .. N);
Result (K) := Ranges (J);
goto Continue;
end if;
end loop;
Result (N + 1) := Ranges (J);
<<Continue>>
N := N + 1;
end loop;
pragma Warnings (On);
-- Now collapse any contiguous or overlapping ranges
J := 1;
while J < N loop
if Result (J).High < Result (J).Low then
N := N - 1;
Result (J .. N) := Result (J + 1 .. N + 1);
elsif Wide_Character'Succ (Result (J).High) >= Result (J + 1).Low then
Result (J).High :=
Wide_Character'Max (Result (J).High, Result (J + 1).High);
N := N - 1;
Result (J + 1 .. N) := Result (J + 2 .. N + 1);
else
J := J + 1;
end if;
end loop;
if N > 0 and then Result (N).High < Result (N).Low then
N := N - 1;
end if;
return (AF.Controlled with
Set => new Wide_Character_Ranges'(Result (1 .. N)));
end To_Set;
-- Case of single range input
function To_Set
(Span : Wide_Character_Range) return Wide_Character_Set
is
begin
if Span.Low > Span.High then
return Null_Set;
-- This is safe, because there is no procedure with parameter
-- Wide_Character_Set of mode "out" or "in out".
else
return (AF.Controlled with
Set => new Wide_Character_Ranges'(1 => Span));
end if;
end To_Set;
-- Case of wide string input
function To_Set
(Sequence : Wide_Character_Sequence) return Wide_Character_Set
is
R : Wide_Character_Ranges (1 .. Sequence'Length);
begin
for J in R'Range loop
R (J) := (Sequence (J), Sequence (J));
end loop;
return To_Set (R);
end To_Set;
-- Case of single wide character input
function To_Set
(Singleton : Wide_Character) return Wide_Character_Set
is
begin
return
(AF.Controlled with
Set => new Wide_Character_Ranges'(1 => (Singleton, Singleton)));
end To_Set;
-----------
-- Value --
-----------
function Value
(Map : Wide_Character_Mapping;
Element : Wide_Character) return Wide_Character
is
L, R, M : Natural;
MV : constant Wide_Character_Mapping_Values_Access := Map.Map;
begin
L := 1;
R := MV.Domain'Last;
-- Binary search loop
loop
-- If not found, identity
if L > R then
return Element;
-- Otherwise do binary divide
else
M := (L + R) / 2;
if Element < MV.Domain (M) then
R := M - 1;
elsif Element > MV.Domain (M) then
L := M + 1;
else -- Element = MV.Domain (M) then
return MV.Rangev (M);
end if;
end if;
end loop;
end Value;
end Ada.Strings.Wide_Maps;
| 27.79677 | 79 | 0.477897 |
10c25cc00c27d71f0e8f10ea96fe31ad7d148141 | 126 | ads | Ada | src/brackelib.ads | bracke/brackelib | 2867ccb08556ba6a315331529bf9e46645688034 | [
"CC0-1.0"
] | 1 | 2022-02-06T07:57:09.000Z | 2022-02-06T07:57:09.000Z | src/brackelib.ads | bracke/brackelib | 2867ccb08556ba6a315331529bf9e46645688034 | [
"CC0-1.0"
] | null | null | null | src/brackelib.ads | bracke/brackelib | 2867ccb08556ba6a315331529bf9e46645688034 | [
"CC0-1.0"
] | null | null | null | pragma License (Unrestricted);
package Brackelib is
-- @summary Root package for Brackelib.
pragma Pure;
end Brackelib;
| 15.75 | 40 | 0.753968 |
397005c0b3b51b7c91b78e6099fb6594358a84c2 | 3,519 | ads | Ada | boards/stm32_common/stm32f746disco/touch_panel_ft5336.ads | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 192 | 2016-06-01T18:32:04.000Z | 2022-03-26T22:52:31.000Z | boards/stm32f746_discovery/src/touch_panel_ft5336.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 239 | 2016-05-26T20:02:01.000Z | 2022-03-31T09:46:56.000Z | boards/stm32f746_discovery/src/touch_panel_ft5336.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 142 | 2016-06-05T08:12:20.000Z | 2022-03-24T17:37:17.000Z | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL.Touch_Panel;
with HAL.Framebuffer;
private with FT5336;
private with STM32.Device;
private with STM32.I2C;
private with STM32.GPIO;
package Touch_Panel_FT5336 is
type Touch_Panel is limited new HAL.Touch_Panel.Touch_Panel_Device
with private;
function Initialize
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation :=
HAL.Framebuffer.Default) return Boolean;
procedure Initialize
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation :=
HAL.Framebuffer.Default);
procedure Set_Orientation
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation);
private
TP_I2C : STM32.I2C.I2C_Port renames STM32.Device.I2C_3;
TP_I2C_SDA : STM32.GPIO.GPIO_Point renames STM32.Device.PH7;
TP_I2C_SCL : STM32.GPIO.GPIO_Point renames STM32.Device.PH8;
TP_I2C_AF : STM32.GPIO_Alternate_Function renames STM32.Device.GPIO_AF_I2C3_4;
type Touch_Panel is limited new FT5336.FT5336_Device
(Port => TP_I2C'Access,
I2C_Addr => 16#70#) with null record;
end Touch_Panel_FT5336;
| 49.56338 | 82 | 0.580847 |
12195b876604d16188b65e32f67515d4460f5a6c | 12,604 | adb | Ada | src/spark_unbound-arrays.adb | mhatzl/spark_unbound | 21d6b80516c9a494a2d7db6b2a62ee226e9a98c1 | [
"MIT"
] | 8 | 2022-01-27T14:16:48.000Z | 2022-02-01T16:35:35.000Z | src/spark_unbound-arrays.adb | mhatzl/spark_unbound | 21d6b80516c9a494a2d7db6b2a62ee226e9a98c1 | [
"MIT"
] | 2 | 2021-12-13T08:13:22.000Z | 2022-02-06T17:59:57.000Z | src/spark_unbound-arrays.adb | mhatzl/spark_unbound | 21d6b80516c9a494a2d7db6b2a62ee226e9a98c1 | [
"MIT"
] | null | null | null | with Spark_Unbound.Safe_Alloc;
package body Spark_Unbound.Arrays with SPARK_Mode is
package Array_Alloc is new Spark_Unbound.Safe_Alloc.Arrays(Element_Type => Element_Type, Index_Type => Index_Type, Array_Type => Array_Type, Array_Type_Acc => Array_Acc);
function Get_Capacity_Offset (Offset : Long_Positive) return Index_Type
is
Arr_Offset : Long_Natural := Long_Natural(Offset) - Long_Natural(Long_Positive'First);
begin
return Index_Type(Long_Integer(Index_Type'First) + Arr_Offset);
end Get_Capacity_Offset;
function To_Unbound_Array (Initial_Capacity : Long_Positive) return Unbound_Array
is
Arr_Acc : Array_Acc := Array_Alloc.Alloc(First => Index_Type'First, Last => Get_Capacity_Offset(Initial_Capacity));
Unbound_Arr : Unbound_Array := Unbound_Array'(Last => No_Index, Arr => Arr_Acc);
begin
return Unbound_Arr;
end To_Unbound_Array;
function "=" (Left, Right : Unbound_Array) return Boolean
is
begin
if Left.Arr = null and then Right.Arr = null then
return True;
end if;
if (Left.Arr = null and then Right.Arr /= null) or else (Left.Arr /= null and then Right.Arr = null) then
return False;
end if;
if (Last_Index(Left) /= Last_Index(Right)) or else (First_Index(Left) /= First_Index(Right)) then
return False;
end if;
for I in First_Index(Left) .. Last_Index(Left) loop
if Element(Left, I) /= Element(Right, I) then
return False;
end if;
pragma Loop_Invariant (for all P in First_Index(Left) .. I => Element(Left, P) = Element(Right, P));
end loop;
return True;
end "=";
function Capacity (Self : Unbound_Array) return Long_Natural
is
begin
if Self.Arr = null then
return Long_Natural'First;
end if;
return Self.Arr.all'Length;
end Capacity;
-- procedure Reserve_Capacity (Self : in out Unbound_Array; Cap : in Count_Type; Success: out Boolean) is
-- begin
-- null;
-- end Reserve_Capacity;
procedure Shrink (Self : in out Unbound_Array; New_Capacity : Long_Natural; Success : out Boolean)
is
begin
if New_Capacity = Long_Natural'First then
Clear(Self);
if Self.Arr = null and then Self.Last = No_Index then
Success := True;
return;
else
raise Program_Error;
end if;
end if;
declare
Arr_Acc : Array_Acc := Array_Alloc.Alloc(First => First_Index(Self), Last => Get_Capacity_Offset(Long_Positive(New_Capacity)));
Tmp : Unbound_Array := Unbound_Array'(Last => No_Index, Arr => Arr_Acc);
begin
if Tmp.Arr = null then
Success := False;
else
if Is_Empty(Self) then
Clear(Self);
else
Move(Tmp, Self);
end if;
if Self.Arr = null and then Self.Last = No_Index then
Self.Arr := Tmp.Arr;
Self.Last := Tmp.Last;
Success := True;
else
Clear(Tmp);
if Tmp.Arr = null and then Tmp.Last = No_Index then
Success := False;
else
raise Program_Error;
end if;
end if;
end if;
end;
end Shrink;
function Length (Self : Unbound_Array) return Long_Natural
is
begin
if Last_Index(Self) = No_Index then
return Long_Natural'First;
end if;
-- abs() needed since indizes might be negative
return Long_Natural(abs(Long_Integer(Last_Index(Self)) - Long_Integer(First_Index(Self))) + 1); -- Last = First leaves room for 1 element
end Length;
function Is_Empty (Self : Unbound_Array) return Boolean
is
begin
return Last_Index(Self) = No_Index;
end Is_Empty;
procedure Clear (Self : in out Unbound_Array) is
begin
Self.Last := No_Index;
Array_Alloc.Free(Self.Arr);
end Clear;
function Element (Self : Unbound_Array; Index : Index_Type) return Element_Type
is
begin
return Self.Arr.all(Index);
end Element;
procedure Replace_Element (Self : in out Unbound_Array; Index : in Index_Type; New_Item : in Element_Type)
is
begin
Self.Arr.all(Index) := New_Item;
end Replace_Element;
-- procedure Update_Element
-- (Self : in out Unbound_Array;
-- Index : in Index_Type;
-- Process : not null access procedure (Process_Element : in out Element_Type)) is
-- begin
-- Process.all(Self.Arr.all(Index));
-- end Update_Element;
procedure Copy (Target : out Unbound_Array; Source : Unbound_Array; Success: out Boolean)
is
begin
Target.Last := No_Index;
Target.Arr := null;
if Source.Arr = null then
Success := True;
return;
end if;
Target.Arr := Array_Alloc.Alloc(First => Source.Arr.all'First, Last => Source.Arr.all'Last);
if Target.Arr = null then
Success := False;
else
Target.Last := Source.Last;
for I in First_Index(Source) .. Last_Index(Source) loop
Target.Arr.all(I) := Source.Arr.all(I);
pragma Loop_Invariant (for all P in First_Index(Source) .. I => Target.Arr.all(P) = Source.Arr.all(P));
end loop;
Success := True;
end if;
end Copy;
procedure Move (Target : in out Unbound_Array; Source : in out Unbound_Array)
is
begin
for I in First_Index(Source) .. Last_Index(Source) loop
Target.Arr.all(I) := Source.Arr.all(I);
pragma Loop_Invariant (for all P in First_Index(Source) .. I => Target.Arr.all(P) = Source.Arr.all(P));
end loop;
Target.Last := Source.Last;
Source.Last := No_Index;
Array_Alloc.Free(Source.Arr);
if Source.Arr /= null or else Source.Last /= No_Index then
raise Program_Error;
end if;
end Move;
procedure Append (Self : in out Unbound_Array; New_Item : in Element_Type; Success: out Boolean)
is
begin
if Last_Index(Self) < Self.Arr.all'Last then
Self.Last := Self.Last + 1;
Self.Arr.all(Last_Index(Self)) := New_Item;
Success := True;
else
declare
Added_Capacity : Long_Natural := Capacity(Self); -- Try to double array capacity for O(Log(N))
Ghost_Added_Capactiy : Long_Natural with Ghost;
begin
while (Long_Integer(Index_Type'Last) - Added_Capacity) < Long_Integer(Get_Capacity_Offset(Long_Positive(Capacity(Self)))) and then Added_Capacity > Long_Natural'First loop
Ghost_Added_Capactiy := Added_Capacity;
Added_Capacity := Added_Capacity - 1;
pragma Loop_Invariant (Added_Capacity = Ghost_Added_Capactiy - 1);
end loop;
declare
New_Max_Last : Index_Type := Get_Capacity_Offset(Long_Positive(Capacity(Self) + Added_Capacity));
Ghost_New_Max_Last : Index_Type with Ghost;
Arr_Acc : Array_Acc := null;
Tmp_Last : Extended_Index := Self.Last;
begin
while Arr_Acc = null and then New_Max_Last > Get_Capacity_Offset(Long_Positive(Capacity(Self))) loop
Arr_Acc := Array_Alloc.Alloc(First => Self.Arr.all'First, Last => New_Max_Last);
Ghost_New_Max_Last := New_Max_Last;
New_Max_Last := New_Max_Last - 1;
pragma Loop_Invariant (New_Max_Last = Ghost_New_Max_Last - 1);
pragma Loop_Invariant (if Arr_Acc /= null then Arr_Acc.all'Last >= Arr_Acc.all'First);
pragma Loop_Invariant (if Arr_Acc /= null then Arr_Acc.all'First = First_Index(Self));
pragma Loop_Invariant (if Arr_Acc /= null then Arr_Acc.all'Last > Get_Capacity_Offset(Long_Positive(Capacity(Self))));
end loop;
if Arr_Acc = null then
Success := False;
else
for I in First_Index(Self) .. Last_Index(Self) loop
Arr_Acc.all(I) := Self.Arr.all(I);
pragma Loop_Invariant (for all P in First_Index(Self) .. I => Arr_Acc.all(P) = Self.Arr.all(P));
end loop;
Self.Last := No_Index;
Array_Alloc.Free(Self.Arr);
if Self.Arr = null and then Self.Last = No_Index then
Self.Arr := Arr_Acc;
if Self.Arr /= null and Tmp_Last < Self.Arr.all'Last then
Self.Last := Tmp_Last + 1;
Self.Arr.all(Last_Index(Self)) := New_Item;
Success := True;
else
raise Program_Error;
end if;
else
raise Program_Error;
end if;
end if;
end;
end;
end if;
end Append;
-- procedure Delete (Self : in out Unbound_Array;
-- Index : in Extended_Index;
-- Count : in Positive := 1) is
-- begin
-- null;
-- end Delete;
procedure Delete_Last (Self : in out Unbound_Array; Count : in Long_Positive := 1)
is
begin
-- Actually not deleting anything, but moving values out of scope
Self.Last := Extended_Index(Long_Integer(Self.Last) - Count);
end;
function First_Element (Self : Unbound_Array) return Element_Type
is
begin
return Self.Arr.all(First_Index(Self));
end First_Element;
function First_Index (Self : Unbound_Array) return Index_Type
is
begin
if Self.Arr = null then
return Index_Type'First;
end if;
return Self.Arr.all'First;
end First_Index;
function Last_Index (Self : Unbound_Array) return Extended_Index
is
begin
return Self.Last;
end Last_Index;
function Last_Element (Self : Unbound_Array) return Element_Type
is
begin
return Self.Arr.all(Last_Index(Self));
end Last_Element;
function Find_Index (Self : Unbound_Array; Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index
is
begin
if Last_Index(Self) = No_Index then
return No_Index;
end if;
for I in Index .. Last_Index(Self) loop
if Element(Self, I) = Item then
return I;
end if;
pragma Loop_Invariant (for all P in Index .. I => Element(Self, P) /= Item);
end loop;
return No_Index;
end Find_Index;
function Contains (Self : Unbound_Array; Item : Element_Type; Index : Index_Type := Index_Type'First) return Boolean
is
begin
if Self.Arr = null or else Self.Last = No_Index then
return False;
end if;
for I in Index .. Last_Index(Self) loop
if Self.Arr.all(I) = Item then
return True;
end if;
pragma Loop_Invariant (for all P in Index .. I => Element(Self, P) /= Item);
end loop;
return False;
end Contains;
-- Ghost ----------------------------------------------------------------------------------
function Ghost_Acc_Length (Self : Array_Acc) return Long_Natural
is
begin
if Self = null then
return Long_Natural'First;
end if;
return Self.all'Length;
end Ghost_Acc_Length;
function Ghost_Arr_Equals (Left, Right : Array_Type; First, Last : Index_Type) return Boolean
is
begin
if Left'First > First or else Right'First > First
or else Left'Last < Last or else Right'Last < Last then
return False;
end if;
for I in First .. Last loop
if Left(I) /= Right(I) then
return False;
end if;
pragma Loop_Invariant (for all P in First .. I => Left(P) = Right(P));
end loop;
return True;
end Ghost_Arr_Equals;
function Ghost_Arr_Length (Self : Array_Type) return Long_Natural
is
begin
return Self'Length;
end Ghost_Arr_Length;
end Spark_Unbound.Arrays;
| 32.071247 | 183 | 0.575135 |
1ca689dae640f64b15ee3eb9bf367ba294276d79 | 1,822 | adb | Ada | src/model/grammar/lse-model-grammar-symbol-logoforward.adb | mgrojo/lsystem-editor | 1f855bc1f783c8d7a1c81594c8aee403e4b53132 | [
"MIT"
] | 2 | 2021-01-09T14:49:35.000Z | 2022-01-18T18:57:45.000Z | src/model/grammar/lse-model-grammar-symbol-logoforward.adb | mgrojo/lsystem-editor | 1f855bc1f783c8d7a1c81594c8aee403e4b53132 | [
"MIT"
] | 1 | 2021-12-03T18:49:59.000Z | 2021-12-03T18:49:59.000Z | src/model/grammar/lse-model-grammar-symbol-logoforward.adb | mgrojo/lsystem-editor | 1f855bc1f783c8d7a1c81594c8aee403e4b53132 | [
"MIT"
] | 1 | 2021-12-03T18:07:44.000Z | 2021-12-03T18:07:44.000Z | -------------------------------------------------------------------------------
-- LSE -- L-System Editor
-- Author: Heziode
--
-- License:
-- MIT License
--
-- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
package body LSE.Model.Grammar.Symbol.LogoForward is
procedure Initialize (This : out Instance)
is
begin
This := Instance '(Representation => 'f');
end Initialize;
procedure Interpret (This : in out Instance;
T : in out Holder)
is
pragma Unreferenced (This);
begin
T.Reference.Forward;
end Interpret;
end LSE.Model.Grammar.Symbol.LogoForward;
| 39.608696 | 79 | 0.654775 |
1c4a203c945e5550f4cc8061a282be77a8ab71c5 | 24,013 | adb | Ada | src/keystore-repository-data.adb | My-Colaborations/ada-keystore | 6ab222c2df81f32309c5a7b4f94a475214ef5ce3 | [
"Apache-2.0"
] | 25 | 2019-05-07T20:35:50.000Z | 2021-11-30T10:35:47.000Z | src/keystore-repository-data.adb | My-Colaborations/ada-keystore | 6ab222c2df81f32309c5a7b4f94a475214ef5ce3 | [
"Apache-2.0"
] | 12 | 2019-12-16T23:30:00.000Z | 2021-09-26T18:52:41.000Z | src/keystore-repository-data.adb | My-Colaborations/ada-keystore | 6ab222c2df81f32309c5a7b4f94a475214ef5ce3 | [
"Apache-2.0"
] | 3 | 2019-12-18T21:30:04.000Z | 2021-01-06T08:30:36.000Z | -----------------------------------------------------------------------
-- keystore-repository-data -- Data access and management for the keystore
-- Copyright (C) 2019, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces;
with Util.Log.Loggers;
with Keystore.Logs;
with Keystore.Repository.Workers;
-- === Data Block ===
--
-- Data block start is encrypted with wallet data key, data fragments are
-- encrypted with their own key. Loading and saving data blocks occurs exclusively
-- from the workers package. The data block can be stored in a separate file so that
-- the wallet repository and its keys are separate from the data blocks.
--
-- ```
-- +------------------+
-- | 03 03 | 2b
-- | Encrypt size | 2b = DATA_ENTRY_SIZE * Nb data fragment
-- | Wallet id | 4b
-- | PAD 0 | 4b
-- | PAD 0 | 4b
-- +------------------+-----
-- | Entry ID | 4b Encrypted with wallet id
-- | Slot size | 2b
-- | 0 0 | 2b
-- | Data offset | 8b
-- | Content HMAC-256 | 32b => 48b = DATA_ENTRY_SIZE
-- +------------------+
-- | ... |
-- +------------------+-----
-- | ... |
-- +------------------+
-- | Data content | Encrypted with data entry key
-- +------------------+-----
-- | Block HMAC-256 | 32b
-- +------------------+
-- ```
--
package body Keystore.Repository.Data is
use type Interfaces.Unsigned_64;
use type Keystore.Repository.Workers.Data_Work_Access;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Repository.Data");
-- ------------------------------
-- Find the data block to hold a new data entry that occupies the given space.
-- The first data block that has enough space is used otherwise a new block
-- is allocated and initialized.
-- ------------------------------
procedure Allocate_Data_Block (Manager : in out Wallet_Repository;
Space : in IO.Block_Index;
Work : in Workers.Data_Work_Access) is
pragma Unreferenced (Space);
begin
Manager.Stream.Allocate (IO.DATA_BLOCK, Work.Data_Block);
Work.Data_Need_Setup := True;
Logs.Debug (Log, "Allocated data block{0}", Work.Data_Block);
end Allocate_Data_Block;
-- ------------------------------
-- Write the data in one or several blocks.
-- ------------------------------
procedure Add_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in Ada.Streams.Stream_Element_Array;
Offset : in out Interfaces.Unsigned_64) is
Size : IO.Buffer_Size;
Input_Pos : Stream_Element_Offset := Content'First;
Data_Offset : Stream_Element_Offset := Stream_Element_Offset (Offset);
Work : Workers.Data_Work_Access;
begin
Workers.Initialize_Queue (Manager);
while Input_Pos <= Content'Last loop
-- Get a data work instance or flush pending works to make one available.
Workers.Allocate_Work (Manager, Workers.DATA_ENCRYPT, null, Iterator, Work);
Workers.Fill (Work.all, Content, Input_Pos, Size);
if Size = 0 then
Workers.Put_Work (Manager.Workers.all, Work);
Work := null;
exit;
end if;
Allocate_Data_Block (Manager, Size, Work);
Keys.Allocate_Key_Slot (Manager, Iterator, Work.Data_Block, Size,
Work.Key_Pos, Work.Key_Block.Buffer.Block);
Work.Key_Block.Buffer := Iterator.Current.Buffer;
Workers.Queue_Cipher_Work (Manager, Work);
Work := null;
-- Move on to what remains.
Data_Offset := Data_Offset + Size;
Input_Pos := Input_Pos + Size;
end loop;
Offset := Interfaces.Unsigned_64 (Data_Offset);
Workers.Flush_Queue (Manager, null);
exception
when E : others =>
Log.Error ("Exception while encrypting data: ", E);
if Work /= null then
Workers.Put_Work (Manager.Workers.all, Work);
end if;
Workers.Flush_Queue (Manager, null);
raise;
end Add_Data;
-- ------------------------------
-- Write the data in one or several blocks.
-- ------------------------------
procedure Add_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in out Util.Streams.Input_Stream'Class;
Offset : in out Interfaces.Unsigned_64) is
Size : IO.Buffer_Size;
Data_Offset : Stream_Element_Offset := Stream_Element_Offset (Offset);
Work : Workers.Data_Work_Access;
begin
Workers.Initialize_Queue (Manager);
loop
-- Get a data work instance or flush pending works to make one available.
Workers.Allocate_Work (Manager, Workers.DATA_ENCRYPT, null, Iterator, Work);
-- Fill the work buffer by reading the stream.
Workers.Fill (Work.all, Content, DATA_MAX_SIZE, Size);
if Size = 0 then
Workers.Put_Work (Manager.Workers.all, Work);
exit;
end if;
Allocate_Data_Block (Manager, DATA_MAX_SIZE, Work);
Keys.Allocate_Key_Slot (Manager, Iterator, Work.Data_Block, Size,
Work.Key_Pos, Work.Key_Block.Buffer.Block);
Work.Key_Block.Buffer := Iterator.Current.Buffer;
Workers.Queue_Cipher_Work (Manager, Work);
-- Move on to what remains.
Data_Offset := Data_Offset + Size;
end loop;
Offset := Interfaces.Unsigned_64 (Data_Offset);
Workers.Flush_Queue (Manager, null);
exception
when E : others =>
Log.Error ("Exception while encrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Add_Data;
procedure Update_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in Ada.Streams.Stream_Element_Array;
Last_Pos : out Ada.Streams.Stream_Element_Offset;
Offset : in out Interfaces.Unsigned_64) is
Size : Stream_Element_Offset;
Input_Pos : Stream_Element_Offset := Content'First;
Work : Workers.Data_Work_Access;
Data_Offset : Stream_Element_Offset := Stream_Element_Offset (Offset);
begin
Workers.Initialize_Queue (Manager);
Keys.Next_Data_Key (Manager, Iterator);
while Input_Pos <= Content'Last and Keys.Has_Data_Key (Iterator) loop
Workers.Allocate_Work (Manager, Workers.DATA_ENCRYPT, null, Iterator, Work);
Size := Content'Last - Input_Pos + 1;
if Size > DATA_MAX_SIZE then
Size := DATA_MAX_SIZE;
end if;
if Size > AES_Align (Iterator.Data_Size) then
Size := AES_Align (Iterator.Data_Size);
end if;
Work.Buffer_Pos := 1;
Work.Last_Pos := Size;
Work.Data (1 .. Size) := Content (Input_Pos .. Input_Pos + Size - 1);
Keys.Update_Key_Slot (Manager, Iterator, Size);
Work.Key_Block.Buffer := Iterator.Current.Buffer;
-- Run the encrypt data work either through work manager or through current task.
Workers.Queue_Cipher_Work (Manager, Work);
Input_Pos := Input_Pos + Size;
Data_Offset := Data_Offset + Size;
exit when Input_Pos > Content'Last;
Keys.Next_Data_Key (Manager, Iterator);
end loop;
Workers.Flush_Queue (Manager, null);
Offset := Interfaces.Unsigned_64 (Data_Offset);
Last_Pos := Input_Pos;
if Input_Pos <= Content'Last then
Keys.Prepare_Append (Iterator);
end if;
exception
when E : others =>
Log.Error ("Exception while encrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Update_Data;
procedure Update_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Content : in out Util.Streams.Input_Stream'Class;
End_Of_Stream : out Boolean;
Offset : in out Interfaces.Unsigned_64) is
Work : Workers.Data_Work_Access;
Size : IO.Buffer_Size := 0;
Data_Offset : Stream_Element_Offset := Stream_Element_Offset (Offset);
Mark : Keys.Data_Key_Marker;
begin
Workers.Initialize_Queue (Manager);
Keys.Mark_Data_Key (Iterator, Mark);
Keys.Next_Data_Key (Manager, Iterator);
while Keys.Has_Data_Key (Iterator) loop
Workers.Allocate_Work (Manager, Workers.DATA_ENCRYPT, null, Iterator, Work);
-- Fill the work buffer by reading the stream.
Workers.Fill (Work.all, Content, AES_Align (Iterator.Data_Size), Size);
if Size = 0 then
Workers.Put_Work (Manager.Workers.all, Work);
Delete_Data (Manager, Iterator, Mark);
exit;
end if;
Keys.Update_Key_Slot (Manager, Iterator, Size);
Work.Key_Block.Buffer := Iterator.Current.Buffer;
-- Run the encrypt data work either through work manager or through current task.
Workers.Queue_Cipher_Work (Manager, Work);
Data_Offset := Data_Offset + Size;
Keys.Mark_Data_Key (Iterator, Mark);
Keys.Next_Data_Key (Manager, Iterator);
end loop;
Workers.Flush_Queue (Manager, null);
Offset := Interfaces.Unsigned_64 (Data_Offset);
End_Of_Stream := Size = 0;
if not End_Of_Stream then
Keys.Prepare_Append (Iterator);
end if;
exception
when E : others =>
Log.Error ("Exception while encrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Update_Data;
-- ------------------------------
-- Erase the data fragments starting at the key iterator current position.
-- ------------------------------
procedure Delete_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Mark : in out Keys.Data_Key_Marker) is
Work : Workers.Data_Work_Access;
begin
while Keys.Has_Data_Key (Iterator) loop
Workers.Allocate_Work (Manager, Workers.DATA_RELEASE, null, Iterator, Work);
-- Run the delete data work either through work manager or through current task.
Workers.Queue_Delete_Work (Manager, Work);
-- When the last data block was processed, erase the data key.
if Keys.Is_Last_Key (Iterator) then
Keys.Delete_Key (Manager, Iterator, Mark);
end if;
Keys.Next_Data_Key (Manager, Iterator);
end loop;
end Delete_Data;
-- ------------------------------
-- Erase the data fragments starting at the key iterator current position.
-- ------------------------------
procedure Delete_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator) is
Work : Workers.Data_Work_Access;
Mark : Keys.Data_Key_Marker;
begin
Keys.Mark_Data_Key (Iterator, Mark);
Workers.Initialize_Queue (Manager);
loop
Keys.Next_Data_Key (Manager, Iterator);
exit when not Keys.Has_Data_Key (Iterator);
Workers.Allocate_Work (Manager, Workers.DATA_RELEASE, null, Iterator, Work);
-- Run the delete data work either through work manager or through current task.
Workers.Queue_Delete_Work (Manager, Work);
-- When the last data block was processed, erase the data key.
if Keys.Is_Last_Key (Iterator) then
Keys.Delete_Key (Manager, Iterator, Mark);
end if;
end loop;
Workers.Flush_Queue (Manager, null);
exception
when E : others =>
Log.Error ("Exception while deleting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Delete_Data;
-- ------------------------------
-- Get the data associated with the named entry.
-- ------------------------------
procedure Get_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Output : out Ada.Streams.Stream_Element_Array) is
procedure Process (Work : in Workers.Data_Work_Access);
Data_Offset : Stream_Element_Offset := Output'First;
procedure Process (Work : in Workers.Data_Work_Access) is
Data_Size : constant Stream_Element_Offset := Work.End_Data - Work.Start_Data + 1;
begin
Output (Data_Offset .. Data_Offset + Data_Size - 1)
:= Work.Data (Work.Buffer_Pos .. Work.Buffer_Pos + Data_Size - 1);
Data_Offset := Data_Offset + Data_Size;
end Process;
Work : Workers.Data_Work_Access;
Enqueued : Boolean;
begin
Workers.Initialize_Queue (Manager);
loop
Keys.Next_Data_Key (Manager, Iterator);
exit when not Keys.Has_Data_Key (Iterator);
Workers.Allocate_Work (Manager, Workers.DATA_DECRYPT, Process'Access, Iterator, Work);
-- Run the decipher work either through work manager or through current task.
Workers.Queue_Decipher_Work (Manager, Work, Enqueued);
if not Enqueued then
Process (Work);
end if;
end loop;
Workers.Flush_Queue (Manager, Process'Access);
exception
when E : others =>
Log.Error ("Exception while decrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Get_Data;
procedure Get_Data (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Output : in out Util.Streams.Output_Stream'Class) is
procedure Process (Work : in Workers.Data_Work_Access);
procedure Process (Work : in Workers.Data_Work_Access) is
begin
Output.Write (Work.Data (Work.Buffer_Pos .. Work.Last_Pos));
end Process;
Work : Workers.Data_Work_Access;
Enqueued : Boolean;
begin
Workers.Initialize_Queue (Manager);
loop
Keys.Next_Data_Key (Manager, Iterator);
exit when not Keys.Has_Data_Key (Iterator);
Workers.Allocate_Work (Manager, Workers.DATA_DECRYPT, Process'Access, Iterator, Work);
-- Run the decipher work either through work manager or through current task.
Workers.Queue_Decipher_Work (Manager, Work, Enqueued);
if not Enqueued then
Process (Work);
end if;
end loop;
Workers.Flush_Queue (Manager, Process'Access);
exception
when E : others =>
Log.Error ("Exception while decrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Get_Data;
-- ------------------------------
-- Get the data associated with the named entry.
-- ------------------------------
procedure Read (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Offset : in Ada.Streams.Stream_Element_Offset;
Output : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
procedure Process (Work : in Workers.Data_Work_Access);
Seek_Offset : Stream_Element_Offset := Offset;
Data_Offset : Stream_Element_Offset := Output'First;
procedure Process (Work : in Workers.Data_Work_Access) is
Data_Size : Stream_Element_Offset
:= Work.End_Data - Work.Start_Data + 1 - Work.Seek_Offset;
begin
Work.Buffer_Pos := Work.Buffer_Pos + Work.Seek_Offset;
if Data_Offset + Data_Size - 1 >= Output'Last then
Data_Size := Output'Last - Data_Offset + 1;
end if;
Output (Data_Offset .. Data_Offset + Data_Size - 1)
:= Work.Data (Work.Buffer_Pos .. Work.Buffer_Pos + Data_Size - 1);
Data_Offset := Data_Offset + Data_Size;
end Process;
Work : Workers.Data_Work_Access;
Enqueued : Boolean;
Length : Stream_Element_Offset := Output'Length;
begin
Workers.Initialize_Queue (Manager);
Keys.Seek (Manager, Seek_Offset, Iterator);
Length := Length + Seek_Offset;
while Keys.Has_Data_Key (Iterator) and Length > 0 loop
Workers.Allocate_Work (Manager, Workers.DATA_DECRYPT, Process'Access, Iterator, Work);
Work.Seek_Offset := Seek_Offset;
-- Run the decipher work either through work manager or through current task.
Workers.Queue_Decipher_Work (Manager, Work, Enqueued);
if not Enqueued then
Process (Work);
end if;
exit when Length < Iterator.Data_Size;
Length := Length - Iterator.Data_Size;
Seek_Offset := 0;
Keys.Next_Data_Key (Manager, Iterator);
end loop;
Workers.Flush_Queue (Manager, Process'Access);
Last := Data_Offset - 1;
exception
when E : others =>
Log.Error ("Exception while decrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Read;
-- ------------------------------
-- Get the data associated with the named entry.
-- ------------------------------
procedure Write (Manager : in out Wallet_Repository;
Iterator : in out Keys.Data_Key_Iterator;
Offset : in Ada.Streams.Stream_Element_Offset;
Content : in Ada.Streams.Stream_Element_Array;
Result : in out Interfaces.Unsigned_64) is
use type Workers.Status_Type;
Seek_Offset : Stream_Element_Offset := Offset;
Input_Pos : Stream_Element_Offset := Content'First;
Work : Workers.Data_Work_Access;
Length : Stream_Element_Offset := Content'Length;
Status : Workers.Status_Type;
begin
Workers.Initialize_Queue (Manager);
Keys.Seek (Manager, Seek_Offset, Iterator);
-- First part that overlaps an existing data block:
-- read the current block, update the content.
if Keys.Has_Data_Key (Iterator) and Length > 0 then
Workers.Allocate_Work (Manager, Workers.DATA_DECRYPT, null, Iterator, Work);
-- Run the decipher work ourselves.
Work.Do_Decipher_Data;
Status := Work.Status;
if Status = Workers.SUCCESS then
declare
Data_Size : Stream_Element_Offset
:= Work.End_Data - Work.Start_Data + 1 - Seek_Offset;
Pos : constant Stream_Element_Offset
:= Work.Buffer_Pos + Seek_Offset;
begin
if Input_Pos + Data_Size - 1 >= Content'Last then
Data_Size := Content'Last - Input_Pos + 1;
end if;
Work.Data (Pos .. Pos + Data_Size - 1)
:= Content (Input_Pos .. Input_Pos + Data_Size - 1);
Input_Pos := Input_Pos + Data_Size;
Work.Kind := Workers.DATA_ENCRYPT;
Work.Status := Workers.PENDING;
Work.Entry_Id := Iterator.Entry_Id;
Work.Key_Pos := Iterator.Key_Pos;
Work.Key_Block.Buffer := Iterator.Current.Buffer;
Work.Data_Block := Iterator.Data_Block;
Work.Data_Need_Setup := False;
Work.Data_Offset := Iterator.Current_Offset;
Length := Length - Data_Size;
Keys.Update_Key_Slot (Manager, Iterator, Work.End_Data - Work.Start_Data + 1);
end;
-- Run the encrypt data work either through work manager or through current task.
Workers.Queue_Cipher_Work (Manager, Work);
else
Workers.Put_Work (Manager.Workers.all, Work);
-- Check_Raise_Error (Status);
end if;
Keys.Next_Data_Key (Manager, Iterator);
end if;
while Keys.Has_Data_Key (Iterator) and Length >= DATA_MAX_SIZE loop
Workers.Allocate_Work (Manager, Workers.DATA_ENCRYPT, null, Iterator, Work);
Work.Buffer_Pos := 1;
Work.Last_Pos := DATA_MAX_SIZE;
Work.Data (1 .. DATA_MAX_SIZE) := Content (Input_Pos .. Input_Pos + DATA_MAX_SIZE - 1);
Keys.Update_Key_Slot (Manager, Iterator, DATA_MAX_SIZE);
Work.Key_Block.Buffer := Iterator.Current.Buffer;
-- Run the encrypt data work either through work manager or through current task.
Workers.Queue_Cipher_Work (Manager, Work);
Input_Pos := Input_Pos + DATA_MAX_SIZE;
-- Data_Offset := Data_Offset + DATA_MAX_SIZE;
Length := Length - DATA_MAX_SIZE;
exit when Input_Pos > Content'Last;
Keys.Next_Data_Key (Manager, Iterator);
end loop;
-- Last part that overlaps an existing data block:
-- read the current block, update the content.
if Keys.Has_Data_Key (Iterator) and Length > 0 then
Workers.Allocate_Work (Manager, Workers.DATA_DECRYPT, null, Iterator, Work);
-- Run the decipher work ourselves.
Work.Do_Decipher_Data;
Status := Work.Status;
if Status = Workers.SUCCESS then
declare
Last : constant Stream_Element_Offset
:= Content'Last - Input_Pos + 1;
begin
Work.Data (1 .. Last) := Content (Input_Pos .. Content'Last);
Input_Pos := Content'Last + 1;
if Last > Work.End_Data then
Work.End_Data := Last;
end if;
Work.Kind := Workers.DATA_ENCRYPT;
Work.Status := Workers.PENDING;
Work.Entry_Id := Iterator.Entry_Id;
Work.Key_Pos := Iterator.Key_Pos;
Work.Key_Block.Buffer := Iterator.Current.Buffer;
Work.Data_Block := Iterator.Data_Block;
Work.Data_Need_Setup := False;
Work.Data_Offset := Iterator.Current_Offset;
Keys.Update_Key_Slot (Manager, Iterator, Work.End_Data - Work.Start_Data + 1);
end;
-- Run the encrypt data work either through work manager or through current task.
Workers.Queue_Cipher_Work (Manager, Work);
else
Workers.Put_Work (Manager.Workers.all, Work);
-- Check_Raise_Error (Status);
end if;
Keys.Next_Data_Key (Manager, Iterator);
end if;
Workers.Flush_Queue (Manager, null);
Result := Iterator.Current_Offset;
if Input_Pos <= Content'Last then
Keys.Prepare_Append (Iterator);
Add_Data (Manager, Iterator, Content (Input_Pos .. Content'Last), Result);
end if;
exception
when E : others =>
Log.Error ("Exception while decrypting data: ", E);
Workers.Flush_Queue (Manager, null);
raise;
end Write;
end Keystore.Repository.Data;
| 38.982143 | 98 | 0.591513 |
0bd52328a7924fda596a16389fd77138f6be5b52 | 2,891 | ads | Ada | src/asf-components-widgets-tabs.ads | jquorning/ada-asf | ddc697c5dfa4e22c57c6958f4cff27e14d02ce98 | [
"Apache-2.0"
] | 12 | 2015-01-18T23:02:20.000Z | 2022-03-25T15:30:30.000Z | src/asf-components-widgets-tabs.ads | jquorning/ada-asf | ddc697c5dfa4e22c57c6958f4cff27e14d02ce98 | [
"Apache-2.0"
] | 3 | 2021-01-06T09:44:02.000Z | 2022-02-04T20:20:53.000Z | src/asf-components-widgets-tabs.ads | jquorning/ada-asf | ddc697c5dfa4e22c57c6958f4cff27e14d02ce98 | [
"Apache-2.0"
] | 4 | 2016-04-12T05:29:00.000Z | 2022-01-24T23:53:59.000Z | -----------------------------------------------------------------------
-- components-widgets-tabs -- Tab views, tabs and accordion
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Components.Html;
with ASF.Contexts.Faces;
package ASF.Components.Widgets.Tabs is
COLLAPSIBLE_ATTR_NAME : constant String := "collapsible";
EFFECT_ATTR_NAME : constant String := "effect";
DURATION_ATTR_NAME : constant String := "duration";
-- ------------------------------
-- UITab
-- ------------------------------
-- The <b>UITab</b> component displays a tab component within a tab view.
type UITab is new ASF.Components.Html.UIHtmlComponent with null record;
-- Render the tab start.
overriding
procedure Encode_Begin (UI : in UITab;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- Render the tab close.
overriding
procedure Encode_End (UI : in UITab;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- ------------------------------
-- UITabView
-- ------------------------------
-- The <b>UITabView</b> component displays a tab selection panel.
type UITabView is new ASF.Components.Html.UIHtmlComponent with null record;
-- Render the tab list and prepare to render the tab contents.
overriding
procedure Encode_Begin (UI : in UITabView;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- Render the tab view close.
overriding
procedure Encode_End (UI : in UITabView;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
-- ------------------------------
-- UIAccordion
-- ------------------------------
-- The <b>UIAccordion</b> component displays a tab selection panel.
type UIAccordion is new ASF.Components.Html.UIHtmlComponent with null record;
-- Render the accordion list and prepare to render the tab contents.
overriding
procedure Encode_Children (UI : in UIAccordion;
Context : in out ASF.Contexts.Faces.Faces_Context'Class);
end ASF.Components.Widgets.Tabs;
| 40.71831 | 87 | 0.597025 |
c57fd41779a45c0fe9e79824b31e7fb6160de6d3 | 2,359 | ads | Ada | src/sdl-inputs-mice-cursors.ads | mosteo/sdlada | 429c594de613c5ba2f0d7c59f8708956697e14f1 | [
"Zlib"
] | 89 | 2015-01-03T01:41:23.000Z | 2022-02-23T18:21:11.000Z | src/sdl-inputs-mice-cursors.ads | mosteo/sdlada | 429c594de613c5ba2f0d7c59f8708956697e14f1 | [
"Zlib"
] | 66 | 2015-05-01T00:54:03.000Z | 2022-01-20T04:09:59.000Z | src/sdl-inputs-mice-cursors.ads | Jellix/sdlada | 997d2ae2da5c75e2ea99cee98372cf5b752519cf | [
"Zlib"
] | 33 | 2015-04-30T23:39:31.000Z | 2022-01-03T13:00:41.000Z | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Inputs.Mice.Cursors
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;
private with SDL.C_Pointers;
package SDL.Inputs.Mice.Cursors is
-- Don't confuse this package with any type of Ada iterator, this is for visual mouse cursors.
type Cursor is new Ada.Finalization.Limited_Controlled with private;
overriding
procedure Finalize (Self : in out Cursor);
type System_Cursors is
(Arrow,
I_Beam,
Wait,
Cross_Hair,
Wait_Arrow,
Size_NWSE,
Size_NESW,
Size_WE,
size_NS,
Size_All,
No,
Hand) with
Convention => C;
-- SDL_CreateColorCursor
-- SDL_CreateCursor
procedure Create_System_Cursor (Self : in out Cursor; Cursor_Name : System_Cursors);
procedure Get_Cursor (Self : in out Cursor);
procedure Set_Cursor (Self : in Cursor);
private
type Cursor is new Ada.Finalization.Limited_Controlled with
record
Internal : SDL.C_Pointers.Cursor_Pointer := null;
Owns : Boolean := True;
end record;
end SDL.Inputs.Mice.Cursors;
| 35.742424 | 116 | 0.586689 |
129746e05a23aa7d02243ec87433f02c89853bf1 | 16,948 | adb | Ada | arch/ARM/STM32/devices/stm32l4x6/stm32-device.adb | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/devices/stm32l4x6/stm32-device.adb | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/devices/stm32l4x6/stm32-device.adb | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with System; use System;
pragma Warnings (Off, "* is an internal GNAT unit");
with System.BB.Parameters;
pragma Warnings (On, "* is an internal GNAT unit");
with STM32_SVD.RCC; use STM32_SVD.RCC;
package body STM32.Device is
HSE_VALUE : constant := System.BB.Parameters.HSE_Clock;
-- External oscillator in Hz
HSI_VALUE : constant := 16_000_000;
-- Internal oscillator in Hz
HPRE_Presc_Table : constant array (UInt4) of UInt32 :=
(1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 64, 128, 256, 512);
PPRE_Presc_Table : constant array (UInt3) of UInt32 :=
(1, 1, 1, 1, 2, 4, 8, 16);
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out GPIO_Port) is
begin
if This'Address = GPIOA_Base then
RCC_Periph.AHB2ENR.GPIOAEN := True;
elsif This'Address = GPIOB_Base then
RCC_Periph.AHB2ENR.GPIOBEN := True;
elsif This'Address = GPIOC_Base then
RCC_Periph.AHB2ENR.GPIOCEN := True;
elsif This'Address = GPIOD_Base then
RCC_Periph.AHB2ENR.GPIODEN := True;
elsif This'Address = GPIOE_Base then
RCC_Periph.AHB2ENR.GPIOEEN := True;
elsif This'Address = GPIOE_Base then
RCC_Periph.AHB2ENR.GPIOEEN := True;
elsif This'Address = GPIOF_Base then
RCC_Periph.AHB2ENR.GPIOFEN := True;
elsif This'Address = GPIOG_Base then
RCC_Periph.AHB2ENR.GPIOGEN := True;
elsif This'Address = GPIOH_Base then
RCC_Periph.AHB2ENR.GPIOHEN := True;
elsif This'Address = GPIOI_Base then
RCC_Periph.AHB2ENR.GPIOIEN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (Point : GPIO_Point)
is
begin
Enable_Clock (Point.Periph.all);
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (Points : GPIO_Points)
is
begin
for Point of Points loop
Enable_Clock (Point.Periph.all);
end loop;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : aliased in out GPIO_Port) is
begin
if This'Address = GPIOA_Base then
RCC_Periph.AHB2RSTR.GPIOARST := True;
RCC_Periph.AHB2RSTR.GPIOARST := False;
elsif This'Address = GPIOB_Base then
RCC_Periph.AHB2RSTR.GPIOBRST := True;
RCC_Periph.AHB2RSTR.GPIOBRST := False;
elsif This'Address = GPIOC_Base then
RCC_Periph.AHB2RSTR.GPIOCRST := True;
RCC_Periph.AHB2RSTR.GPIOCRST := False;
elsif This'Address = GPIOD_Base then
RCC_Periph.AHB2RSTR.GPIODRST := True;
RCC_Periph.AHB2RSTR.GPIODRST := False;
elsif This'Address = GPIOE_Base then
RCC_Periph.AHB2RSTR.GPIOERST := True;
RCC_Periph.AHB2RSTR.GPIOERST := False;
elsif This'Address = GPIOF_Base then
RCC_Periph.AHB2RSTR.GPIOFRST := True;
RCC_Periph.AHB2RSTR.GPIOFRST := False;
elsif This'Address = GPIOG_Base then
RCC_Periph.AHB2RSTR.GPIOGRST := True;
RCC_Periph.AHB2RSTR.GPIOGRST := False;
elsif This'Address = GPIOH_Base then
RCC_Periph.AHB2RSTR.GPIOHRST := True;
RCC_Periph.AHB2RSTR.GPIOHRST := False;
elsif This'Address = GPIOI_Base then
RCC_Periph.AHB2RSTR.GPIOIRST := True;
RCC_Periph.AHB2RSTR.GPIOIRST := False;
else
raise Unknown_Device;
end if;
end Reset;
-----------
-- Reset --
-----------
procedure Reset (Point : GPIO_Point) is
begin
Reset (Point.Periph.all);
end Reset;
-----------
-- Reset --
-----------
procedure Reset (Points : GPIO_Points)
is
Do_Reset : Boolean;
begin
for J in Points'Range loop
Do_Reset := True;
for K in Points'First .. J - 1 loop
if Points (K).Periph = Points (J).Periph then
Do_Reset := False;
exit;
end if;
end loop;
if Do_Reset then
Reset (Points (J).Periph.all);
end if;
end loop;
end Reset;
------------------------------
-- GPIO_Port_Representation --
------------------------------
function GPIO_Port_Representation (Port : GPIO_Port) return UInt4 is
begin
-- TODO: rather ugly to have this board-specific range here
if Port'Address = GPIOA_Base then
return 0;
elsif Port'Address = GPIOB_Base then
return 1;
elsif Port'Address = GPIOC_Base then
return 2;
elsif Port'Address = GPIOD_Base then
return 3;
elsif Port'Address = GPIOE_Base then
return 4;
elsif Port'Address = GPIOF_Base then
return 5;
elsif Port'Address = GPIOG_Base then
return 6;
elsif Port'Address = GPIOH_Base then
return 7;
elsif Port'Address = GPIOI_Base then
return 8;
else
raise Program_Error;
end if;
end GPIO_Port_Representation;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out DMA_Controller) is
begin
if This'Address = STM32_SVD.DMA1_Base then
RCC_Periph.AHB1ENR.DMA1EN := True;
elsif This'Address = STM32_SVD.DMA2_Base then
RCC_Periph.AHB1ENR.DMA2EN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : aliased in out DMA_Controller) is
begin
if This'Address = STM32_SVD.DMA1_Base then
RCC_Periph.AHB1RSTR.DMA1RST := True;
RCC_Periph.AHB1RSTR.DMA1RST := False;
elsif This'Address = STM32_SVD.DMA2_Base then
RCC_Periph.AHB1RSTR.DMA2RST := True;
RCC_Periph.AHB1RSTR.DMA2RST := False;
else
raise Unknown_Device;
end if;
end Reset;
----------------
-- As_Port_Id --
----------------
function As_Port_Id (Port : I2C_Port) return I2C_Port_Id is
begin
if Port.Periph.all'Address = I2C1_Base then
return I2C_Id_1;
elsif Port.Periph.all'Address = I2C2_Base then
return I2C_Id_2;
elsif Port.Periph.all'Address = I2C3_Base then
return I2C_Id_3;
elsif Port.Periph.all'Address = I2C4_Base then
return I2C_Id_4;
else
raise Unknown_Device;
end if;
end As_Port_Id;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : I2C_Port) is
begin
Enable_Clock (As_Port_Id (This));
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : I2C_Port_Id) is
begin
case This is
when I2C_Id_1 =>
RCC_Periph.APB1ENR1.I2C1EN := True;
when I2C_Id_2 =>
RCC_Periph.APB1ENR1.I2C2EN := True;
when I2C_Id_3 =>
RCC_Periph.APB1ENR1.I2C3EN := True;
when I2C_Id_4 =>
RCC_Periph.APB1ENR2.I2C4EN := True;
end case;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : I2C_Port) is
begin
Reset (As_Port_Id (This));
end Reset;
-----------
-- Reset --
-----------
procedure Reset (This : I2C_Port_Id) is
begin
case This is
when I2C_Id_1 =>
RCC_Periph.APB1RSTR1.I2C1RST := True;
RCC_Periph.APB1RSTR1.I2C1RST := False;
when I2C_Id_2 =>
RCC_Periph.APB1RSTR1.I2C2RST := True;
RCC_Periph.APB1RSTR1.I2C2RST := False;
when I2C_Id_3 =>
RCC_Periph.APB1RSTR1.I2C3RST := True;
RCC_Periph.APB1RSTR1.I2C3RST := False;
when I2C_Id_4 =>
RCC_Periph.APB1RSTR2.I2C4RST := True;
RCC_Periph.APB1RSTR2.I2C4RST := False;
end case;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : SPI_Port) is
begin
if This.Periph.all'Address = SPI1_Base then
RCC_Periph.APB2ENR.SPI1EN := True;
elsif This.Periph.all'Address = SPI2_Base then
RCC_Periph.APB1ENR1.SPI2EN := True;
elsif This.Periph.all'Address = SPI3_Base then
RCC_Periph.APB1ENR1.SPI3EN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out SPI_Port) is
begin
if This.Periph.all'Address = SPI1_Base then
RCC_Periph.APB2RSTR.SPI1RST := True;
RCC_Periph.APB2RSTR.SPI1RST := False;
elsif This.Periph.all'Address = SPI2_Base then
RCC_Periph.APB1RSTR1.SPI2RST := True;
RCC_Periph.APB1RSTR1.SPI2RST := False;
elsif This.Periph.all'Address = SPI3_Base then
RCC_Periph.APB1RSTR1.SPI3RST := True;
RCC_Periph.APB1RSTR1.SPI3RST := False;
else
raise Unknown_Device;
end if;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : in out Timer) is
begin
if This'Address = TIM1_Base then
RCC_Periph.APB2ENR.TIM1EN := True;
elsif This'Address = TIM2_Base then
RCC_Periph.APB1ENR1.TIM2EN := True;
elsif This'Address = TIM3_Base then
RCC_Periph.APB1ENR1.TIM3EN := True;
elsif This'Address = TIM4_Base then
RCC_Periph.APB1ENR1.TIM4EN := True;
elsif This'Address = TIM6_Base then
RCC_Periph.APB1ENR1.TIM6EN := True;
elsif This'Address = TIM7_Base then
RCC_Periph.APB1ENR1.TIM7EN := True;
elsif This'Address = TIM8_Base then
RCC_Periph.APB2ENR.TIM8EN := True;
elsif This'Address = TIM15_Base then
RCC_Periph.APB2ENR.TIM15EN := True;
elsif This'Address = TIM16_Base then
RCC_Periph.APB2ENR.TIM16EN := True;
elsif This'Address = TIM17_Base then
RCC_Periph.APB2ENR.TIM17EN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out Timer) is
begin
if This'Address = TIM1_Base then
RCC_Periph.APB2RSTR.TIM1RST := True;
RCC_Periph.APB2RSTR.TIM1RST := False;
elsif This'Address = TIM2_Base then
RCC_Periph.APB1RSTR1.TIM2RST := True;
RCC_Periph.APB1RSTR1.TIM2RST := False;
elsif This'Address = TIM3_Base then
RCC_Periph.APB1RSTR1.TIM3RST := True;
RCC_Periph.APB1RSTR1.TIM3RST := False;
elsif This'Address = TIM4_Base then
RCC_Periph.APB1RSTR1.TIM4RST := True;
RCC_Periph.APB1RSTR1.TIM4RST := False;
elsif This'Address = TIM5_Base then
RCC_Periph.APB1RSTR1.TIM5RST := True;
RCC_Periph.APB1RSTR1.TIM5RST := False;
elsif This'Address = TIM6_Base then
RCC_Periph.APB1RSTR1.TIM6RST := True;
RCC_Periph.APB1RSTR1.TIM6RST := False;
elsif This'Address = TIM7_Base then
RCC_Periph.APB1RSTR1.TIM7RST := True;
RCC_Periph.APB1RSTR1.TIM7RST := False;
elsif This'Address = TIM8_Base then
RCC_Periph.APB2RSTR.TIM8RST := True;
RCC_Periph.APB2RSTR.TIM8RST := False;
elsif This'Address = TIM15_Base then
RCC_Periph.APB2RSTR.TIM15RST := True;
RCC_Periph.APB2RSTR.TIM15RST := False;
elsif This'Address = TIM16_Base then
RCC_Periph.APB2RSTR.TIM16RST := True;
RCC_Periph.APB2RSTR.TIM16RST := False;
elsif This'Address = TIM17_Base then
RCC_Periph.APB2RSTR.TIM17RST := True;
RCC_Periph.APB2RSTR.TIM17RST := False;
else
raise Unknown_Device;
end if;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : in out SAI_Port)
is
begin
if This'Address = SAI1_Base then
RCC_Periph.APB2ENR.SAI1EN := True;
elsif This'Address = SAI2_Base then
RCC_Periph.APB2ENR.SAI2EN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out SAI_Port)
is
begin
if This'Address = SAI1_Base then
RCC_Periph.APB2RSTR.SAI1RST := True;
RCC_Periph.APB2RSTR.SAI1RST := False;
elsif This'Address = SAI2_Base then
RCC_Periph.APB2RSTR.SAI2RST := True;
RCC_Periph.APB2RSTR.SAI2RST := False;
else
raise Unknown_Device;
end if;
end Reset;
---------------------
-- Get_Input_Clock --
---------------------
function Get_Input_Clock (Periph : SAI_Port) return UInt32
is
begin
-- Returns the SAI clock. This needs work
return 48_000_000;
end Get_Input_Clock;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out Analog_To_Digital_Converter)
is
begin
if This'Address = ADC_Base then
RCC_Periph.AHB2ENR.ADCEN := True;
RCC_Periph.CCIPR.ADCSEL := 3; -- clock sel. Default is... none!
else
raise Unknown_Device;
end if;
end Enable_Clock;
-------------------------
-- Reset_All_ADC_Units --
-------------------------
procedure Reset_All_ADC_Units is
begin
RCC_Periph.AHB2RSTR.ADCRST := True;
RCC_Periph.AHB2RSTR.ADCRST := False;
end Reset_All_ADC_Units;
-----------
-- Reset --
-----------
procedure Reset (This : aliased in out Digital_To_Analog_Converter) is
pragma Unreferenced (This);
begin
RCC_Periph.APB1RSTR1.DAC1RST := True;
RCC_Periph.APB1RSTR1.DAC1RST := False;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out Digital_To_Analog_Converter)
is
pragma Unreferenced (This);
begin
RCC_Periph.APB1ENR1.DAC1EN := True;
end Enable_Clock;
------------------------------
-- System_Clock_Frequencies --
------------------------------
function System_Clock_Frequencies return RCC_System_Clocks
is
Source : constant UInt2 := RCC_Periph.CFGR.SWS;
Result : RCC_System_Clocks;
begin
Result.I2SCLK := 0;
return Result;
end System_Clock_Frequencies;
procedure Enable_Clock (This : aliased in out DFSDM_Block)
is
begin
RCC_Periph.APB2ENR.DFSDMEN := True;
end Enable_Clock;
end STM32.Device;
| 31.501859 | 78 | 0.576469 |
12ee5c89f476e07ef7cf21f019880562c09d0cb9 | 149 | ads | Ada | src/ewok-tasks-debug.ads | PThierry/ewok-kernel | e9c23cb3fd0afd8378bc27418778e1117d5e16cc | [
"Apache-2.0"
] | null | null | null | src/ewok-tasks-debug.ads | PThierry/ewok-kernel | e9c23cb3fd0afd8378bc27418778e1117d5e16cc | [
"Apache-2.0"
] | null | null | null | src/ewok-tasks-debug.ads | PThierry/ewok-kernel | e9c23cb3fd0afd8378bc27418778e1117d5e16cc | [
"Apache-2.0"
] | null | null | null |
package ewok.tasks.debug
with spark_mode => off
is
procedure crashdump
(frame_a : in ewok.t_stack_frame_access);
end ewok.tasks.debug;
| 18.625 | 48 | 0.724832 |
39e9c33c13fe8b99a91e595a9e79a10d740bceb6 | 16,842 | ads | Ada | gcc-gcc-7_3_0-release/gcc/ada/a-calend.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/a-calend.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/a-calend.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C A L E N D A R --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package Ada.Calendar with
SPARK_Mode,
Abstract_State => (Clock_Time with Synchronous,
External => (Async_Readers,
Async_Writers)),
Initializes => Clock_Time
is
type Time is private;
-- Declarations representing limits of allowed local time values. Note that
-- these do NOT constrain the possible stored values of time which may well
-- permit a larger range of times (this is explicitly allowed in Ada 95).
subtype Year_Number is Integer range 1901 .. 2399;
subtype Month_Number is Integer range 1 .. 12;
subtype Day_Number is Integer range 1 .. 31;
-- A Day_Duration value of 86_400.0 designates a new day
subtype Day_Duration is Duration range 0.0 .. 86_400.0;
function Clock return Time with
Volatile_Function,
Global => Clock_Time;
-- The returned time value is the number of nanoseconds since the start
-- of Ada time (1901-01-01 00:00:00.0 UTC). If leap seconds are enabled,
-- the result will contain all elapsed leap seconds since the start of
-- Ada time until now.
function Year (Date : Time) return Year_Number;
function Month (Date : Time) return Month_Number;
function Day (Date : Time) return Day_Number;
function Seconds (Date : Time) return Day_Duration;
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Seconds : out Day_Duration);
-- Break down a time value into its date components set in the current
-- time zone. If Split is called on a time value created using Ada 2005
-- Time_Of in some arbitrary time zone, the input value will always be
-- interpreted as relative to the local time zone.
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Seconds : Day_Duration := 0.0) return Time;
-- GNAT Note: Normally when procedure Split is called on a Time value
-- result of a call to function Time_Of, the out parameters of procedure
-- Split are identical to the in parameters of function Time_Of. However,
-- when a non-existent time of day is specified, the values for Seconds
-- may or may not be different. This may happen when Daylight Saving Time
-- (DST) is in effect, on the day when switching to DST, if Seconds
-- specifies a time of day in the hour that does not exist. For example,
-- in New York:
--
-- Time_Of (Year => 1998, Month => 4, Day => 5, Seconds => 10740.0)
--
-- will return a Time value T. If Split is called on T, the resulting
-- Seconds may be 14340.0 (3:59:00) instead of 10740.0 (2:59:00 being
-- a time that not exist).
function "+" (Left : Time; Right : Duration) return Time;
function "+" (Left : Duration; Right : Time) return Time;
function "-" (Left : Time; Right : Duration) return Time;
function "-" (Left : Time; Right : Time) return Duration;
-- The first three functions will raise Time_Error if the resulting time
-- value is less than the start of Ada time in UTC or greater than the
-- end of Ada time in UTC. The last function will raise Time_Error if the
-- resulting difference cannot fit into a duration value.
function "<" (Left, Right : Time) return Boolean;
function "<=" (Left, Right : Time) return Boolean;
function ">" (Left, Right : Time) return Boolean;
function ">=" (Left, Right : Time) return Boolean;
Time_Error : exception;
private
-- Mark the private part as SPARK_Mode Off to avoid accounting for variable
-- Invalid_Time_Zone_Offset in abstract state.
pragma SPARK_Mode (Off);
pragma Inline (Clock);
pragma Inline (Year);
pragma Inline (Month);
pragma Inline (Day);
pragma Inline ("+");
pragma Inline ("-");
pragma Inline ("<");
pragma Inline ("<=");
pragma Inline (">");
pragma Inline (">=");
-- The units used in this version of Ada.Calendar are nanoseconds. The
-- following constants provide values used in conversions of seconds or
-- days to the underlying units.
Nano : constant := 1_000_000_000;
Nano_F : constant := 1_000_000_000.0;
Nanos_In_Day : constant := 86_400_000_000_000;
Secs_In_Day : constant := 86_400;
----------------------------
-- Implementation of Time --
----------------------------
-- Time is represented as a signed 64 bit integer count of nanoseconds
-- since the start of Ada time (1901-01-01 00:00:00.0 UTC). Time values
-- produced by Time_Of are internally normalized to UTC regardless of their
-- local time zone. This representation ensures correct handling of leap
-- seconds as well as performing arithmetic. In Ada 95, Split and Time_Of
-- will treat a time value as being in the local time zone, in Ada 2005,
-- Split and Time_Of will treat a time value as being in the designated
-- time zone by the formal parameter or in UTC by default. The size of the
-- type is large enough to cover the Ada 2005 range of time (1901-01-01
-- 00:00:00.0 UTC - 2399-12-31-23:59:59.999999999 UTC).
------------------
-- Leap Seconds --
------------------
-- Due to Earth's slowdown, the astronomical time is not as precise as the
-- International Atomic Time. To compensate for this inaccuracy, a single
-- leap second is added after the last day of June or December. The count
-- of seconds during those occurrences becomes:
-- ... 58, 59, leap second 60, 0, 1, 2 ...
-- Unlike leap days, leap seconds occur simultaneously around the world.
-- In other words, if a leap second occurs at 23:59:60 UTC, it also occurs
-- on 18:59:60 -5 the same day or 2:59:60 +2 on the next day.
-- Leap seconds do not follow a formula. The International Earth Rotation
-- and Reference System Service decides when to add one. Leap seconds are
-- included in the representation of time in Ada 95 mode. As a result,
-- the following two time values will differ by two seconds:
-- 1972-06-30 23:59:59.0
-- 1972-07-01 00:00:00.0
-- When a new leap second is introduced, the following steps must be
-- carried out:
-- 1) Increment Leap_Seconds_Count in a-calend.adb by one
-- 2) Increment LS_Count in xleaps.adb by one
-- 3) Add the new date to the aggregate of array LS_Dates in
-- xleaps.adb
-- 4) Compile and execute xleaps
-- 5) Replace the values of Leap_Second_Times in a-calend.adb with the
-- aggregate generated by xleaps
-- The algorithms that build the actual leap second values and discover
-- how many leap seconds have occurred between two dates do not need any
-- modification.
------------------------------
-- Non-leap Centennial Years --
------------------------------
-- Over the range of Ada time, centennial years 2100, 2200 and 2300 are
-- non-leap. As a consequence, seven non-leap years occur over the period
-- of year - 4 to year + 4. Internally, routines Split and Time_Of add or
-- subtract a "fake" February 29 to facilitate the arithmetic involved.
------------------------
-- Local Declarations --
------------------------
type Time_Rep is new Long_Long_Integer;
type Time is new Time_Rep;
-- The underlying type of Time has been chosen to be a 64 bit signed
-- integer number since it allows for easier processing of sub-seconds
-- and arithmetic. We use Long_Long_Integer to allow this unit to compile
-- when using custom target configuration files where the max integer is
-- 32 bits. This is useful for static analysis tools such as SPARK or
-- CodePeer.
--
-- Note: the reason we have two separate types here is to avoid problems
-- with overloading ambiguities in the body if we tried to use Time as an
-- internal computational type.
Days_In_Month : constant array (Month_Number) of Day_Number :=
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
-- Days in month for non-leap year, leap year case is adjusted in code
Invalid_Time_Zone_Offset : Long_Integer;
pragma Import (C, Invalid_Time_Zone_Offset, "__gnat_invalid_tzoff");
function Is_Leap (Year : Year_Number) return Boolean;
-- Determine whether a given year is leap
----------------------------------------------------------
-- Target-Independent Interface to Children of Calendar --
----------------------------------------------------------
-- The following packages provide a target-independent interface to the
-- children of Calendar - Arithmetic, Conversions, Delays, Formatting and
-- Time_Zones.
---------------------------
-- Arithmetic_Operations --
---------------------------
package Arithmetic_Operations is
function Add (Date : Time; Days : Long_Integer) return Time;
-- Add a certain number of days to a time value
procedure Difference
(Left : Time;
Right : Time;
Days : out Long_Integer;
Seconds : out Duration;
Leap_Seconds : out Integer);
-- Calculate the difference between two time values in terms of days,
-- seconds and leap seconds elapsed. The leap seconds are not included
-- in the seconds returned. If Left is greater than Right, the returned
-- values are positive, negative otherwise.
function Subtract (Date : Time; Days : Long_Integer) return Time;
-- Subtract a certain number of days from a time value
end Arithmetic_Operations;
---------------------------
-- Conversion_Operations --
---------------------------
package Conversion_Operations is
function To_Ada_Time (Unix_Time : Long_Integer) return Time;
-- Unix to Ada Epoch conversion
function To_Ada_Time
(tm_year : Integer;
tm_mon : Integer;
tm_day : Integer;
tm_hour : Integer;
tm_min : Integer;
tm_sec : Integer;
tm_isdst : Integer) return Time;
-- Struct tm to Ada Epoch conversion
function To_Duration
(tv_sec : Long_Integer;
tv_nsec : Long_Integer) return Duration;
-- Struct timespec to Duration conversion
procedure To_Struct_Timespec
(D : Duration;
tv_sec : out Long_Integer;
tv_nsec : out Long_Integer);
-- Duration to struct timespec conversion
procedure To_Struct_Tm
(T : Time;
tm_year : out Integer;
tm_mon : out Integer;
tm_day : out Integer;
tm_hour : out Integer;
tm_min : out Integer;
tm_sec : out Integer);
-- Time to struct tm conversion
function To_Unix_Time (Ada_Time : Time) return Long_Integer;
-- Ada to Unix Epoch conversion
end Conversion_Operations;
----------------------
-- Delay_Operations --
----------------------
package Delay_Operations is
function To_Duration (Date : Time) return Duration;
-- Given a time value in nanoseconds since 1901, convert it into a
-- duration value giving the number of nanoseconds since the Unix Epoch.
end Delay_Operations;
---------------------------
-- Formatting_Operations --
---------------------------
package Formatting_Operations is
function Day_Of_Week (Date : Time) return Integer;
-- Determine which day of week Date falls on. The returned values are
-- within the range of 0 .. 6 (Monday .. Sunday).
procedure Split
(Date : Time;
Year : out Year_Number;
Month : out Month_Number;
Day : out Day_Number;
Day_Secs : out Day_Duration;
Hour : out Integer;
Minute : out Integer;
Second : out Integer;
Sub_Sec : out Duration;
Leap_Sec : out Boolean;
Use_TZ : Boolean;
Is_Historic : Boolean;
Time_Zone : Long_Integer);
pragma Export (Ada, Split, "__gnat_split");
-- Split a time value into its components. If flag Is_Historic is set,
-- this routine would try to use to the best of the OS's abilities the
-- time zone offset that was or will be in effect on Date. Set Use_TZ
-- to use the local time zone (the value in Time_Zone is ignored) when
-- splitting a time value.
function Time_Of
(Year : Year_Number;
Month : Month_Number;
Day : Day_Number;
Day_Secs : Day_Duration;
Hour : Integer;
Minute : Integer;
Second : Integer;
Sub_Sec : Duration;
Leap_Sec : Boolean;
Use_Day_Secs : Boolean;
Use_TZ : Boolean;
Is_Historic : Boolean;
Time_Zone : Long_Integer) return Time;
pragma Export (Ada, Time_Of, "__gnat_time_of");
-- Given all the components of a date, return the corresponding time
-- value. Set Use_Day_Secs to use the value in Day_Secs, otherwise the
-- day duration will be calculated from Hour, Minute, Second and Sub_
-- Sec. If flag Is_Historic is set, this routine would try to use to the
-- best of the OS's abilities the time zone offset that was or will be
-- in effect on the input date. Set Use_TZ to use the local time zone
-- (the value in formal Time_Zone is ignored) when building a time value
-- and to verify the validity of a requested leap second.
end Formatting_Operations;
---------------------------
-- Time_Zones_Operations --
---------------------------
package Time_Zones_Operations is
function UTC_Time_Offset (Date : Time) return Long_Integer;
-- Return (in seconds) the difference between the local time zone and
-- UTC time at a specific historic date.
end Time_Zones_Operations;
end Ada.Calendar;
| 42.530303 | 79 | 0.585204 |
4df197f8d669ce39cfc8243b9f015ff1cd29e6cf | 1,257 | ads | Ada | mat/regtests/mat-memory-tests.ads | stcarrez/mat | fb242feb5662b8130680cd06e50da7ef40b95bd7 | [
"Apache-2.0"
] | 7 | 2015-01-18T23:04:30.000Z | 2021-04-06T14:07:56.000Z | mat/regtests/mat-memory-tests.ads | stcarrez/mat | fb242feb5662b8130680cd06e50da7ef40b95bd7 | [
"Apache-2.0"
] | null | null | null | mat/regtests/mat-memory-tests.ads | stcarrez/mat | fb242feb5662b8130680cd06e50da7ef40b95bd7 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- mat-memory-tests -- Unit tests for MAT memory
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package MAT.Memory.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test Probe_Malloc with update of memory slots.
procedure Test_Probe_Malloc (T : in out Test);
-- Test Probe_Free with update of memory slots.
procedure Test_Probe_Free (T : in out Test);
end MAT.Memory.Tests;
| 36.970588 | 76 | 0.647574 |
4dfd042ef717ac3b304954e59567484e33dfe03e | 485 | ads | Ada | tests/log-test_data-tests.ads | thindil/steamsky | d5d7fea622f7994c91017c4cd7ba5e188153556c | [
"TCL",
"MIT"
] | 80 | 2017-04-08T23:14:07.000Z | 2022-02-10T22:30:51.000Z | tests/log-test_data-tests.ads | thindil/steamsky | d5d7fea622f7994c91017c4cd7ba5e188153556c | [
"TCL",
"MIT"
] | 89 | 2017-06-24T08:18:26.000Z | 2021-11-12T04:37:36.000Z | tests/log-test_data-tests.ads | thindil/steamsky | d5d7fea622f7994c91017c4cd7ba5e188153556c | [
"TCL",
"MIT"
] | 9 | 2018-04-14T16:37:25.000Z | 2020-03-21T14:33:49.000Z | -- This package has been generated automatically by GNATtest.
-- Do not edit any part of it, see GNATtest documentation for more details.
-- begin read only
with Gnattest_Generated;
package Log.Test_Data.Tests is
type Test is new GNATtest_Generated.GNATtest_Standard.Log.Test_Data
.Test with
null record;
procedure Test_Log_Message_6a7537_caf43b(Gnattest_T: in out Test);
-- log.ads:66:4:Log_Message:Test_LogMessage
end Log.Test_Data.Tests;
-- end read only
| 26.944444 | 76 | 0.764948 |
dcaa3f01051388c1a8a172bbb3bad358281112cb | 6,599 | ads | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-sequio.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-sequio.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-sequio.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S E Q U E N T I A L _ I O --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with System.Sequential_IO;
generic
type Element_Type (<>) is private;
package Ada.Sequential_IO is
pragma Compile_Time_Warning
(Element_Type'Has_Access_Values,
"Element_Type for Sequential_IO instance has access values");
pragma Compile_Time_Warning
(Element_Type'Has_Tagged_Values,
"Element_Type for Sequential_IO instance has tagged values");
type File_Type is limited private with Default_Initial_Condition;
type File_Mode is (In_File, Out_File, Append_File);
-- The following representation clause allows the use of unchecked
-- conversion for rapid translation between the File_Mode type
-- used in this package and System.File_IO.
for File_Mode use
(In_File => 0, -- System.File_IO.File_Mode'Pos (In_File)
Out_File => 2, -- System.File_IO.File_Mode'Pos (Out_File)
Append_File => 3); -- System.File_IO.File_Mode'Pos (Append_File)
---------------------
-- File management --
---------------------
procedure Create
(File : in out File_Type;
Mode : File_Mode := Out_File;
Name : String := "";
Form : String := "");
procedure Open
(File : in out File_Type;
Mode : File_Mode;
Name : String;
Form : String := "");
procedure Close (File : in out File_Type);
procedure Delete (File : in out File_Type);
procedure Reset (File : in out File_Type; Mode : File_Mode);
procedure Reset (File : in out File_Type);
function Mode (File : File_Type) return File_Mode;
function Name (File : File_Type) return String;
function Form (File : File_Type) return String;
function Is_Open (File : File_Type) return Boolean;
procedure Flush (File : File_Type);
---------------------------------
-- Input and output operations --
---------------------------------
procedure Read (File : File_Type; Item : out Element_Type);
procedure Write (File : File_Type; Item : Element_Type);
function End_Of_File (File : File_Type) return Boolean;
----------------
-- Exceptions --
----------------
Status_Error : exception renames IO_Exceptions.Status_Error;
Mode_Error : exception renames IO_Exceptions.Mode_Error;
Name_Error : exception renames IO_Exceptions.Name_Error;
Use_Error : exception renames IO_Exceptions.Use_Error;
Device_Error : exception renames IO_Exceptions.Device_Error;
End_Error : exception renames IO_Exceptions.End_Error;
Data_Error : exception renames IO_Exceptions.Data_Error;
private
-- The following procedures have a File_Type formal of mode IN OUT because
-- they may close the original file. The Close operation may raise an
-- exception, but in that case we want any assignment to the formal to
-- be effective anyway, so it must be passed by reference (or the caller
-- will be left with a dangling pointer).
pragma Export_Procedure
(Internal => Close,
External => "",
Mechanism => Reference);
pragma Export_Procedure
(Internal => Delete,
External => "",
Mechanism => Reference);
pragma Export_Procedure
(Internal => Reset,
External => "",
Parameter_Types => (File_Type),
Mechanism => Reference);
pragma Export_Procedure
(Internal => Reset,
External => "",
Parameter_Types => (File_Type, File_Mode),
Mechanism => (File => Reference));
type File_Type is new System.Sequential_IO.File_Type;
-- All subprograms are inlined
pragma Inline (Close);
pragma Inline (Create);
pragma Inline (Delete);
pragma Inline (End_Of_File);
pragma Inline (Form);
pragma Inline (Is_Open);
pragma Inline (Mode);
pragma Inline (Name);
pragma Inline (Open);
pragma Inline (Read);
pragma Inline (Reset);
pragma Inline (Write);
end Ada.Sequential_IO;
| 40.987578 | 78 | 0.545083 |
d0fd37a84369dc2aa897ea92088d033ec8e1fa1e | 3,114 | adb | Ada | middleware/src/command_line/command_line-filesystem.adb | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 192 | 2016-06-01T18:32:04.000Z | 2022-03-26T22:52:31.000Z | middleware/src/command_line/command_line-filesystem.adb | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 239 | 2016-05-26T20:02:01.000Z | 2022-03-31T09:46:56.000Z | middleware/src/command_line/command_line-filesystem.adb | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 142 | 2016-06-05T08:12:20.000Z | 2022-03-24T17:37:17.000Z | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Command_Line.Filesystem.List_Directory;
with Command_Line.Filesystem.Remove_Directory;
with Command_Line.Filesystem.Touch;
with Command_Line.Filesystem.Cat;
package body Command_Line.Filesystem is
Ls : aliased Command_Line.Filesystem.List_Directory.Ls_Cmd;
Rmdir : aliased Command_Line.Filesystem.Remove_Directory.Rmdir_Cmd;
Touch_C : aliased Command_Line.Filesystem.Touch.Touch_Cmd;
Cat_C : aliased Command_Line.Filesystem.Cat.Cat_Cmd;
------------------
-- Register_All --
------------------
procedure Register_All is
begin
Register (Ls'Access);
Register (Rmdir'Access);
Register (Touch_C'Access);
Register (Cat_C'Access);
end Register_All;
end Command_Line.Filesystem;
| 54.631579 | 78 | 0.554592 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.