id
int64
0
30.9k
extension
stringclasses
1 value
max_stars_count
int64
0
17k
max_stars_repo_name
stringlengths
7
106
max_stars_repo_path
stringlengths
5
136
text
stringlengths
9
1M
30,900
ada
0
bee-Michi/Hello-World-Mania
src/a/ada.adb
-- Using text_io with Text_IO; procedure Hello_World is -- begin the brogram begin -- Output Text_IO.Put_line("Hello World!"); -- Enf end Hello_World;
30,901
ada
60
RREE/ada-util
src/base/commands/util-commands-consoles.ads
<reponame>RREE/ada-util ----------------------------------------------------------------------- -- util-commands-consoles -- Console interface -- Copyright (C) 2014, 2015, 2017, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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.Strings.Unbounded; generic type Field_Type is (<>); type Notice_Type is (<>); package Util.Commands.Consoles is type Justify_Type is (J_LEFT, -- Justify left |item | J_RIGHT, -- Justify right | item| J_CENTER, -- Justify center | item | J_RIGHT_NO_FILL -- Justify right |item| ); type Console_Type is abstract tagged limited private; type Console_Access is access all Console_Type'Class; -- Report an error message. procedure Error (Console : in out Console_Type; Message : in String) is abstract; -- Report a notice message. procedure Notice (Console : in out Console_Type; Kind : in Notice_Type; Message : in String) is abstract; -- Print the field value for the given field. procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; Value : in String; Justify : in Justify_Type := J_LEFT) is abstract; -- Print the title for the given field. procedure Print_Title (Console : in out Console_Type; Field : in Field_Type; Title : in String) is abstract; -- Start a new title in a report. procedure Start_Title (Console : in out Console_Type) is abstract; -- Finish a new title in a report. procedure End_Title (Console : in out Console_Type) is abstract; -- Start a new row in a report. procedure Start_Row (Console : in out Console_Type) is abstract; -- Finish a new row in a report. procedure End_Row (Console : in out Console_Type) is abstract; -- Print the title for the given field and setup the associated field size. procedure Print_Title (Console : in out Console_Type; Field : in Field_Type; Title : in String; Length : in Positive); -- Format the integer and print it for the given field. procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; Value : in Integer; Justify : in Justify_Type := J_LEFT); -- Format the integer and print it for the given field. procedure Print_Field (Console : in out Console_Type; Field : in Field_Type; Value : in Ada.Strings.Unbounded.Unbounded_String; Justify : in Justify_Type := J_LEFT); -- Get the field count that was setup through the Print_Title calls. function Get_Field_Count (Console : in Console_Type) return Natural; -- Reset the field count. procedure Clear_Fields (Console : in out Console_Type); private type Field_Size_Array is array (Field_Type) of Natural; type Field_List_Array is array (1 .. Field_Size_Array'Length) of Field_Type; type Console_Type is abstract tagged limited record Sizes : Field_Size_Array := (others => 0); Cols : Field_Size_Array := (others => 1); Fields : Field_List_Array; Field_Count : Natural := 0; end record; end Util.Commands.Consoles;
30,902
ada
7
best08618/asylo
gcc-gcc-7_3_0-release/gcc/ada/a-cfdlli.ads
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.FORMAL_DOUBLY_LINKED_LISTS -- -- -- -- 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 spec is derived from Ada.Containers.Bounded_Doubly_Linked_Lists in the -- Ada 2012 RM. The modifications are meant to facilitate formal proofs by -- making it easier to express properties, and by making the specification of -- this unit compatible with SPARK 2014. Note that the API of this unit may be -- subject to incompatible changes as SPARK 2014 evolves. -- The modifications are: -- A parameter for the container is added to every function reading the -- contents of a container: Next, Previous, Query_Element, Has_Element, -- Iterate, Reverse_Iterate, Element. This change is motivated by the need -- to have cursors which are valid on different containers (typically a -- container C and its previous version C'Old) for expressing properties, -- which is not possible if cursors encapsulate an access to the underlying -- container. -- There are three new functions: -- function Strict_Equal (Left, Right : List) return Boolean; -- function First_To_Previous (Container : List; Current : Cursor) -- return List; -- function Current_To_Last (Container : List; Current : Cursor) -- return List; -- See subprogram specifications that follow for details generic type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Formal_Doubly_Linked_Lists with Pure, SPARK_Mode is pragma Annotate (GNATprove, External_Axiomatization); pragma Annotate (CodePeer, Skip_Analysis); type List (Capacity : Count_Type) is private with Iterable => (First => First, Next => Next, Has_Element => Has_Element, Element => Element), Default_Initial_Condition => Is_Empty (List); pragma Preelaborable_Initialization (List); type Cursor is private; pragma Preelaborable_Initialization (Cursor); Empty_List : constant List; No_Element : constant Cursor; function "=" (Left, Right : List) return Boolean with Global => null; function Length (Container : List) return Count_Type with Global => null; function Is_Empty (Container : List) return Boolean with Global => null; procedure Clear (Container : in out List) with Global => null; procedure Assign (Target : in out List; Source : List) with Global => null, Pre => Target.Capacity >= Length (Source); function Copy (Source : List; Capacity : Count_Type := 0) return List with Global => null, Pre => Capacity = 0 or else Capacity >= Source.Capacity; function Element (Container : List; Position : Cursor) return Element_Type with Global => null, Pre => Has_Element (Container, Position); procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type) with Global => null, Pre => Has_Element (Container, Position); procedure Move (Target : in out List; Source : in out List) with Global => null, Pre => Target.Capacity >= Length (Source); procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1) with Global => null, Pre => Length (Container) + Count <= Container.Capacity and then (Has_Element (Container, Before) or else Before = No_Element); procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1) with Global => null, Pre => Length (Container) + Count <= Container.Capacity and then (Has_Element (Container, Before) or else Before = No_Element); procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1) with Global => null, Pre => Length (Container) + Count <= Container.Capacity and then (Has_Element (Container, Before) or else Before = No_Element); procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) with Global => null, Pre => Length (Container) + Count <= Container.Capacity; procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1) with Global => null, Pre => Length (Container) + Count <= Container.Capacity; procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1) with Global => null, Pre => Has_Element (Container, Position); procedure Delete_First (Container : in out List; Count : Count_Type := 1) with Global => null; procedure Delete_Last (Container : in out List; Count : Count_Type := 1) with Global => null; procedure Reverse_Elements (Container : in out List) with Global => null; procedure Swap (Container : in out List; I, J : Cursor) with Global => null, Pre => Has_Element (Container, I) and then Has_Element (Container, J); procedure Swap_Links (Container : in out List; I, J : Cursor) with Global => null, Pre => Has_Element (Container, I) and then Has_Element (Container, J); procedure Splice (Target : in out List; Before : Cursor; Source : in out List) with Global => null, Pre => Length (Source) + Length (Target) <= Target.Capacity and then (Has_Element (Target, Before) or else Before = No_Element); procedure Splice (Target : in out List; Before : Cursor; Source : in out List; Position : in out Cursor) with Global => null, Pre => Length (Source) + Length (Target) <= Target.Capacity and then (Has_Element (Target, Before) or else Before = No_Element) and then Has_Element (Source, Position); procedure Splice (Container : in out List; Before : Cursor; Position : Cursor) with Global => null, Pre => 2 * Length (Container) <= Container.Capacity and then (Has_Element (Container, Before) or else Before = No_Element) and then Has_Element (Container, Position); function First (Container : List) return Cursor with Global => null; function First_Element (Container : List) return Element_Type with Global => null, Pre => not Is_Empty (Container); function Last (Container : List) return Cursor with Global => null; function Last_Element (Container : List) return Element_Type with Global => null, Pre => not Is_Empty (Container); function Next (Container : List; Position : Cursor) return Cursor with Global => null, Pre => Has_Element (Container, Position) or else Position = No_Element; procedure Next (Container : List; Position : in out Cursor) with Global => null, Pre => Has_Element (Container, Position) or else Position = No_Element; function Previous (Container : List; Position : Cursor) return Cursor with Global => null, Pre => Has_Element (Container, Position) or else Position = No_Element; procedure Previous (Container : List; Position : in out Cursor) with Global => null, Pre => Has_Element (Container, Position) or else Position = No_Element; function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor with Global => null, Pre => Has_Element (Container, Position) or else Position = No_Element; function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor with Global => null, Pre => Has_Element (Container, Position) or else Position = No_Element; function Contains (Container : List; Item : Element_Type) return Boolean with Global => null; function Has_Element (Container : List; Position : Cursor) return Boolean with Global => null; generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting with SPARK_Mode is function Is_Sorted (Container : List) return Boolean with Global => null; procedure Sort (Container : in out List) with Global => null; procedure Merge (Target, Source : in out List) with Global => null; end Generic_Sorting; function Strict_Equal (Left, Right : List) return Boolean with Ghost, Global => null; -- Strict_Equal returns True if the containers are physically equal, i.e. -- they are structurally equal (function "=" returns True) and that they -- have the same set of cursors. function First_To_Previous (Container : List; Current : Cursor) return List with Ghost, Global => null, Pre => Has_Element (Container, Current) or else Current = No_Element; function Current_To_Last (Container : List; Current : Cursor) return List with Ghost, Global => null, Pre => Has_Element (Container, Current) or else Current = No_Element; -- First_To_Previous returns a container containing all elements preceding -- Current (excluded) in Container. Current_To_Last returns a container -- containing all elements following Current (included) in Container. -- These two new functions can be used to express invariant properties in -- loops which iterate over containers. First_To_Previous returns the part -- of the container already scanned and Current_To_Last the part not -- scanned yet. private pragma SPARK_Mode (Off); type Node_Type is record Prev : Count_Type'Base := -1; Next : Count_Type; Element : Element_Type; end record; function "=" (L, R : Node_Type) return Boolean is abstract; type Node_Array is array (Count_Type range <>) of Node_Type; function "=" (L, R : Node_Array) return Boolean is abstract; type List (Capacity : Count_Type) is record Free : Count_Type'Base := -1; Length : Count_Type := 0; First : Count_Type := 0; Last : Count_Type := 0; Nodes : Node_Array (1 .. Capacity) := (others => <>); end record; type Cursor is record Node : Count_Type := 0; end record; Empty_List : constant List := (0, others => <>); No_Element : constant Cursor := (Node => 0); end Ada.Containers.Formal_Doubly_Linked_Lists;
30,903
ada
1
micahwelf/FLTK-Ada
src/fltk-devices-surfaces-copy.ads
with FLTK.Widgets.Groups.Windows; package FLTK.Devices.Surfaces.Copy is type Copy_Surface is new Surface_Device with private; type Copy_Surface_Reference (Data : not null access Copy_Surface'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (W, H : in Natural) return Copy_Surface; end Forge; function Get_W (This : in Copy_Surface) return Integer; function Get_H (This : in Copy_Surface) return Integer; procedure Draw_Widget (This : in out Copy_Surface; Item : in FLTK.Widgets.Widget'Class; Offset_X, Offset_Y : in Integer := 0); procedure Draw_Decorated_Window (This : in out Copy_Surface; Item : in FLTK.Widgets.Groups.Windows.Window'Class; Offset_X, Offset_Y : in Integer := 0); procedure Set_Current (This : in out Copy_Surface); private type Copy_Surface is new Surface_Device with null record; overriding procedure Finalize (This : in out Copy_Surface); pragma Inline (Get_W); pragma Inline (Get_H); pragma Inline (Draw_Widget); pragma Inline (Draw_Decorated_Window); pragma Inline (Set_Current); end FLTK.Devices.Surfaces.Copy;
30,904
ada
7
best08618/asylo
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt50_pkg.ads
<reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt50_pkg.ads package Opt50_Pkg is type Enum is (One, Two, Three); for Enum'Size use 16; type Enum_Boolean_Array is array (Enum range <>) of Boolean; procedure Get (Kind : String; Result : out Enum; Success : out Boolean); procedure Set (A : Enum_Boolean_Array); end Opt50_Pkg;
30,905
ada
7
best08618/asylo
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/a85013b.ada
-- A85013B.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: -- A) A SUBPROGRAM OR ENTRY CAN BE RENAMED WITHIN ITS OWN BODY. -- B) THE NEW NAME OF A SUBPROGRAM CAN BE USED IN A RENAMING -- DECLARATION. -- EG 02/22/84 WITH REPORT; PROCEDURE A85013B IS USE REPORT; BEGIN TEST("A85013B","CHECK THAT A SUBPROGRAM CAN BE RENAMED WITHIN " & "ITS OWN BODY AND THAT THE NEW NAME CAN BE USED" & " IN A RENAMING DECLARATION"); DECLARE PROCEDURE PROC1 (A : BOOLEAN) IS PROCEDURE PROC2 (B : BOOLEAN := FALSE) RENAMES PROC1; PROCEDURE PROC3 (C : BOOLEAN := FALSE) RENAMES PROC2; BEGIN IF A THEN PROC3; END IF; END PROC1; BEGIN PROC1 (TRUE); END; DECLARE TASK T IS ENTRY E; END T; TASK BODY T IS PROCEDURE E1 RENAMES E; PROCEDURE E2 RENAMES E1; BEGIN ACCEPT E DO DECLARE PROCEDURE E3 RENAMES E; PROCEDURE E4 RENAMES E3; BEGIN NULL; END; END E; END T; BEGIN T.E; END; RESULT; END A85013B;
30,906
ada
24
svn2github/matreshka
source/amf/uml/amf-visitors-umldi_iterators.ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- 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.UMLDI.UML_Activity_Diagrams; with AMF.UMLDI.UML_Association_End_Labels; with AMF.UMLDI.UML_Association_Or_Connector_Or_Link_Shapes; with AMF.UMLDI.UML_Class_Diagrams; with AMF.UMLDI.UML_Classifier_Shapes; with AMF.UMLDI.UML_Compartmentable_Shapes; with AMF.UMLDI.UML_Compartments; with AMF.UMLDI.UML_Component_Diagrams; with AMF.UMLDI.UML_Composite_Structure_Diagrams; with AMF.UMLDI.UML_Deployment_Diagrams; with AMF.UMLDI.UML_Edges; with AMF.UMLDI.UML_Interaction_Diagrams; with AMF.UMLDI.UML_Interaction_Table_Labels; with AMF.UMLDI.UML_Keyword_Labels; with AMF.UMLDI.UML_Labels; with AMF.UMLDI.UML_Multiplicity_Labels; with AMF.UMLDI.UML_Name_Labels; with AMF.UMLDI.UML_Object_Diagrams; with AMF.UMLDI.UML_Package_Diagrams; with AMF.UMLDI.UML_Profile_Diagrams; with AMF.UMLDI.UML_Redefines_Labels; with AMF.UMLDI.UML_Shapes; with AMF.UMLDI.UML_State_Machine_Diagrams; with AMF.UMLDI.UML_State_Shapes; with AMF.UMLDI.UML_Stereotype_Property_Value_Labels; with AMF.UMLDI.UML_Styles; with AMF.UMLDI.UML_Typed_Element_Labels; with AMF.UMLDI.UML_Use_Case_Diagrams; package AMF.Visitors.UMLDI_Iterators is pragma Preelaborate; type UMLDI_Iterator is limited interface and AMF.Visitors.Abstract_Iterator; not overriding procedure Visit_UML_Activity_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Activity_Diagrams.UMLDI_UML_Activity_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Association_End_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Association_End_Labels.UMLDI_UML_Association_End_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Association_Or_Connector_Or_Link_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Association_Or_Connector_Or_Link_Shapes.UMLDI_UML_Association_Or_Connector_Or_Link_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Class_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Class_Diagrams.UMLDI_UML_Class_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Classifier_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Classifier_Shapes.UMLDI_UML_Classifier_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Compartment (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Compartments.UMLDI_UML_Compartment_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Compartmentable_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Compartmentable_Shapes.UMLDI_UML_Compartmentable_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Component_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Component_Diagrams.UMLDI_UML_Component_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Composite_Structure_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Composite_Structure_Diagrams.UMLDI_UML_Composite_Structure_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Deployment_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Deployment_Diagrams.UMLDI_UML_Deployment_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Edge (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Edges.UMLDI_UML_Edge_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Interaction_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Interaction_Diagrams.UMLDI_UML_Interaction_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Interaction_Table_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Interaction_Table_Labels.UMLDI_UML_Interaction_Table_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Keyword_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Keyword_Labels.UMLDI_UML_Keyword_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Multiplicity_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Multiplicity_Labels.UMLDI_UML_Multiplicity_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Name_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Name_Labels.UMLDI_UML_Name_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Object_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Object_Diagrams.UMLDI_UML_Object_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Package_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Package_Diagrams.UMLDI_UML_Package_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Profile_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Profile_Diagrams.UMLDI_UML_Profile_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Redefines_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Redefines_Labels.UMLDI_UML_Redefines_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_State_Machine_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_State_Machine_Diagrams.UMLDI_UML_State_Machine_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_State_Shape (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_State_Shapes.UMLDI_UML_State_Shape_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Stereotype_Property_Value_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Stereotype_Property_Value_Labels.UMLDI_UML_Stereotype_Property_Value_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Style (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Typed_Element_Label (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Typed_Element_Labels.UMLDI_UML_Typed_Element_Label_Access; Control : in out AMF.Visitors.Traverse_Control) is null; not overriding procedure Visit_UML_Use_Case_Diagram (Self : in out UMLDI_Iterator; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Element : not null AMF.UMLDI.UML_Use_Case_Diagrams.UMLDI_UML_Use_Case_Diagram_Access; Control : in out AMF.Visitors.Traverse_Control) is null; end AMF.Visitors.UMLDI_Iterators;
30,907
ada
0
strenkml/EE368
memsim-master/src/memory-prefetch.adb
<gh_stars>0 package body Memory.Prefetch is function Create_Prefetch(mem : access Memory_Type'Class; stride : Address_Type := 1) return Prefetch_Pointer is result : constant Prefetch_Pointer := new Prefetch_Type; begin result.stride := stride; Set_Memory(result.all, mem); return result; end Create_Prefetch; function Random_Prefetch(next : access Memory_Type'Class; generator : Distribution_Type; max_cost : Cost_Type) return Memory_Pointer is result : Prefetch_Pointer := new Prefetch_Type; wsize : constant Positive := Get_Word_Size(next.all); begin Set_Memory(result.all, next); if Get_Cost(result.all) > max_cost then Set_Memory(result.all, null); Destroy(Memory_Pointer(result)); return Memory_Pointer(next); end if; result.stride := Address_Type(Random(generator) mod 3) - 1; result.stride := result.stride * Address_Type(wsize); return Memory_Pointer(result); end Random_Prefetch; function Clone(mem : Prefetch_Type) return Memory_Pointer is result : constant Prefetch_Pointer := new Prefetch_Type'(mem); begin return Memory_Pointer(result); end Clone; procedure Permute(mem : in out Prefetch_Type; generator : in Distribution_Type; max_cost : in Cost_Type) is wsize : constant Positive := Get_Word_Size(mem); begin if (Random(generator) mod 2) = 0 then mem.stride := mem.stride + Address_Type(wsize); else mem.stride := mem.stride - Address_Type(wsize); end if; end Permute; procedure Reset(mem : in out Prefetch_Type; context : in Natural) is begin Reset(Container_Type(mem), context); mem.pending := 0; end Reset; procedure Read(mem : in out Prefetch_Type; address : in Address_Type; size : in Positive) is begin -- Add any time left from the last prefetch. Advance(mem, mem.pending); mem.pending := 0; -- Fetch the requested address. Read(Container_Type(mem), address, size); -- Prefetch the next address and save the time needed for the fetch. if mem.stride /= 0 and then address mod mem.stride = 0 then declare asize : constant Address_Type := Address_Type(size) + mem.stride; ssize : constant Address_Type := (asize - 1) / mem.stride; next : constant Address_Type := address + mem.stride * ssize; begin Start(mem); Do_Read(mem, next, 1); Commit(mem, mem.pending); end; end if; end Read; procedure Write(mem : in out Prefetch_Type; address : in Address_Type; size : in Positive) is begin -- Add any time left from the last prefetch. Advance(mem, mem.pending); mem.pending := 0; -- Write the requested address. Write(Container_Type(mem), address, size); end Write; procedure Idle(mem : in out Prefetch_Type; cycles : in Time_Type) is begin if cycles >= mem.pending then mem.pending := 0; else mem.pending := mem.pending - cycles; end if; Idle(Container_Type(mem), cycles); end Idle; function Get_Time(mem : Prefetch_Type) return Time_Type is begin return Get_Time(Container_Type(mem)) + mem.pending; end Get_Time; function To_String(mem : Prefetch_Type) return Unbounded_String is result : Unbounded_String; begin Append(result, "(prefetch "); Append(result, "(stride "); if (mem.stride and 2 ** 63) /= 0 then Append(result, "-" & To_String(-mem.stride)); else Append(result, To_String(mem.stride)); end if; Append(result, ")"); Append(result, "(memory "); Append(result, To_String(Container_Type(mem))); Append(result, ")"); Append(result, ")"); return result; end To_String; function Get_Cost(mem : Prefetch_Type) return Cost_Type is begin return Get_Cost(Container_Type(mem)); end Get_Cost; procedure Generate(mem : in Prefetch_Type; sigs : in out Unbounded_String; code : in out Unbounded_String) is wsize : constant Natural := Get_Word_Size(mem); word_bits : constant Natural := 8 * wsize; other : constant Memory_Pointer := Get_Memory(mem); name : constant String := "m" & To_String(Get_ID(mem)); oname : constant String := "m" & To_String(Get_ID(other.all)); stride : constant Address_Type := mem.stride; begin Generate(other.all, sigs, code); Declare_Signals(sigs, name, word_bits); Line(code, name & "_inst : entity work.prefetch"); Line(code, " generic map ("); Line(code, " ADDR_WIDTH => ADDR_WIDTH,"); Line(code, " WORD_WIDTH => " & To_String(word_bits) & ","); if (stride and 2 ** 63) /= 0 then Line(code, " STRIDE => -" & To_String((-stride) / Address_Type(wsize))); else Line(code, " STRIDE => " & To_String(stride / Address_Type(wsize))); end if; Line(code, " )"); Line(code, " port map ("); Line(code, " clk => clk,"); Line(code, " rst => rst,"); Line(code, " addr => " & name & "_addr,"); Line(code, " din => " & name & "_din,"); Line(code, " dout => " & name & "_dout,"); Line(code, " re => " & name & "_re,"); Line(code, " we => " & name & "_we,"); Line(code, " mask => " & name & "_mask,"); Line(code, " ready => " & name & "_ready,"); Line(code, " maddr => " & oname & "_addr,"); Line(code, " min => " & oname & "_dout,"); Line(code, " mout => " & oname & "_din,"); Line(code, " mre => " & oname & "_re,"); Line(code, " mwe => " & oname & "_we,"); Line(code, " mmask => " & oname & "_mask,"); Line(code, " mready => " & oname & "_ready"); Line(code, " );"); end Generate; end Memory.Prefetch;
30,908
ada
1
vidkidz/crossbridge
llvm-gcc-4.2-2.9/gcc/ada/sem_ch3.ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ C H 3 -- -- -- -- 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. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Nlists; use Nlists; with Types; use Types; package Sem_Ch3 is procedure Analyze_Component_Declaration (N : Node_Id); procedure Analyze_Incomplete_Type_Decl (N : Node_Id); procedure Analyze_Itype_Reference (N : Node_Id); procedure Analyze_Number_Declaration (N : Node_Id); procedure Analyze_Object_Declaration (N : Node_Id); procedure Analyze_Others_Choice (N : Node_Id); procedure Analyze_Private_Extension_Declaration (N : Node_Id); procedure Analyze_Subtype_Declaration (N : Node_Id); procedure Analyze_Subtype_Indication (N : Node_Id); procedure Analyze_Type_Declaration (N : Node_Id); procedure Analyze_Variant_Part (N : Node_Id); function Access_Definition (Related_Nod : Node_Id; N : Node_Id) return Entity_Id; -- An access definition defines a general access type for a formal -- parameter. The procedure is called when processing formals, when -- the current scope is the subprogram. The Implicit type is attached -- to the Related_Nod put into the enclosing scope, so that the only -- entities defined in the spec are the formals themselves. procedure Access_Subprogram_Declaration (T_Name : Entity_Id; T_Def : Node_Id); -- The subprogram specification yields the signature of an implicit -- type, whose Ekind is Access_Subprogram_Type. This implicit type is -- the designated type of the declared access type. In subprogram calls, -- the signature of the implicit type works like the profile of a regular -- subprogram. procedure Analyze_Declarations (L : List_Id); -- Called to analyze a list of declarations (in what context ???). Also -- performs necessary freezing actions (more description needed ???) procedure Analyze_Interface_Declaration (T : Entity_Id; Def : Node_Id); -- Analyze an interface declaration or a formal interface declaration procedure Analyze_Per_Use_Expression (N : Node_Id; T : Entity_Id); -- Default and per object expressions do not freeze their components, -- and must be analyzed and resolved accordingly. The analysis is -- done by calling the Pre_Analyze_And_Resolve routine and setting -- the global In_Default_Expression flag. See the documentation section -- entitled "Handling of Default and Per-Object Expressions" in sem.ads -- for details. N is the expression to be analyzed, T is the expected type. procedure Array_Type_Declaration (T : in out Entity_Id; Def : Node_Id); -- Process an array type declaration. If the array is constrained, we -- create an implicit parent array type, with the same index types and -- component type. procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id); -- Process an access type declaration procedure Check_Abstract_Overriding (T : Entity_Id); -- Check that all abstract subprograms inherited from T's parent type -- have been overridden as required, and that nonabstract subprograms -- have not been incorrectly overridden with an abstract subprogram. procedure Check_Aliased_Component_Types (T : Entity_Id); -- Given an array type or record type T, check that if the type is -- nonlimited, then the nominal subtype of any components of T -- that have discriminants must be constrained. procedure Check_Completion (Body_Id : Node_Id := Empty); -- At the end of a declarative part, verify that all entities that -- require completion have received one. If Body_Id is absent, the -- error indicating a missing completion is placed on the declaration -- that needs completion. If Body_Id is present, it is the defining -- identifier of a package body, and errors are posted on that node, -- rather than on the declarations that require completion in the package -- declaration. procedure Collect_Interfaces (N : Node_Id; Derived_Type : Entity_Id); -- Ada 2005 (AI-251): Subsidiary procedure to Build_Derived_Record_Type -- and Analyze_Formal_Interface_Type. -- Collect the list of interfaces that are not already implemented by the -- ancestors. This is the list of interfaces for which we must provide -- additional tag components. procedure Derive_Subprogram (New_Subp : in out Entity_Id; Parent_Subp : Entity_Id; Derived_Type : Entity_Id; Parent_Type : Entity_Id; Actual_Subp : Entity_Id := Empty); -- Derive the subprogram Parent_Subp from Parent_Type, and replace the -- subsidiary subtypes with the derived type to build the specification -- of the inherited subprogram (returned in New_Subp). For tagged types, -- the derived subprogram is aliased to that of the actual (in the -- case where Actual_Subp is nonempty) rather than to the corresponding -- subprogram of the parent type. procedure Derive_Subprograms (Parent_Type : Entity_Id; Derived_Type : Entity_Id; Generic_Actual : Entity_Id := Empty; No_Predefined_Prims : Boolean := False); -- To complete type derivation, collect/retrieve the primitive operations -- of the parent type, and replace the subsidiary subtypes with the derived -- type, to build the specs of the inherited ops. For generic actuals, the -- mapping of the primitive operations to those of the parent type is also -- done by rederiving the operations within the instance. For tagged types, -- the derived subprograms are aliased to those of the actual, not those of -- the ancestor. The last two params are used in case of derivation from -- abstract interface types: No_Predefined_Prims is used to avoid the -- derivation of predefined primitives from an abstract interface. -- -- Note: one might expect this to be private to the package body, but -- there is one rather unusual usage in package Exp_Dist. function Find_Type_Of_Subtype_Indic (S : Node_Id) return Entity_Id; -- Given a subtype indication S (which is really an N_Subtype_Indication -- node or a plain N_Identifier), find the type of the subtype mark. function Find_Type_Name (N : Node_Id) return Entity_Id; -- Enter the identifier in a type definition, or find the entity already -- declared, in the case of the full declaration of an incomplete or -- private type. function Get_Discriminant_Value (Discriminant : Entity_Id; Typ_For_Constraint : Entity_Id; Constraint : Elist_Id) return Node_Id; -- ??? MORE DOCUMENTATION -- Given a discriminant somewhere in the Typ_For_Constraint tree -- and a Constraint, return the value of that discriminant. function Is_Null_Extension (T : Entity_Id) return Boolean; -- Returns True if the tagged type T has an N_Full_Type_Declaration that -- is a null extension, meaning that it has an extension part without any -- components and does not have a known discriminant part. function Is_Visible_Component (C : Entity_Id) return Boolean; -- Determines if a record component C is visible in the present context. -- Note that even though component C could appear in the entity chain -- of a record type, C may not be visible in the current context. For -- instance, C may be a component inherited in the full view of a private -- extension which is not visible in the current context. procedure Make_Index (I : Node_Id; Related_Nod : Node_Id; Related_Id : Entity_Id := Empty; Suffix_Index : Nat := 1); -- Process an index that is given in an array declaration, an entry -- family declaration or a loop iteration. The index is given by an -- index declaration (a 'box'), or by a discrete range. The later can -- be the name of a discrete type, or a subtype indication. -- Related_Nod is the node where the potential generated implicit types -- will be inserted. The 2 last parameters are used for creating the name. procedure Make_Class_Wide_Type (T : Entity_Id); -- A Class_Wide_Type is created for each tagged type definition. The -- attributes of a class wide type are inherited from those of the type -- T. If T is introduced by a private declaration, the corresponding -- class wide type is created at the same time, and therefore there is -- a private and a full declaration for the class wide type type as well. procedure Process_Full_View (N : Node_Id; Full_T, Priv_T : Entity_Id); -- Process some semantic actions when the full view of a private type is -- encountered and analyzed. The first action is to create the full views -- of the dependant private subtypes. The second action is to recopy the -- primitive operations of the private view (in the tagged case). -- N is the N_Full_Type_Declaration node. -- Full_T is the full view of the type whose full declaration is in N. -- -- Priv_T is the private view of the type whose full declaration is in N. procedure Process_Range_Expr_In_Decl (R : Node_Id; T : Entity_Id; Check_List : List_Id := Empty_List; R_Check_Off : Boolean := False); -- Process a range expression that appears in a declaration context. The -- range is analyzed and resolved with the base type of the given type, -- and an appropriate check for expressions in non-static contexts made -- on the bounds. R is analyzed and resolved using T, so the caller should -- if necessary link R into the tree before the call, and in particular in -- the case of a subtype declaration, it is appropriate to set the parent -- pointer of R so that the types get properly frozen. The Check_List -- parameter is used when the subprogram is called from -- Build_Record_Init_Proc and is used to return a set of constraint -- checking statements generated by the Checks package. R_Check_Off is -- set to True when the call to Range_Check is to be skipped. function Process_Subtype (S : Node_Id; Related_Nod : Node_Id; Related_Id : Entity_Id := Empty; Suffix : Character := ' ') return Entity_Id; -- Process a subtype indication S and return corresponding entity. -- Related_Nod is the node where the potential generated implicit types -- will be inserted. The Related_Id and Suffix parameters are used to -- build the associated Implicit type name. procedure Process_Discriminants (N : Node_Id; Prev : Entity_Id := Empty); -- Process the discriminants contained in an N_Full_Type_Declaration or -- N_Incomplete_Type_Decl node N. If the declaration is a completion, -- Prev is entity on the partial view, on which references are posted. function Replace_Anonymous_Access_To_Protected_Subprogram (N : Node_Id; Prev_E : Entity_Id) return Entity_Id; -- Ada 2005 (AI-254): Create and decorate an internal full type declaration -- in the enclosing scope corresponding to an anonymous access to protected -- subprogram. In addition, replace the anonymous access by an occurrence -- of this internal type. Prev_Etype is used to link the new internal -- entity with the anonymous entity. Return the entity of this type -- declaration. procedure Set_Completion_Referenced (E : Entity_Id); -- If E is the completion of a private or incomplete type declaration, -- or the completion of a deferred constant declaration, mark the entity -- as referenced. Warnings on unused entities, if needed, go on the -- partial view. end Sem_Ch3;
30,909
ada
9
ajnavarro/language-dataset
data/github.com/janverschelde/PHCpack/2666077c7461478d61ddaf87cb713fe5d569e7ff/src/Ada/Math_Lib/Matrices/varbprec_matrix_conversions.ads
<reponame>ajnavarro/language-dataset<gh_stars>1-10 with Standard_Natural_Numbers; use Standard_Natural_Numbers; with Standard_Floating_Matrices; with Standard_Complex_Matrices; with Double_Double_Matrices; with Quad_Double_Matrices; with Multprec_Floating_Matrices; with DoblDobl_Complex_Matrices; with QuadDobl_Complex_Matrices; with Multprec_Complex_Matrices; package VarbPrec_Matrix_Conversions is -- DESCRIPTION : -- Often we want to convert matrices of various precisions. -- This package collects routines to convert between matrices of -- different types of precision for use in variable precision solvers, -- for real and complex numbers. function d2dd ( mtx : Standard_Floating_Matrices.Matrix ) return Double_Double_Matrices.Matrix; function d2dd ( mtx : Standard_Complex_Matrices.Matrix ) return DoblDobl_Complex_Matrices.Matrix; function d2qd ( mtx : Standard_Floating_Matrices.Matrix ) return Quad_Double_Matrices.Matrix; function d2qd ( mtx : Standard_Complex_Matrices.Matrix ) return QuadDobl_Complex_Matrices.Matrix; function d2mp ( mtx : Standard_Floating_Matrices.Matrix ) return Multprec_Floating_Matrices.Matrix; function d2mp ( mtx : Standard_Complex_Matrices.Matrix ) return Multprec_Complex_Matrices.Matrix; -- DESCRIPTION : -- Converts a floating-point matrix in standard double precision -- to a matrix in double double (dd), quad double (qd) precision, -- or arbitrary multiprecision (mp). function dd2d ( mtx : Double_Double_Matrices.Matrix ) return Standard_Floating_Matrices.Matrix; function dd2d ( mtx : DoblDobl_Complex_Matrices.Matrix ) return Standard_Complex_Matrices.Matrix; function dd2qd ( mtx : Double_Double_Matrices.Matrix ) return Quad_Double_Matrices.Matrix; function dd2qd ( mtx : DoblDobl_Complex_Matrices.Matrix ) return QuadDobl_Complex_Matrices.Matrix; function dd2mp ( mtx : Double_Double_Matrices.Matrix ) return Multprec_Floating_Matrices.Matrix; function dd2mp ( mtx : DoblDobl_Complex_Matrices.Matrix ) return Multprec_Complex_Matrices.Matrix; -- DESCRIPTION : -- Converts a matrix in double double precision to a matrix -- in standard double (d), quad double (qd) precision, -- or arbitrary multiprecision (mp). function qd2d ( mtx : Quad_Double_Matrices.Matrix ) return Standard_Floating_Matrices.Matrix; function qd2d ( mtx : QuadDobl_Complex_Matrices.Matrix ) return Standard_Complex_Matrices.Matrix; function qd2dd ( mtx : Quad_Double_Matrices.Matrix ) return Double_Double_Matrices.Matrix; function qd2dd ( mtx : QuadDobl_Complex_Matrices.Matrix ) return DoblDobl_Complex_Matrices.Matrix; function qd2mp ( mtx : Quad_Double_Matrices.Matrix ) return Multprec_Floating_Matrices.Matrix; function qd2mp ( mtx : QuadDobl_Complex_Matrices.Matrix ) return Multprec_Complex_Matrices.Matrix; -- DESCRIPTION : -- Converts a matrix in quad double precision to a matrix -- in standard double (d) or double double (dd) precision, -- or arbitrary multiprecision (mp). procedure Set_Size ( mtx : in out Multprec_Floating_Matrices.Matrix; size : in natural32 ); procedure Set_Size ( mtx : in out Multprec_Complex_Matrices.Matrix; size : in natural32 ); -- DESCRIPTION : -- Sets the size of the matrix mtx to the given value of size. end VarbPrec_Matrix_Conversions;
30,910
ada
25
My-Colaborations/ada-keystore
src/keystore-files.ads
<reponame>My-Colaborations/ada-keystore<filename>src/keystore-files.ads ----------------------------------------------------------------------- -- keystore-files -- Ada keystore files -- Copyright (C) 2019, 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 Keystore.Passwords.Keys; private with Keystore.Containers; package Keystore.Files is type Wallet_File is limited new Wallet with private; -- Open the keystore file and unlock the wallet using the given password. -- Raises the Bad_Password exception if no key slot match the password. procedure Open (Container : in out Wallet_File; Password : in Secret_Key; Path : in String; Data_Path : in String := ""; Config : in Wallet_Config := Secure_Config) with Pre => not Container.Is_Open, Post => Container.Is_Open; -- Open the keystore file without unlocking the wallet but get some information -- from the header section. procedure Open (Container : in out Wallet_File; Path : in String; Data_Path : in String := ""; Config : in Wallet_Config := Secure_Config; Info : out Wallet_Info) with Pre => not Container.Is_Open, Post => Container.State = S_PROTECTED; -- Create the keystore file and protect it with the given password. -- The key slot #1 is used. procedure Create (Container : in out Wallet_File; Password : in Secret_Key; Path : in String; Data_Path : in String := ""; Config : in Wallet_Config := Secure_Config) with Pre => not Container.Is_Open, Post => Container.Is_Open; procedure Create (Container : in out Wallet_File; Password : in out Keystore.Passwords.Provider'Class; Path : in String; Data_Path : in String := ""; Config : in Wallet_Config := Secure_Config) with Pre => not Container.Is_Open, Post => Container.Is_Open; -- Set the keystore master key before creating or opening the keystore. procedure Set_Master_Key (Container : in out Wallet_File; Password : in out Keystore.Passwords.Keys.Key_Provider'Class) with Pre => not Container.Is_Open; -- Unlock the wallet with the password. -- Raises the Bad_Password exception if no key slot match the password. procedure Unlock (Container : in out Wallet_File; Password : in Secret_Key) with Pre => Container.State = S_PROTECTED, Post => Container.Is_Open; procedure Unlock (Container : in out Wallet_File; Password : in out Keystore.Passwords.Provider'Class; Slot : out Key_Slot) with Pre => Container.State = S_PROTECTED, Post => Container.Is_Open; -- Close the keystore file. procedure Close (Container : in out Wallet_File) with Pre => Container.Is_Open, Post => not Container.Is_Open; -- Set some header data in the keystore file. procedure Set_Header_Data (Container : in out Wallet_File; Index : in Header_Slot_Index_Type; Kind : in Header_Slot_Type; Data : in Ada.Streams.Stream_Element_Array) with Pre => Container.State in S_OPEN | S_PROTECTED and Data'Length <= 1024; -- Get the header data information from the keystore file. procedure Get_Header_Data (Container : in out Wallet_File; Index : in Header_Slot_Index_Type; Kind : out Header_Slot_Type; Data : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) with Pre => Container.State = S_PROTECTED; -- Add in the wallet the named entry and associate it the children wallet. -- The children wallet meta data is protected by the container. -- The children wallet has its own key to protect the named entries it manages. procedure Add (Container : in out Wallet_File; Name : in String; Password : in out Keystore.Passwords.Provider'Class; Wallet : in out Wallet_File'Class) with Pre => Container.Is_Open and not Wallet.Is_Open, Post => Container.Is_Open and Wallet.Is_Open; procedure Add (Container : in out Wallet_File; Name : in String; Password : in Keystore.Secret_Key; Wallet : in out Wallet_File'Class) with Pre => Container.Is_Open and not Wallet.Is_Open, Post => Container.Is_Open and Wallet.Is_Open; -- Load from the container the named children wallet. procedure Open (Container : in out Wallet_File; Name : in String; Password : in out Keystore.Passwords.Provider'Class; Wallet : in out Wallet_File'Class) with Pre => Container.Is_Open and not Wallet.Is_Open, Post => Container.Is_Open and Wallet.Is_Open; procedure Open (Container : in out Wallet_File; Name : in String; Password : in Secret_Key; Wallet : in out Wallet_File'Class) with Pre => Container.Is_Open and not Wallet.Is_Open, Post => Container.Is_Open and Wallet.Is_Open; -- Return True if the container was configured. overriding function Is_Configured (Container : in Wallet_File) return Boolean; -- Return True if the container can be accessed. overriding function Is_Open (Container : in Wallet_File) return Boolean; -- Get the wallet state. overriding function State (Container : in Wallet_File) return State_Type; -- Set the key to encrypt and decrypt the container meta data. overriding procedure Set_Key (Container : in out Wallet_File; Password : in Secret_Key; New_Password : in Secret_Key; Config : in Wallet_Config; Mode : in Mode_Type) with Pre => Container.Is_Open; procedure Set_Key (Container : in out Wallet_File; Password : in out Keystore.Passwords.Provider'Class; New_Password : in out Keystore.Passwords.Provider'Class; Config : in Wallet_Config := Secure_Config; Mode : in Mode_Type := KEY_REPLACE) with Pre'Class => Container.Is_Open; -- Remove the key from the key slot identified by `Slot`. The password is necessary to -- make sure a valid password is available. The `Remove_Current` must be set to remove -- the slot when it corresponds to the used password. procedure Remove_Key (Container : in out Wallet_File; Password : in out Keystore.Passwords.Provider'Class; Slot : in Key_Slot; Force : in Boolean); -- Return True if the container contains the given named entry. overriding function Contains (Container : in Wallet_File; Name : in String) return Boolean with Pre => Container.Is_Open; -- Add in the wallet the named entry and associate it the content. -- The content is encrypted in AES-CBC with a secret key and an IV vector -- that is created randomly for the new named entry. overriding procedure Add (Container : in out Wallet_File; Name : in String; Kind : in Entry_Type := T_BINARY; Content : in Ada.Streams.Stream_Element_Array) with Pre => Container.Is_Open, Post => Container.Contains (Name); overriding procedure Add (Container : in out Wallet_File; Name : in String; Kind : in Entry_Type := T_BINARY; Input : in out Util.Streams.Input_Stream'Class) with Pre'Class => Container.Is_Open, Post'Class => Container.Contains (Name); -- Add or update in the wallet the named entry and associate it the content. -- The content is encrypted in AES-CBC with a secret key and an IV vector -- that is created randomly for the new or updated named entry. overriding procedure Set (Container : in out Wallet_File; Name : in String; Kind : in Entry_Type := T_BINARY; Content : in Ada.Streams.Stream_Element_Array) with Pre => Container.Is_Open, Post => Container.Contains (Name); overriding procedure Set (Container : in out Wallet_File; Name : in String; Kind : in Entry_Type := T_BINARY; Input : in out Util.Streams.Input_Stream'Class) with Pre => Container.Is_Open, Post => Container.Contains (Name); -- Update in the wallet the named entry and associate it the new content. -- The secret key and IV vectors are not changed. procedure Update (Container : in out Wallet_File; Name : in String; Kind : in Entry_Type := T_BINARY; Content : in Ada.Streams.Stream_Element_Array) with Pre => Container.Is_Open, Post => Container.Contains (Name); -- Read from the wallet the named entry starting at the given position. -- Upon successful completion, Last will indicate the last valid position of -- the Content array. overriding procedure Read (Container : in out Wallet_File; Name : in String; Offset : in Ada.Streams.Stream_Element_Offset; Content : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) with Pre => Container.Is_Open, Post => Container.Contains (Name); -- Write in the wallet the named entry starting at the given position. -- The existing content is overwritten or new content is appended. overriding procedure Write (Container : in out Wallet_File; Name : in String; Offset : in Ada.Streams.Stream_Element_Offset; Content : in Ada.Streams.Stream_Element_Array) with Pre => Container.Is_Open, Post => Container.Contains (Name); -- Delete from the wallet the named entry. overriding procedure Delete (Container : in out Wallet_File; Name : in String) with Pre => Container.Is_Open, Post => not Container.Contains (Name); overriding procedure Get (Container : in out Wallet_File; Name : in String; Info : out Entry_Info; Content : out Ada.Streams.Stream_Element_Array) with Pre => Container.Is_Open; -- Write in the output stream the named entry value from the wallet. overriding procedure Get (Container : in out Wallet_File; Name : in String; Output : in out Util.Streams.Output_Stream'Class) with Pre => Container.Is_Open; -- Get the list of entries contained in the wallet that correspond to the optional filter. overriding procedure List (Container : in out Wallet_File; Filter : in Filter_Type := (others => True); Content : out Entry_Map) with Pre => Container.Is_Open; -- Get the list of entries contained in the wallet that correspond to the optiona filter -- and whose name matches the pattern. procedure List (Container : in out Wallet_File; Pattern : in GNAT.Regpat.Pattern_Matcher; Filter : in Filter_Type := (others => True); Content : out Entry_Map) with Pre => Container.Is_Open; overriding function Find (Container : in out Wallet_File; Name : in String) return Entry_Info; -- Get wallet file information and statistics. procedure Get_Stats (Container : in out Wallet_File; Stats : out Wallet_Stats); procedure Set_Work_Manager (Container : in out Wallet_File; Workers : in Keystore.Task_Manager_Access); private type Wallet_File is limited new Wallet with record Container : Keystore.Containers.Wallet_Container; end record; overriding procedure Initialize (Wallet : in out Wallet_File); overriding procedure Finalize (Wallet : in out Wallet_File); end Keystore.Files;
30,911
ada
80
enfoTek/tomato.linksys.e2000.nvram-mod
tools-src/gnu/gcc/gcc/ada/exp_ch8.adb
<reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 8 -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 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. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Exp_Dbug; use Exp_Dbug; with Exp_Util; use Exp_Util; with Nlists; use Nlists; with Sem; use Sem; with Sem_Ch8; use Sem_Ch8; with Sinfo; use Sinfo; with Stand; use Stand; package body Exp_Ch8 is --------------------------------------------- -- Expand_N_Exception_Renaming_Declaration -- --------------------------------------------- procedure Expand_N_Exception_Renaming_Declaration (N : Node_Id) is Decl : constant Node_Id := Debug_Renaming_Declaration (N); begin if Present (Decl) then Insert_Action (N, Decl); end if; end Expand_N_Exception_Renaming_Declaration; ------------------------------------------ -- Expand_N_Object_Renaming_Declaration -- ------------------------------------------ -- Most object renaming cases can be done by just capturing the address -- of the renamed object. The cases in which this is not true are when -- this address is not computable, since it involves extraction of a -- packed array element, or of a record component to which a component -- clause applies (that can specify an arbitrary bit boundary), or where -- the enclosing record itself has a non-standard representation. -- In these two cases, we pre-evaluate the renaming expression, by -- extracting and freezing the values of any subscripts, and then we -- set the flag Is_Renaming_Of_Object which means that any reference -- to the object will be handled by macro substitution in the front -- end, and the back end will know to ignore the renaming declaration. -- An additional odd case that requires processing by expansion is -- the renaming of a discriminant of a mutable record type. The object -- is a constant because it renames something that cannot be assigned to, -- but in fact the underlying value can change and must be reevaluated -- at each reference. Gigi does have a notion of a "constant view" of -- an object, and therefore the front-end must perform the expansion. -- For simplicity, and to bypass some obscure code-generation problem, -- we use macro substitution for all renamed discriminants, whether the -- enclosing type is constrained or not. -- The other special processing required is for the case of renaming -- of an object of a class wide type, where it is necessary to build -- the appropriate subtype for the renamed object. -- More comments needed for this para ??? procedure Expand_N_Object_Renaming_Declaration (N : Node_Id) is Nam : Node_Id := Name (N); T : Entity_Id; Decl : Node_Id; procedure Evaluate_Name (Fname : Node_Id); -- A recursive procedure used to freeze a name in the sense described -- above, i.e. any variable references or function calls are removed. -- Of course the outer level variable reference must not be removed. -- For example in A(J,F(K)), A is left as is, but J and F(K) are -- evaluated and removed. function Evaluation_Required (Nam : Node_Id) return Boolean; -- Determines whether it is necessary to do static name evaluation -- for renaming of Nam. It is considered necessary if evaluating the -- name involves indexing a packed array, or extracting a component -- of a record to which a component clause applies. Note that we are -- only interested in these operations if they occur as part of the -- name itself, subscripts are just values that are computed as part -- of the evaluation, so their form is unimportant. ------------------- -- Evaluate_Name -- ------------------- procedure Evaluate_Name (Fname : Node_Id) is K : constant Node_Kind := Nkind (Fname); E : Node_Id; begin -- For an explicit dereference, we simply force the evaluation -- of the name expression. The dereference provides a value that -- is the address for the renamed object, and it is precisely -- this value that we want to preserve. if K = N_Explicit_Dereference then Force_Evaluation (Prefix (Fname)); -- For a selected component, we simply evaluate the prefix elsif K = N_Selected_Component then Evaluate_Name (Prefix (Fname)); -- For an indexed component, or an attribute reference, we evaluate -- the prefix, which is itself a name, recursively, and then force -- the evaluation of all the subscripts (or attribute expressions). elsif K = N_Indexed_Component or else K = N_Attribute_Reference then Evaluate_Name (Prefix (Fname)); E := First (Expressions (Fname)); while Present (E) loop Force_Evaluation (E); if Original_Node (E) /= E then Set_Do_Range_Check (E, Do_Range_Check (Original_Node (E))); end if; Next (E); end loop; -- For a slice, we evaluate the prefix, as for the indexed component -- case and then, if there is a range present, either directly or -- as the constraint of a discrete subtype indication, we evaluate -- the two bounds of this range. elsif K = N_Slice then Evaluate_Name (Prefix (Fname)); declare DR : constant Node_Id := Discrete_Range (Fname); Constr : Node_Id; Rexpr : Node_Id; begin if Nkind (DR) = N_Range then Force_Evaluation (Low_Bound (DR)); Force_Evaluation (High_Bound (DR)); elsif Nkind (DR) = N_Subtype_Indication then Constr := Constraint (DR); if Nkind (Constr) = N_Range_Constraint then Rexpr := Range_Expression (Constr); Force_Evaluation (Low_Bound (Rexpr)); Force_Evaluation (High_Bound (Rexpr)); end if; end if; end; -- For a type conversion, the expression of the conversion must be -- the name of an object, and we simply need to evaluate this name. elsif K = N_Type_Conversion then Evaluate_Name (Expression (Fname)); -- For a function call, we evaluate the call. elsif K = N_Function_Call then Force_Evaluation (Fname); -- The remaining cases are direct name, operator symbol and -- character literal. In all these cases, we do nothing, since -- we want to reevaluate each time the renamed object is used. else return; end if; end Evaluate_Name; ------------------------- -- Evaluation_Required -- ------------------------- function Evaluation_Required (Nam : Node_Id) return Boolean is begin if Nkind (Nam) = N_Indexed_Component or else Nkind (Nam) = N_Slice then if Is_Packed (Etype (Prefix (Nam))) then return True; else return Evaluation_Required (Prefix (Nam)); end if; elsif Nkind (Nam) = N_Selected_Component then declare Rec_Type : Entity_Id := Etype (Prefix (Nam)); begin if Present (Component_Clause (Entity (Selector_Name (Nam)))) or else Has_Non_Standard_Rep (Rec_Type) then return True; elsif Ekind (Entity (Selector_Name (Nam))) = E_Discriminant and then Is_Record_Type (Rec_Type) and then not Is_Concurrent_Record_Type (Rec_Type) then return True; else return Evaluation_Required (Prefix (Nam)); end if; end; else return False; end if; end Evaluation_Required; -- Start of processing for Expand_N_Object_Renaming_Declaration begin -- Perform name evaluation if required if Evaluation_Required (Nam) then Evaluate_Name (Nam); Set_Is_Renaming_Of_Object (Defining_Identifier (N)); end if; -- Deal with construction of subtype in class-wide case T := Etype (Defining_Identifier (N)); if Is_Class_Wide_Type (T) then Expand_Subtype_From_Expr (N, T, Subtype_Mark (N), Name (N)); Find_Type (Subtype_Mark (N)); Set_Etype (Defining_Identifier (N), Entity (Subtype_Mark (N))); end if; -- Create renaming entry for debug information Decl := Debug_Renaming_Declaration (N); if Present (Decl) then Insert_Action (N, Decl); end if; end Expand_N_Object_Renaming_Declaration; ------------------------------------------- -- Expand_N_Package_Renaming_Declaration -- ------------------------------------------- procedure Expand_N_Package_Renaming_Declaration (N : Node_Id) is Decl : constant Node_Id := Debug_Renaming_Declaration (N); begin if Present (Decl) then -- If we are in a compilation unit, then this is an outer -- level declaration, and must have a scope of Standard if Nkind (Parent (N)) = N_Compilation_Unit then declare Aux : constant Node_Id := Aux_Decls_Node (Parent (N)); begin New_Scope (Standard_Standard); if No (Actions (Aux)) then Set_Actions (Aux, New_List (Decl)); else Append (Decl, Actions (Aux)); end if; Analyze (Decl); Pop_Scope; end; -- Otherwise, just insert after the package declaration else Insert_Action (N, Decl); end if; end if; end Expand_N_Package_Renaming_Declaration; end Exp_Ch8;
30,912
ada
7
best08618/asylo
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/rep_clause5.adb
-- { dg-do compile } -- { dg-options "-O" } package body Rep_Clause5 is function To_LNumber(S : String) return LNumber_Type is V : VString; LV : Long_Type; LN : LNumber_Type; begin LV := To_Long(V, 10); LN := LNumber_Type(LV); return LN; end; procedure Merge_Numbered(LNodes : in out LNodes_Ptr) is T1 : Token_Type; LNO : LNumber_Type; begin for X in LNodes.all'Range loop T1 := LNodes(X).Line(0); if T1.Token /= LEX_LF then declare S : String := Element(T1.SID); begin begin LNO := To_LNumber(S); exception when Bad_Number => LNO := 0; when Too_Large => LNO := 0; end; end; end if; end loop; end; end Rep_Clause5;
30,913
ada
0
optikos/oasis
source/oasis/program-elements-defining_identifiers.ads
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; with Program.Elements.Defining_Names; with Program.Lexical_Elements; package Program.Elements.Defining_Identifiers is pragma Pure (Program.Elements.Defining_Identifiers); type Defining_Identifier is limited interface and Program.Elements.Defining_Names.Defining_Name; type Defining_Identifier_Access is access all Defining_Identifier'Class with Storage_Size => 0; type Defining_Identifier_Text is limited interface; type Defining_Identifier_Text_Access is access all Defining_Identifier_Text'Class with Storage_Size => 0; not overriding function To_Defining_Identifier_Text (Self : aliased in out Defining_Identifier) return Defining_Identifier_Text_Access is abstract; not overriding function Identifier_Token (Self : Defining_Identifier_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; type Defining_Identifier_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Defining_Identifier_Vector_Access is access all Defining_Identifier_Vector'Class with Storage_Size => 0; overriding function Element (Self : Defining_Identifier_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Defining_Identifier; function To_Defining_Identifier (Self : Defining_Identifier_Vector'Class; Index : Positive) return not null Defining_Identifier_Access is (Self.Element (Index).To_Defining_Identifier); end Program.Elements.Defining_Identifiers;
30,914
ada
4
faelys/gela-asis
tools/xml2ayacc/encoding/encodings-unicode.adb
<gh_stars>1-10 -------------------------------------------------------- -- E n c o d i n g s -- -- -- -- Tools for convertion strings between Unicode and -- -- national/vendor character sets. -- -- - - - - - - - - - -- -- Read copyright and license at the end of this file -- -------------------------------------------------------- with Encodings.Maps.ISO_8859_1; with Encodings.Maps.ISO_8859_2; with Encodings.Maps.ISO_8859_3; with Encodings.Maps.ISO_8859_4; with Encodings.Maps.ISO_8859_5; with Encodings.Maps.ISO_8859_6; with Encodings.Maps.ISO_8859_7; with Encodings.Maps.ISO_8859_8; with Encodings.Maps.ISO_8859_9; with Encodings.Maps.ISO_8859_10; with Encodings.Maps.ISO_8859_11; with Encodings.Maps.ISO_8859_13; with Encodings.Maps.ISO_8859_14; with Encodings.Maps.ISO_8859_15; with Encodings.Maps.ISO_8859_16; with Encodings.Maps.CP_037; with Encodings.Maps.CP_424; with Encodings.Maps.CP_437; with Encodings.Maps.CP_500; with Encodings.Maps.CP_737; with Encodings.Maps.CP_775; with Encodings.Maps.CP_850; with Encodings.Maps.CP_852; with Encodings.Maps.CP_855; with Encodings.Maps.CP_856; with Encodings.Maps.CP_857; with Encodings.Maps.CP_860; with Encodings.Maps.CP_861; with Encodings.Maps.CP_862; with Encodings.Maps.CP_863; with Encodings.Maps.CP_864; with Encodings.Maps.CP_865; with Encodings.Maps.CP_866; with Encodings.Maps.CP_869; with Encodings.Maps.CP_874; with Encodings.Maps.CP_875; with Encodings.Maps.CP_1006; with Encodings.Maps.CP_1026; with Encodings.Maps.CP_1250; with Encodings.Maps.CP_1251; with Encodings.Maps.CP_1252; with Encodings.Maps.CP_1253; with Encodings.Maps.CP_1254; with Encodings.Maps.CP_1255; with Encodings.Maps.CP_1256; with Encodings.Maps.CP_1257; with Encodings.Maps.CP_1258; with Encodings.Maps.AtariST; with Encodings.Maps.KOI8_R; package body Encodings.Unicode is ------------ -- Decode -- ------------ procedure Decode (Buffer : in String; Index : in out Positive; Free : in Positive; Map : in Encoding; Char : out Unicode_Character) is subtype C is Character; subtype W is Wide_Character; Ind : Positive := Index; function Continuing return Boolean is begin if Ind = Buffer'Last then Ind := Buffer'First; else Ind := Ind + 1; end if; if Ind = Free then Char := Empty_Buffer; return False; elsif C'Pos (Buffer (Ind)) in 2#1000_0000# .. 2#1011_1111# then Char := (Char * 2 ** 6) or (C'Pos (Buffer (Ind)) and 2#0011_1111#); return True; else raise Invalid_Encoding; end if; end Continuing; pragma Inline (Continuing); begin if Ind = Free then Char := Empty_Buffer; return; end if; case Map is when UTF_8 => case C'Pos (Buffer (Ind)) is when 2#0000_0000# .. 2#0111_1111# => Char := C'Pos (Buffer (Ind)); when 2#1100_0000# .. 2#1101_1111# => Char := C'Pos (Buffer (Ind)) and 2#0001_1111#; if not Continuing then return; end if; when 2#1110_0000# .. 2#1110_1111# => Char := C'Pos (Buffer (Ind)) and 2#0000_1111#; if not (Continuing and then Continuing) then return; end if; when 2#1111_0000# .. 2#1111_0111# => Char := C'Pos (Buffer (Ind)) and 2#0000_0111#; if not (Continuing and then Continuing and then Continuing) then return; end if; when 2#1111_1000# .. 2#1111_1011# => Char := C'Pos (Buffer (Ind)) and 2#0000_0011#; if not (Continuing and then Continuing and then Continuing and then Continuing) then return; end if; when 2#1111_1100# .. 2#1111_1101# => Char := C'Pos (Buffer (Ind)) and 2#0000_0001#; if not (Continuing and then Continuing and then Continuing and then Continuing and then Continuing) then return; end if; when others => raise Invalid_Encoding; end case; when ISO_8859_1 => Char := W'Pos (Maps.ISO_8859_1.Decode (Buffer (Ind))); when ISO_8859_2 => Char := W'Pos (Maps.ISO_8859_2.Decode (Buffer (Ind))); when ISO_8859_3 => Char := W'Pos (Maps.ISO_8859_3.Decode (Buffer (Ind))); when ISO_8859_4 => Char := W'Pos (Maps.ISO_8859_4.Decode (Buffer (Ind))); when ISO_8859_5 => Char := W'Pos (Maps.ISO_8859_5.Decode (Buffer (Ind))); when ISO_8859_6 => Char := W'Pos (Maps.ISO_8859_6.Decode (Buffer (Ind))); when ISO_8859_7 => Char := W'Pos (Maps.ISO_8859_7.Decode (Buffer (Ind))); when ISO_8859_8 => Char := W'Pos (Maps.ISO_8859_8.Decode (Buffer (Ind))); when ISO_8859_9 => Char := W'Pos (Maps.ISO_8859_9.Decode (Buffer (Ind))); when ISO_8859_10 => Char := W'Pos (Maps.ISO_8859_10.Decode (Buffer (Ind))); when ISO_8859_11 => Char := W'Pos (Maps.ISO_8859_11.Decode (Buffer (Ind))); when ISO_8859_13 => Char := W'Pos (Maps.ISO_8859_13.Decode (Buffer (Ind))); when ISO_8859_14 => Char := W'Pos (Maps.ISO_8859_14.Decode (Buffer (Ind))); when ISO_8859_15 => Char := W'Pos (Maps.ISO_8859_15.Decode (Buffer (Ind))); when ISO_8859_16 => Char := W'Pos (Maps.ISO_8859_16.Decode (Buffer (Ind))); when CP_037 => Char := W'Pos (Maps.CP_037.Decode (Buffer (Ind))); when CP_424 => Char := W'Pos (Maps.CP_424.Decode (Buffer (Ind))); when CP_437 => Char := W'Pos (Maps.CP_437.Decode (Buffer (Ind))); when CP_500 => Char := W'Pos (Maps.CP_500.Decode (Buffer (Ind))); when CP_875 => Char := W'Pos (Maps.CP_875.Decode (Buffer (Ind))); when CP_737 => Char := W'Pos (Maps.CP_737.Decode (Buffer (Ind))); when CP_775 => Char := W'Pos (Maps.CP_775.Decode (Buffer (Ind))); when CP_850 => Char := W'Pos (Maps.CP_850.Decode (Buffer (Ind))); when CP_852 => Char := W'Pos (Maps.CP_852.Decode (Buffer (Ind))); when CP_855 => Char := W'Pos (Maps.CP_855.Decode (Buffer (Ind))); when CP_856 => Char := W'Pos (Maps.CP_856.Decode (Buffer (Ind))); when CP_857 => Char := W'Pos (Maps.CP_857.Decode (Buffer (Ind))); when CP_860 => Char := W'Pos (Maps.CP_860.Decode (Buffer (Ind))); when CP_861 => Char := W'Pos (Maps.CP_861.Decode (Buffer (Ind))); when CP_862 => Char := W'Pos (Maps.CP_862.Decode (Buffer (Ind))); when CP_863 => Char := W'Pos (Maps.CP_863.Decode (Buffer (Ind))); when CP_864 => Char := W'Pos (Maps.CP_864.Decode (Buffer (Ind))); when CP_865 => Char := W'Pos (Maps.CP_865.Decode (Buffer (Ind))); when CP_866 => Char := W'Pos (Maps.CP_866.Decode (Buffer (Ind))); when CP_869 => Char := W'Pos (Maps.CP_869.Decode (Buffer (Ind))); when CP_874 => Char := W'Pos (Maps.CP_874.Decode (Buffer (Ind))); when CP_1006 => Char := W'Pos (Maps.CP_1006.Decode (Buffer (Ind))); when CP_1026 => Char := W'Pos (Maps.CP_1026.Decode (Buffer (Ind))); when CP_1250 => Char := W'Pos (Maps.CP_1250.Decode (Buffer (Ind))); when CP_1251 => Char := W'Pos (Maps.CP_1251.Decode (Buffer (Ind))); when CP_1252 => Char := W'Pos (Maps.CP_1252.Decode (Buffer (Ind))); when CP_1253 => Char := W'Pos (Maps.CP_1253.Decode (Buffer (Ind))); when CP_1254 => Char := W'Pos (Maps.CP_1254.Decode (Buffer (Ind))); when CP_1255 => Char := W'Pos (Maps.CP_1255.Decode (Buffer (Ind))); when CP_1256 => Char := W'Pos (Maps.CP_1256.Decode (Buffer (Ind))); when CP_1257 => Char := W'Pos (Maps.CP_1257.Decode (Buffer (Ind))); when CP_1258 => Char := W'Pos (Maps.CP_1258.Decode (Buffer (Ind))); when KOI8_R => Char := W'Pos (Maps.KOI8_R.Decode (Buffer (Ind))); when AtariST => Char := W'Pos (Maps.AtariST.Decode (Buffer (Ind))); when Unknown => raise Invalid_Encoding; end case; if Ind = Buffer'Last then Index := Buffer'First; else Index := Ind + 1; end if; end Decode; end Encodings.Unicode; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- 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 <NAME>, 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 OWNER 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. ------------------------------------------------------------------------------
30,915
ada
33
ytomino/drake
source/ada83/sequenio.ads
pragma License (Unrestricted); with Ada.Sequential_IO; generic package Sequential_IO renames Ada.Sequential_IO;
30,916
ada
0
Lucretia/old_nehe_ada95
thirdparty/adasdl/thin/adasdl/AdaSDL_framebuff/sdl_framebuffer_generics.adb
-- ----------------------------------------------------------------- -- -- AdaSDL_Framebuffer -- -- Copyright (C) 2001 A.M.F.Vargas -- -- <NAME> -- -- Ponta Delgada - Azores - Portugal -- -- http://www.adapower.net/~avargas -- -- E-mail: <EMAIL> -- -- ----------------------------------------------------------------- -- -- -- -- This library 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 2 of the License, or (at your option) any later version. -- -- -- -- This library 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 library; if not, write to the -- -- Free Software Foundation, Inc., 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. -- -- ----------------------------------------------------------------- -- -- ########################################################################## -- ### These are new extensions to the SDL API in order to improve the -- ### Ada code and to isolate the pointer arithmetic inside the library. -- ########################################################################## with Lib_C; package body SDL_Framebuffer_Generics is -- =========================================================== -- Go_XY_Generic -- =========================================================== function Go_XY_Generic ( Surface : Vd.Surface_ptr; X : Natural; Y : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; use Uint_Ptrs; begin if X < Natural (Surface.h) and Y < Natural (Surface.w) then return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t ( Y * Natural (Surface.pitch) / Natural (Surface.format.BytesPerPixel) + X)); else return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels))); end if; end Go_XY_Generic; -- =========================================================== -- Go_XY_Unchecked_Generic -- =========================================================== function Go_XY_Unchecked_Generic ( Surface : Vd.Surface_ptr; X : Natural; Y : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; use Uint_Ptrs; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t ( Y * Natural (Surface.pitch) / Natural (Surface.format.BytesPerPixel) + X)); end Go_XY_Unchecked_Generic; -- =========================================================== -- Get_Framebuffer_Generic -- =========================================================== function Get_Framebuffer_Generic ( Surface : Vd.Surface_ptr) return Uint_Ptrs.Object_Pointer is begin return Uint_Ptrs.To_Pointer (Surface.pixels); end Get_Framebuffer_Generic; -- =========================================================== -- Goto_Line_Generic -- =========================================================== function Goto_Line_Generic ( Surface : Vd.Surface_ptr; Line_Num : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; use type C.int; begin if Line_Num > Natural (Surface.h - 1) then return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t (Line_Num * Natural (Surface.pitch))); else return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels))); end if; end Goto_Line_Generic; -- =================================================================== -- Goto_Line_Unchecked_Generic -- =================================================================== function Goto_Line_Unchecked_Generic ( Surface : Vd.Surface_ptr; Line_Num : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t (Line_Num * Natural (Surface.pitch))); end Goto_Line_Unchecked_Generic; -- =========================================================== -- Goto_Line_End_Unchecked_Generic -- =========================================================== function Goto_Line_End_Unchecked_Generic ( Surface : Vd.Surface_ptr; Line_Num : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; use type C.int; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t (Line_Num * Natural (Surface.pitch) + Natural (Surface.w - 1))); end Goto_Line_End_Unchecked_Generic; -- =========================================================== -- Goto_Line_End_Generic -- =========================================================== function Goto_Line_End_Generic ( Surface : Vd.Surface_ptr; Line_Num : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; use type C.int; begin if Line_Num < Natural (Surface.h - 1) then return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t (Line_Num * Natural (Surface.pitch) + Natural (Surface.w - 1))); else return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Uint_Ptrs.To_Pointer (Surface.pixels)) + C.ptrdiff_t (Natural (Surface.w - 1))); end if; end Goto_Line_End_Generic; -- =========================================================== -- Next_Line_Unchecked_Generic -- =========================================================== function Next_Line_Unchecked_Generic ( Surface : Vd.Surface_ptr; Actual : Uint_Ptrs.Object_Pointer) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Actual) + C.ptrdiff_t (Surface.pitch)); end Next_Line_Unchecked_Generic; -- =========================================================== -- Prev_Line_Unchecked_Generic -- =========================================================== function Prev_Line_Unchecked_Generic ( Surface : Vd.Surface_ptr; Actual : Uint_Ptrs.Object_Pointer) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Actual) - C.ptrdiff_t (Surface.pitch)); end Prev_Line_Unchecked_Generic; -- =========================================================== -- Go_Right_Unchecked_Generic -- =========================================================== function Go_Right_Unchecked_Generic ( Actual : Uint_Ptrs.Object_Pointer; Displacement : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Actual) + C.ptrdiff_t (Displacement)); end Go_Right_Unchecked_Generic; -- =========================================================== -- Go_Left_Unchecked_Generic -- =========================================================== function Go_Left_Unchecked_Generic ( Actual : Uint_Ptrs.Object_Pointer; Displacement : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Actual) - C.ptrdiff_t (Displacement)); end Go_Left_Unchecked_Generic; -- =========================================================== -- Go_Up_Unchecked_Generic -- =========================================================== function Go_Up_Unchecked_Generic ( Surface : Vd.Surface_ptr; Actual : Uint_Ptrs.Object_Pointer; Displacement : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Actual) - C.ptrdiff_t (Uint16 (Displacement) * Surface.pitch)); end Go_Up_Unchecked_Generic; -- =========================================================== -- Go_Down_Unchecked_Generic -- =========================================================== function Go_Down_Unchecked_Generic ( Surface : Vd.Surface_ptr; Actual : Uint_Ptrs.Object_Pointer; Displacement : Natural) return Uint_Ptrs.Object_Pointer is use Uint_PtrOps; begin return Uint_Ptrs.Object_Pointer ( Uint_PtrOps.Pointer (Actual) + C.ptrdiff_t (Uint16 (Displacement) * Surface.pitch)); end Go_Down_Unchecked_Generic; -- =========================================================== -- Paint_Line_Generic -- =========================================================== procedure Paint_Line_Generic ( Surface : Vd.Surface_ptr; Line_Num : Natural; Color : C.int) is Line_Begin : Uint_Ptrs.Object_Pointer; begin Line_Begin := Goto_Line (Surface, Line_Num); Lib_C.memset ( Uint_Ptrs.To_Address (Line_Begin), Color, -- Surface.w * Surface.format.BytesPerPixel); C.size_t (Surface.pitch)); end Paint_Line_Generic; -- =========================================================== -- Paint_Line_Unchecked_Generic -- =========================================================== procedure Paint_Line_Unchecked_Generic ( Surface : Vd.Surface_ptr; Line_Begin : Uint_Ptrs.Object_Pointer; Color : C.int) is begin Lib_C.memset ( Uint_Ptrs.To_Address (Line_Begin), Color, -- Surface.w * Surface.format.BytesPerPixel); C.size_t (Surface.pitch)); end Paint_Line_Unchecked_Generic; -- =========================================================== function MapRGB_Generic ( format : Vd.PixelFormat_ptr; r : Uint8; g : Uint8; b : Uint8) return Element_Type is begin return Element_Type (Vd.MapRGB (format, r, g, b)); end MapRGB_Generic; -- =========================================================== end SDL_Framebuffer_Generics;
30,917
ada
33
ytomino/drake
source/containers/a-cohata.ads
<gh_stars>10-100 pragma License (Unrestricted); -- implementation unit with System; private package Ada.Containers.Hash_Tables is pragma Preelaborate; Node_Size : constant := Standard'Address_Size + Hash_Type'Size * 2; type Node; type Node_Access is access Node; type Node is limited record Next : Node_Access; Hash : Hash_Type; Index : Hash_Type; end record; for Node'Size use Node_Size; type Entry_List is limited record First : Node_Access; Previous : Node_Access; end record; type Entry_Array is array (Hash_Type range <>) of Entry_List; type Table (Last_Index : Hash_Type) is limited record First : Node_Access; Entries : Entry_Array (0 .. Last_Index); end record; type Table_Access is access Table; -- traversing function First (Container : Table_Access) return Node_Access; procedure Iterate ( Container : Table_Access; Process : not null access procedure (Position : not null Node_Access)); function Is_Before (Before, After : Node_Access) return Boolean; -- search function Find ( Container : Table_Access; Hash : Hash_Type; Params : System.Address; Equivalent : not null access function ( Position : not null Node_Access; Params : System.Address) return Boolean) return Node_Access; -- comparison function Equivalent ( Left : Table_Access; Left_Length : Count_Type; Right : Table_Access; Right_Length : Count_Type; Equivalent : not null access function ( Left, Right : not null Node_Access) return Boolean) return Boolean; function Overlap ( Left, Right : Table_Access; Equivalent : not null access function ( Left, Right : not null Node_Access) return Boolean) return Boolean; function Is_Subset ( Subset, Of_Set : Table_Access; Equivalent : not null access function ( Left, Right : not null Node_Access) return Boolean) return Boolean; -- management function Capacity (Container : Table_Access) return Count_Type; procedure Free ( Container : in out Table_Access; Length : in out Count_Type; Free : not null access procedure (Object : in out Node_Access)); procedure Copy ( Target : out Table_Access; Length : out Count_Type; Source : Table_Access; New_Capacity : Count_Type; Copy : not null access procedure ( Target : out Node_Access; Source : not null Node_Access)); procedure Rebuild ( Container : in out Table_Access; New_Capacity : Count_Type); procedure Insert ( Container : in out Table_Access; Length : in out Count_Type; Hash : Hash_Type; New_Item : not null Node_Access); procedure Remove ( Container : Table_Access; Length : in out Count_Type; Item : not null Node_Access); -- set operations type Containing is (In_Only_Left, In_Only_Right, In_Both); pragma Discard_Names (Containing); type Filter_Type is array (Containing) of Boolean; pragma Pack (Filter_Type); pragma Suppress_Initialization (Filter_Type); procedure Merge ( Target : in out Table_Access; Length : in out Count_Type; Source : Table_Access; Source_Length : Count_Type; Filter : Filter_Type; Equivalent : not null access function ( Left, Right : not null Node_Access) return Boolean; Copy : access procedure ( Target : out Node_Access; Source : not null Node_Access); Free : access procedure (Object : in out Node_Access)); procedure Copying_Merge ( Target : out Table_Access; Length : out Count_Type; Left : Table_Access; Left_Length : Count_Type; Right : Table_Access; Right_Length : Count_Type; Filter : Filter_Type; Equivalent : not null access function ( Left, Right : not null Node_Access) return Boolean; Copy : not null access procedure ( Target : out Node_Access; Source : not null Node_Access)); end Ada.Containers.Hash_Tables;
30,918
ada
0
joffreyhuguet/LmcpGen
ada/src/afrl/cmasi/afrl-cmasi-operatingregion.adb
package body afrl.cmasi.operatingRegion is function getFullLmcpTypeName(this : OperatingRegion) return String is ("afrl.cmasi.operatingRegion.OperatingRegion"); function getLmcpTypeName(this : OperatingRegion) return String is ("OperatingRegion"); function getLmcpType(this : OperatingRegion) return UInt32_t is (CmasiEnum'Pos(OPERATINGREGION_ENUM)); function getID(this : OperatingRegion'Class) return Int64_t is (this.ID); procedure setID(this : out OperatingRegion'Class; ID : in Int64_t) is begin this.ID := ID; end setID; function getKeepInAreas(this : OperatingRegion'Class) return Vect_Int64_t_Acc is (this.KeepInAreas); function getKeepOutAreas(this : OperatingRegion'Class) return Vect_Int64_t_Acc is (this.KeepOutAreas); end afrl.cmasi.operatingRegion;
30,919
ada
1
ekoeppen/STM32_Generic_Ada_Drivers
examples/stm32f0/rtc/rtc_irq.ads
<filename>examples/stm32f0/rtc/rtc_irq.ads with Ada.Interrupts.Names; use Ada.Interrupts.Names; with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control; package RTC_IRQ is Alarm_Occurred : Suspension_Object; protected Handler is pragma Interrupt_Priority; private procedure IRQ_Handler; pragma Attach_Handler (IRQ_Handler, RTC); end Handler; end RTC_IRQ;
30,920
ada
0
Fabien-Chouteau/ASFML
include/sf-network-tcplistener.ads
--////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2015 <NAME> (<EMAIL>) -- 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. --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// with Sf.Network.IpAddress; with Sf.Network.SocketStatus; package Sf.Network.TcpListener is --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --/ @brief Create a new TCP listener --/ --/ @return A new sfTcpListener object --/ --////////////////////////////////////////////////////////// function create return sfTcpListener_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy a TCP listener --/ --/ @param listener TCP listener to destroy --/ --////////////////////////////////////////////////////////// procedure destroy (listener : sfTcpListener_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the blocking state of a TCP listener --/ --/ In blocking mode, calls will not return until they have --/ completed their task. For example, a call to --/ sfTcpListener_accept in blocking mode won't return until --/ a new connection was actually received. --/ In non-blocking mode, calls will always return immediately, --/ using the return code to signal whether there was data --/ available or not. --/ By default, all sockets are blocking. --/ --/ @param listener TCP listener object --/ @param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking --/ --////////////////////////////////////////////////////////// procedure setBlocking (listener : sfTcpListener_Ptr; blocking : sfBool); --////////////////////////////////////////////////////////// --/ @brief Tell whether a TCP listener is in blocking or non-blocking mode --/ --/ @param listener TCP listener object --/ --/ @return sfTrue if the socket is blocking, sfFalse otherwise --/ --////////////////////////////////////////////////////////// function isBlocking (listener : sfTcpListener_Ptr) return sfBool; --////////////////////////////////////////////////////////// --/ @brief Get the port to which a TCP listener is bound locally --/ --/ If the socket is not listening to a port, this function --/ returns 0. --/ --/ @param listener TCP listener object --/ --/ @return Port to which the TCP listener is bound --/ --////////////////////////////////////////////////////////// function getLocalPort (listener : sfTcpListener_Ptr) return sfUint16; --////////////////////////////////////////////////////////// --/ @brief Start listening for connections --/ --/ This functions makes the socket listen to the specified --/ port, waiting for new connections. --/ If the socket was previously listening to another port, --/ it will be stopped first and bound to the new port. --/ --/ If there is no specific address to listen to, pass sfIpAddress_Any --/ --/ @param listener TCP listener object --/ @param port Port to listen for new connections --/ @param address Address of the interface to listen on --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function listen (listener : sfTcpListener_Ptr; port : sfUint16; address : Sf.Network.IpAddress.sfIpAddress) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Accept a new connection --/ --/ If the socket is in blocking mode, this function will --/ not return until a connection is actually received. --/ --/ The @a connected argument points to a valid sfTcpSocket pointer --/ in case of success (the function returns sfSocketDone), it points --/ to a NULL pointer otherwise. --/ --/ @param listener TCP listener object --/ @param connected Socket that will hold the new connection --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function tcpAccept (listener : sfTcpListener_Ptr; connected : in out sfTcpSocket_Ptr) return Sf.Network.SocketStatus.sfSocketStatus; private pragma Import (C, create, "sfTcpListener_create"); pragma Import (C, destroy, "sfTcpListener_destroy"); pragma Import (C, setBlocking, "sfTcpListener_setBlocking"); pragma Import (C, isBlocking, "sfTcpListener_isBlocking"); pragma Import (C, getLocalPort, "sfTcpListener_getLocalPort"); pragma Import (C, listen, "sfTcpListener_listen"); pragma Import (C, tcpAccept, "sfTcpListener_accept"); end Sf.Network.TcpListener;
30,921
ada
7
best08618/asylo
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c34005o.ada
<gh_stars>1-10 -- C34005O.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: -- FOR DERIVED MULTI-DIMENSIONAL ARRAY TYPES WHOSE COMPONENT TYPE -- IS A NON-LIMITED TYPE: -- CHECK THAT ALL VALUES OF THE PARENT (BASE) TYPE ARE PRESENT FOR -- THE DERIVED (BASE) TYPE WHEN THE DERIVED TYPE DEFINITION IS -- CONSTRAINED. -- CHECK THAT ANY CONSTRAINT IMPOSED ON THE PARENT SUBTYPE IS ALSO -- IMPOSED ON THE DERIVED SUBTYPE. -- HISTORY: -- JRK 9/17/86 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C34005O IS SUBTYPE COMPONENT IS INTEGER; PACKAGE PKG IS FIRST : CONSTANT := 0; LAST : CONSTANT := 10; SUBTYPE INDEX IS INTEGER RANGE FIRST .. LAST; TYPE PARENT IS ARRAY (INDEX RANGE <>, INDEX RANGE <>) OF COMPONENT; FUNCTION CREATE ( F1, L1 : INDEX; F2, L2 : INDEX; C : COMPONENT; DUMMY : PARENT -- TO RESOLVE OVERLOADING. ) RETURN PARENT; END PKG; USE PKG; TYPE T IS NEW PARENT (IDENT_INT (4) .. IDENT_INT (5), IDENT_INT (6) .. IDENT_INT (8)); SUBTYPE SUBPARENT IS PARENT (4 .. 5, 6 .. 8); TYPE S IS NEW SUBPARENT; X : T := (OTHERS => (OTHERS => 2)); Y : S := (OTHERS => (OTHERS => 2)); PACKAGE BODY PKG IS FUNCTION CREATE ( F1, L1 : INDEX; F2, L2 : INDEX; C : COMPONENT; DUMMY : PARENT ) RETURN PARENT IS A : PARENT (F1 .. L1, F2 .. L2); B : COMPONENT := C; BEGIN FOR I IN F1 .. L1 LOOP FOR J IN F2 .. L2 LOOP A (I, J) := B; B := B + 1; END LOOP; END LOOP; RETURN A; END CREATE; END PKG; BEGIN TEST ("C34005O", "CHECK THAT ALL VALUES OF THE PARENT (BASE) " & "TYPE ARE PRESENT FOR THE DERIVED (BASE) TYPE " & "WHEN THE DERIVED TYPE DEFINITION IS " & "CONSTRAINED. ALSO CHECK THAT ANY CONSTRAINT " & "IMPOSED ON THE PARENT SUBTYPE IS ALSO IMPOSED " & "ON THE DERIVED SUBTYPE. CHECK FOR DERIVED " & "MULTI-DIMENSIONAL ARRAY TYPES WHOSE COMPONENT " & "TYPE IS A NON-LIMITED TYPE"); -- CHECK THAT BASE TYPE VALUES NOT IN THE SUBTYPE ARE PRESENT. BEGIN IF CREATE (6, 9, 2, 3, 1, X) /= ((1, 2), (3, 4), (5, 6), (7, 8)) OR CREATE (6, 9, 2, 3, 1, Y) /= ((1, 2), (3, 4), (5, 6), (7, 8)) THEN FAILED ("CAN'T CREATE BASE TYPE VALUES OUTSIDE THE " & "SUBTYPE"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CALL TO CREATE RAISED CONSTRAINT_ERROR"); WHEN OTHERS => FAILED ("CALL TO CREATE RAISED EXCEPTION"); END; IF ((1, 2), (3, 4), (5, 6), (7, 8)) IN T OR ((1, 2), (3, 4), (5, 6), (7, 8)) IN S THEN FAILED ("INCORRECT ""IN"""); END IF; -- CHECK THE DERIVED SUBTYPE CONSTRAINT. IF T'FIRST /= 4 OR T'LAST /= 5 OR S'FIRST /= 4 OR S'LAST /= 5 OR T'FIRST (2) /= 6 OR T'LAST (2) /= 8 OR S'FIRST (2) /= 6 OR S'LAST (2) /= 8 THEN FAILED ("INCORRECT 'FIRST OR 'LAST"); END IF; BEGIN X := ((1, 2, 3), (4, 5, 6)); Y := ((1, 2, 3), (4, 5, 6)); IF PARENT (X) /= PARENT (Y) THEN -- USE X AND Y. FAILED ("INCORRECT CONVERSION TO PARENT"); END IF; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED BY OK ASSIGNMENT"); END; BEGIN X := (4 => (6 .. 8 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "X := (4 => (6 .. 8 => 0))"); IF X = (4 => (6 .. 8 => 0)) THEN -- USE X. COMMENT ("X ALTERED -- " & "X := (4 => (6 .. 8 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "X := (4 => (6 .. 8 => 0))"); END; BEGIN X := (4 .. 6 => (6 .. 8 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "X := (4 .. 6 => (6 .. 8 => 0))"); IF X = (4 .. 6 => (6 .. 8 => 0)) THEN -- USE X. COMMENT ("X ALTERED -- " & "X := (4 .. 6 => (6 .. 8 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "X := (4 .. 6 => (6 .. 8 => 0))"); END; BEGIN X := (4 .. 5 => (6 .. 7 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "X := (4 .. 5 => (6 .. 7 => 0))"); IF X = (4 .. 5 => (6 .. 7 => 0)) THEN -- USE X. COMMENT ("X ALTERED -- " & "X := (4 .. 5 => (6 .. 7 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "X := (4 .. 5 => (6 .. 7 => 0))"); END; BEGIN X := (4 .. 5 => (6 .. 9 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "X := (4 .. 5 => (6 .. 9 => 0))"); IF X = (4 .. 5 => (6 .. 9 => 0)) THEN -- USE X. COMMENT ("X ALTERED -- " & "X := (4 .. 5 => (6 .. 9 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "X := (4 .. 5 => (6 .. 9 => 0))"); END; BEGIN Y := (4 => (6 .. 8 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "Y := (4 => (6 .. 8 => 0))"); IF Y = (4 => (6 .. 8 => 0)) THEN -- USE Y. COMMENT ("Y ALTERED -- " & "Y := (4 => (6 .. 8 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "Y := (4 => (6 .. 8 => 0))"); END; BEGIN Y := (4 .. 6 => (6 .. 8 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "Y := (4 .. 6 => (6 .. 8 => 0))"); IF Y = (4 .. 6 => (6 .. 8 => 0)) THEN -- USE Y. COMMENT ("Y ALTERED -- " & "Y := (4 .. 6 => (6 .. 8 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "Y := (4 .. 6 => (6 .. 8 => 0))"); END; BEGIN Y := (4 .. 5 => (6 .. 7 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "Y := (4 .. 5 => (6 .. 7 => 0))"); IF Y = (4 .. 5 => (6 .. 7 => 0)) THEN -- USE Y. COMMENT ("Y ALTERED -- " & "Y := (4 .. 5 => (6 .. 7 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "Y := (4 .. 5 => (6 .. 7 => 0))"); END; BEGIN Y := (4 .. 5 => (6 .. 9 => 0)); FAILED ("CONSTRAINT_ERROR NOT RAISED -- " & "Y := (4 .. 5 => (6 .. 9 => 0))"); IF Y = (4 .. 5 => (6 .. 9 => 0)) THEN -- USE Y. COMMENT ("Y ALTERED -- " & "Y := (4 .. 5 => (6 .. 9 => 0))"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED -- " & "Y := (4 .. 5 => (6 .. 9 => 0))"); END; RESULT; END C34005O;
30,922
ada
0
djamal2727/Main-Bearing-Analytical-Model
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-shabig.ads
<reponame>djamal2727/Main-Bearing-Analytical-Model ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . S H A R E D _ B I G N U M S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2012-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. -- -- -- ------------------------------------------------------------------------------ -- This package provides declarations shared across all instantiations of -- System.Generic_Bignums. with Ada.Unchecked_Conversion; with Interfaces; package System.Shared_Bignums is pragma Preelaborate; pragma Assert (Long_Long_Integer'Size = 64); -- This package assumes that Long_Long_Integer size is 64 bit (i.e. that it -- has a range of -2**63 to 2**63-1). The front end ensures that the mode -- ELIMINATED is not allowed for overflow checking if this is not the case. subtype Length is Natural range 0 .. 2 ** 23 - 1; -- Represent number of words in Digit_Vector Base : constant := 2 ** 32; -- Digit vectors use this base subtype SD is Interfaces.Unsigned_32; -- Single length digit type Digit_Vector is array (Length range <>) of SD; -- Represent digits of a number (most significant digit first) type Bignum_Data (Len : Length) is record Neg : Boolean; -- Set if value is negative, never set for zero D : Digit_Vector (1 .. Len); -- Digits of number, most significant first, represented in base -- 2**Base. No leading zeroes are stored, and the value of zero is -- represented using an empty vector for D. end record; for Bignum_Data use record Len at 0 range 0 .. 23; Neg at 3 range 0 .. 7; end record; type Bignum is access all Bignum_Data; function To_Bignum is new Ada.Unchecked_Conversion (System.Address, Bignum); function To_Address is new Ada.Unchecked_Conversion (Bignum, System.Address); end System.Shared_Bignums;
30,923
ada
0
caqg/linux-home
.emacs.d/elpa/wisi-3.1.3/sal-gen_bounded_definite_vectors.adb
-- Abstract : -- -- See spec. -- -- Copyright (C) 2017 - 2019 Free Software Foundation, Inc. -- -- This library is free software; you can redistribute it and/or modify it -- under terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY 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. pragma License (Modified_GPL); package body SAL.Gen_Bounded_Definite_Vectors with Spark_Mode is pragma Suppress (All_Checks); function Length (Container : in Vector) return Ada.Containers.Count_Type is (Ada.Containers.Count_Type (To_Peek_Index (Container.Last))); function Is_Full (Container : in Vector) return Boolean is begin return Length (Container) = Capacity; end Is_Full; procedure Clear (Container : in out Vector) is begin Container.Last := No_Index; end Clear; function Element (Container : Vector; Index : Index_Type) return Element_Type is (Container.Elements (Peek_Type (Index - Index_Type'First + 1))); procedure Replace_Element (Container : in out Vector; Index : in Index_Type; New_Item : in Element_Type) is begin Container.Elements (To_Peek_Index (Index)) := New_Item; end Replace_Element; function Last_Index (Container : Vector) return Extended_Index is (Container.Last); procedure Append (Container : in out Vector; New_Item : in Element_Type) is J : constant Peek_Type := To_Peek_Index (Container.Last + 1); begin Container.Elements (J) := New_Item; Container.Last := Container.Last + 1; end Append; procedure Prepend (Container : in out Vector; New_Item : in Element_Type) is J : constant Peek_Type := Peek_Type (Container.Last + 1 - Index_Type'First + 1); begin Container.Elements (2 .. J) := Container.Elements (1 .. J - 1); Container.Elements (1) := New_Item; Container.Last := Container.Last + 1; end Prepend; procedure Insert (Container : in out Vector; New_Item : in Element_Type; Before : in Extended_Index) is J : constant Peek_Type := To_Peek_Index ((if Before = No_Index then Container.Last + 1 else Before)); K : constant Base_Peek_Type := To_Peek_Index (Container.Last); begin Container.Elements (J + 1 .. K + 1) := Container.Elements (J .. K); Container.Elements (J) := New_Item; Container.Last := Container.Last + 1; end Insert; function "+" (Item : in Element_Type) return Vector is begin return Result : Vector do Append (Result, Item); end return; end "+"; function "&" (Left : in Vector; Right : in Element_Type) return Vector is begin -- WORKAROUND: If init Result with ":= Left", GNAT Community 2019 -- checks Default_Initial_Condition (which fails when Left is not -- empty)! That is only supposed to be checked when initialized by -- default. Reported to AdaCore as ticket S724-042. return Result : Vector do Result := Left; Append (Result, Right); end return; end "&"; procedure Delete_First (Container : in out Vector; Count : in Ada.Containers.Count_Type := 1) is use Ada.Containers; begin if Count = 0 then return; end if; declare New_Last : constant Extended_Index := Extended_Index (Integer (Container.Last) - Integer (Count)); J : constant Base_Peek_Type := Base_Peek_Type (Count); K : constant Peek_Type := To_Peek_Index (Container.Last); begin -- Delete items 1 .. J, shift remaining down. Container.Elements (1 .. K - J) := Container.Elements (J + 1 .. K); Container.Last := New_Last; end; end Delete_First; end SAL.Gen_Bounded_Definite_Vectors;
30,924
ada
0
SSOCsoft/Log_Reporter
src/nso-types-report_objects-weather_report.ads
<gh_stars>0 With NSO.JSON, Ada.Containers.Ordered_Maps, Ada.Containers.Indefinite_Ordered_Maps, Ada.Calendar, Gnoga.Gui.Base, Gnoga.Gui.Element.Form, Gnoga.Gui.Element.Common; Limited with Report_Form; Package NSO.Types.Report_Objects.Weather_Report with Elaborate_Body is ----------------- -- CONSTANTS -- ----------------- Min_See : Constant := 1; Max_See : Constant := 8; Min_Wind : Constant := 0; Max_Wind : Constant := 80; Min_Temp : Constant := -40; Max_Temp : Constant := 120; ---------------------- -- INTERNAL TYPES -- ---------------------- Type Field is (Wind_Speed, Temperature, Seeing, Conditions, Wind_Direction); Function "+"(Item : Field) return String; Function "+"(Item : String) return Field; Type Wind_Range is range Min_Wind..Max_Wind; Function "-"( Input : String ) Return Wind_Range; Function "+"( Input : Wind_Range ) Return String; Type Temp_Range is range Min_Temp..Max_Temp; Function "-"( Input : String ) Return Temp_Range; Function "+"( Input : Temp_Range ) Return String; Type See_Range is range Min_See..Max_See; Function "-"( Input : String ) Return See_Range; Function "+"( Input : See_Range ) Return String; ------------------- -- REPORT DATA -- ------------------- Type Report_Data is record Wind_Speed : Wind_Range:= Max_Wind; Temperature : Temp_Range:= Max_Temp; Seeing : See_Range := Max_See; Conditions : Sky := Sky'Last; Wind_Direction : Direction := Direction'Last; Initalized : Bit_Vector(Natural'Pred(1)..Natural'Pred(5)):= (Others => False); End record; ------------------ -- REPORT MAP -- ------------------ Package Report_Map is new Ada.Containers.Indefinite_Ordered_Maps( --"=" => , "<" => Ada.Calendar."<", Key_Type => Ada.Calendar.Time, Element_Type => Report_Data ); ------------------------------------ -- WEATHER REPORT GNOGA ELEMENT -- ------------------------------------ Type Weather_Report is new Abstract_Report with record --Gnoga.Gui.Element.Common.DIV_Type with -- record Date : Gnoga.Gui.Element.Form.Date_Type; Time : Gnoga.Gui.Element.Form.Time_Type; Wind_Speed, Temperature, Seeing : Gnoga.Gui.Element.Form.Number_Type; Conditions, Wind_Direction : Gnoga.Gui.Element.Form.Selection_Type; end record; overriding procedure Create (Report : in out Weather_Report; Parent : in out Gnoga.Gui.Base.Base_Type'Class; Content : in String := ""; ID : in String := "" ); overriding procedure Add_Self( Self : in Weather_Report; Form : in out Gnoga.Gui.Element.Form.Form_Type'Class ); -- procedure Add_To_Form( -- Self : in Weather_Report'Class; -- Form : in out Gnoga.Gui.Element.Form.Form_Type'Class -- ); Function Report( Object : in Weather_Report ) return String; Function Report( Object : in Weather_Report ) return Reports; Function Report( Data : in NSO.JSON.Instance'Class ) return Report_Map.Map; --Function Report( Cursor : Report_Map.Cursor ) return String; Function Report( Object : Report_Map.Map ) return String; Private Overriding Function Get_Name( Self : Weather_Report ) return String; Function Report( Object : in Weather_Report ) return Reports is (NSO.Types.Weather); Function Report( Object : in Weather_Report ) return String is ( Reports'Image( Report(Object) ) ); Function "+"(Item : Field) return String renames Field'Image; Function "+"(Item : String) return Field renames Field'Value; Function "-"(Input : String) Return Wind_Range is (Wind_Range'Value(Input)); Function "-"(Input : String) Return Temp_Range is (Temp_Range'Value(Input)); Function "-"(Input : String) Return See_Range is (See_Range'Value(Input)); Function "+"( Input : Wind_Range ) Return String is (Wind_Range'Image(Input)); Function "+"( Input : Temp_Range ) Return String is (Temp_Range'image(Input)); Function "+"( Input : See_Range ) Return String is (See_Range'Image(Input)); End NSO.Types.Report_Objects.Weather_Report;
30,925
ada
22
FardaleM/metalang
out/euler31.adb
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure euler31 is type stringptr is access all char_array; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; type a is Array (Integer range <>) of Integer; type a_PTR is access a; type b is Array (Integer range <>) of a_PTR; type b_PTR is access b; function result(sum : in Integer; t : in a_PTR; maxIndex : in Integer; cache : in b_PTR) return Integer is out0 : Integer; div : Integer; begin if cache(sum)(maxIndex) /= 0 then return cache(sum)(maxIndex); else if sum = 0 or else maxIndex = 0 then return 1; else out0 := 0; div := sum / t(maxIndex); for i in integer range 0..div loop out0 := out0 + result(sum - i * t(maxIndex), t, maxIndex - 1, cache); end loop; cache(sum)(maxIndex) := out0; return out0; end if; end if; end; t : a_PTR; o : a_PTR; cache : b_PTR; begin t := new a (0..7); for i in integer range 0..7 loop t(i) := 0; end loop; t(0) := 1; t(1) := 2; t(2) := 5; t(3) := 10; t(4) := 20; t(5) := 50; t(6) := 100; t(7) := 200; cache := new b (0..200); for j in integer range 0..200 loop o := new a (0..7); for k in integer range 0..7 loop o(k) := 0; end loop; cache(j) := o; end loop; PInt(result(200, t, 7, cache)); end;
30,926
ada
33
ytomino/drake
source/textio/a-llctio.ads
pragma License (Unrestricted); with Ada.Numerics.Long_Long_Complex_Types; with Ada.Text_IO.Complex_IO; package Ada.Long_Long_Complex_Text_IO is new Text_IO.Complex_IO (Numerics.Long_Long_Complex_Types);
30,927
ada
0
melwyncarlo/ProjectEuler
problems/011/a011.adb
with Ada.Integer_Text_IO; -- Copyright 2021 <NAME> procedure A011 is use Ada.Integer_Text_IO; type Array_1D_Bool is array (Integer range 1 .. 3) of Boolean; type Array_2D_Int is array (Integer range 1 .. 20, Integer range 1 .. 20) of Integer; Is_RC_Safe : Array_1D_Bool; Temp_Product : Integer; Max_Product : Integer := 1788695; Grid : constant Array_2D_Int := ( (8, 02, 22, 97, 38, 15, 00, 40, 00, 75, 04, 05, 07, 78, 52, 12, 50, 77, 91, 8), (49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 04, 56, 62, 00), (81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 03, 49, 13, 36, 65), (52, 70, 95, 23, 04, 60, 11, 42, 69, 24, 68, 56, 01, 32, 56, 71, 37, 02, 36, 91), (22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80), (24, 47, 32, 60, 99, 03, 45, 02, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50), (32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70), (67, 26, 20, 68, 02, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21), (24, 55, 58, 05, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72), (21, 36, 23, 9, 75, 00, 76, 44, 20, 45, 35, 14, 00, 61, 33, 97, 34, 31, 33, 95), (78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 03, 80, 04, 62, 16, 14, 9, 53, 56, 92), (16, 39, 05, 42, 96, 35, 31, 47, 55, 58, 88, 24, 00, 17, 54, 24, 36, 29, 85, 57), (86, 56, 00, 48, 35, 71, 89, 07, 05, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58), (19, 80, 81, 68, 05, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 04, 89, 55, 40), (04, 52, 8, 83, 97, 35, 99, 16, 07, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66), (88, 36, 68, 87, 57, 62, 20, 72, 03, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69), (04, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36), (20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 04, 36, 16), (20, 73, 35, 29, 78, 31, 90, 01, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 05, 54), (01, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 01, 89, 19, 67, 48) ); begin for I in 1 .. 20 loop for J in 1 .. 20 loop Is_RC_Safe := (False, False, False); if (I + 3) <= 20 then if ((Grid (I, J) /= 0) and (Grid (I + 1, J) /= 0) and (Grid (I + 2, J) /= 0) and (Grid (I + 3, J) /= 0) and ((Grid (I, J) > 50) or (Grid (I + 1, J) > 50) or (Grid (I + 2, J) > 50) or (Grid (I + 3, J) > 50))) then Temp_Product := Grid (I, J) * Grid (I + 1, J) * Grid (I + 2, J) * Grid (I + 3, J); if (Temp_Product > Max_Product) then Max_Product := Temp_Product; end if; Is_RC_Safe (1) := True; end if; end if; if (J + 3) <= 20 then if ((Grid (I, J) /= 0) and (Grid (I, J + 1) /= 0) and (Grid (I, J + 2) /= 0) and (Grid (I, J + 3) /= 0) and ((Grid (I, J) > 50) or (Grid (I, J + 1) > 50) or (Grid (I, J + 2) > 50) or (Grid (I, J + 3) > 50))) then Temp_Product := Grid (I, J) * Grid (I, J + 1) * Grid (I, J + 2) * Grid (I, J + 3); if (Temp_Product > Max_Product) then Max_Product := Temp_Product; end if; Is_RC_Safe (2) := True; end if; end if; if (I > 3 and Is_RC_Safe (2)) then Is_RC_Safe (3) := True; end if; if (Is_RC_Safe (1) and Is_RC_Safe (2)) then if ((Grid (I + 1, J + 1) /= 0) and (Grid (I + 2, J + 2) /= 0) and (Grid (I + 3, J + 3) /= 0) and ((Grid (I + 1, J + 1) > 50) or (Grid (I + 2, J + 2) > 50) or (Grid (I + 3, J + 3) > 50))) then Temp_Product := Grid (I, J) * Grid (I + 1, J + 1) * Grid (I + 2, J + 2) * Grid (I + 3, J + 3); if (Temp_Product > Max_Product) then Max_Product := Temp_Product; end if; end if; end if; if Is_RC_Safe (3) then if ((Grid (I - 1, J + 1) /= 0) and (Grid (I - 2, J + 2) /= 0) and (Grid (I - 3, J + 3) /= 0) and ((Grid (I - 1, J + 1) > 50) or (Grid (I - 2, J + 2) > 50) or (Grid (I - 3, J + 3) > 50))) then Temp_Product := Grid (I, J) * Grid (I - 1, J + 1) * Grid (I - 2, J + 2) * Grid (I - 3, J + 3); if (Temp_Product > Max_Product) then Max_Product := Temp_Product; end if; end if; end if; end loop; end loop; Put (Max_Product, Width => 0); end A011;
30,928
ada
1
LaudateCorpus1/RosettaCodeData
Task/Semordnilap/Ada/semordnilap-2.ada
package body String_Vectors is function Is_In(List: Vec; Word: String; Start: Positive; Stop: Natural) return Boolean is Middle: Positive; begin if Start > Stop then return False; else Middle := (Start+Stop) / 2; if List.Element(Middle) = Word then return True; elsif List.Element(Middle) < Word then return List.Is_In(Word, Middle+1, Stop); else return List.Is_In(Word, Start, Middle-1); end if; end if; end Is_In; function Read(Filename: String) return Vec is package IO renames Ada.Text_IO; Persistent_List: IO.File_Type; List: Vec; begin IO.Open(File => Persistent_List, Name => Filename, Mode => IO.In_File); while not IO.End_Of_File(Persistent_List) loop List.Append(New_Item => IO.Get_Line(Persistent_List)); end loop; IO.Close(Persistent_List); return List; end Read; end String_Vectors;
30,929
ada
0
JCGobbi/Nucleo-STM32G474RE
ADL/drivers/stm32g474/stm32-dac.ads
<filename>ADL/drivers/stm32g474/stm32-dac.ads ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, 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 STMicroelectronics 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. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_hal_dac.h and stm32f4xx_hal_dac_ex.h -- -- @author MCD Application Team -- -- @version V1.3.1 -- -- @date 25-March-2015 -- -- @brief Header file of DAC HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides interfaces for the digital-to-analog converters on the -- STM32G4 (ARM Cortex M4F) microcontrollers from ST Microelectronics. with System; use System; private with STM32_SVD.DAC; package STM32.DAC is type Digital_To_Analog_Converter is limited private; type DAC_Channel is (Channel_1, Channel_2); -- Note that DAC_1 Channel 1 is tied to GPIO pin PA4, DAC_1 Channel 2 to PA5 -- and DAC_2 channel 1 to GPIO pin PA6. procedure Enable (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Inline, Post => Enabled (This, Channel); -- Powers up the channel. The channel is then enabled after a startup -- time "Twakeup" specified in the datasheet. -- -- NB: When no hardware trigger has been selected, the value in the -- DAC_DHRx register is transfered automatically to the DAC_DORx register. -- Therefore, in that case enabling the channel starts the output -- conversion on that channel. See the RM0440, section 22.4.5 "DAC -- conversion" second and third paragraphs. procedure Disable (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Inline, Post => not Enabled (This, Channel); -- When the software trigger has been selected, disabling the channel stops -- the output conversion on that channel. function Enabled (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Boolean; type HF_Interface_Mode is (HF_Disabled, HF_AHB_GT_80MHz, HF_AHB_GT_160MHz); procedure Configure_Interface_Mode (This : in out Digital_To_Analog_Converter; Mode : HF_Interface_Mode) with Post => Read_Interface_Mode (This) = Mode; function Read_Interface_Mode (This : Digital_To_Analog_Converter) return HF_Interface_Mode; type DAC_Resolution is (DAC_Resolution_12_Bits, DAC_Resolution_8_Bits); Max_12bit_Resolution : constant := 16#0FFF#; Max_8bit_Resolution : constant := 16#00FF#; type Data_Alignment is (Left_Aligned, Right_Aligned); procedure Set_Output (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Value : UInt32; Resolution : DAC_Resolution; Alignment : Data_Alignment); -- For the specified channel, writes the output Value to the data holding -- register within This corresponding to the Resolution and Alignment. -- -- The output voltage = ((Value / Max_nbit_Counts) * VRef+), where VRef+ is -- the reference input voltage and the 'n' of Max_nbit_Counts is either 12 -- or 8. type Input_Format is (Unsigned, Signed); -- Select the type of input. When signed (2'd complement) the MSB bit -- represents the sign. procedure Set_Input_Format (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Format : Input_Format) with Post => Read_Input_Format (This, Channel) = Format; function Read_Input_Format (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Input_Format; procedure Trigger_Conversion_By_Software (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Pre => Trigger_Selection (This, Channel) = Software_Trigger and Trigger_Enabled (This, Channel); -- Cause the conversion to occur and the output to appear, per 22.4.7 "DAC -- trigger selection" in the RM0440. This routine is needed when the -- Software Trigger has been selected and the trigger has been enabled, -- otherwise no conversion occurs. If you don't enable the trigger any prior -- selection has no effect, but note that when no *hardware* trigger is -- selected the output happens automatically when the channel is enabled. -- See the RM0440 section 22.4.5 "DAC conversion" second and third -- paragraphs. function Converted_Output_Value (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return UInt32; -- Returns the latest output value for the specified channel. procedure Set_Dual_Output_Voltages (This : in out Digital_To_Analog_Converter; Channel_1_Value : UInt32; Channel_2_Value : UInt32; Resolution : DAC_Resolution; Alignment : Data_Alignment); type Dual_Channel_Output is record Channel_1_Data : UInt16; Channel_2_Data : UInt16; end record; function Converted_Dual_Output_Value (This : Digital_To_Analog_Converter) return Dual_Channel_Output; -- Returns the combination of the latest output values for both channels. type Channel_Mode is (Normal_External_Pin_Buffer, Normal_External_Pin_OnChip_Peripheral_Buffer, Normal_External_Pin, Normal_OnChip_Peripheral, SampleHold_External_Pin_Buffer, SampleHold_External_Pin_OnChip_Peripheral_Buffer, SampleHold_External_Pin_OnChip_Peripheral, SampleHold_OnChip_Peripheral); procedure Configure_Channel_Mode (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Mode : Channel_Mode) with Pre => not Enabled (This, Channel) and not Read_Calibration_Mode (This, Channel), Post => Read_Channel_Mode (This, Channel) = Mode; function Read_Channel_Mode (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Channel_Mode; procedure Configure_Sample_Hold_Time (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Sample : UInt10; Hold : UInt10; Refresh : UInt8); -- Configure the sample, hold and refresh timing when in Sample & Hold mode -- In this mode, the DAC core and all corresponding logic and registers are -- driven by the LSI or LSE low-speed clock (dac_hold_ck) in addition to -- the dac_hclk clock, so these timings are based on these clock sources. -- See UM0440 rev 6 pg. 745 chapter 22.4.12 for timing examples. type External_Event_Trigger_Selection is (Software_Trigger, Option_2, Timer_7_Output_Trigger, Timer_15_Output_Trigger, Timer_2_Output_Trigger, Timer_4_Output_Trigger, EXTI_Line_9_Trigger, -- any GPIO_x Pin_9 Timer_6_Output_Trigger, Timer_3_Output_Trigger, HRTimer_DAC_Reset_Trigger_1, HRTimer_DAC_Reset_Trigger_2, HRTimer_DAC_Reset_Trigger_3, HRTimer_DAC_Reset_Trigger_4, HRTimer_DAC_Reset_Trigger_5, HRTimer_DAC_Reset_Trigger_6, Option_16); -- Option DAC1 DAC2 DAC3 DAC4 -- 2 TIM8_TRG0 TIM8_TRG0 TIM1_TRG0 TIM8_TRG0 -- 16 HRTIM_DAC_TRG1 HRTIM_DAC_TRG2 HRTIM_DAC_TRG3 HRTIM_DAC_TRG1 -- -- Refer to UM0440 rev 6 chapter 22.4.2 for DAC pins and internal signals. procedure Select_Trigger (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Trigger : External_Event_Trigger_Selection) with Pre => not Trigger_Enabled (This, Channel), -- per note in RM, pg 435 Post => Trigger_Selection (This, Channel) = Trigger and not Trigger_Enabled (This, Channel); -- If the software trigger is selected, output conversion starts once the -- channel is enabled. function Trigger_Selection (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return External_Event_Trigger_Selection; procedure Enable_Trigger (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Post => Trigger_Enabled (This, Channel); procedure Disable_Trigger (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Post => not Trigger_Enabled (This, Channel); function Trigger_Enabled (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Boolean; procedure Enable_DMA (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Post => DMA_Enabled (This, Channel); procedure Disable_DMA (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Post => not DMA_Enabled (This, Channel); function DMA_Enabled (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Boolean; procedure Set_DMA_Double_Mode (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Mode : Boolean); -- Select DMA double data mode (only for dual-channel DACs: DAC1, DAC3 and -- DAC4). type DAC_Status_Flag is (DORB_Output_Channel_1, DORB_Output_Channel_2, DMA_Underrun_Channel_1, DMA_Underrun_Channel_2, Calibration_EQGT_Offset_Channel_1, Calibration_EQGT_Offset_Channel_2, Write_Operation_Busy_Channel_1, Write_Operation_Busy_Channel_2); function Status (This : Digital_To_Analog_Converter; Flag : DAC_Status_Flag) return Boolean; procedure Clear_Status (This : in out Digital_To_Analog_Converter; Flag : DAC_Status_Flag) with Inline, Post => not Status (This, Flag); type DAC_Interrupts is (DMA_Underrun_Channel_1, DMA_Underrun_Channel_2); procedure Enable_Interrupts (This : in out Digital_To_Analog_Converter; Source : DAC_Interrupts) with Inline, Post => Interrupt_Enabled (This, Source); procedure Disable_Interrupts (This : in out Digital_To_Analog_Converter; Source : DAC_Interrupts) with Inline, Post => not Interrupt_Enabled (This, Source); function Interrupt_Enabled (This : Digital_To_Analog_Converter; Source : DAC_Interrupts) return Boolean with Inline; procedure Clear_Interrupt_Pending (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel) with Inline; type Wave_Generation_Selection is (No_Wave_Generation, Noise_Wave, Triangle_Wave, Sawtooth_Wave); type Noise_Wave_Mask_Selection is (LFSR_Unmask_Bit0, LFSR_Unmask_Bits1_0, LFSR_Unmask_Bits2_0, LFSR_Unmask_Bits3_0, LFSR_Unmask_Bits4_0, LFSR_Unmask_Bits5_0, LFSR_Unmask_Bits6_0, LFSR_Unmask_Bits7_0, LFSR_Unmask_Bits8_0, LFSR_Unmask_Bits9_0, LFSR_Unmask_Bits10_0, LFSR_Unmask_Bits11_0); -- Unmask LFSR bits for noise wave generation type Triangle_Wave_Amplitude_Selection is (Triangle_Amplitude_1, -- Select max triangle amplitude of 1 Triangle_Amplitude_3, -- Select max triangle amplitude of 3 Triangle_Amplitude_7, -- Select max triangle amplitude of 7 Triangle_Amplitude_15, -- Select max triangle amplitude of 15 Triangle_Amplitude_31, -- Select max triangle amplitude of 31 Triangle_Amplitude_63, -- Select max triangle amplitude of 63 Triangle_Amplitude_127, -- Select max triangle amplitude of 127 Triangle_Amplitude_255, -- Select max triangle amplitude of 255 Triangle_Amplitude_511, -- Select max triangle amplitude of 511 Triangle_Amplitude_1023, -- Select max triangle amplitude of 1023 Triangle_Amplitude_2047, -- Select max triangle amplitude of 2047 Triangle_Amplitude_4095); -- Select max triangle amplitude of 4095 type Wave_Generation (Kind : Wave_Generation_Selection) is record case Kind is when No_Wave_Generation => null; when Noise_Wave => Mask : Noise_Wave_Mask_Selection; when Triangle_Wave .. Sawtooth_Wave => Amplitude : Triangle_Wave_Amplitude_Selection; end case; end record; Wave_Generation_Disabled : constant Wave_Generation := (Kind => No_Wave_Generation); procedure Select_Wave_Generation (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Selection : Wave_Generation) with Post => Selected_Wave_Generation (This, Channel) = Selection; function Selected_Wave_Generation (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Wave_Generation; type Sawtooth_Direction is (Down, Up); type Sawtooth_Trigger_Selection is (Software_Trigger, Option_2, Timer_7_Output_Trigger, Timer_15_Output_Trigger, Timer_2_Output_Trigger, Timer_4_Output_Trigger, EXTI_Line_10_Trigger, -- any GPIO_x Pin_10 Timer_6_Output_Trigger, Timer_3_Output_Trigger, HRTimer_DAC_Step_Trigger_1, HRTimer_DAC_Step_Trigger_2, HRTimer_DAC_Step_Trigger_3, HRTimer_DAC_Step_Trigger_4, HRTimer_DAC_Step_Trigger_5, HRTimer_DAC_Step_Trigger_6); -- Option DAC1 DAC2 DAC3 DAC4 -- 2 TIM8_TRG0 TIM8_TRG0 TIM1_TRG0 TIM8_TRG0 -- -- Refer to UM0440 rev 6 chapter 22.4.2 for DAC pins and internal signals. procedure Configure_Sawtooth_Wave_Generation (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Start_Val : UInt12; Start_Trg : Sawtooth_Trigger_Selection; Incr_Val : UInt16; Incr_Trg : Sawtooth_Trigger_Selection; Direction : Sawtooth_Direction); function Data_Address (This : Digital_To_Analog_Converter; Channel : DAC_Channel; Resolution : DAC_Resolution; Alignment : Data_Alignment) return Address; -- Returns the address of the Data Holding register within This, for the -- specified Channel, at the specified Resolution and Alignment. -- -- This function is stricly for use with DMA, all others use the API above. procedure Set_Calibration_Mode (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Mode : Boolean) with Post => Read_Calibration_Mode (This, Channel) = Mode; function Read_Calibration_Mode (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Boolean; function Read_Calibration_Flag (This : Digital_To_Analog_Converter; Channel : DAC_Channel) return Boolean; procedure Set_Offset_Trimming (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel; Input : UInt5); procedure Calibrate (This : in out Digital_To_Analog_Converter; Channel : DAC_Channel); -- Calibrate the DAC channel. This routine is described in RM0440 pg. 747 -- chapter 22.4.13 - DAC channel buffer calibration. private type Digital_To_Analog_Converter is new STM32_SVD.DAC.DAC_Peripheral; end STM32.DAC;
30,930
ada
12
TUM-EI-RCS/StratoX
software/hal/boards/common/hil/hil-uart.ads
<reponame>TUM-EI-RCS/StratoX -- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- -- Authors: <NAME> (<EMAIL>) with HIL.Devices; -- @summary -- Target-independent specification for HIL of UART package HIL.UART with Spark_Mode is BUFFER_MAX : constant := 200; subtype Device_ID_Type is HIL.Devices.Device_Type_UART; type Baudrates_Type is range 9_600 .. 1_500_000 with Static_Predicate => Baudrates_Type in 9_600 | 19_200 | 38_400 | 57_600 | 115_200 | 1_500_000; subtype Data_Type is Byte_Array; procedure configure; procedure write (Device : in Device_ID_Type; Data : in Data_Type); procedure read (Device : in Device_ID_Type; Data : out Data_Type; n_read : out Natural); function toData_Type (Message : String) return Data_Type; end HIL.UART;
30,931
ada
1
LaudateCorpus1/RosettaCodeData
Task/Fibonacci-word/Ada/fibonacci-word.ada
<filename>Task/Fibonacci-word/Ada/fibonacci-word.ada with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO, Ada.Numerics.Long_Elementary_Functions, Ada.Long_Float_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO, Ada.Numerics.Long_Elementary_Functions, Ada.Long_Float_Text_IO; procedure Fibonacci_Words is function Entropy (S : Unbounded_String) return Long_Float is CF : array (Character) of Natural := (others => 0); Len : constant Natural := Length (S); H : Long_Float := 0.0; Ratio : Long_Float; begin for I in 1 .. Len loop CF (Element (S, I)) := CF (Element (S, I)) + 1; end loop; for C in Character loop Ratio := Long_Float (CF (C)) / Long_Float (Len); if Ratio /= 0.0 then H := H - Ratio * Log (Ratio, 2.0); end if; end loop; return H; end Entropy; procedure Print_Line (Word : Unbounded_String; Number : Integer) is begin Put (Number, 4); Put (Length (Word), 10); Put (Entropy (Word), 2, 15, 0); if Length (Word) < 35 then Put (" " & Word); end if; New_Line; end Print_Line; First, Second, Result : Unbounded_String; begin Set_Col (4); Put ("N"); Set_Col (9); Put ("Length"); Set_Col (16); Put ("Entropy"); Set_Col (35); Put_Line ("Word"); First := To_Unbounded_String ("1"); Print_Line (First, 1); Second := To_Unbounded_String ("0"); Print_Line (Second, 2); for N in 3 .. 37 loop Result := Second & First; Print_Line (Result, N); First := Second; Second := Result; end loop; end Fibonacci_Words;
30,932
ada
7
best08618/asylo
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd3014c.ada
-- CD3014C.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 AN ENUMERATION REPRESENTATION CLAUSE CAN BE GIVEN IN -- THE VISIBLE OR PRIVATE PART OF A PACKAGE FOR A TYPE DECLARED IN -- THE VISIBLE PART. -- HISTORY -- DHH 09/30/87 CREATED ORIGINAL TEST -- DHH 03/27/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA',CHANGED -- FROM 'A' TEST TO 'C' TEST AND ADDED CHECK FOR -- REPRESENTATION CLAUSE. WITH REPORT; USE REPORT; WITH ENUM_CHECK; -- CONTAINS CALL TO 'FAILED' PROCEDURE CD3014C IS BEGIN TEST ("CD3014C", "CHECK THAT AN ENUMERATION " & "REPRESENTATION CLAUSE CAN BE GIVEN IN THE " & "VISIBLE OR PRIVATE PART OF A PACKAGE FOR " & "A TYPE DECLARED IN THE VISIBLE PART"); DECLARE PACKAGE PACK IS TYPE HUE IS (RED,BLUE,YELLOW); TYPE NEWHUE IS (RED,BLUE,YELLOW); FOR HUE USE (RED => 8, BLUE => 16, YELLOW => 32); A : HUE := BLUE; PRIVATE FOR NEWHUE USE (RED => 8, BLUE => 16, YELLOW => 32); B : NEWHUE := RED; TYPE INT_HUE IS RANGE 8 .. 32; FOR INT_HUE'SIZE USE HUE'SIZE; TYPE INT_NEW IS RANGE 8 .. 32; FOR INT_NEW'SIZE USE NEWHUE'SIZE; PROCEDURE CHECK_HUE IS NEW ENUM_CHECK(HUE, INT_HUE); PROCEDURE CHECK_NEW IS NEW ENUM_CHECK(NEWHUE, INT_NEW); END PACK; PACKAGE BODY PACK IS BEGIN CHECK_HUE (RED, 8, "HUE"); CHECK_NEW (YELLOW, 32, "NEWHUE"); END PACK; BEGIN NULL; END; RESULT; END CD3014C;
30,933
ada
7,053
Elon143/Amass
resources/scripts/api/sonarsearch.ads
<reponame>Elon143/Amass -- Copyright 2021 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "SonarSearch" type = "api" function start() set_rate_limit(1) end function vertical(ctx, domain) local p = 0 while(true) do local vurl = "https://sonar.omnisint.io/subdomains/" .. domain .. "?page=" .. p local resp, err = request(ctx, {['url']=vurl}) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return end resp = "{\"subdomains\":" .. resp .. "}" local d = json.decode(resp) if (d == nil or d.subdomains == nil or #(d.subdomains) == 0) then return end for _, sub in pairs(d.subdomains) do new_name(ctx, sub) end p = p + 1 end end